Advertisement
Guest User

EPO.ViewModel.MainFormViewModelBase.QuitCommandLogic()

a guest
Jan 29th, 2016
360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.45 KB | None | 0 0
  1.  EPO.ViewModel.MainFormViewModelBase.QuitCommandLogic()
  2. ==============================================
  3. private void QuitCommandLogic()
  4.         {
  5.             this._appClosing = true;
  6.             if (DialogContainer.StudyFormViewModel != null)
  7.             {
  8.                 DialogContainer.StudyFormViewModel.BlockHighKv();
  9.             }
  10.             if (!this.TryCloseArchivingDialog())
  11.             {
  12.                 DialogService.ShowMessageBox(EpoMainResources.get_QuitIsForbiddenBecauseOfArchivingMessage(), EpoMainResources.get_InfoMessageBoxTittle(), MessageBoxButton.OK, MessageBoxResult.None, false, null, 0);
  13.                 this._appClosing = false;
  14.                 return;
  15.             }
  16.             if (DialogService.ShowMessageBox(EpoMainResources.get_ApplicationExitConfirmation(), EpoMainResources.get_ConfirmationMessageBoxTittle(), MessageBoxButton.YesNo, MessageBoxResult.None, false, null, 0) != MessageBoxResult.Yes)
  17.             {
  18.                 this._appClosing = false;
  19.                 return;
  20.             }
  21.             IMessenger messenger = SimpleServiceLocator.Instance.Get<IMessenger>();
  22.             if (messenger != null)
  23.             {
  24.                 messenger.SendMessage(MessageType.ApplicationClosing);
  25.             }
  26.             List<BackupFilesHelper.BackupFileInfo> backupFoldersToDelete = BackupFilesHelper.GetBackupFoldersToDelete();
  27.             List<string> list = (
  28.                 from i in SimpleServiceLocator.Instance.Get<IWgdEntityService>().GetImages((EpoModel.Wgd.Image i) => {
  29.                     if (i.get_StudyImageStatus() != 3)
  30.                     {
  31.                         return false;
  32.                     }
  33.                     return i.get_DateCreation() < DateTime.Now.AddDays((double)CommonParameters.get_Instance().get_BackupExpDays());
  34.                 }, null)
  35.                 select i.get_FileName()).ToList<string>();
  36.             if (backupFoldersToDelete.Count > 0 || list.Count > 0)
  37.             {
  38.                 if (DialogService.ShowMessageBox((CommonParameters.get_Instance().get_BackupExpDays() == 1 ? EpoMainResources.get_OneDayImagesRemovingConfirmFormat() : string.Format(EpoMainResources.get_OldImagesRemovingConfirmFormat(), CommonParameters.get_Instance().get_BackupExpDays())), EpoMainResources.get_ConfirmationMessageBoxTittle(), MessageBoxButton.YesNo, MessageBoxResult.None, false, null, 0) == MessageBoxResult.Yes)
  39.                 {
  40.                     BackupFilesHelper.DeleteExpiredBackupFiles(backupFoldersToDelete);
  41.                     BackupFilesHelper.DeleteExpiredImageFiles(list);
  42.                 }
  43.                     this._secondMonitorForm.Close();
  44.                 }
  45.                 base.IsNeedClose = true;
  46.                 DialogContainer.ArchivingViewModel.Dialog.Close();
  47.                 SimpleServiceLocator.Instance.Get<ApplicationLifecycleService>().Shutdown(ApplicationLifecycleService.ShutdownMode.ApplicationAndComputer);
  48.             }
  49.             this.DeletePacsStudies();
  50.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement