개정판 264c9309
issue #660: Smart Updater 수정중
Change-Id: I573a5f58b4f34a4fddb68dc670aaf5c770cf5d07
KCOM/MainWindow.xaml.cs | ||
---|---|---|
1 | 1 |
using KCOM.Common; |
2 |
using KCOM.Views; |
|
2 | 3 |
using KCOMDataModel; |
3 | 4 |
using KCOMDataModel.DataModel; |
4 | 5 |
using MarkupToPDF.Common; |
... | ... | |
7 | 8 |
using MarkupToPDF.Serialize.S_Control; |
8 | 9 |
using System; |
9 | 10 |
using System.Collections.Generic; |
11 |
using System.ComponentModel; |
|
12 |
using System.Diagnostics; |
|
10 | 13 |
using System.IO; |
11 | 14 |
using System.Linq; |
15 |
using System.Net; |
|
16 |
using System.Reflection; |
|
12 | 17 |
using System.Runtime.InteropServices; |
13 | 18 |
using System.Text; |
19 |
using System.Threading; |
|
20 |
using System.Threading.Tasks; |
|
14 | 21 |
using System.Windows; |
15 | 22 |
using System.Windows.Controls; |
16 | 23 |
using System.Windows.Data; |
... | ... | |
38 | 45 |
this.KeyDown += new KeyEventHandler(KeyEventDownAction); |
39 | 46 |
this.KeyUp += new KeyEventHandler(KeyEventUpAction); |
40 | 47 |
this.SourceInitialized += new EventHandler(win_SourceInitialized); |
48 |
this.Closed += MainWindow_Closed; |
|
41 | 49 |
|
42 | 50 |
} |
43 | 51 |
|
... | ... | |
168 | 176 |
|
169 | 177 |
private void WindowDragEvent(object sender, MouseButtonEventArgs e) |
170 | 178 |
{ |
171 |
if (e.ClickCount == 2)
|
|
179 |
if(filename == null)
|
|
172 | 180 |
{ |
173 |
if ((ResizeMode == ResizeMode.CanResize) || |
|
174 |
(ResizeMode == ResizeMode.CanResizeWithGrip)) |
|
181 |
if (e.ClickCount == 2) |
|
175 | 182 |
{ |
176 |
SwitchState(); |
|
183 |
if ((ResizeMode == ResizeMode.CanResize) || |
|
184 |
(ResizeMode == ResizeMode.CanResizeWithGrip)) |
|
185 |
{ |
|
186 |
SwitchState(); |
|
187 |
} |
|
177 | 188 |
} |
178 |
} |
|
179 |
else |
|
180 |
{ |
|
181 |
if (WindowState == WindowState.Maximized) |
|
189 |
else |
|
182 | 190 |
{ |
183 |
restoreIfMove = true; |
|
184 |
} |
|
191 |
if (WindowState == WindowState.Maximized) |
|
192 |
{ |
|
193 |
restoreIfMove = true; |
|
194 |
} |
|
185 | 195 |
|
186 |
this.DragMove(); |
|
187 |
} |
|
196 |
this.DragMove(); |
|
197 |
} |
|
198 |
} |
|
188 | 199 |
} |
189 | 200 |
|
190 | 201 |
private void WindowDragEventUp(object sender, MouseButtonEventArgs e) |
... | ... | |
337 | 348 |
RadWindow.Confirm(parameters); |
338 | 349 |
} |
339 | 350 |
} |
340 |
this.Close(); |
|
351 |
|
|
352 |
MainWindow_Close(); |
|
341 | 353 |
} |
342 | 354 |
break; |
343 | 355 |
} |
344 | 356 |
} |
345 | 357 |
|
358 |
private void MainWindow_Closed(object sender, EventArgs e) |
|
359 |
{ |
|
360 |
splashScreen.Close(); |
|
361 |
ProcessStartInfo proInfo = new ProcessStartInfo(); |
|
362 |
proInfo.FileName = AppDomain.CurrentDomain.BaseDirectory + filename; |
|
363 |
Process.Start(proInfo); |
|
364 |
} |
|
365 |
|
|
366 |
//파일 다운로드 상황을 반영(수정 필요) |
|
367 |
private void DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) |
|
368 |
{ |
|
369 |
|
|
370 |
if (i <= 100) |
|
371 |
{ |
|
372 |
i++; |
|
373 |
} |
|
374 |
Thread.Sleep(3); |
|
375 |
splashScreen.Progress = i; |
|
376 |
splashScreen.Close(); |
|
377 |
|
|
378 |
//splashScreen.Close(); |
|
379 |
} |
|
380 |
private Thread theProgBarThread; |
|
381 |
string filename = null; |
|
382 |
int i = 1; |
|
383 |
|
|
384 |
|
|
385 |
public static SplashScreenWindow splashScreen = new SplashScreenWindow(); |
|
386 |
private void MainWindow_Close() |
|
387 |
{ |
|
388 |
try |
|
389 |
{ |
|
390 |
string url = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetVersionData(Environment.Is64BitProcess, Assembly.GetExecutingAssembly().GetName().Version.ToString()); |
|
391 |
if (!string.IsNullOrEmpty(url)) |
|
392 |
{ |
|
393 |
if (MessageBox.Show("새로운 버전이 있습니다. \n업데이트 하시겠습니까?", "MARKUS", MessageBoxButton.OKCancel) == MessageBoxResult.OK) |
|
394 |
{ |
|
395 |
//splashScreen.splashText.Text = " DownLoad..."; |
|
396 |
|
|
397 |
splashScreen.Show(); |
|
398 |
WebClient theDownloadThread = new WebClient(); |
|
399 |
//Uri url = new Uri(itemInfoList[i].FileName); |
|
400 |
theDownloadThread.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressChanged); |
|
401 |
theDownloadThread.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed); |
|
402 |
filename = System.IO.Path.GetFileName(url); |
|
403 |
|
|
404 |
if (!File.Exists(TempFile.TempFolder)) |
|
405 |
{ |
|
406 |
Directory.CreateDirectory(TempFile.TempFolder); |
|
407 |
} |
|
408 |
|
|
409 |
theDownloadThread.DownloadFileAsync(new Uri(url), System.IO.Path.Combine(TempFile.TempFolder, filename)); |
|
410 |
|
|
411 |
} |
|
412 |
else |
|
413 |
{ |
|
414 |
this.Close(); |
|
415 |
} |
|
416 |
} |
|
417 |
else |
|
418 |
{ |
|
419 |
this.Close(); |
|
420 |
} |
|
421 |
|
|
422 |
} |
|
423 |
catch (Exception) |
|
424 |
{ |
|
425 |
this.Close(); |
|
426 |
} |
|
427 |
} |
|
428 |
|
|
429 |
private void Completed(object sender, AsyncCompletedEventArgs e) |
|
430 |
{ |
|
431 |
try |
|
432 |
{ |
|
433 |
this.Close(); |
|
434 |
} |
|
435 |
catch (Exception ee) |
|
436 |
{ |
|
437 |
} |
|
438 |
|
|
439 |
} |
|
440 |
|
|
346 | 441 |
private void Onclose(object sender, WindowClosedEventArgs e) |
347 | 442 |
{ |
348 | 443 |
if (e.DialogResult == true) |
내보내기 Unified diff