Пример #1
0
        protected override void OnClosing(CancelEventArgs e)
        {
            e.Cancel = MessageBoxHelper.AskQuestion(Properties.Resources.TXT_CONFIRM_EXIT) == false;

            if (!e.Cancel && MessageBoxHelper.AskQuestion(Properties.Resources.QTN_WOULD_YOU_LIKE_BACKUP_DATABASE))
            {
                BackupRestoreManager.BackUp();
            }
        }
 private void buttonDeleteSyncSelection_Click(object sender, RoutedEventArgs e)
 {
     if (listSyncSelections.SelectedItem != null)
     {
         Platform platform = (Platform)listSyncSelections.SelectedItem;
         if (MessageBoxHelper.AskQuestion(this, "Are you sure you want to delete the Sync Selection \"" + platform + "\"?"))
         {
             this.Device.SyncPlatformSelections.Remove(platform);
             UpdateSyncSelections();
         }
     }
 }
Пример #3
0
        private void buttonDeleteGameConfig_Click(object sender, RoutedEventArgs e)
        {
            string gameConfig = listGameConfigs.SelectedItem as string;

            if (gameConfig != null)
            {
                if (MessageBoxHelper.AskQuestion(this, "Are you sure you want to delete the Game Config \"" + gameConfig + "\"?"))
                {
                    this.PlatformConfig.GameConfigs.Remove(gameConfig);
                    UpdateGameConfigs();
                }
            }
        }
Пример #4
0
        private void buttonDeleteEmulator_Click(object sender, RoutedEventArgs e)
        {
            string emulator = listEmulators.SelectedItem as string;

            if (emulator != null)
            {
                if (MessageBoxHelper.AskQuestion(this, "Are you sure you want to delete the Emulator \"" + emulator + "\"?"))
                {
                    this.PlatformConfig.Emulators.Remove(emulator);
                    UpdateEmulators();
                }
            }
        }
Пример #5
0
        public static void Create(ICollection <IDocumentHistoryItem> documents, bool promptForDate, DateTime start, DateTime end)
        {
            if (promptForDate)
            {
                var window    = new DateRangePickerWindow();
                var viewModel = window.DataContext as DateRangePickerWindowViewModel;
                if (viewModel == null)
                {
                    return;
                }

                viewModel.StartDateTime = start;
                viewModel.EndDateTime   = end;

                if (window.ShowDialog() != true)
                {
                    return;
                }

                start = DateTime.Parse($"{viewModel.StartDateTime.ToString(Constants.DateFormat)} 00:00:00");
                end   = DateTime.Parse($"{viewModel.EndDateTime.ToString(Constants.DateFormat)} 23:59:59");
            }

            var applicableDocuments = documents.Where(doc => doc.Document != null && doc.Document is TachographDocument)
                                      .Select(c => c.Document)
                                      .Where(doc => doc.InspectionDate != null && doc.InspectionDate.Value >= start && doc.InspectionDate.Value <= end)
                                      .Cast <TachographDocument>()
                                      .ToList();

            var result = applicableDocuments.GenerateGV212Document(start, end);

            if (result.Success)
            {
                var gv212Repository = ContainerBootstrapper.Resolve <IRepository <GV212Report> >();
                gv212Repository.Add(new GV212Report
                {
                    Created        = DateTime.Now.Date,
                    SerializedData = result.SerializedData
                });

                if (MessageBoxHelper.AskQuestion(Resources.TXT_DO_YOU_WANT_TO_PRINT))
                {
                    result.Print();
                }

                var settingsRepository = ContainerBootstrapper.Resolve <ISettingsRepository <WorkshopSettings> >();
                var workshopSettings   = settingsRepository.GetWorkshopSettings();
                workshopSettings.MonthlyGV212Date = DateTime.Now.Date;
                settingsRepository.Save(workshopSettings);
            }
        }
Пример #6
0
 private void SyncDeviceDialog_Closing(object sender, CancelEventArgs e)
 {
     if (this.BackgroundWorker != null)
     {
         if (MessageBoxHelper.AskQuestion(this, "Device Sync in progress; cancel?", true))
         {
             this.SyncEngine.StopSync();
         }
         else
         {
             e.Cancel = true;
         }
     }
 }
Пример #7
0
 private void MatchGamesDialog_Closing(object sender, CancelEventArgs e)
 {
     if (this.BackgroundWorker != null)
     {
         if (MessageBoxHelper.AskQuestion(this, "Bulk-Matching in progress; cancel?", true))
         {
             this.BackgroundWorker.CancelAsync();
         }
         else
         {
             e.Cancel = true;
         }
     }
 }
        private void buttonDeleteDevice_Click(object sender, RoutedEventArgs e)
        {
            var device = (Device)listDevices.SelectedItem;

            if (device != null)
            {
                if (MessageBoxHelper.AskQuestion(this, "Are you sure you want to delete the Device \"" +
                                                 device.ToString() + "\"?", true))
                {
                    this.Config.Devices.Remove(device);
                    UpdateDevices();
                }
            }
        }
        private void buttonDeletePlatformConfig_Click(object sender, RoutedEventArgs e)
        {
            var platformConfig = (PlatformConfig)listPlatformConfigs.SelectedItem;

            if (platformConfig != null)
            {
                if (MessageBoxHelper.AskQuestion(this, "Are you sure you want to delete the Platform Config \"" +
                                                 platformConfig.ToString() + "\"?", true))
                {
                    this.Config.PlatformConfigs.Remove(platformConfig);
                    UpdatePlatformConfigs();
                }
            }
        }
 private void linkDelete_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (MessageBoxHelper.AskQuestion(this, "Are you sure you want to delete the " +
                                          this.Game.Platform.ToDisplayString() + " game " + this.Game.ToString() + "?"))
         {
             AsyncHelper.RunSync(() => this.CatalogEditor.DeleteGameAsync(this.Game));
             this.GamesListview.Update();
         }
     }
     catch (Exception ex)
     {
         MessageBoxHelper.ShowError(this, ex);
     }
 }
Пример #11
0
 protected bool AskQuestion(string msg)
 {
     return(MessageBoxHelper.AskQuestion(msg));
 }