markus / KCOM / MainWindow.xaml.cs @ 7cee8c20
이력 | 보기 | 이력해설 | 다운로드 (9.75 KB)
1 | 787a4489 | KangIngu | using KCOM.Common; |
---|---|---|---|
2 | using KCOMDataModel; |
||
3 | using KCOMDataModel.DataModel; |
||
4 | using System; |
||
5 | using System.Collections.Generic; |
||
6 | using System.Linq; |
||
7 | using System.Text; |
||
8 | using System.Windows; |
||
9 | using System.Windows.Controls; |
||
10 | using System.Windows.Data; |
||
11 | using System.Windows.Documents; |
||
12 | using System.Windows.Input; |
||
13 | using System.Windows.Media; |
||
14 | using System.Windows.Media.Imaging; |
||
15 | using System.Windows.Navigation; |
||
16 | using System.Windows.Shapes; |
||
17 | 992a98b4 | KangIngu | using Telerik.Windows.Controls; |
18 | 787a4489 | KangIngu | |
19 | namespace KCOM |
||
20 | { |
||
21 | /// <summary> |
||
22 | /// MainWindow.xaml에 대한 상호 작용 논리 |
||
23 | /// </summary> |
||
24 | public partial class MainWindow : Window |
||
25 | { |
||
26 | |||
27 | public MainWindow() |
||
28 | { |
||
29 | InitializeComponent(); |
||
30 | this.Loaded += MainWindow_Loaded; |
||
31 | this.KeyDown += new KeyEventHandler(KeyEventDownAction); |
||
32 | this.KeyUp += new KeyEventHandler(KeyEventUpAction); |
||
33 | } |
||
34 | public void DialogMessage_Alert(string content, string header) |
||
35 | { |
||
36 | var box = new TextBlock(); |
||
37 | box.MinWidth = 400; |
||
38 | box.FontSize = 12; |
||
39 | box.Text = content; |
||
40 | box.TextWrapping = System.Windows.TextWrapping.Wrap; |
||
41 | |||
42 | Telerik.Windows.Controls.DialogParameters parameters = new Telerik.Windows.Controls.DialogParameters() |
||
43 | { |
||
44 | Content = box, |
||
45 | Header = header, |
||
46 | Theme = new Telerik.Windows.Controls.VisualStudio2013Theme(), |
||
47 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
48 | }; |
||
49 | Telerik.Windows.Controls.RadWindow.Alert(parameters); |
||
50 | } |
||
51 | 6c781c0c | djkim | |
52 | 787a4489 | KangIngu | private void MainWindow_Loaded(object sender, RoutedEventArgs e) |
53 | { |
||
54 | double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth; |
||
55 | double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight; |
||
56 | 9f473fb7 | KangIngu | //this.Width += 40; |
57 | 787a4489 | KangIngu | double windowWidth = this.Width; |
58 | double windowHeight = this.Height; |
||
59 | this.Left = (screenWidth / 2) - (windowWidth / 2); |
||
60 | this.Top = (screenHeight / 2) - (windowHeight / 2); |
||
61 | |||
62 | |||
63 | ViewerDataModel.Instance.SystemMain = this; |
||
64 | |||
65 | if (!App.ParameterMode) |
||
66 | { |
||
67 | //App.ViewInfo = new IKCOM.ViewInfo |
||
68 | //{ |
||
69 | // DocumentItemID = "11111112", |
||
70 | // //DocumentItemID = "10001", |
||
71 | // bPartner = false, |
||
72 | // CreateFinalPDFPermission = true, |
||
73 | // NewCommentPermission = true, |
||
74 | // ProjectNO = "000000", |
||
75 | // UserID = "H2011357", |
||
76 | // //UserID = "H2009115", |
||
77 | // //Mode = 0 , 1 , 2 |
||
78 | //}; |
||
79 | //DialogMessage_Alert("데모버전은 단독 실행모드를 지원하지 않습니다", "안내"); |
||
80 | |||
81 | //#if DEBUG |
||
82 | // App.ViewInfo = new IKCOM.ViewInfo |
||
83 | // { |
||
84 | // DocumentItemID = "11111112", |
||
85 | // //DocumentItemID = "10001", |
||
86 | // bPartner = false, |
||
87 | // CreateFinalPDFPermission = true, |
||
88 | // NewCommentPermission = true, |
||
89 | // ProjectNO = "000000", |
||
90 | // UserID = "H2011357", |
||
91 | // //UserID = "H2009115", |
||
92 | // //Mode = 0 , 1 , 2 |
||
93 | // }; |
||
94 | // App.ParameterMode = true; |
||
95 | // this.dzMainMenu.ServiceOn(); |
||
96 | // this.dzMainMenu.SetView(App.ViewInfo); |
||
97 | //#else |
||
98 | |||
99 | DialogMessage_Alert("데모버전은 단독 실행모드를 지원하지 않습니다", "안내"); |
||
100 | this.dzMainMenu.pageNavigator.Visibility = Visibility.Collapsed; |
||
101 | this.dzMainMenu.historyPane.Visibility = Visibility.Collapsed; |
||
102 | this.dzMainMenu.infoListPane.Visibility = Visibility.Collapsed; |
||
103 | this.dzMainMenu.searchPane.Visibility = Visibility.Collapsed; |
||
104 | this.dzMainMenu.talkPane.Visibility = Visibility.Collapsed; |
||
105 | //#endif |
||
106 | } |
||
107 | else |
||
108 | { |
||
109 | this.dzMainMenu.ServiceOn(); |
||
110 | 992a98b4 | KangIngu | |
111 | if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission) |
||
112 | { |
||
113 | this.dzTopMenu.radRibbonView.HelpButtonVisibility = Visibility.Collapsed; |
||
114 | var list = this.dzTopMenu.ChildrenOfType<RadRibbonTab>().ToList(); |
||
115 | list.ForEach(item => item.Visibility = Visibility.Collapsed); |
||
116 | this.dzTopMenu.ribbontab_ReadOnly.Visibility = Visibility.Visible; |
||
117 | this.dzTopMenu.radRibbonView.SelectedItem = this.dzTopMenu.ribbontab_ReadOnly; |
||
118 | this.dzMainMenu.SymbolPane.Visibility = Visibility.Collapsed; |
||
119 | this.dzMainMenu.FavoritePane.Visibility = Visibility.Collapsed; |
||
120 | this.dzMainMenu.drawingRotateCanvas.IsHitTestVisible = false; |
||
121 | } |
||
122 | 787a4489 | KangIngu | this.dzMainMenu.SetView(App.ViewInfo); |
123 | 992a98b4 | KangIngu | this.dzMainMenu.HubSet(); |
124 | 787a4489 | KangIngu | } |
125 | //App.ViewInfo = new IKCOM.ViewInfo |
||
126 | //{ |
||
127 | // DocumentItemID = "11111112", |
||
128 | // //DocumentItemID = "10001", |
||
129 | // bPartner = false, |
||
130 | // CreateFinalPDFPermission = true, |
||
131 | // NewCommentPermission = true, |
||
132 | // ProjectNO = "000000", |
||
133 | // UserID = "H2011357", |
||
134 | // //UserID = "H2009115", |
||
135 | // //Mode = 0 , 1 , 2 |
||
136 | //}; |
||
137 | |||
138 | //this.dzMainMenu.ServiceOn(); |
||
139 | //this.dzMainMenu.SetView(App.ViewInfo); |
||
140 | |||
141 | } |
||
142 | private void WindowDragEvent(object sender, MouseButtonEventArgs e) |
||
143 | { |
||
144 | if (e.ClickCount >= 2) |
||
145 | { |
||
146 | switch (this.WindowState) |
||
147 | { |
||
148 | case WindowState.Normal: |
||
149 | this.WindowState = WindowState.Maximized; |
||
150 | break; |
||
151 | case WindowState.Minimized: |
||
152 | break; |
||
153 | case WindowState.Maximized: |
||
154 | this.WindowState = WindowState.Normal; |
||
155 | break; |
||
156 | default: |
||
157 | break; |
||
158 | } |
||
159 | } |
||
160 | else |
||
161 | { |
||
162 | this.DragMove(); |
||
163 | } |
||
164 | } |
||
165 | |||
166 | private void RadButton_Click(object sender, RoutedEventArgs e) |
||
167 | { |
||
168 | Telerik.Windows.Controls.RadButton button = sender as Telerik.Windows.Controls.RadButton; |
||
169 | |||
170 | switch (button.CommandParameter.ToString()) |
||
171 | { |
||
172 | case ("Min"): |
||
173 | { |
||
174 | WindowState = WindowState.Minimized; |
||
175 | } |
||
176 | break; |
||
177 | case ("Max"): |
||
178 | { |
||
179 | WindowState = WindowState.Maximized; |
||
180 | } |
||
181 | break; |
||
182 | case ("Exit"): |
||
183 | { |
||
184 | |||
185 | } |
||
186 | break; |
||
187 | } |
||
188 | } |
||
189 | |||
190 | private void WinState(object sender, MouseButtonEventArgs e) |
||
191 | { |
||
192 | af177ca1 | djkim | switch ((e.Source as Image).Name) |
193 | 787a4489 | KangIngu | { |
194 | af177ca1 | djkim | case ("Win_min"): |
195 | 787a4489 | KangIngu | { |
196 | WindowState = WindowState.Minimized; |
||
197 | } |
||
198 | break; |
||
199 | af177ca1 | djkim | case ("Win_max"): |
200 | 787a4489 | KangIngu | { |
201 | af177ca1 | djkim | if (WindowState == WindowState.Maximized) |
202 | { |
||
203 | 787a4489 | KangIngu | WindowState = WindowState.Normal; |
204 | af177ca1 | djkim | } |
205 | 787a4489 | KangIngu | else |
206 | af177ca1 | djkim | { |
207 | 787a4489 | KangIngu | WindowState = WindowState.Maximized; |
208 | af177ca1 | djkim | } |
209 | 787a4489 | KangIngu | } |
210 | break; |
||
211 | af177ca1 | djkim | case ("Win_Close"): |
212 | 787a4489 | KangIngu | { |
213 | 316d0f5c | KangIngu | if (ViewerDataModel.Instance.UndoDataList.Count > 0) |
214 | 69ef0800 | KangIngu | { |
215 | 316d0f5c | KangIngu | DateTime undoTime = ViewerDataModel.Instance.UndoDataList.OrderByDescending(order => order.EventTime).FirstOrDefault().EventTime; |
216 | d2cd1e16 | djkim | DateTime updatetime = DateTime.Now.AddDays(-1); |
217 | if (ViewerDataModel.Instance._markupInfoList.Count > 0) |
||
218 | { |
||
219 | updatetime = ViewerDataModel.Instance._markupInfoList.OrderByDescending(order => order.UpdateTime).FirstOrDefault().UpdateTime; |
||
220 | } |
||
221 | 316d0f5c | KangIngu | if (undoTime > updatetime) |
222 | { |
||
223 | 69ef0800 | KangIngu | var box = new TextBlock(); |
224 | box.MinWidth = 400; |
||
225 | box.FontSize = 11; |
||
226 | box.Text = "저장되지 않은 코멘트가 있습니다. 저장 하시겠습니까?"; |
||
227 | box.TextWrapping = System.Windows.TextWrapping.Wrap; |
||
228 | |||
229 | DialogParameters parameters = new DialogParameters() |
||
230 | { |
||
231 | Content = box, |
||
232 | Header = "Confirm", |
||
233 | Theme = new VisualStudio2013Theme(), |
||
234 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
235 | Closed = Onclose, |
||
236 | }; |
||
237 | RadWindow.Confirm(parameters); |
||
238 | } |
||
239 | 316d0f5c | KangIngu | } |
240 | 787a4489 | KangIngu | this.Close(); |
241 | } |
||
242 | break; |
||
243 | } |
||
244 | } |
||
245 | |||
246 | 69ef0800 | KangIngu | private void Onclose(object sender, WindowClosedEventArgs e) |
247 | { |
||
248 | if (e.DialogResult == true) |
||
249 | { |
||
250 | dzTopMenu.SaveEvent(null, null); |
||
251 | } |
||
252 | } |
||
253 | 787a4489 | KangIngu | } |
254 | } |