프로젝트

일반

사용자정보

통계
| 개정판:

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

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

1
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
        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

    
43
        public static List<Layer> ExceptLayers { get; } = new List<Layer>();
44
        public static List<Layer> LineLayers { get; } = new List<Layer>();
45
        public static List<SpecialCharacter> SpecialCharacters{ get; } = new List<SpecialCharacter>();
46
        public static double LengthToleranceRatio = 0.1;
47
        public static double ArrowMaxLength { get; set; } = 2;
48
        private BindingList<Layer> _ExceptLayerBindings { get; } = new BindingList<Layer>();
49
        private BindingList<Layer> _LineLayerBindings { get; } = new BindingList<Layer>();
50
        private BindingList<SpecialCharacter> _SpecialCharacterBindings { get; } = new BindingList<SpecialCharacter>();
51

    
52
        public ExceptLayer()
53
        {
54
            InitializeComponent();
55

    
56
            #region BindingList에 담음
57
            ExceptLayers.ForEach(x => _ExceptLayerBindings.Add(x));
58
            LineLayers.ForEach(x => _LineLayerBindings.Add(x));
59
            SpecialCharacters.ForEach(x => _SpecialCharacterBindings.Add(x));
60
            #endregion
61

    
62
            this.radGridViewExceptLayer.DataBindingComplete += RadGridViewExceptLayer_DataBindingComplete;
63
            this.radGridViewExceptLayer.DataSource = _ExceptLayerBindings;
64

    
65
            this.radGridViewLineLayer.DataBindingComplete += RadGridViewLineLayer_DataBindingComplete;
66
            this.radGridViewLineLayer.DataSource = _LineLayerBindings;
67

    
68
            this.radSpinEditorLengthToleranceRatio.Value = Convert.ToDecimal(LengthToleranceRatio);
69
            this.radSpinEditorArrowMaxLength.Value = Convert.ToDecimal(ArrowMaxLength);
70

    
71
            this.radGridViewSpecialCharacter.DataBindingComplete += RadGridViewSpecialCharacter_DataBindingComplete;
72
            this.radGridViewSpecialCharacter.DataSource = _SpecialCharacterBindings;
73

    
74
            this.radButtonOK.Click += RadButtonOK_Click;
75
            this.radButtonCancel.Click += RadButtonCancel_Click;
76
        }
77

    
78
        private void RadGridViewSpecialCharacter_DataBindingComplete(object sender, GridViewBindingCompleteEventArgs e)
79
        {
80
            radGridViewSpecialCharacter.BestFitColumns();
81
        }
82

    
83
        private void RadGridViewExceptLayer_DataBindingComplete(object sender, GridViewBindingCompleteEventArgs e)
84
        {
85
            radGridViewExceptLayer.BestFitColumns();
86
        }
87

    
88
        private void RadGridViewLineLayer_DataBindingComplete(object sender, GridViewBindingCompleteEventArgs e)
89
        {
90
            radGridViewLineLayer.BestFitColumns();
91
        }
92

    
93
        private void RadButtonOK_Click(object sender, EventArgs e)
94
        {
95
            ExceptLayers.Clear();
96
            ExceptLayers.AddRange(_ExceptLayerBindings);
97

    
98
            LineLayers.Clear();
99
            LineLayers.AddRange(_LineLayerBindings);
100

    
101
            SpecialCharacters.Clear();
102
            SpecialCharacters.AddRange(_SpecialCharacterBindings);
103

    
104
            LengthToleranceRatio = Convert.ToDouble(this.radSpinEditorLengthToleranceRatio.Value);
105
            ArrowMaxLength = Convert.ToDouble(this.radSpinEditorArrowMaxLength.Value);
106

    
107
            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)