개정판 d03dde83
dev issue #1230 : get attribute info
Change-Id: I3d40f948a4092bcc1ee16f118ec82484aea02a60
DTI_PID/APIDConverter/Utils/AvevaThread.cs | ||
---|---|---|
42 | 42 |
None = 0, |
43 | 43 |
LineNumberModeling = 1, |
44 | 44 |
AddProperty = 2, |
45 |
DuplicationWarning = 4 |
|
45 |
DuplicationWarning = 4, |
|
46 |
GetAttributeInformationFromForm = 8, |
|
46 | 47 |
} |
47 | 48 |
|
48 | 49 |
class AvevaThread |
... | ... | |
116 | 117 |
thread.Start(); |
117 | 118 |
Running |= ThreadType.DuplicationWarning; |
118 | 119 |
} |
120 |
else if (type.HasFlag(ThreadType.GetAttributeInformationFromForm) && !Running.HasFlag(ThreadType.GetAttributeInformationFromForm)) |
|
121 |
{ |
|
122 |
Thread thread = new Thread(GetAttributeInformationFromForm); |
|
123 |
thread.IsBackground = true; |
|
124 |
thread.Start(); |
|
125 |
Running |= ThreadType.GetAttributeInformationFromForm; |
|
126 |
} |
|
119 | 127 |
} |
120 | 128 |
} |
121 | 129 |
|
... | ... | |
219 | 227 |
|
220 | 228 |
} |
221 | 229 |
} |
230 |
public static void GetAttributeInformationFromForm() |
|
231 |
{ |
|
232 |
while (Running.HasFlag(ThreadType.GetAttributeInformationFromForm)) |
|
233 |
{ |
|
234 |
int handle = FindPropertiesFormHandle(); |
|
235 |
if (handle > 0) |
|
236 |
{ |
|
237 |
System.Windows.Forms.Control control = System.Windows.Forms.Control.FromHandle((IntPtr)handle); |
|
238 |
if (control != null && control.GetType() == typeof(ComponentPropertiesUI)) |
|
239 |
{ |
|
240 |
ComponentPropertiesUI UI = control as ComponentPropertiesUI; |
|
241 |
string level1 = UI.Text; |
|
242 |
foreach (PropertyRegion region in UI.PropertyRegions) |
|
243 |
{ |
|
244 |
string level2 = region.Title; |
|
245 |
foreach (PropertyField field in region.PropertyFields) |
|
246 |
{ |
|
247 |
string level3 = field.Key; |
|
248 |
string displayName = field.Name; |
|
249 |
|
|
250 |
|
|
251 |
} |
|
252 |
} |
|
253 |
|
|
254 |
int button = FindWindowEx(handle, 0, null, "Cancel"); |
|
255 |
if (button > 0) |
|
256 |
{ |
|
257 |
SendMessage((IntPtr)button, BM_CLICK, (IntPtr)0, (IntPtr)0); |
|
258 |
Running &= ~ThreadType.GetAttributeInformationFromForm; |
|
259 |
break; |
|
260 |
} |
|
261 |
} |
|
262 |
} |
|
263 |
} |
|
264 |
} |
|
222 | 265 |
|
223 | 266 |
public static int FindPropertiesFormHandle() |
224 | 267 |
{ |
... | ... | |
232 | 275 |
|
233 | 276 |
return result; |
234 | 277 |
} |
235 |
public static void Test() |
|
236 |
{ |
|
237 |
|
|
238 |
} |
|
278 |
|
|
239 | 279 |
} |
240 | 280 |
} |
내보내기 Unified diff