개정판 f25808d5
dev issue #1230 : fix thread
Change-Id: I3890ebf920e76445d73abcdae4b7a1a68909cf7c
DTI_PID/APIDConverter/AutoModeling.cs | ||
---|---|---|
715 | 715 |
|
716 | 716 |
ComponentPropertiesHelper componentPropertiesHelper = new ComponentPropertiesHelper(); |
717 | 717 |
AvevaThread.Run(ThreadType.AddProperty, datas); |
718 |
if (!componentPropertiesHelper.DisplayComponentProperties(entity))
|
|
719 |
AvevaThread.Stop(ThreadType.AddProperty);
|
|
718 |
componentPropertiesHelper.DisplayComponentProperties(entity);
|
|
719 |
AvevaThread.Stop(ThreadType.AddProperty); |
|
720 | 720 |
} |
721 | 721 |
#endregion |
722 | 722 |
|
DTI_PID/APIDConverter/Utils/AvevaThread.cs | ||
---|---|---|
134 | 134 |
|
135 | 135 |
public static void LineNumberModeling() |
136 | 136 |
{ |
137 |
try
|
|
137 |
while (Running.HasFlag(ThreadType.LineNumberModeling))
|
|
138 | 138 |
{ |
139 |
while (Running.HasFlag(ThreadType.LineNumberModeling)) |
|
139 |
int handle = FindPropertiesFormHandle(); |
|
140 |
if (handle > 0) |
|
140 | 141 |
{ |
141 |
int handle = FindPropertiesFormHandle(); |
|
142 |
if (handle > 0) |
|
143 |
{ |
|
144 |
string name = GetClassNameOfWindow((IntPtr)handle); |
|
142 |
string name = GetClassNameOfWindow((IntPtr)handle); |
|
145 | 143 |
|
146 |
System.Windows.Forms.Control control = System.Windows.Forms.Control.FromHandle((IntPtr)handle);
|
|
147 |
if (control != null && control.GetType() == typeof(ComponentPropertiesUI))
|
|
148 |
{
|
|
149 |
ComponentPropertiesUI UI = control as ComponentPropertiesUI;
|
|
150 |
Infragistics.Win.UltraWinGrid.UltraGridRow row = UI.GetGridRow("AddLabel");
|
|
151 |
if (row != null)
|
|
152 |
row.Cells["Value"].Value = "Yes";
|
|
153 |
}
|
|
144 |
System.Windows.Forms.Control control = System.Windows.Forms.Control.FromHandle((IntPtr)handle); |
|
145 |
if (control != null && control.GetType() == typeof(ComponentPropertiesUI)) |
|
146 |
{ |
|
147 |
ComponentPropertiesUI UI = control as ComponentPropertiesUI; |
|
148 |
Infragistics.Win.UltraWinGrid.UltraGridRow row = UI.GetGridRow("AddLabel"); |
|
149 |
if (row != null) |
|
150 |
row.Cells["Value"].Value = "Yes"; |
|
151 |
} |
|
154 | 152 |
|
155 |
int button = FindWindowEx(handle, 0, null, "OK"); |
|
156 |
if (button > 0) |
|
157 |
{ |
|
158 |
SendMessage((IntPtr)button, BM_CLICK, (IntPtr)0, (IntPtr)0); |
|
159 |
Running &= ~ThreadType.LineNumberModeling; |
|
160 |
} |
|
153 |
int button = FindWindowEx(handle, 0, null, "OK"); |
|
154 |
if (button > 0) |
|
155 |
{ |
|
156 |
SendMessage((IntPtr)button, BM_CLICK, (IntPtr)0, (IntPtr)0); |
|
157 |
Running &= ~ThreadType.LineNumberModeling; |
|
161 | 158 |
} |
162 |
Thread.Sleep(LoopTime); |
|
163 | 159 |
} |
164 |
} |
|
165 |
catch (System.Exception ex) |
|
166 |
{ |
|
167 |
|
|
160 |
Thread.Sleep(LoopTime); |
|
168 | 161 |
} |
169 | 162 |
} |
170 | 163 |
public static void AddProperty(List<Tuple<string, string>> datas) |
171 | 164 |
{ |
172 |
try
|
|
165 |
while (Running.HasFlag(ThreadType.AddProperty))
|
|
173 | 166 |
{ |
174 |
while (Running.HasFlag(ThreadType.AddProperty)) |
|
167 |
int handle = FindPropertiesFormHandle(); |
|
168 |
if (handle > 0) |
|
175 | 169 |
{ |
176 |
int handle = FindPropertiesFormHandle();
|
|
177 |
if (handle > 0)
|
|
170 |
System.Windows.Forms.Control control = System.Windows.Forms.Control.FromHandle((IntPtr)handle);
|
|
171 |
if (control != null && control.GetType() == typeof(ComponentPropertiesUI))
|
|
178 | 172 |
{ |
179 |
System.Windows.Forms.Control control = System.Windows.Forms.Control.FromHandle((IntPtr)handle); |
|
180 |
if (control != null && control.GetType() == typeof(ComponentPropertiesUI)) |
|
181 |
{ |
|
182 |
ComponentPropertiesUI UI = control as ComponentPropertiesUI; |
|
183 |
foreach (var item in AvevaACAD18String.LabelNames) |
|
184 |
datas.Add(new Tuple<string, string>(item, "No")); |
|
173 |
ComponentPropertiesUI UI = control as ComponentPropertiesUI; |
|
174 |
foreach (var item in AvevaACAD18String.LabelNames) |
|
175 |
datas.Add(new Tuple<string, string>(item, "No")); |
|
185 | 176 |
|
186 |
foreach (var tuple in datas)
|
|
187 |
{
|
|
188 |
Infragistics.Win.UltraWinGrid.UltraGridRow row = UI.GetGridRow(tuple.Item1);
|
|
189 |
if (row != null)
|
|
190 |
row.Cells["Value"].Value = tuple.Item2;
|
|
191 |
}
|
|
177 |
foreach (var tuple in datas) |
|
178 |
{ |
|
179 |
Infragistics.Win.UltraWinGrid.UltraGridRow row = UI.GetGridRow(tuple.Item1); |
|
180 |
if (row != null) |
|
181 |
row.Cells["Value"].Value = tuple.Item2; |
|
182 |
} |
|
192 | 183 |
|
193 |
int button = FindWindowEx(handle, 0, null, "OK"); |
|
194 |
if (button > 0) |
|
195 |
{ |
|
196 |
SendMessage((IntPtr)button, BM_CLICK, (IntPtr)0, (IntPtr)0); |
|
197 |
} |
|
184 |
int button = FindWindowEx(handle, 0, null, "OK"); |
|
185 |
if (button > 0) |
|
186 |
{ |
|
187 |
SendMessage((IntPtr)button, BM_CLICK, (IntPtr)0, (IntPtr)0); |
|
198 | 188 |
} |
199 |
Running &= ~ThreadType.AddProperty; |
|
200 |
break; |
|
201 | 189 |
} |
202 |
Thread.Sleep(LoopTime); |
|
190 |
Running &= ~ThreadType.AddProperty; |
|
191 |
break; |
|
203 | 192 |
} |
204 |
} |
|
205 |
catch (System.Exception ex) |
|
206 |
{ |
|
207 |
|
|
193 |
Thread.Sleep(LoopTime); |
|
208 | 194 |
} |
209 | 195 |
} |
210 | 196 |
public static void DuplicationWarningMessageBox() |
내보내기 Unified diff