hytos / DTI_PID / APIDConverter / Utils / APIDUtils.cs @ 8af2ace4
이력 | 보기 | 이력해설 | 다운로드 (1.5 KB)
1 |
using System; |
---|---|
2 |
using System.Collections.Generic; |
3 |
using System.Linq; |
4 |
using System.Text; |
5 |
using System.Threading.Tasks; |
6 |
|
7 |
using AVEVA.PID.CustomizationUtility.DB; |
8 |
using AVEVA.PID.CustomizationUtility.Model; |
9 |
using AVEVA.PID.CustomizationUtility.Properties; |
10 |
|
11 |
namespace AVEVA.PID.CustomizationUtility |
12 |
{ |
13 |
public class APIDUtils |
14 |
{ |
15 |
public static object FindObjectByUID(Document document, string UID) |
16 |
{ |
17 |
if (!string.IsNullOrEmpty(UID) && UID != "None") |
18 |
{ |
19 |
foreach (PlantItem item in document.PlantItems) |
20 |
{ |
21 |
if (item.UID == UID) |
22 |
return item; |
23 |
} |
24 |
} |
25 |
|
26 |
return null; |
27 |
} |
28 |
|
29 |
public static void SetAvevaExplorer() |
30 |
{ |
31 |
bool exist = false; |
32 |
string sName = "APID Converter"; |
33 |
for (int i = 0; i < Aveva.Command.AvevaCommands.projectExplorer.Count; i++) |
34 |
{ |
35 |
if (Aveva.Command.AvevaCommands.projectExplorer[i].Name == sName) |
36 |
{ |
37 |
exist = true; |
38 |
Aveva.Command.AvevaCommands.projectExplorer.Remove(i); |
39 |
break; |
40 |
} |
41 |
} |
42 |
|
43 |
if (!exist) |
44 |
{ |
45 |
Aveva.Command.AvevaCommands.projectExplorer.Add(sName, new APIDConverterExplorer()); |
46 |
Aveva.Command.AvevaCommands.projectExplorer.Activate(Aveva.Command.AvevaCommands.projectExplorer.Count - 1); |
47 |
} |
48 |
|
49 |
} |
50 |
} |
51 |
} |