private void OKButton_Click(object sender, RoutedEventArgs e) { CanceledByUser = false; // Close the dialog CloseDialog?.Invoke(this, new EventArgs()); }
/// <summary> /// Creates the dialog where the number of buttons specified indicates how many "choices" /// are available. The button chosen by the user is returned in Result. The values /// are from the MultiChoiceMsgBoxResult enum. Note that 1 to 4 buttons are supported where /// button[0] is the right most button and is the default button. /// </summary> public MultiChoiceMsgBoxViewModel(string title, string errorText, string[] buttons) { if (buttons.Length < 1 || buttons.Length > 4) { throw new ArgumentException(null, nameof(buttons)); } ErrorMsgText = errorText; DialogTitle = title; Button1Text = buttons[0]; if (buttons.Length > 1) { Button2Text = buttons[1]; } if (buttons.Length > 2) { Button3Text = buttons[2]; } if (buttons.Length > 3) { Button4Text = buttons[3]; } ButtonClickCommand = new RelayCommand((parameter) => { CloseDialog.Invoke(this, (MultiChoiceMsgBoxResult)(parameter)); }); }
public SyncContactsView() { InitializeComponent(); this.BindingContext = viewModel = new SyncContactsViewModel(this); viewModel.CancelClicked += (sender, e) => CloseDialog?.Invoke(this, e); viewModel.CloseClicked += (sender, e) => CloseDialog?.Invoke(this, e); }
private async void OKButton_ClickAsync(object sender, RoutedEventArgs e) { if (!await ViewModel.CreateArchiveAsync()) { return; } // Close the dialog CloseDialog?.Invoke(this, new EventArgs()); }
private void CheckNullInputParams(object catRepo, object categories) { if (catRepo == null || categories == null) { MessageBox.Show( "Непредвиденные данные контекста", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Exclamation ); CloseDialog?.Invoke(this, new EventArgs()); } }
public SelectFacebookUserView() { InitializeComponent(); this.BindingContext = viewModel = new SelectFacebookUserViewModel(this); viewModel.Cancel += (sender, e) => { CloseDialog?.Invoke(this, new EventArgs()); }; viewModel.FacebookUserSelected += (sender, e) => { FacebookUserSelected?.Invoke(this, e); }; }
public override void Execute(object parameter) { var recipient = parameter as Recipient; if (!IsExist(recipient)) { _recipientRepo.Add(recipient); _recipients.Add(recipient); CloseDialog?.Invoke(this, new EventArgs()); } else { MessageBox.Show( $"Получатель \"{recipient}\"\n" + $"уже содержится в базе\n\n", "Дублирование данных", MessageBoxButton.OK, MessageBoxImage.Information ); } }
public override void Execute(object parameter) { var category = parameter as Category; if (!IsExist(category)) { _catRepo.Add(category); _categories.Add(category); CloseDialog?.Invoke(this, new EventArgs()); } else { MessageBox.Show( $"Категория \"{category}\"\n" + $"уже содержится в базе\n\n", "Дублирование данных", MessageBoxButton.OK, MessageBoxImage.Information ); } }
public override void Execute(object parameter) { var inputUser = parameter as User; var resultData = CreateCompliteUser(inputUser); if (!IsExist(resultData)) { _userRepo.Add(resultData); _users.Add(resultData); CloseDialog?.Invoke(this, new EventArgs()); } else { MessageBox.Show( $"Пользователь с логином \"{resultData.WinUserName}\"\n" + $"уже содержится в базе\n\n", "Дублирование данных", MessageBoxButton.OK, MessageBoxImage.Information ); } }
public override void Execute(object parameter) { var resultWinUser = parameter as IWinAccount; if (IsExist(resultWinUser)) { MessageBox.Show( $"Пользователь с win-логином \"{resultWinUser.Name}\" уже существует", "Дублирование данных", MessageBoxButton.OK, MessageBoxImage.Information ); } else { var winUserCreated = false; try { winUserCreated = _factory.CreateWinHelper().CreateWinAccount(resultWinUser); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); } if (winUserCreated) { MessageBox.Show($"Пользователь создан!", "Успех", MessageBoxButton.OK, MessageBoxImage.Information); _winUsers.Add(resultWinUser); CloseDialog?.Invoke(this, new EventArgs()); } } }
protected void OnCloseDialog(DialogEventArgs args) { CloseDialog?.Invoke(args); }
public async Task ExecuteCloseCommand() { CloseDialog?.Invoke(null, new EventArgs()); }
private void LeftButton_Click(object sender, RoutedEventArgs e) { IsAllowed = false; MainViewModel.Instance.DialogVM.IsDialogOpen = false; CloseDialog?.Invoke(this, new EventArgs()); }
private void CancelButton_Click(object sender, RoutedEventArgs e) { // Close the dialog CloseDialog?.Invoke(this, new EventArgs()); }
/// <summary> /// Initialize the dialog /// </summary> /// <param name="nodeToEdit">The node we'll be editing</param> /// <param name="canEdit">True if we can open the maneuver node editing tools, false otherwise</param> public PlanningNodeEditDialog(PlanningNodeModel nodeToEdit, bool canEdit) : base(-1, -1, pad, new RectOffset(4, 4, 4, 4), TextAnchor.UpperLeft) { editingNode = nodeToEdit; var toprow = new List <DialogGUIBase>() { TooltipExtensions.DeferTooltip(new DialogGUIButton( "PlanningNode_DeleteButtonCaption", () => DeleteNode?.Invoke(), buttonWidth, buttonHeight, false ) { tooltipText = "PlanningNode_DeleteButtonTooltip" }), new DialogGUIFlexibleSpace(), TooltipExtensions.DeferTooltip(new DialogGUIButton( "PlanningNode_CloseButtonCaption", () => CloseDialog?.Invoke(), buttonWidth, buttonHeight, false ) { tooltipText = "PlanningNode_CloseButtonTooltip" }) }; if (canEdit) { toprow.Insert(0, TooltipExtensions.DeferTooltip(new DialogGUIButton( "PlanningNode_NewButtonCaption", () => NewNode?.Invoke(), buttonWidth, buttonHeight, false ) { tooltipText = "PlanningNode_NewButtonTooltip" })); } AddChild(new DialogGUIHorizontalLayout( -1, -1, 8, new RectOffset(0, 0, 0, 0), TextAnchor.MiddleLeft, toprow.ToArray() )); AddChild(new DialogGUIHorizontalLayout( -1, -1, pad, new RectOffset(0, 0, 0, 0), TextAnchor.MiddleLeft, new DialogGUILabel("PlanningNode_NameLabelCaption", buttonWidth / 2), NotifyOnFocus(new DialogGUITextInput( editingNode.name, false, 24, s => { return(editingNode.name = s); }, () => { return(editingNode.name); }, TMP_InputField.ContentType.Standard, buttonHeight ), // Don't trigger other parts of the game while they're typing a name in the text field v => InputLockManager.SetControlLock(MyLocks, "PlanningNodeEditDialogName"), v => InputLockManager.RemoveControlLock("PlanningNodeEditDialogName") ), TooltipExtensions.DeferTooltip(new DialogGUIButton( "PlanningNode_PrevNodeCaption", () => PrevNode?.Invoke(), smallBtnWidth, buttonHeight, false ) { tooltipText = canEdit ? "PlanningNode_PrevNodeTooltip" : "PlanningNode_PrevNodeViewOnlyTooltip" }), TooltipExtensions.DeferTooltip(new DialogGUIButton( "PlanningNode_NextNodeCaption", () => NextNode?.Invoke(), smallBtnWidth, buttonHeight, false ) { tooltipText = canEdit ? "PlanningNode_NextNodeTooltip" : "PlanningNode_NextNodeViewOnlyTooltip" }) )); AddChild(new DialogGUIHorizontalLayout( -1, -1, pad, new RectOffset(0, 0, 0, 0), TextAnchor.MiddleLeft, new DialogGUILabel("PlanningNode_HueLabelCaption", buttonWidth / 2), new DialogGUISlider( () => { if (editingNode != null) { Color.RGBToHSV(editingNode.color, out float hue, out float _, out float _); return(hue); } return(0f); }, 0f, 1f, false, -1, buttonHeight, v => { if (editingNode != null) { editingNode.color = Color.HSVToRGB(v, 0.5f, 0.75f); } } ) )); if (canEdit) { AddChild(new DialogGUIHorizontalLayout( -1, -1, pad, new RectOffset(0, 0, 0, 0), TextAnchor.MiddleLeft, new DialogGUILabel("PlanningNode_BodyLabelCaption", buttonWidth / 2), new DialogGUILabel( () => editingNode.origin.bodyName, -1 ), TooltipExtensions.DeferTooltip(new DialogGUIButton( "PlanningNode_PrevBodyCaption", () => BodyChanged?.Invoke(prevBody(editingNode.origin)), smallBtnWidth, buttonHeight, false ) { tooltipText = "PlanningNode_PrevBodyTooltip" }), TooltipExtensions.DeferTooltip(new DialogGUIButton( "PlanningNode_NextBodyCaption", () => BodyChanged?.Invoke(nextBody(editingNode.origin)), smallBtnWidth, buttonHeight, false ) { tooltipText = "PlanningNode_NextBodyTooltip" }) )); AddChild(TooltipExtensions.DeferTooltip(new DialogGUIToggle( () => editingNode.vessel == null, "PlanningNode_ShowForAllCheckboxCaption", b => { editingNode.vessel = b ? null : FlightGlobals.ActiveVessel; } ) { tooltipText = "PlanningNode_ShowForAllCheckboxTooltip" })); } AddChild(TooltipExtensions.DeferTooltip(new DialogGUIButton( "PlanningNode_WarpToCaption", () => WarpTo?.Invoke(editingNode), buttonWidth, buttonHeight, false ) { tooltipText = "PlanningNode_WarpToTooltip" })); // Don't try to plot a maneuver from the Sun for (int i = 0; i < FlightGlobals.Bodies.Count; ++i) { var b = FlightGlobals.Bodies[i]; if (b.referenceBody != null && b.referenceBody != b) { allowedBodies.Add(b); } } }