markus / KCOM / MainWindow.xaml.cs @ 552af7c7
이력 | 보기 | 이력해설 | 다운로드 (18.4 KB)
1 | 787a4489 | KangIngu | using KCOM.Common; |
---|---|---|---|
2 | 32af2c3b | djkim | using KCOM.Controls; |
3 | 264c9309 | ljiyeon | using KCOM.Views; |
4 | 787a4489 | KangIngu | using KCOMDataModel; |
5 | using KCOMDataModel.DataModel; |
||
6 | b0fb3ad7 | ljiyeon | using MarkupToPDF.Common; |
7 | 5529d2a2 | humkyung | using MarkupToPDF.Controls.Parsing; |
8 | b0fb3ad7 | ljiyeon | using MarkupToPDF.Serialize.Core; |
9 | using MarkupToPDF.Serialize.S_Control; |
||
10 | 787a4489 | KangIngu | using System; |
11 | using System.Collections.Generic; |
||
12 | 264c9309 | ljiyeon | using System.ComponentModel; |
13 | using System.Diagnostics; |
||
14 | 6707a5c7 | ljiyeon | using System.IO; |
15 | 787a4489 | KangIngu | using System.Linq; |
16 | 264c9309 | ljiyeon | using System.Net; |
17 | using System.Reflection; |
||
18 | 71bfd53e | ljiyeon | using System.Runtime.InteropServices; |
19 | 787a4489 | KangIngu | using System.Text; |
20 | 264c9309 | ljiyeon | using System.Threading; |
21 | using System.Threading.Tasks; |
||
22 | 787a4489 | KangIngu | using System.Windows; |
23 | using System.Windows.Controls; |
||
24 | using System.Windows.Data; |
||
25 | using System.Windows.Documents; |
||
26 | using System.Windows.Input; |
||
27 | using System.Windows.Media; |
||
28 | using System.Windows.Media.Imaging; |
||
29 | using System.Windows.Navigation; |
||
30 | using System.Windows.Shapes; |
||
31 | 6707a5c7 | ljiyeon | using System.Xml; |
32 | 992a98b4 | KangIngu | using Telerik.Windows.Controls; |
33 | 7e2d29a0 | ljiyeon | using WinInterop = System.Windows.Interop; |
34 | 787a4489 | KangIngu | |
35 | namespace KCOM |
||
36 | { |
||
37 | /// <summary> |
||
38 | /// MainWindow.xaml에 대한 상호 작용 논리 |
||
39 | /// </summary> |
||
40 | 68302e9d | taeseongkim | public partial class MainWindow : KCOM.Controls.CustomizedWindow.CustomWindow |
41 | 787a4489 | KangIngu | { |
42 | 32af2c3b | djkim | bool isSaveCheck = false; |
43 | d33ef543 | taeseongkim | |
44 | 32af2c3b | djkim | ProgressControl progressControl = null; |
45 | string destfilepath = string.Empty; |
||
46 | |||
47 | 787a4489 | KangIngu | public MainWindow() |
48 | { |
||
49 | e0cfc73c | ljiyeon | App.splashString(ISplashMessage.MAINWINDOW); |
50 | c362d2a5 | taeseongkim | |
51 | 787a4489 | KangIngu | this.Loaded += MainWindow_Loaded; |
52 | eeb0a39c | taeseongkim | this.Unloaded += MainWindow_Unloaded; |
53 | 8e6884a5 | taeseongkim | //this.PreviewKeyDown += new KeyEventHandler(KeyEventDownAction); |
54 | d97dbc7f | taeseongkim | this.Activated += MainWindow_Activated; |
55 | } |
||
56 | |||
57 | 9d5b4bc2 | taeseongkim | |
58 | 2007ecaa | taeseongkim | |
59 | d97dbc7f | taeseongkim | private void MainWindow_Activated(object sender, EventArgs e) |
60 | { |
||
61 | this.Topmost = true; |
||
62 | 448c5399 | taeseongkim | this.Topmost = false; |
63 | 787a4489 | KangIngu | } |
64 | ca16abb2 | ljiyeon | |
65 | eeb0a39c | taeseongkim | private void MainWindow_Unloaded(object sender, RoutedEventArgs e) |
66 | { |
||
67 | } |
||
68 | |||
69 | 787a4489 | KangIngu | public void DialogMessage_Alert(string content, string header) |
70 | { |
||
71 | c362d2a5 | taeseongkim | App.splashScreen.Close(); |
72 | |||
73 | 787a4489 | KangIngu | Telerik.Windows.Controls.DialogParameters parameters = new Telerik.Windows.Controls.DialogParameters() |
74 | { |
||
75 | b9b01f8e | ljiyeon | Owner = Application.Current.MainWindow, |
76 | 0d32593b | ljiyeon | Content = new TextBlock() |
77 | d33ef543 | taeseongkim | { |
78 | 0d32593b | ljiyeon | MinWidth = 400, |
79 | FontSize = 12, |
||
80 | Text = content, |
||
81 | TextWrapping = System.Windows.TextWrapping.Wrap |
||
82 | }, |
||
83 | 787a4489 | KangIngu | Header = header, |
84 | Theme = new Telerik.Windows.Controls.VisualStudio2013Theme(), |
||
85 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
86 | }; |
||
87 | Telerik.Windows.Controls.RadWindow.Alert(parameters); |
||
88 | } |
||
89 | 7e2d29a0 | ljiyeon | |
90 | 787a4489 | KangIngu | private void MainWindow_Loaded(object sender, RoutedEventArgs e) |
91 | { |
||
92 | 0c997b99 | ljiyeon | InitializeComponent(); |
93 | f44e0cd0 | 이지연 | //Loaded 이벤트에서 MaxHeight를 설정 모니터가 1개일때만 |
94 | //MaxHeight = SystemParameters.WorkArea.Height; |
||
95 | //LocationChanged : 모니터가 2개 이상이고, 모니터의 해상도가 다를 때에 설정 |
||
96 | this.LocationChanged += Window_LocationChanged; |
||
97 | ca16abb2 | ljiyeon | //cursor change |
98 | 902faaea | taeseongkim | this.Cursor = new Cursor(App.DefaultArrowCursorStream); |
99 | ca16abb2 | ljiyeon | |
100 | d33ef543 | taeseongkim | var point = GetScreenCenter(); |
101 | |||
102 | c362d2a5 | taeseongkim | //this.Left = point.X; |
103 | //this.Top = point.Y; |
||
104 | 787a4489 | KangIngu | |
105 | ViewerDataModel.Instance.SystemMain = this; |
||
106 | |||
107 | if (!App.ParameterMode) |
||
108 | { |
||
109 | //App.ViewInfo = new IKCOM.ViewInfo |
||
110 | //{ |
||
111 | // DocumentItemID = "11111112", |
||
112 | // //DocumentItemID = "10001", |
||
113 | // bPartner = false, |
||
114 | // CreateFinalPDFPermission = true, |
||
115 | // NewCommentPermission = true, |
||
116 | // ProjectNO = "000000", |
||
117 | // UserID = "H2011357", |
||
118 | // //UserID = "H2009115", |
||
119 | // //Mode = 0 , 1 , 2 |
||
120 | //}; |
||
121 | //DialogMessage_Alert("데모버전은 단독 실행모드를 지원하지 않습니다", "안내"); |
||
122 | |||
123 | 7e2d29a0 | ljiyeon | //#if DEBUG |
124 | // App.ViewInfo = new IKCOM.ViewInfo |
||
125 | // { |
||
126 | // DocumentItemID = "11111112", |
||
127 | // //DocumentItemID = "10001", |
||
128 | // bPartner = false, |
||
129 | // CreateFinalPDFPermission = true, |
||
130 | // NewCommentPermission = true, |
||
131 | // ProjectNO = "000000", |
||
132 | // UserID = "H2011357", |
||
133 | // //UserID = "H2009115", |
||
134 | // //Mode = 0 , 1 , 2 |
||
135 | // }; |
||
136 | // App.ParameterMode = true; |
||
137 | // this.dzMainMenu.ServiceOn(); |
||
138 | // this.dzMainMenu.SetView(App.ViewInfo); |
||
139 | //#else |
||
140 | 787a4489 | KangIngu | |
141 | DialogMessage_Alert("데모버전은 단독 실행모드를 지원하지 않습니다", "안내"); |
||
142 | this.dzMainMenu.pageNavigator.Visibility = Visibility.Collapsed; |
||
143 | this.dzMainMenu.historyPane.Visibility = Visibility.Collapsed; |
||
144 | this.dzMainMenu.infoListPane.Visibility = Visibility.Collapsed; |
||
145 | this.dzMainMenu.searchPane.Visibility = Visibility.Collapsed; |
||
146 | this.dzMainMenu.talkPane.Visibility = Visibility.Collapsed; |
||
147 | 7e2d29a0 | ljiyeon | //#endif |
148 | 787a4489 | KangIngu | } |
149 | else |
||
150 | { |
||
151 | 43e1d368 | taeseongkim | this.dzMainMenu.talkPane.Visibility = Visibility.Collapsed; |
152 | 787a4489 | KangIngu | this.dzMainMenu.ServiceOn(); |
153 | 992a98b4 | KangIngu | |
154 | if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission) |
||
155 | { |
||
156 | this.dzTopMenu.radRibbonView.HelpButtonVisibility = Visibility.Collapsed; |
||
157 | var list = this.dzTopMenu.ChildrenOfType<RadRibbonTab>().ToList(); |
||
158 | list.ForEach(item => item.Visibility = Visibility.Collapsed); |
||
159 | this.dzTopMenu.ribbontab_ReadOnly.Visibility = Visibility.Visible; |
||
160 | this.dzTopMenu.radRibbonView.SelectedItem = this.dzTopMenu.ribbontab_ReadOnly; |
||
161 | e0204db0 | djkim | //this.dzMainMenu.SymbolPane.Visibility = Visibility.Collapsed; |
162 | //this.dzMainMenu.FavoritePane.Visibility = Visibility.Collapsed; |
||
163 | //this.dzMainMenu.drawingRotateCanvas.IsHitTestVisible = false; |
||
164 | 992a98b4 | KangIngu | } |
165 | 3d31db34 | 송근호 | |
166 | try |
||
167 | { |
||
168 | ff01c725 | humkyung | ///this.dzMainMenu.HubSet(); |
169 | 3d31db34 | 송근호 | this.dzMainMenu.SetView(App.ViewInfo); |
170 | } |
||
171 | 5a6493ad | humkyung | catch (Exception ex) |
172 | 3d31db34 | 송근호 | { |
173 | 5a6493ad | humkyung | MessageBox.Show(string.Format("웹 서비스 접속시 에러가 발생했습니다.\n{0}", ex.StackTrace)); |
174 | 3724d2a2 | 송근호 | |
175 | System.Environment.Exit(0); |
||
176 | 3d31db34 | 송근호 | } |
177 | 787a4489 | KangIngu | } |
178 | } |
||
179 | f44e0cd0 | 이지연 | /// <summary> |
180 | /// 멤버 변수로 현 사용자의 모든 모니터들의 상태를 가져온다. |
||
181 | /// Window의 LocationChanged Event를 통해 Window가 이동할 때마다 어떤 모니터에 있는지를 확인 |
||
182 | /// Window가 어떤 모니터에 있는지의 기준은 각 Window의 중앙 부분 |
||
183 | /// Sum 은 모니터들의 왼쪽 끝 부터 오른쪽 끝까지의 합 |
||
184 | /// 현재 Window의 중앙은 Left 값 + Width의 반 |
||
185 | /// um보다 작다면 현재 더하게 된 Screen 안에 있다는 뜻이므로 현재 더한 item의 WorkingArea의 Height를MaxHeight로 설정 |
||
186 | /// </summary> |
||
187 | System.Windows.Forms.Screen[] screens = System.Windows.Forms.Screen.AllScreens; |
||
188 | private void Window_LocationChanged(object sender, EventArgs e) |
||
189 | 0d2d2a08 | 이지연 | { |
190 | int sum = 0; |
||
191 | foreach (var item in screens) |
||
192 | { |
||
193 | sum += item.WorkingArea.Width; |
||
194 | if (sum >= this.Left + this.Width / 2) |
||
195 | { |
||
196 | f44e0cd0 | 이지연 | this.MaxHeight = item.WorkingArea.Height; |
197 | 0d2d2a08 | 이지연 | this.MaxWidth = item.WorkingArea.Width; |
198 | if (this.Left < 0) |
||
199 | { |
||
200 | this.Left = 0; |
||
201 | } |
||
202 | |||
203 | if (this.Top < 0) |
||
204 | { |
||
205 | this.Top = 0; |
||
206 | } |
||
207 | // if(this.Tag.Equals("Normal")) |
||
208 | //{ |
||
209 | // this.WindowState = WindowState.Normal; |
||
210 | // this.CustomState = WindowState.Maximized; |
||
211 | //} |
||
212 | //if (this.CustomState == WindowState.Maximized) |
||
213 | //{ |
||
214 | // this.WindowState = WindowState.Normal; |
||
215 | // this.CustomState = WindowState.Normal; |
||
216 | |||
217 | |||
218 | //} |
||
219 | //else |
||
220 | //{ |
||
221 | // this.WindowState = WindowState.Normal; |
||
222 | // this.CustomState = WindowState.Maximized; |
||
223 | // this.NomalWindowArea = new Rect(this.Left, this.Top, this.Width, this.Height); |
||
224 | |||
225 | //} |
||
226 | break; |
||
227 | } |
||
228 | f44e0cd0 | 이지연 | } |
229 | } |
||
230 | |||
231 | d33ef543 | taeseongkim | private Point GetScreenCenter() |
232 | 787a4489 | KangIngu | { |
233 | d33ef543 | taeseongkim | Point result = new Point(); |
234 | 3933072f | ljiyeon | |
235 | d33ef543 | taeseongkim | //first get all the screens |
236 | System.Drawing.Rectangle ret; |
||
237 | int ScreenWidth = 0; |
||
238 | 787a4489 | KangIngu | |
239 | d33ef543 | taeseongkim | var mousePosition = System.Windows.Forms.Cursor.Position; |
240 | 71bfd53e | ljiyeon | |
241 | d33ef543 | taeseongkim | for (int i = 1; i <= System.Windows.Forms.Screen.AllScreens.Count(); i++) |
242 | 71bfd53e | ljiyeon | { |
243 | d33ef543 | taeseongkim | ret = System.Windows.Forms.Screen.AllScreens[i - 1].Bounds; |
244 | 3933072f | ljiyeon | |
245 | d33ef543 | taeseongkim | if (ret.Contains(mousePosition)) |
246 | { |
||
247 | result.X = ScreenWidth + (ret.Width / 2 - this.Width / 2); |
||
248 | result.Y = (ret.Height / 2 - this.Height / 2); |
||
249 | 71bfd53e | ljiyeon | |
250 | d33ef543 | taeseongkim | break; |
251 | } |
||
252 | else |
||
253 | { |
||
254 | ScreenWidth += ret.Width; |
||
255 | 71bfd53e | ljiyeon | } |
256 | |||
257 | d33ef543 | taeseongkim | } |
258 | 71bfd53e | ljiyeon | |
259 | |||
260 | d33ef543 | taeseongkim | return result; |
261 | 71bfd53e | ljiyeon | } |
262 | |||
263 | d33ef543 | taeseongkim | protected override void OnStateChanged(EventArgs e) |
264 | 71bfd53e | ljiyeon | { |
265 | d33ef543 | taeseongkim | base.OnStateChanged(e); |
266 | 71bfd53e | ljiyeon | } |
267 | |||
268 | d33ef543 | taeseongkim | protected override void OnClosing(CancelEventArgs e) |
269 | 787a4489 | KangIngu | { |
270 | d33ef543 | taeseongkim | base.OnClosing(e); |
271 | cf1cc862 | taeseongkim | |
272 | bae83c92 | taeseongkim | if(!ViewerDataModel.Instance.SaveCheck()) |
273 | 75f6ff19 | taeseongkim | { |
274 | c362d2a5 | taeseongkim | var IsConfirm = SaveConfirm(); |
275 | |||
276 | if (IsConfirm == null) |
||
277 | 75f6ff19 | taeseongkim | { |
278 | e.Cancel = true; |
||
279 | } |
||
280 | c362d2a5 | taeseongkim | else if(IsConfirm == true) |
281 | { |
||
282 | dzTopMenu.SaveEventCallback(null, null); |
||
283 | } |
||
284 | 75f6ff19 | taeseongkim | } |
285 | 787a4489 | KangIngu | |
286 | bae83c92 | taeseongkim | if (App.ViewInfo.CreateFinalPDFPermission) |
287 | { |
||
288 | if (!ViewerDataModel.Instance.FinalPDFCheck()) |
||
289 | { |
||
290 | var result = FinalConfirm(); |
||
291 | |||
292 | 9380813b | swate0609 | if(result == null) |
293 | e.Cancel = true; |
||
294 | |||
295 | bae83c92 | taeseongkim | if (result == false) |
296 | { |
||
297 | e.Cancel = true; |
||
298 | } |
||
299 | else |
||
300 | { |
||
301 | 6a19b48d | taeseongkim | //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveLog(App.ViewInfo.ProjectNO, App.ViewInfo.DocumentItemID, "최종 Merged PDF 안됨."); |
302 | bae83c92 | taeseongkim | } |
303 | } |
||
304 | } |
||
305 | |||
306 | d33ef543 | taeseongkim | //Update Check 를 통해 update url 을 Get 하고 결과값이 있을 경우에는 SmartUpdater 실행. |
307 | 9d5b4bc2 | taeseongkim | //KeyValuePair<bool, string> updatecheck = UpdateCheck(); |
308 | //if (updatecheck.Key && !string.IsNullOrEmpty(updatecheck.Value)) |
||
309 | //{ |
||
310 | // CallUpdateProcess(updatecheck.Value); |
||
311 | //} |
||
312 | 787a4489 | KangIngu | } |
313 | d33ef543 | taeseongkim | |
314 | bae83c92 | taeseongkim | |
315 | private bool? SaveConfirm() |
||
316 | 264c9309 | ljiyeon | { |
317 | bae83c92 | taeseongkim | bool? result = null; |
318 | |||
319 | EventHandler<WindowClosedEventArgs> Closedhandler = null; |
||
320 | 75f6ff19 | taeseongkim | |
321 | bae83c92 | taeseongkim | Closedhandler = (snd, evt) => |
322 | 32af2c3b | djkim | { |
323 | bae83c92 | taeseongkim | result = evt.DialogResult; |
324 | }; |
||
325 | 264c9309 | ljiyeon | |
326 | bae83c92 | taeseongkim | DialogParameters parameters = new DialogParameters() |
327 | { |
||
328 | Content = new TextBlock() |
||
329 | 32af2c3b | djkim | { |
330 | bae83c92 | taeseongkim | MinWidth = 300, |
331 | FontSize = 11, |
||
332 | Text = "Found unsaved comments. Save now?", |
||
333 | TextWrapping = System.Windows.TextWrapping.Wrap |
||
334 | }, |
||
335 | |||
336 | Header = "Confirm", |
||
337 | Theme = new VisualStudio2013Theme(), |
||
338 | ContentStyle = Application.Current.Resources["RadConfirmYNCStyle"] as Style, |
||
339 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
340 | |||
341 | Owner = Application.Current.MainWindow, |
||
342 | Opened = (s, openedEvent) => |
||
343 | 32af2c3b | djkim | { |
344 | bae83c92 | taeseongkim | RadWindow confirm = s as RadWindow; |
345 | //Button Cancel = confirm.ChildrenOfType<Button>()[5]; |
||
346 | //FocusManager.SetIsFocusScope(confirm, true); |
||
347 | //FocusManager.SetFocusedElement(confirm, Cancel); |
||
348 | }, |
||
349 | |||
350 | Closed = Closedhandler |
||
351 | }; |
||
352 | |||
353 | RadWindow.Confirm(parameters); |
||
354 | 75f6ff19 | taeseongkim | |
355 | return result; |
||
356 | 264c9309 | ljiyeon | } |
357 | 75f6ff19 | taeseongkim | |
358 | bae83c92 | taeseongkim | private bool? FinalConfirm() |
359 | 32af2c3b | djkim | { |
360 | bae83c92 | taeseongkim | bool? result = false; |
361 | 75f6ff19 | taeseongkim | |
362 | EventHandler<WindowClosedEventArgs> Closedhandler = null; |
||
363 | |||
364 | Closedhandler = (snd, evt) => |
||
365 | 32af2c3b | djkim | { |
366 | c362d2a5 | taeseongkim | result = evt.DialogResult; |
367 | 75f6ff19 | taeseongkim | }; |
368 | |||
369 | DialogParameters parameters = new DialogParameters() |
||
370 | { |
||
371 | Content = new TextBlock() |
||
372 | { |
||
373 | c362d2a5 | taeseongkim | MinWidth = 300, |
374 | 75f6ff19 | taeseongkim | FontSize = 11, |
375 | bae83c92 | taeseongkim | Text = "Merged PDF가 수행되지 않았습니다. 창을 닫으시겠습니까?", |
376 | 75f6ff19 | taeseongkim | TextWrapping = System.Windows.TextWrapping.Wrap |
377 | }, |
||
378 | c362d2a5 | taeseongkim | |
379 | 75f6ff19 | taeseongkim | Header = "Confirm", |
380 | Theme = new VisualStudio2013Theme(), |
||
381 | 90d1dee0 | swate0609 | ContentStyle = Application.Current.Resources["RadConfirmYCStyle"] as Style, |
382 | 75f6ff19 | taeseongkim | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
383 | c362d2a5 | taeseongkim | |
384 | Owner = Application.Current.MainWindow, |
||
385 | Opened = (s, openedEvent) => |
||
386 | { |
||
387 | RadWindow confirm = s as RadWindow; |
||
388 | }, |
||
389 | |||
390 | 75f6ff19 | taeseongkim | Closed = Closedhandler |
391 | }; |
||
392 | |||
393 | RadWindow.Confirm(parameters); |
||
394 | |||
395 | return result; |
||
396 | 32af2c3b | djkim | } |
397 | d33ef543 | taeseongkim | |
398 | 32af2c3b | djkim | private void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) |
399 | { |
||
400 | Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate |
||
401 | { |
||
402 | double bytesIn = double.Parse(e.BytesReceived.ToString()); |
||
403 | double totalBytes = double.Parse(e.TotalBytesToReceive.ToString()); |
||
404 | double percentage = bytesIn / totalBytes * 100; |
||
405 | progressControl.splashText.Text = "Download : " + Math.Truncate(percentage).ToString() + " %"; |
||
406 | d33ef543 | taeseongkim | progressControl.progressBar.Value = int.Parse(Math.Truncate(percentage).ToString()); |
407 | 32af2c3b | djkim | })); |
408 | 310eff8b | djkim | } |
409 | |||
410 | /// <summary> |
||
411 | /// KCOM_API 를 통해 업데이트 URL 을 가져옴. |
||
412 | /// false : 업데이트 불필요. |
||
413 | /// true : 업데이트 필요. url 을 같이 Return. |
||
414 | /// </summary> |
||
415 | /// <returns></returns> |
||
416 | private KeyValuePair<bool, string> UpdateCheck() |
||
417 | 264c9309 | ljiyeon | { |
418 | 310eff8b | djkim | bool isUpdateCheck = false; |
419 | string updateurl = string.Empty; |
||
420 | 264c9309 | ljiyeon | try |
421 | { |
||
422 | ffddbe4e | djkim | bool is64bit = Environment.Is64BitProcess; |
423 | string clientversion = Assembly.GetExecutingAssembly().GetName().Version.ToString(); |
||
424 | updateurl = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetVersionData(is64bit, clientversion); |
||
425 | d33ef543 | taeseongkim | |
426 | ffddbe4e | djkim | if (Check_Uri.isUri(updateurl)) |
427 | d33ef543 | taeseongkim | { |
428 | 32af2c3b | djkim | DialogParameters parameters = new DialogParameters() |
429 | 264c9309 | ljiyeon | { |
430 | 32af2c3b | djkim | Owner = Application.Current.MainWindow, |
431 | 97cde7e3 | ljiyeon | Content = new TextBlock() |
432 | { |
||
433 | MinWidth = 400, |
||
434 | FontSize = 11, |
||
435 | eeb0a39c | taeseongkim | Text = "Update is available. \n Update now?", |
436 | 97cde7e3 | ljiyeon | TextWrapping = System.Windows.TextWrapping.Wrap |
437 | }, |
||
438 | 32af2c3b | djkim | Header = "Confirm", |
439 | Theme = new VisualStudio2013Theme(), |
||
440 | d33ef543 | taeseongkim | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
441 | 32af2c3b | djkim | Closed = delegate (object windowSender, WindowClosedEventArgs e) |
442 | 264c9309 | ljiyeon | { |
443 | 32af2c3b | djkim | if (e.DialogResult == true) |
444 | d33ef543 | taeseongkim | { |
445 | isUpdateCheck = true; |
||
446 | 97cde7e3 | ljiyeon | } |
447 | else |
||
448 | 32af2c3b | djkim | { |
449 | 310eff8b | djkim | isUpdateCheck = false; |
450 | d33ef543 | taeseongkim | } |
451 | } |
||
452 | 32af2c3b | djkim | }; |
453 | d33ef543 | taeseongkim | RadWindow.Confirm(parameters); |
454 | |||
455 | 264c9309 | ljiyeon | } |
456 | else |
||
457 | { |
||
458 | 310eff8b | djkim | isUpdateCheck = false; |
459 | 264c9309 | ljiyeon | } |
460 | } |
||
461 | 5a6493ad | humkyung | catch (Exception ex) |
462 | 264c9309 | ljiyeon | { |
463 | 5a6493ad | humkyung | throw ex; |
464 | 310eff8b | djkim | } |
465 | return new KeyValuePair<bool, string>(isUpdateCheck, updateurl); |
||
466 | 264c9309 | ljiyeon | } |
467 | |||
468 | 310eff8b | djkim | /// <summary> |
469 | /// SmartUpdate 를 호출. |
||
470 | /// </summary> |
||
471 | /// <param name="updateurl">Download 할 설치파일 경로</param> |
||
472 | private void CallUpdateProcess(string updateurl) |
||
473 | { |
||
474 | ProcessStartInfo proInfo = new ProcessStartInfo(); |
||
475 | string smartupdaterpath = string.Empty; |
||
476 | smartupdaterpath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SmartUpdate.exe"); |
||
477 | Process.Start(smartupdaterpath, updateurl); |
||
478 | } |
||
479 | d04e8ee9 | taeseongkim | private async void Client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) |
480 | 32af2c3b | djkim | { |
481 | 264c9309 | ljiyeon | try |
482 | { |
||
483 | d33ef543 | taeseongkim | await Dispatcher.InvokeAsync(() => progressControl.splashText.Text = "Download Completed"); |
484 | d04e8ee9 | taeseongkim | |
485 | d33ef543 | taeseongkim | if (progressControl != null) |
486 | 32af2c3b | djkim | { |
487 | progressControl.Close(); |
||
488 | progressControl = null; |
||
489 | } |
||
490 | d33ef543 | taeseongkim | if (File.Exists(destfilepath)) |
491 | 32af2c3b | djkim | { |
492 | ProcessStartInfo update_msi = new ProcessStartInfo(); |
||
493 | update_msi.FileName = destfilepath; |
||
494 | Process.Start(update_msi); |
||
495 | d33ef543 | taeseongkim | } |
496 | 32af2c3b | djkim | this.Close(); |
497 | 264c9309 | ljiyeon | } |
498 | 32af2c3b | djkim | catch (Exception) |
499 | 69ef0800 | KangIngu | { |
500 | 32af2c3b | djkim | throw; |
501 | 69ef0800 | KangIngu | } |
502 | 7e2d29a0 | ljiyeon | |
503 | } |
||
504 | 787a4489 | KangIngu | } |
505 | } |