public bool AskUserToDeleteSelectedGlobal(object context) { if (_dialogCoordinator.ShowModalMessageExternal(context, _localizerService.GetLocalizedString(ApplicationGlobalNames.DialogStrings.DELETE), _localizerService.GetLocalizedString(ApplicationGlobalNames.DialogStrings.DELETE_SELECTED_ITEM_QUESTION), MessageDialogStyle.AffirmativeAndNegative) == MessageDialogResult.Affirmative) { return(true); } return(false); }
protected virtual MessageDialogResult ShowQuestionSync(string message, string title = null) { var settings = new MetroDialogSettings { AffirmativeButtonText = CommonStrings.YesLabel, DefaultButtonFocus = MessageDialogResult.Affirmative, NegativeButtonText = CommonStrings.NoLabel }; title = title ?? CommonStrings.ACGeneralLabel; return(_dialogCoordinator.ShowModalMessageExternal(this, title, message, MessageDialogStyle.AffirmativeAndNegative, settings)); }
public DialogResult ShowModalMessageExternal(object context, string title, string message, DialogStyle style = DialogStyle.Affirmative, IDialogSettings settings = null) => Instance.ShowModalMessageExternal( context, title, message, style.ToMetroDialogStyle(), settings?.ToMetroDialogSettings()).ToDialogResult();
/// <summary> /// /// </summary> public ServerListViewModel() { StartSearchingCmd = new RelayCommand(async() => { try { StartSearchingEnabled = false; StopSearchingEnabled = true; ConnectEnabled = false; DataGridEnabled = false; IsIndeterminate = true; Ips.Clear(); tokenSrc = new CancellationTokenSource(); comm.BroadcastReceived += AddIp; await comm.ReceiveBroadcast(tokenSrc.Token); } catch { IsIndeterminate = false; try { dialogCoordinator.ShowModalMessageExternal(this, "Searching Stopped", "", MessageDialogStyle.Affirmative, new MetroDialogSettings { ColorScheme = MetroDialogColorScheme.Accented }); } catch { } } finally { tokenSrc.Dispose(); tokenSrc = null; StopSearchingEnabled = false; StartSearchingEnabled = true; DataGridEnabled = true; comm.BroadcastReceived -= AddIp; } }); StopSearchingCmd = new RelayCommand(() => { tokenSrc.Cancel(); }); ConnectCmd = new RelayCommand <MetroWindow>((wnd) => { SetReturnedIp = true; wnd.Close(); }); }
private void OnDeleteFragmentExecute(object obj) { if (!(obj is IFragmentEditorViewModel)) { return; } if (_dialogCoordinator.ShowModalMessageExternal(this, _localizerService.GetLocalizedString(ApplicationGlobalNames.DialogStrings.DELETE), _localizerService.GetLocalizedString(ApplicationGlobalNames.DialogStrings .DELETE_SELECTED_ITEM_QUESTION) + " (" + _localizerService.GetLocalizedString((obj as IFragmentEditorViewModel).NameForUiKey) + ") ", MessageDialogStyle.AffirmativeAndNegative) == MessageDialogResult.Affirmative) { ResultingDeviceViewModel.FragmentEditorViewModels.Remove(obj as IFragmentEditorViewModel); } }
private void OpenNewAccount(object[] param) { var settings = new MetroDialogSettings() { ColorScheme = MetroDialogColorScheme.Accented }; if (param == null) { dialogCoordinator.ShowModalMessageExternal(this, "Aviso", "Nenhum dado selecionado.", MessageDialogStyle.Affirmative, settings); return; } if (Convert.ToInt32(param[0]) == -1 || Convert.ToInt32(param[1]) == -1 || Convert.ToInt32(param[2]) == -1 || param[3].Equals("")) { dialogCoordinator.ShowModalMessageExternal(this, "Aviso", "Alguns dados estão faltando para realização de um pedido.", MessageDialogStyle.Affirmative, settings); return; } Execute(param, settings); }
public void OpenNewAccount(object param) { var settings = new MetroDialogSettings() { ColorScheme = MetroDialogColorScheme.Accented }; var result = ((System.Collections.IEnumerable)param).Cast <object>().ToList(); if (result.Count <= 0) { dialogCoordinator.ShowModalMessageExternal(this, "Aviso", "Nenhuma mesa foi selecionada.", MessageDialogStyle.Affirmative, settings); } else if ((result.First() as ItemAccount).Disponivel == false) { dialogCoordinator.ShowModalMessageExternal(this, "Aviso", "Mesa indisponível.", MessageDialogStyle.Affirmative, settings); } else { var numeroMesa = (result.First() as ItemAccount).Mesa; var contaAberta = Model.AbrirNovaConta(numeroMesa); dialogCoordinator.ShowModalMessageExternal(this, "Aviso", "A conta " + contaAberta + " foi reservada para a mesa " + numeroMesa + ".", MessageDialogStyle.Affirmative, settings); Model.ReloadItems(); } }
public bool NotificationWithConfirmation(string header, string body) { var a = _dialogCoordinator.ShowModalMessageExternal(this, header, body, MessageDialogStyle.AffirmativeAndNegative, new MetroDialogSettings() { AffirmativeButtonText = "Да", NegativeButtonText = "Нет" }); if (a == MessageDialogResult.Affirmative) { return(true); } else { return(false); } }
private void UnchainGroup(Group group) { if (group == null) { _dialogCoordinator.ShowMessageAsync(this, "Внимание", "Выберите группу"); return; } MessageDialogResult dialogResult = _dialogCoordinator.ShowModalMessageExternal(this, "Подтверждение", "Вы действительно хотите открепить данную группу из учебного плана?", MessageDialogStyle.AffirmativeAndNegative); if (dialogResult == MessageDialogResult.Affirmative) { UnchainGroupFromEducationPlan(group); Groups = new ObservableCollection <Group>(GetGroupsByEducationPlanId(_educationPlan.EducationPlanId)); } }
/// <summary> /// /// </summary> /// <returns></returns> private async Task <bool?> WinCheck(string player) { bool?check = false; if (btnStatus.Count(x => x == null) <= 4) { if (btnStatus[0] == btnStatus[1] && btnStatus[1] == btnStatus[2] && (btnStatus[0] == "O" || btnStatus[0] == "X")) { check = true; } if (btnStatus[3] == btnStatus[4] && btnStatus[4] == btnStatus[5] && (btnStatus[3] == "O" || btnStatus[3] == "X")) { check = true; } if (btnStatus[6] == btnStatus[7] && btnStatus[7] == btnStatus[8] && (btnStatus[6] == "O" || btnStatus[6] == "X")) { check = true; } if (btnStatus[0] == btnStatus[3] && btnStatus[3] == btnStatus[6] && (btnStatus[0] == "O" || btnStatus[0] == "X")) { check = true; } if (btnStatus[1] == btnStatus[4] && btnStatus[4] == btnStatus[7] && (btnStatus[1] == "O" || btnStatus[1] == "X")) { check = true; } if (btnStatus[2] == btnStatus[5] && btnStatus[5] == btnStatus[8] && (btnStatus[2] == "O" || btnStatus[2] == "X")) { check = true; } if (btnStatus[0] == btnStatus[4] && btnStatus[4] == btnStatus[8] && (btnStatus[0] == "O" || btnStatus[0] == "X")) { check = true; } if (btnStatus[2] == btnStatus[4] && btnStatus[4] == btnStatus[6] && (btnStatus[2] == "O" || btnStatus[2] == "X")) { check = true; } } if (check == true) { GameBoardEnabled = false; await Task.Delay(1000); dialogCoordinator.ShowModalMessageExternal(this, player == "O" ? "You Won!" : "You Lost!", "", MessageDialogStyle.Affirmative, new MetroDialogSettings { ColorScheme = MetroDialogColorScheme.Accented }); return(true); } if (btnStatus.Count(x => x == null) == 0) { GameBoardEnabled = false; await Task.Delay(1000); dialogCoordinator.ShowModalMessageExternal(this, "It's a tie!", "", MessageDialogStyle.Affirmative, new MetroDialogSettings { ColorScheme = MetroDialogColorScheme.Accented }); return(null); } return(false); }