private async void AffirmNewConfigurationDialog(object sender, ExecutedRoutedEventArgs e) { try { var dialog = sender as CustomDialog; Debug.Assert(dialog != null); var configuration = dialog.DataContext as NewConfiguration; Debug.Assert(configuration != null); await NewConfigurationAsync(configuration); await _mainWindow.HideMetroDialogAsync(dialog); } catch (Exception ex) { _logger.Log(ex); await _messageService.ShowMessageAsync("New Product Configuration", "Error occured creating new configuration"); } }
private async void StartBuildAsync() { ProgressDialogController progress = null; try { IsBuilding = true; foreach (var page in Configuration.Pages) { if (!page.Validate()) { SelectedPage = page; return; } } if (SelectedDrive == null) { await _messageService.ShowMessageAsync("No Drive Selected", "Please select a USB drive to copy install files."); return; } if (!SelectedDrive.IsFatFormat) { await _messageService.ShowMessageAsync("The selected drive is not formatted for FAT (FAT16 or FAT32) and cannot " + "be used for this purpose.Please format the drive and try again.", "Invalid Drive Format"); return; } var settings = new MetroDialogSettings { AffirmativeButtonText = "Continue", NegativeButtonText = "Stop", AnimateShow = true, AnimateHide = false }; var result = await _messageService.ShowMessageAsync("Build Warning!", "All files on the destination drive are about to be erased. Do you wish to continue?", MessageDialogStyle.AffirmativeAndNegative, settings); if (result == MessageDialogResult.Negative) { return; } var mainWindow = (MetroWindow)ServiceLocator.Current.GetInstance <Window>(ViewNames.MainWindow); progress = await mainWindow.ShowProgressAsync("Building...", "Preparing build..."); await _configurator.BuildAsync(_key, SelectedDrive.Name, (title, message, value) => { progress.SetTitle(title); progress.SetMessage(message); progress.SetProgress(value); }); } catch (Exception ex) { await _messageService.ShowMessageAsync("Build Failed", "Please check the logs for error details"); _logger.Log(ex); } finally { if (progress != null) { await progress.CloseAsync(); } IsBuilding = false; } }