프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

hytos / DTI_PID / APIDConverter / Utils / APIDUtils.cs @ 75b3c39a

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

1 4e320fcb gaqhf
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Threading.Tasks;
6
7 5aec7e24 gaqhf
using AVEVA.PID.CustomizationUtility.DB;
8
using AVEVA.PID.CustomizationUtility.Model;
9
using AVEVA.PID.CustomizationUtility.Properties;
10
11 4e320fcb gaqhf
namespace AVEVA.PID.CustomizationUtility
12
{
13
    public class APIDUtils
14
    {
15 5aec7e24 gaqhf
        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 4e320fcb gaqhf
26 5aec7e24 gaqhf
            return null;
27
        }
28 88cb9898 gaqhf
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 4e320fcb gaqhf
    }
51
}