WdGraphConfig.xaml.cs 1.94 KB
Newer Older
潘栩锋's avatar
潘栩锋 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

潘栩锋's avatar
潘栩锋 committed
15
namespace MultiLayout.MainEdit
潘栩锋's avatar
潘栩锋 committed
16 17 18 19
{
    /// <summary>
    /// Window_MainEditGraphComponent.xaml 的交互逻辑
    /// </summary>
20
    public partial class WdGraphConfig : FLY.ControlLibrary.WindowBigClose
潘栩锋's avatar
潘栩锋 committed
21 22
    {
        public GraphComponentEditResult Result;
23
        public WdGraphConfig()
潘栩锋's avatar
潘栩锋 committed
24 25 26
        {
            InitializeComponent();
        }
潘栩锋's avatar
潘栩锋 committed
27
        public void Init(MeGraphComponent component, List<string> serviceNames)
潘栩锋's avatar
潘栩锋 committed
28 29 30 31
        {
            Result = new GraphComponentEditResult();
            Result.Header = component.Type.Header;
            Result.Rect = component.Rect;
潘栩锋's avatar
潘栩锋 committed
32
            Result.ServiceContainerName = component.ServiceContainerName;
潘栩锋's avatar
潘栩锋 committed
33
            this.DataContext = Result;
潘栩锋's avatar
潘栩锋 committed
34
            this.cbServiceNames.ItemsSource = serviceNames;
潘栩锋's avatar
潘栩锋 committed
35 36 37 38 39 40
        }
        private void button_apply_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;
        }
    }
潘栩锋's avatar
潘栩锋 committed
41
    public class GraphComponentEditResult:INotifyPropertyChanged
潘栩锋's avatar
潘栩锋 committed
42 43 44 45 46 47
    {
        public string Header { get; set; }
        public int X { get; set; }
        public int Y { get; set; }
        public int Width { get; set; }
        public int Height { get; set; }
潘栩锋's avatar
潘栩锋 committed
48
        public string ServiceContainerName { get; set; }
潘栩锋's avatar
潘栩锋 committed
49 50 51 52 53 54 55 56 57 58 59
        public System.Drawing.Rectangle Rect
        {
            get { return new System.Drawing.Rectangle(X,Y,Width,Height); }
            set
            {
                X = (int)value.X;
                Y = (int)value.Y;
                Width = (int)value.Width;
                Height = (int)value.Height;
            }
        }
潘栩锋's avatar
潘栩锋 committed
60 61

        public event PropertyChangedEventHandler PropertyChanged;
潘栩锋's avatar
潘栩锋 committed
62 63
    }
}