개정판 310eff8b
issue #660: mainwindow.close 를 WinState의 Win_Close 일 경우에 하도록 수정.
Change-Id: Ifa1aed2bf3f79fc28e498e7af0098c6c960371df
KCOM/MainWindow.xaml.cs | ||
---|---|---|
40 | 40 |
public partial class MainWindow : Window |
41 | 41 |
{ |
42 | 42 |
bool isSaveCheck = false; |
43 |
bool isUpdateCheck = false; |
|
43 |
|
|
44 | 44 |
ProgressControl progressControl = null; |
45 | 45 |
string destfilepath = string.Empty; |
46 | 46 |
|
... | ... | |
324 | 324 |
case ("Win_Close"): |
325 | 325 |
{ |
326 | 326 |
SaveCheck(); |
327 |
UpdateCheck(); |
|
328 |
if(isSaveCheck && isUpdateCheck) |
|
327 |
//Update Check 를 통해 update url 을 Get 하고 결과값이 있을 경우에는 SmartUpdater 실행. |
|
328 |
KeyValuePair<bool, string> updatecheck = UpdateCheck(); |
|
329 |
if (updatecheck.Key && !string.IsNullOrEmpty(updatecheck.Value)) |
|
329 | 330 |
{ |
330 |
this.Close();
|
|
331 |
CallUpdateProcess(updatecheck.Value);
|
|
331 | 332 |
} |
332 |
|
|
333 |
//MainWindow_Close(); |
|
333 |
this.Close(); |
|
334 | 334 |
} |
335 | 335 |
break; |
336 | 336 |
} |
... | ... | |
394 | 394 |
progressControl.splashText.Text = "Download : " + Math.Truncate(percentage).ToString() + " %"; |
395 | 395 |
progressControl.progressBar.Value = int.Parse(Math.Truncate(percentage).ToString()); |
396 | 396 |
})); |
397 |
} |
|
398 |
|
|
399 |
private void UpdateCheck() |
|
397 |
} |
|
398 |
|
|
399 |
/// <summary> |
|
400 |
/// KCOM_API 를 통해 업데이트 URL 을 가져옴. |
|
401 |
/// false : 업데이트 불필요. |
|
402 |
/// true : 업데이트 필요. url 을 같이 Return. |
|
403 |
/// </summary> |
|
404 |
/// <returns></returns> |
|
405 |
private KeyValuePair<bool, string> UpdateCheck() |
|
400 | 406 |
{ |
407 |
bool isUpdateCheck = false; |
|
408 |
string updateurl = string.Empty; |
|
401 | 409 |
try |
402 | 410 |
{ |
403 |
string url = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetVersionData(Environment.Is64BitProcess, Assembly.GetExecutingAssembly().GetName().Version.ToString());
|
|
404 |
if (!string.IsNullOrEmpty(url)) |
|
411 |
updateurl = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetVersionData(Environment.Is64BitProcess, Assembly.GetExecutingAssembly().GetName().Version.ToString());
|
|
412 |
if (!string.IsNullOrEmpty(updateurl))
|
|
405 | 413 |
{ |
406 | 414 |
DialogParameters parameters = new DialogParameters() |
407 | 415 |
{ |
... | ... | |
419 | 427 |
Closed = delegate (object windowSender, WindowClosedEventArgs e) |
420 | 428 |
{ |
421 | 429 |
if (e.DialogResult == true) |
422 |
{ |
|
423 |
ProcessStartInfo proInfo = new ProcessStartInfo(); |
|
424 |
var FileName = AppDomain.CurrentDomain.BaseDirectory + "SmartUpdate.exe"; |
|
425 |
Process.Start(FileName, url); |
|
426 |
this.Close(); |
|
430 |
{ |
|
431 |
isUpdateCheck = true; |
|
427 | 432 |
|
428 |
/* |
|
429 |
Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate |
|
430 |
{ |
|
431 |
destfilepath = System.IO.Path.Combine(TempFile.TempFolder, System.IO.Path.GetFileName(url)); |
|
432 |
progressControl = new ProgressControl(); |
|
433 |
progressControl.splashText.Text = "Update Download Start..."; |
|
434 |
progressControl.WindowStartupLocation = WindowStartupLocation.CenterScreen; |
|
435 |
progressControl.Show(); |
|
436 |
WebClient client = new WebClient(); |
|
437 |
client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged); |
|
438 |
client.DownloadFileCompleted += new AsyncCompletedEventHandler(Client_DownloadFileCompleted); |
|
439 |
client.DownloadFileAsync(new Uri(url), destfilepath); |
|
440 |
})); |
|
441 |
*/ |
|
433 |
//this.Close(); |
|
442 | 434 |
} |
443 | 435 |
else |
444 | 436 |
{ |
445 |
isUpdateCheck = true;
|
|
437 |
isUpdateCheck = false;
|
|
446 | 438 |
} |
447 | 439 |
} |
448 | 440 |
}; |
... | ... | |
451 | 443 |
} |
452 | 444 |
else |
453 | 445 |
{ |
454 |
isUpdateCheck = true;
|
|
446 |
isUpdateCheck = false;
|
|
455 | 447 |
} |
456 | 448 |
} |
457 | 449 |
catch (Exception) |
458 | 450 |
{ |
459 | 451 |
throw; |
460 |
} |
|
452 |
} |
|
453 |
return new KeyValuePair<bool, string>(isUpdateCheck, updateurl); |
|
461 | 454 |
} |
462 | 455 |
|
456 |
/// <summary> |
|
457 |
/// SmartUpdate 를 호출. |
|
458 |
/// </summary> |
|
459 |
/// <param name="updateurl">Download 할 설치파일 경로</param> |
|
460 |
private void CallUpdateProcess(string updateurl) |
|
461 |
{ |
|
462 |
ProcessStartInfo proInfo = new ProcessStartInfo(); |
|
463 |
string smartupdaterpath = string.Empty; |
|
464 |
smartupdaterpath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SmartUpdate.exe"); |
|
465 |
Process.Start(smartupdaterpath, updateurl); |
|
466 |
} |
|
463 | 467 |
private void Client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) |
464 | 468 |
{ |
465 | 469 |
try |
내보내기 Unified diff