프로젝트

일반

사용자정보

통계
| 개정판:

hytos / ID2.Manager / ID2.Manager.Compare / Forms / ExceptLayer.cs @ 353b7f9f

이력 | 보기 | 이력해설 | 다운로드 (4.19 KB)

1 13a36357 humkyung
using System;
2
using System.Collections.Generic;
3
using System.ComponentModel;
4
using System.Data;
5
using System.Drawing;
6
using System.Linq;
7
using System.Text;
8
using System.Threading.Tasks;
9
using System.Windows.Forms;
10
11
using Telerik.WinControls;
12
using Telerik.WinControls.UI;
13
using System.Configuration;
14
15
namespace ID2.Manager.Forms
16
{
17
    public partial class ExceptLayer : RadForm
18
    {
19
        public class Layer
20
        {
21
            public Layer() { }
22
            public Layer(string layer)
23
            {
24
                Name = layer;
25
            }
26
27
            public string Name { get; set; } = string.Empty;
28
            public bool Visible { get; set; } = false;
29
        }
30 353b7f9f humkyung
        public class SpecialCharacter
31
        {
32
            public SpecialCharacter() { }
33
            public SpecialCharacter(string _Special, string _Normal)
34
            {
35
                Special = _Special;
36
                Normal = _Normal;
37
            }
38
39
            public string Special { get; set; }
40
            public string Normal { get; set; }
41
        }
42 13a36357 humkyung
43
        public static List<Layer> ExceptLayers { get; } = new List<Layer>();
44 288ed615 humkyung
        public static List<Layer> LineLayers { get; } = new List<Layer>();
45 353b7f9f humkyung
        public static List<SpecialCharacter> SpecialCharacters{ get; } = new List<SpecialCharacter>();
46 c4ba621d humkyung
        public static double LengthToleranceRatio = 0.1;
47 51b9a24a humkyung
        public static double ArrowMaxLength { get; set; } = 2;
48 288ed615 humkyung
        private BindingList<Layer> _ExceptLayerBindings { get; } = new BindingList<Layer>();
49
        private BindingList<Layer> _LineLayerBindings { get; } = new BindingList<Layer>();
50 353b7f9f humkyung
        private BindingList<SpecialCharacter> _SpecialCharacterBindings { get; } = new BindingList<SpecialCharacter>();
51 13a36357 humkyung
52
        public ExceptLayer()
53
        {
54
            InitializeComponent();
55
56 353b7f9f humkyung
            #region BindingList에 담음
57 288ed615 humkyung
            ExceptLayers.ForEach(x => _ExceptLayerBindings.Add(x));
58
            LineLayers.ForEach(x => _LineLayerBindings.Add(x));
59 353b7f9f humkyung
            SpecialCharacters.ForEach(x => _SpecialCharacterBindings.Add(x));
60
            #endregion
61 288ed615 humkyung
62 13a36357 humkyung
            this.radGridViewExceptLayer.DataBindingComplete += RadGridViewExceptLayer_DataBindingComplete;
63 288ed615 humkyung
            this.radGridViewExceptLayer.DataSource = _ExceptLayerBindings;
64
65
            this.radGridViewLineLayer.DataBindingComplete += RadGridViewLineLayer_DataBindingComplete;
66
            this.radGridViewLineLayer.DataSource = _LineLayerBindings;
67 13a36357 humkyung
68 c4ba621d humkyung
            this.radSpinEditorLengthToleranceRatio.Value = Convert.ToDecimal(LengthToleranceRatio);
69 51b9a24a humkyung
            this.radSpinEditorArrowMaxLength.Value = Convert.ToDecimal(ArrowMaxLength);
70 c4ba621d humkyung
71 353b7f9f humkyung
            this.radGridViewSpecialCharacter.DataBindingComplete += RadGridViewSpecialCharacter_DataBindingComplete;
72
            this.radGridViewSpecialCharacter.DataSource = _SpecialCharacterBindings;
73
74 13a36357 humkyung
            this.radButtonOK.Click += RadButtonOK_Click;
75
            this.radButtonCancel.Click += RadButtonCancel_Click;
76
        }
77
78 353b7f9f humkyung
        private void RadGridViewSpecialCharacter_DataBindingComplete(object sender, GridViewBindingCompleteEventArgs e)
79
        {
80
            radGridViewSpecialCharacter.BestFitColumns();
81
        }
82
83 13a36357 humkyung
        private void RadGridViewExceptLayer_DataBindingComplete(object sender, GridViewBindingCompleteEventArgs e)
84
        {
85
            radGridViewExceptLayer.BestFitColumns();
86
        }
87
88 288ed615 humkyung
        private void RadGridViewLineLayer_DataBindingComplete(object sender, GridViewBindingCompleteEventArgs e)
89
        {
90
            radGridViewLineLayer.BestFitColumns();
91
        }
92
93 13a36357 humkyung
        private void RadButtonOK_Click(object sender, EventArgs e)
94
        {
95
            ExceptLayers.Clear();
96 288ed615 humkyung
            ExceptLayers.AddRange(_ExceptLayerBindings);
97
98
            LineLayers.Clear();
99
            LineLayers.AddRange(_LineLayerBindings);
100 13a36357 humkyung
101 353b7f9f humkyung
            SpecialCharacters.Clear();
102
            SpecialCharacters.AddRange(_SpecialCharacterBindings);
103
104 c4ba621d humkyung
            LengthToleranceRatio = Convert.ToDouble(this.radSpinEditorLengthToleranceRatio.Value);
105 51b9a24a humkyung
            ArrowMaxLength = Convert.ToDouble(this.radSpinEditorArrowMaxLength.Value);
106 c4ba621d humkyung
107 13a36357 humkyung
            this.DialogResult = DialogResult.OK;
108
        }
109
110
        private void RadButtonCancel_Click(object sender, EventArgs e)
111
        {
112
            this.DialogResult = DialogResult.Cancel;
113
        }
114
    }
115
}
클립보드 이미지 추가 (최대 크기: 500 MB)