hytos / DTI_PID / APIDConverter / Utils / GUIUtils.cs @ 14540282
이력 | 보기 | 이력해설 | 다운로드 (4.6 KB)
1 | c4c1e3b5 | gaqhf | using System; |
---|---|---|---|
2 | using System.Collections.Generic; |
||
3 | using System.Linq; |
||
4 | using System.Text; |
||
5 | using System.Threading.Tasks; |
||
6 | |||
7 | aabc2b2d | gaqhf | namespace AVEVA.PID.CustomizationUtility |
8 | c4c1e3b5 | gaqhf | { |
9 | public class GUIUtils |
||
10 | { |
||
11 | public static object FindItem(Autodesk.Windows.RibbonItemCollection items, string automationName) |
||
12 | { |
||
13 | foreach (var item in items) |
||
14 | { |
||
15 | if (item.AutomationName == automationName) |
||
16 | return item; |
||
17 | else if (item.GetType() == typeof(Autodesk.Windows.RibbonRowPanel)) |
||
18 | { |
||
19 | Autodesk.Windows.RibbonRowPanel rowPanel = item as Autodesk.Windows.RibbonRowPanel; |
||
20 | foreach (var item2 in rowPanel.Items) |
||
21 | { |
||
22 | if (item2.AutomationName == automationName) |
||
23 | return item2; |
||
24 | } |
||
25 | } |
||
26 | } |
||
27 | |||
28 | return null; |
||
29 | } |
||
30 | 14540282 | gaqhf | |
31 | public static void InitGUI() |
||
32 | { |
||
33 | //Autodesk.Windows.RibbonItemCollection items = GUI.RibbonHelper.GetPanelItems("ID_PIPE_PANEL"); |
||
34 | //object objPipeStyle = GUIUtils.FindItem(items, "PIPESTYLE"); |
||
35 | //if (objPipeStyle != null) |
||
36 | // pipeStyleCombo = objPipeStyle as Autodesk.Windows.RibbonCombo; |
||
37 | //object objAutoLabel = GUIUtils.FindItem(items, "Auto Label"); |
||
38 | //if (objAutoLabel != null) |
||
39 | // autoLabelCheckListButton = objAutoLabel as Autodesk.Windows.RibbonChecklistButton; |
||
40 | |||
41 | //items = GUI.RibbonHelper.GetPanelItems("ID_SIGNAL_PANEL"); |
||
42 | //object objSignalStyle = GUIUtils.FindItem(items, "SIGNALSTYLE"); |
||
43 | //if (objSignalStyle != null) |
||
44 | // signalStyleCombo = objSignalStyle as Autodesk.Windows.RibbonCombo; |
||
45 | } |
||
46 | private void SetAutoLabelUnCehck() |
||
47 | { |
||
48 | //if (autoLabelCheckListButton != null) |
||
49 | //{ |
||
50 | // foreach (var item in autoLabelCheckListButton.Items) |
||
51 | // { |
||
52 | // if (item.GetType() == typeof(Autodesk.Windows.RibbonButton)) |
||
53 | // { |
||
54 | // Autodesk.Windows.RibbonButton ribbonButton = item as Autodesk.Windows.RibbonButton; |
||
55 | // if (ribbonButton.IsChecked) |
||
56 | // ribbonButton.IsChecked = false; |
||
57 | // } |
||
58 | // } |
||
59 | //} |
||
60 | } |
||
61 | |||
62 | public static void SetPipeStyle(string style) |
||
63 | { |
||
64 | Autodesk.Windows.RibbonCombo pipeStyleCombo = null; |
||
65 | Autodesk.Windows.RibbonItemCollection items = GUI.RibbonHelper.GetPanelItems("ID_PIPE_PANEL"); |
||
66 | object objPipeStyle = GUIUtils.FindItem(items, "PIPESTYLE"); |
||
67 | if (objPipeStyle != null) |
||
68 | pipeStyleCombo = objPipeStyle as Autodesk.Windows.RibbonCombo; |
||
69 | |||
70 | if (pipeStyleCombo.Current != null) |
||
71 | { |
||
72 | Autodesk.Windows.RibbonButton button = pipeStyleCombo.Current as Autodesk.Windows.RibbonButton; |
||
73 | if (button.AutomationName != style) |
||
74 | { |
||
75 | foreach (var item in pipeStyleCombo.Items) |
||
76 | { |
||
77 | Autodesk.Windows.RibbonButton loop = item as Autodesk.Windows.RibbonButton; |
||
78 | if (loop.AutomationName == style) |
||
79 | { |
||
80 | pipeStyleCombo.Current = loop; |
||
81 | break; |
||
82 | } |
||
83 | } |
||
84 | } |
||
85 | } |
||
86 | } |
||
87 | |||
88 | public static void SetSignalStyle(string style) |
||
89 | { |
||
90 | Autodesk.Windows.RibbonCombo signalStyleCombo = null; |
||
91 | Autodesk.Windows.RibbonItemCollection items = GUI.RibbonHelper.GetPanelItems("ID_SIGNAL_PANEL"); |
||
92 | object objSignalStyle = GUIUtils.FindItem(items, "SIGNALSTYLE"); |
||
93 | if (objSignalStyle != null) |
||
94 | signalStyleCombo = objSignalStyle as Autodesk.Windows.RibbonCombo; |
||
95 | if (signalStyleCombo.Current != null) |
||
96 | { |
||
97 | Autodesk.Windows.RibbonButton button = signalStyleCombo.Current as Autodesk.Windows.RibbonButton; |
||
98 | if (button.AutomationName != style) |
||
99 | { |
||
100 | foreach (var item in signalStyleCombo.Items) |
||
101 | { |
||
102 | Autodesk.Windows.RibbonButton loop = item as Autodesk.Windows.RibbonButton; |
||
103 | if (loop.AutomationName == style) |
||
104 | { |
||
105 | signalStyleCombo.Current = loop; |
||
106 | break; |
||
107 | } |
||
108 | } |
||
109 | } |
||
110 | } |
||
111 | } |
||
112 | |||
113 | |||
114 | c4c1e3b5 | gaqhf | } |
115 | } |