/// <summary> /// Shows the dialog in a seperate window displayed over the current main window. /// </summary> /// <param name="parentWindow"></param> internal void ShowDialogOutside(IMetroWindow parentWindow , bool isNegativeButtonVisible = true , bool isUserNameVisible = true) { var customDialog = CreateLoginDialog(isNegativeButtonVisible, isUserNameVisible); var viewModel = customDialog.DataContext as Demos.ViewModels.LoginDialogViewModel; var dlg = GetService <IContentDialogService>(); var result = dlg.Manager.ShowModalDialogExternal(parentWindow, customDialog , dlg.DialogSettings); if (result != DialogIntResults.OK) // user pressed cancel or not OK { return; } // user pressed cancel, press ESC or closed via (x) button if (result == DialogIntResults.CANCEL) { return; } dlg.MsgBox.Show(parentWindow , String.Format("Username: {0}\nPassword: {1}" , viewModel.Username , PasswordBoxTextChanged.ConvertToUnsecureString(viewModel.Password)) , "Authentication Information"); }
internal async void ShowDialog(IMetroWindow parentWindow , bool isNegativeButtonVisible = true , bool isUserNameVisible = true) { var customDialog = CreateLoginDialog(isNegativeButtonVisible, isUserNameVisible); var viewModel = customDialog.DataContext as Demos.ViewModels.LoginDialogViewModel; var dlg = GetService <IContentDialogService>(); var manager = dlg.Manager; var result = await manager.ShowMetroDialogAsync(parentWindow, customDialog); if (result == DialogIntResults.OK) { var msgResult = await dlg.MsgBox.ShowAsync(parentWindow , String.Format("Username: {0}\nPassword: {1}", viewModel.Username, PasswordBoxTextChanged.ConvertToUnsecureString(viewModel.Password)) , "Authentication Information"); } }