public static async void ShowAddProfileDialog(IProfileManager viewModel, IDialogCoordinator dialogCoordinator) { var customDialog = new CustomDialog { Title = Localization.Resources.Strings.AddProfile }; var profileViewModel = new ProfileViewModel(async instance => { await dialogCoordinator.HideMetroDialogAsync(viewModel, customDialog); viewModel.OnProfileDialogClose(); AddProfile(instance); }, async instance => { await dialogCoordinator.HideMetroDialogAsync(viewModel, customDialog); viewModel.OnProfileDialogClose(); }, ProfileManager.GetGroups()); customDialog.Content = new ProfileDialog { DataContext = profileViewModel }; viewModel.OnProfileDialogOpen(); await dialogCoordinator.ShowMetroDialogAsync(viewModel, customDialog); }
private async void AddProfileAction() { CustomDialog customDialog = new CustomDialog() { Title = LocalizationManager.GetStringByKey("String_Header_AddProfile") }; PortScannerProfileViewModel portScannerProfileViewModel = new PortScannerProfileViewModel(instance => { dialogCoordinator.HideMetroDialogAsync(this, customDialog); PortScannerProfileInfo portScannerProfileInfo = new PortScannerProfileInfo { Name = instance.Name, Hostname = instance.Hostname, Ports = instance.Ports, Group = instance.Group }; PortScannerProfileManager.AddProfile(portScannerProfileInfo); }, instance => { dialogCoordinator.HideMetroDialogAsync(this, customDialog); }, PortScannerProfileManager.GetProfileGroups(), new PortScannerProfileInfo() { Hostname = Host, Ports = Port }); customDialog.Content = new PortScannerProfileDialog { DataContext = portScannerProfileViewModel }; await dialogCoordinator.ShowMetroDialogAsync(this, customDialog); }
public static async Task ShowEditGroupDialog(IProfileManager viewModel, IDialogCoordinator dialogCoordinator, string group) { var customDialog = new CustomDialog { Title = Localization.Resources.Strings.EditGroup }; var editGroupViewModel = new GroupViewModel(async instance => { await dialogCoordinator.HideMetroDialogAsync(viewModel, customDialog); viewModel.OnProfileDialogClose(); ProfileManager.RenameGroup(instance.OldGroup, instance.Group); viewModel.RefreshProfiles(); }, async instance => { await dialogCoordinator.HideMetroDialogAsync(viewModel, customDialog); viewModel.OnProfileDialogClose(); }, group, ProfileManager.GetGroups()); customDialog.Content = new GroupDialog { DataContext = editGroupViewModel }; viewModel.OnProfileDialogOpen(); await dialogCoordinator.ShowMetroDialogAsync(viewModel, customDialog); }
public static async void ShowDeleteProfileDialog(IProfileViewModel viewModel, IDialogCoordinator dialogCoordinator, ProfileInfo selectedProfile) { var customDialog = new CustomDialog { Title = Resources.Localization.Strings.DeleteProfile }; var confirmRemoveViewModel = new ConfirmRemoveViewModel(instance => { dialogCoordinator.HideMetroDialogAsync(viewModel, customDialog); viewModel.OnProfileDialogClose(); RemoveProfile(selectedProfile); }, instance => { dialogCoordinator.HideMetroDialogAsync(viewModel, customDialog); viewModel.OnProfileDialogClose(); }, Resources.Localization.Strings.DeleteProfileMessage); customDialog.Content = new ConfirmRemoveDialog { DataContext = confirmRemoveViewModel }; viewModel.OnProfileDialogOpen(); await dialogCoordinator.ShowMetroDialogAsync(viewModel, customDialog); }
public static async Task ShowCopyAsProfileDialog(IProfileManager viewModel, IDialogCoordinator dialogCoordinator, ProfileInfo selectedProfile) { var customDialog = new CustomDialog { Title = Localization.Resources.Strings.CopyProfile, Style = (Style)Application.Current.FindResource("ProfileMetroDialog") }; var profileViewModel = new ProfileViewModel(async instance => { await dialogCoordinator.HideMetroDialogAsync(viewModel, customDialog); viewModel.OnProfileDialogClose(); AddProfile(instance); }, async instance => { await dialogCoordinator.HideMetroDialogAsync(viewModel, customDialog); viewModel.OnProfileDialogClose(); }, ProfileManager.GetGroups(), ProfileEditMode.Copy, selectedProfile); customDialog.Content = new ProfileDialog { DataContext = profileViewModel }; viewModel.OnProfileDialogOpen(); await dialogCoordinator.ShowMetroDialogAsync(viewModel, customDialog); }
private async void ConnectRemoteDesktopSessionAction() { CustomDialog customDialog = new CustomDialog() { Title = Application.Current.Resources["String_Header_Connect"] as string }; RemoteDesktopSessionConnectViewModel connectRemoteDesktopSessionViewModel = new RemoteDesktopSessionConnectViewModel(instance => { dialogCoordinator.HideMetroDialogAsync(this, customDialog); ConfigurationManager.Current.FixAirspace = false; Models.RemoteDesktop.RemoteDesktopSessionInfo remoteDesktopSessionInfo = new Models.RemoteDesktop.RemoteDesktopSessionInfo { Hostname = instance.Hostname, }; ConnectSession(remoteDesktopSessionInfo); }, instance => { dialogCoordinator.HideMetroDialogAsync(this, customDialog); ConfigurationManager.Current.FixAirspace = false; }); customDialog.Content = new RemoteDesktopSessionConnectDialog { DataContext = connectRemoteDesktopSessionViewModel }; ConfigurationManager.Current.FixAirspace = true; await dialogCoordinator.ShowMetroDialogAsync(this, customDialog); }
public static async Task ShowDeleteProfileDialog(IProfileManager viewModel, IDialogCoordinator dialogCoordinator, ProfileInfo selectedProfile) { var customDialog = new CustomDialog { Title = Localization.Resources.Strings.DeleteProfile }; var confirmDeleteViewModel = new ConfirmDeleteViewModel(async instance => { await dialogCoordinator.HideMetroDialogAsync(viewModel, customDialog); viewModel.OnProfileDialogClose(); ProfileManager.RemoveProfile(selectedProfile); }, async instance => { await dialogCoordinator.HideMetroDialogAsync(viewModel, customDialog); viewModel.OnProfileDialogClose(); }, Localization.Resources.Strings.DeleteProfileMessage); customDialog.Content = new ConfirmDeleteDialog { DataContext = confirmDeleteViewModel }; viewModel.OnProfileDialogOpen(); await dialogCoordinator.ShowMetroDialogAsync(viewModel, customDialog); }
private async void AddProfileAction() { CustomDialog customDialog = new CustomDialog() { Title = LocalizationManager.GetStringByKey("String_Header_AddProfile") }; IPScannerProfileViewModel ipScannerProfileViewModel = new IPScannerProfileViewModel(instance => { dialogCoordinator.HideMetroDialogAsync(this, customDialog); IPScannerProfileInfo ipScannerProfileInfo = new IPScannerProfileInfo { Name = instance.Name, IPRange = instance.IPRange, Group = instance.Group }; IPScannerProfileManager.AddProfile(ipScannerProfileInfo); }, instance => { dialogCoordinator.HideMetroDialogAsync(this, customDialog); }, IPScannerProfileManager.GetProfileGroups()); customDialog.Content = new IPScannerProfileDialog { DataContext = ipScannerProfileViewModel }; await dialogCoordinator.ShowMetroDialogAsync(this, customDialog); }
private async void Cancel_Pressed(RoutedEventArgs e) { Cancel = true; await _dialogCoordinator.HideMetroDialogAsync(Context, Dialog); //App.Current.Shutdown(); }
private async void AddProfileAction() { CustomDialog customDialog = new CustomDialog() { Title = LocalizationManager.GetStringByKey("String_Header_AddProfile") }; PingProfileViewModel pingProfileViewModel = new PingProfileViewModel(instance => { dialogCoordinator.HideMetroDialogAsync(this, customDialog); PingProfileInfo pingProfileInfo = new PingProfileInfo { Name = instance.Name, Host = instance.Host, Group = instance.Group, Tags = instance.Tags }; PingProfileManager.AddProfile(pingProfileInfo); }, instance => { dialogCoordinator.HideMetroDialogAsync(this, customDialog); }, PingProfileManager.GetProfileGroups()); customDialog.Content = new PingProfileDialog { DataContext = pingProfileViewModel }; await dialogCoordinator.ShowMetroDialogAsync(this, customDialog); }
private async void AddProfileAction() { CustomDialog customDialog = new CustomDialog() { Title = Application.Current.Resources["String_Header_AddProfile"] as string }; IPScannerProfileViewModel ipScannerProfileViewModel = new IPScannerProfileViewModel(instance => { dialogCoordinator.HideMetroDialogAsync(this, customDialog); IPScannerProfileInfo ipScannerProfileInfo = new IPScannerProfileInfo { Name = instance.Name, IPRange = instance.IPRange, Group = instance.Group }; IPScannerProfileManager.AddProfile(ipScannerProfileInfo); }, instance => { dialogCoordinator.HideMetroDialogAsync(this, customDialog); }, IPScannerProfileManager.GetProfileGroups(), new IPScannerProfileInfo() { IPRange = IPRange }); customDialog.Content = new IPScannerProfileDialog { DataContext = ipScannerProfileViewModel }; await dialogCoordinator.ShowMetroDialogAsync(this, customDialog); }
/// <summary> /// Manage an exception /// </summary> /// <param name="exception">The exception</param> private void ManageException(Exception exception) { if (_isManagingException) { return; } _isManagingException = true; IsMovieFlyoutOpen = false; IsSettingsFlyoutOpen = false; if (exception is WebException || exception is SocketException) { ApplicationState.IsConnectionInError = true; } DispatcherHelper.CheckBeginInvokeOnUI(async() => { var exceptionDialog = new ExceptionDialog( new ExceptionDialogSettings( LocalizationProviderHelper.GetLocalizedValue <string>("EmbarrassingError"), exception.Message)); await _dialogCoordinator.ShowMetroDialogAsync(this, exceptionDialog); await exceptionDialog.WaitForButtonPressAsync(); _isManagingException = false; await _dialogCoordinator.HideMetroDialogAsync(this, exceptionDialog); }); }
public static async void ShowEditProfileDialog(IProfileViewModel viewModel, IDialogCoordinator dialogCoordinator, ProfileInfo selectedProfile) { var customDialog = new CustomDialog { Title = Resources.Localization.Strings.EditProfile }; var profileViewModel = new ProfileViewModel(instance => { dialogCoordinator.HideMetroDialogAsync(viewModel, customDialog); viewModel.OnProfileDialogClose(); RemoveProfile(selectedProfile); AddProfile(instance); }, instance => { dialogCoordinator.HideMetroDialogAsync(viewModel, customDialog); viewModel.OnProfileDialogClose(); }, GetGroups(), ProfileEditMode.Edit, selectedProfile); customDialog.Content = new ProfileDialog { DataContext = profileViewModel }; viewModel.OnProfileDialogOpen(); await dialogCoordinator.ShowMetroDialogAsync(viewModel, customDialog); }
public SettingsViewModel(IDialogCoordinator coordinator) { _dialogCoordinator = coordinator; DatabaseImport = new RelayCommand(x => { var dlg = new OpenFileDialog { Filter = "Zip filer (.zip)|*.zip" }; dlg.FileOk += ValidateDatabaseFile; var result = dlg.ShowDialog(); if (result == true) { ApplicationDatabase.Import(dlg.FileName); DisplayTimedMessage("Succes", "Databasen er importeret succesfuldt. ", 2); } DatabaseExport.NotifyCanExecuteChanged(); }); DatabaseExport = new RelayCommand(x => { var dlg = new SaveFileDialog { Filter = "Zip filer (.zip)|*.zip", FileName = "database", DefaultExt = ".zip" }; var result = dlg.ShowDialog(); if (result != true) { return; } ApplicationDatabase.Export(dlg.FileName); DisplayTimedMessage("Succes", "Databasen er eksporteret succesfuldt. ", 2); }, x => ApplicationDatabase.Exists); RunOfferSettingsDialogCmd = new RelayCommand(x => { OpenOfferSettingsDialog(instanceCanceled => { _dialogCoordinator.HideMetroDialogAsync(this, _customDialog); }, async instanceCompleted => { await _dialogCoordinator.HideMetroDialogAsync(this, _customDialog); DisplayTimedMessage("Information gemt!", "", 2); }); }); NavigateBackCmd = new RelayCommand(async x => { if (!IsDataSaved) { var result = await NavigationService.ConfirmDiscardChanges(_dialogCoordinator); if (result == false) { return; } } NavigationService.GoBack(); }); }
public async void Execute(CoroutineExecutionContext context) { var mySettings = new MetroDialogSettings() { AffirmativeButtonText = "OK", AnimateShow = true, AnimateHide = false }; IDialogCoordinator coordinator = IoC.Get <IDialogCoordinator>(); DialogContent.CloseButton.Click += async(s, e) => { Result = (T)DialogContent.Combo.SelectedItem; await coordinator.HideMetroDialogAsync(context.Target, DialogContent); var args = new ResultCompletionEventArgs() { WasCancelled = Result == null }; this.Completed(this, args); }; DialogContent.Title = Title; await coordinator.ShowMetroDialogAsync(context.Target, DialogContent); }
private async Task <LoginWithUrlDialogData> LoginToRedmine() { var settings = new LoginWithUrlDialogSettings { AnimateShow = true, AnimateHide = true, AffirmativeButtonText = "Login", NegativeButtonText = "Cancel", NegativeButtonVisibility = Visibility.Visible, EnablePasswordPreview = true, RememberCheckBoxVisibility = Visibility.Collapsed }; var loginDialog = new LoginWithUrlDialog(null, settings) { Title = "Login to Redmine" }; await _dialogCoordinator.ShowMetroDialogAsync(this, loginDialog); var result = await loginDialog.WaitForButtonPressAsync(); await _dialogCoordinator.HideMetroDialogAsync(this, loginDialog); return(result); }
public AddSystemDialogViewModel(IDialogCoordinator dialogService, CustomDialog callingDialog, IHyperspinManager manager, IEventAggregator ea, IFileDialogHelper fileFolderServic, ISettingsHypermint settings, ISelectedService service) { _dialogService = dialogService; _hyperspinManager = manager; _callingDialog = callingDialog; _eventAggregator = ea; _fileFolderServic = fileFolderServic; _settings = settings; _service = service; CloseDialogCommand = new DelegateCommand(async() => { await _dialogService.HideMetroDialogAsync(this, callingDialog); }); SelectDatabaseCommand = new DelegateCommand(() => { OnSelectDatabase(); }); SaveNewSystemCommand = new DelegateCommand(() => { OnSaveNewSystem(); }); }
public async void showCreateSphereDialog() { Console.WriteLine("MainWindowViewModel@createSphere | create sphere in view model"); var dialog = new CreateSphereDialog(); dialog.Height = 300; dialog.Width = 400; var dialogViewModel = new CreateSphereDialogViewModel(async instance => { Console.WriteLine("MainWindowViewModel@createSphere | closing dialog"); await _dialogCoordinator.HideMetroDialogAsync(this, dialog); //instance --> dialog ViewModel //if (!(instance.Cancel || String.IsNullOrEmpty(instance.UserInput)) ProcessUserInput(instance.UserInput); if (!instance.Cancel) { Console.WriteLine("MainWindowViewModel@createSphere | generating sphere ( name {0}, radius {1}, accuracy {2}, color {3}", instance.name, instance.radius, instance.accuracy, instance.color); generateSphere(instance.color, instance.radius, instance.accuracy, instance.name); } }); dialogViewModel.MessageText = "SPHERE CONFIGURATION"; dialog.DataContext = dialogViewModel; await _dialogCoordinator.ShowMetroDialogAsync(this, dialog); }
public async void SetConnectionInfo(ConnectionInfoEditorViewModel viewModel) { _options.BaselineServer = viewModel.BaselineServer; _options.BaselineDatabase = viewModel.BaselineDatabase; _options.BaselineSchema = viewModel.BaselineSchema; _options.BaselineUsername = viewModel.BaselineUsername; _options.BaselinePassword = viewModel.BaselinePassword; _options.BenchmarkServer = viewModel.BenchmarkServer; _options.BenchmarkDatabase = viewModel.BenchmarkDatabase; _options.BenchmarkSchema = viewModel.BenchmarkSchema; _options.BenchmarkUsername = viewModel.BenchmarkUsername; _options.BenchmarkPassword = viewModel.BenchmarkPassword; _invalidOptions = false; ShowStatusMessage("Pre InitializeAll"); // now that the options are filled, I can invoke the initialization InitializeAll(); BaseMetroDialog showingDialog = null; showingDialog = await _dialogCoordinator.GetCurrentDialogAsync <BaseMetroDialog>(this); if (showingDialog != null) { await _dialogCoordinator.HideMetroDialogAsync(this, showingDialog); } ShowStatusMessage("Post InitializeAll"); }
private async Task <LoginWithUrlDialogData> LoginToRedmine() { var settings = new LoginWithUrlDialogSettings { InitialHost = appConfig.LastRedmineUrl, InitialUsername = appConfig.LastRedmineUser, AnimateShow = true, AnimateHide = true, AffirmativeButtonText = "Login", NegativeButtonText = "Cancel", NegativeButtonVisibility = Visibility.Visible, EnablePasswordPreview = true, RememberCheckBoxVisibility = Visibility.Collapsed }; var loginDialog = new LoginWithUrlDialog(null, settings) { Title = "Login to Redmine" }; await dialCoord.ShowMetroDialogAsync(this, loginDialog); var result = await loginDialog.WaitForButtonPressAsync(); await dialCoord.HideMetroDialogAsync(this, loginDialog); if (result != null) { appConfig.LastRedmineUrl = result.Host; appConfig.LastRedmineUser = result.Username; } return(result); }
public MultiSystemViewModel(IEventAggregator ea, IFileDialogHelper fileService, IDialogCoordinator dialogService, IHyperspinManager hyperspinManager, ISettingsHypermint settings, ISelectedService selectedService, ILoggerFacade loggerFacade) : base(loggerFacade) { _eventAggregator = ea; _fileFolderService = fileService; _settingsService = settings; _dialogService = dialogService; _hyperspinManager = hyperspinManager; _selectedService = selectedService; MultiSystemList = new ListCollectionView(_hyperspinManager.MultiSystemGamesList); _eventAggregator.GetEvent <AddToMultiSystemEvent>().Subscribe(AddToMultiSystem); _eventAggregator.GetEvent <BuildMultiSystemEvent>().Subscribe((x) => OpenBuildMultiSystemDialog()); _eventAggregator.GetEvent <ScanMultiSystemFavoritesEvent>().Subscribe(async(x) => await ScanFavoritesAsync()); //Commands RemoveGameCommand = new DelegateCommand <GameItemViewModel>(RemoveFromMultisystemList); //OpenSearchCommand = new DelegateCommand<string>(async x => //{ // await RunCustomDialog(); //}); //Used for the save dialog CloseCommand = new DelegateCommand(async() => { await _dialogService.HideMetroDialogAsync(this, customDialog); }); SelectionChanged = new DelegateCommand <IList>(items => { OnMultipleItemsSelectionChanged(items); }); }
public SaveDatabaseDialogViewModel(ISettingsHypermint settingsRepo, IHyperspinManager hyperspinManager, IHyperspinXmlDataProvider dataProvider, ISelectedService selectedService, IDialogCoordinator dialogService, IEventAggregator ea) { _settingsRepo = settingsRepo; _selectedService = selectedService; _eventAggregator = ea; _dialogService = dialogService; _hyperspinManager = hyperspinManager; SaveOptions = new SaveOptions(); //Commands SaveXmlCommand = new DelegateCommand(async() => { await SaveDatabaseConfirmAsync(SaveOptions.DbName); }); CloseCommand = new DelegateCommand(async() => { await _dialogService.HideMetroDialogAsync(this, customDialog); }); //Events _eventAggregator.GetEvent <SystemSelectedEvent>().Subscribe(sysName => { SaveOptions.DbName = sysName; }); _eventAggregator.GetEvent <SystemDatabaseChanged>().Subscribe(sysName => { SaveOptions.DbName = sysName; }); }
private async void UpdateLibrary(bool isLibraryUpdate) { if (isLibraryUpdate) { await _VMLocator.Player.UpdateMusicLibraryAsync(); } await _dialogCoordinator.HideMetroDialogAsync(this, _customDialog); }
/// <summary> /// Closes the dialog window /// </summary> /// <param name="dialogService">The dialog service.</param> /// <param name="customDialog">The custom dialog.</param> /// <returns></returns> private async System.Threading.Tasks.Task CloseDialog(IDialogCoordinator dialogService, CustomDialog customDialog) { cancelPending = true; await dialogService.HideMetroDialogAsync(this, customDialog); cancelPending = false; }
private async void OpenDialog() { var customDialog = new MyCustomDialog(); await _dialogCoordinator.ShowMetroDialogAsync(this, customDialog); var result = await customDialog.WaitForClosingAsync(); await _dialogCoordinator.HideMetroDialogAsync(this, customDialog); }
public async Task HideDialogAsync(object context, IDialogInstance dialog, IDialogSettings settings = null) { // Get the current dialog var metroDialog = await Instance.GetCurrentDialogAsync <BaseMetroDialog>(context); // Perform a very simply check to see if the correct dialog is returned, then hide it if (metroDialog is not null && metroDialog.Title == dialog.Title) { await Instance.HideMetroDialogAsync(context, metroDialog, settings?.ToMetroDialogSettings()); } }
public SaveMultiSystemViewModel(IDialogCoordinator dialogService, CustomDialog customDialog, IEventAggregator ea, ISettingsHypermint settingsService, IHyperspinManager hyperspinManager, IFileDialogHelper fileService, ISelectedService selected, ILoggerFacade loggerFacade) : base(loggerFacade) { _dialogService = dialogService; _customDialog = customDialog; _eventAggregator = ea; _settingsService = settingsService; _fileFolderService = fileService; _hyperspinManager = hyperspinManager; CloseCommand = new DelegateCommand(async() => { await _dialogService.HideMetroDialogAsync(this, _customDialog); }); SelectSettingsCommand = new DelegateCommand(SelectSettings); BuildMultiSystemCommand = new DelegateCommand(async() => { try { if (CheckValid()) { await BuildMultiSystemAsync(); Log("Saving MS to xmls"); await _hyperspinManager.SaveCurrentSystemsListToXmlAsync(selected.CurrentMainMenu, true); Log("Completed"); await _dialogService.HideMetroDialogAsync(this, _customDialog); } } catch (Exception ex) { Log(ex.Message, Category.Warn); await _dialogService.HideMetroDialogAsync(this, _customDialog); } } ); }
private async void RunInstallWorkloadDialog() { var diaglog = new WorkLoadInstallDialog(); var diaglogContent = new PageFourViewModel((instance) => { _dialogCoordinator.HideMetroDialogAsync(this, diaglog); }); diaglog.Content = new PageFour { DataContext = diaglogContent }; await _dialogCoordinator.ShowMetroDialogAsync(this, diaglog); }
public async void ShowTimedDialog() { var customDialog = new CustomDialog() { Title = "Dialog with time-out; will close in 2 seconds." }; await _dialogCoordinator.ShowMetroDialogAsync(this, customDialog); await Task.Delay(2000); await _dialogCoordinator.HideMetroDialogAsync(this, customDialog); }
private async void RunUploadLogDiaglog() { var uploadLogDiaglog = new QAToolsUploadDialog(); var uploadLogDiaglogContent = new QAToolsUploadViewModel((instance) => { _dialogCoordinator.HideMetroDialogAsync(this, uploadLogDiaglog); }); uploadLogDiaglog.Content = new QAToolsUpload { DataContext = uploadLogDiaglogContent }; await _dialogCoordinator.ShowMetroDialogAsync(this, uploadLogDiaglog); }