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;

namespace ThickTcpUiInWindow.MainEdit
{
    /// <summary>
    /// Window_MainEditGraphComponent.xaml 的交互逻辑
    /// </summary>
    public partial class WdGraphConfig : FLY.ControlLibrary.WindowBigClose
    {
        public GraphComponentEditResult Result;
        public WdGraphConfig()
        {
            InitializeComponent();
        }
        public void Init(GraphComponent component)
        {
            Result = new GraphComponentEditResult();
            Result.Header = component.Type.Header;
            Result.Rect = component.Rect;
            this.DataContext = Result;
            
        }
        private void button_apply_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;
        }
    }
    public class GraphComponentEditResult
    {
        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; }
        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;
            }
        }
    }
}
