hytos / ID2.Manager / ID2.Manager.Compare / Program.cs @ 42d7b127
이력 | 보기 | 이력해설 | 다운로드 (5.62 KB)
1 | 13a36357 | humkyung | using System; |
---|---|---|---|
2 | using System.Collections.Generic; |
||
3 | using System.Linq; |
||
4 | using System.Threading.Tasks; |
||
5 | using System.Windows.Forms; |
||
6 | using ID2.Manager.Forms; |
||
7 | using log4net; |
||
8 | using GemBox.Spreadsheet; |
||
9 | using System.ComponentModel; |
||
10 | using System.Drawing; |
||
11 | 42d7b127 | humkyung | using System.Runtime.CompilerServices; |
12 | using Xtractor.Viewer; |
||
13 | 13a36357 | humkyung | |
14 | namespace ID2.Manager |
||
15 | { |
||
16 | public class Document : INotifyPropertyChanged |
||
17 | { |
||
18 | public event PropertyChangedEventHandler PropertyChanged; |
||
19 | protected void OnPropertyChanged(string propName) |
||
20 | { |
||
21 | if (PropertyChanged != null) |
||
22 | { |
||
23 | PropertyChanged(this, new PropertyChangedEventArgs(propName)); |
||
24 | } |
||
25 | } |
||
26 | |||
27 | public Document(string DocNo) |
||
28 | { |
||
29 | DocumentNo = DocNo; |
||
30 | } |
||
31 | |||
32 | private bool _Checked = false; |
||
33 | public bool Checked |
||
34 | { |
||
35 | get { return _Checked; } |
||
36 | set |
||
37 | { |
||
38 | bool tmp = IsValid && value; |
||
39 | if(_Checked != tmp) |
||
40 | { |
||
41 | _Checked = tmp; |
||
42 | OnPropertyChanged("Checked"); |
||
43 | } |
||
44 | } |
||
45 | } |
||
46 | |||
47 | [Browsable(false)] |
||
48 | public string DocumentNo { get; set; } |
||
49 | public string AutoCADFileName { get; set; } |
||
50 | public string AVEVAFileName { get; set; } |
||
51 | |||
52 | [Browsable(false)] |
||
53 | public bool IsValid |
||
54 | { |
||
55 | get { return !string.IsNullOrEmpty(AutoCADFileName) && !string.IsNullOrEmpty(AVEVAFileName); } |
||
56 | } |
||
57 | } |
||
58 | |||
59 | 42d7b127 | humkyung | public sealed class TextInfo : IEquatable<TextInfo>, INotifyPropertyChanged |
60 | { |
||
61 | public event PropertyChangedEventHandler PropertyChanged; |
||
62 | private void NotifyPropertyChanged([CallerMemberName] String propertyName = "") |
||
63 | { |
||
64 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); |
||
65 | } |
||
66 | |||
67 | public TextInfo(double x, double y, string text) |
||
68 | { |
||
69 | X = x; |
||
70 | Y = y; |
||
71 | TextString = text; |
||
72 | } |
||
73 | |||
74 | private bool _Unmatched = false; |
||
75 | public bool Unmatched |
||
76 | { |
||
77 | get { return _Unmatched; } |
||
78 | set |
||
79 | { |
||
80 | if( _Unmatched != value) |
||
81 | { |
||
82 | _Unmatched = value; |
||
83 | NotifyPropertyChanged("Unmatched"); |
||
84 | } |
||
85 | } |
||
86 | } |
||
87 | [Description("시스템에서 일치하는 문자열을 찾는 경우 설정")] |
||
88 | public bool Found { get; set; } = true; |
||
89 | [ReadOnly(true)] |
||
90 | public double X { get; set; } |
||
91 | [ReadOnly(true)] |
||
92 | public double Y { get; set; } |
||
93 | [ReadOnly(true)] |
||
94 | public string TextString { get; set; } |
||
95 | |||
96 | public bool Equals(TextInfo other) |
||
97 | { |
||
98 | return Math.Abs(this.X - other.X) < double.Epsilon |
||
99 | && Math.Abs(this.Y - other.Y) < double.Epsilon |
||
100 | && this.TextString.Replace(System.Environment.NewLine, string.Empty).Equals(other.TextString.Replace(System.Environment.NewLine, string.Empty)); |
||
101 | } |
||
102 | |||
103 | public bool DoesEquals(devDept.Eyeshot.Entities.Text text, double toler=double.Epsilon) |
||
104 | { |
||
105 | return Math.Abs(this.X - Math.Round(text.InsertionPoint.X, 5)) < toler && |
||
106 | Math.Abs(this.Y - Math.Round(text.InsertionPoint.Y, 5)) < toler && |
||
107 | this.TextString.Replace(System.Environment.NewLine, string.Empty).Equals(text.TextString.Replace(System.Environment.NewLine, string.Empty)); |
||
108 | } |
||
109 | |||
110 | public override string ToString() |
||
111 | { |
||
112 | return $"{X},{Y},{TextString}"; |
||
113 | } |
||
114 | } |
||
115 | |||
116 | 13a36357 | humkyung | static class Program |
117 | { |
||
118 | /// </summary> |
||
119 | public static ILog logger = null; |
||
120 | |||
121 | public static string IniFilePath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), |
||
122 | Application.ProductName, $"{Application.ProductName}.ini"); |
||
123 | #region 테마 |
||
124 | public static string ThemeName = "ControlDefault"; |
||
125 | #endregion |
||
126 | |||
127 | public static string AutoCADFolder = string.Empty; |
||
128 | public static string AVEVAPIDFolder = string.Empty; |
||
129 | |||
130 | public static Font UnmatchedFont = new System.Drawing.Font("Segoe UI", 9F, FontStyle.Italic); |
||
131 | public static Font MatchedFont = new System.Drawing.Font("Segoe UI", 9F, FontStyle.Bold); |
||
132 | |||
133 | public static BindingList<Document> Documents {get;} = new BindingList<Document>(); |
||
134 | |||
135 | /// <summary> |
||
136 | /// 해당 애플리케이션의 주 진입점입니다. |
||
137 | /// </summary> |
||
138 | [STAThread] |
||
139 | static void Main() |
||
140 | { |
||
141 | logger = LogManager.GetLogger(typeof(Program)); |
||
142 | |||
143 | Application.ThreadException += Application_ThreadException; |
||
144 | devDept.LicenseManager.Unlock(typeof(devDept.Eyeshot.Workspace), "US22-CKTU9-RX12F-3SF6-R1X9"); |
||
145 | SpreadsheetInfo.SetLicense(Properties.Settings.Default.GemBoxLicense); |
||
146 | |||
147 | Application.EnableVisualStyles(); |
||
148 | Application.SetCompatibleTextRenderingDefault(false); |
||
149 | |||
150 | CustomSynchronizationContext.Install(); |
||
151 | |||
152 | #region 프로그램 업데이트 후 기존 설정값을 유지하도록 함 |
||
153 | if (Properties.Settings.Default.UserInfo.Equals(string.Empty) || Properties.Settings.Default.ID2SQLiteInfo.Equals(string.Empty)) |
||
154 | { |
||
155 | Properties.Settings.Default.Upgrade(); |
||
156 | Properties.Settings.Default.Reload(); |
||
157 | } |
||
158 | #endregion |
||
159 | |||
160 | Application.Run(new Main()); |
||
161 | } |
||
162 | |||
163 | private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) |
||
164 | { |
||
165 | logger.Error("Application Exception.", e.Exception); |
||
166 | } |
||
167 | } |
||
168 | } |