示例#1
0
        private void CloseRoutine()
        {
            var closeDialog = new CloseDialog(((MainViewModel)this.DataContext).IsSimulationOpen);

            closeDialog.ShowDialog();

            switch (closeDialog.Result)
            {
            case UI.SharedWPF.DialogResult.CloseWithOutSave:
            {
                this.Close();
            }
            break;

            case UI.SharedWPF.DialogResult.SaveAndClose:
            {
                //CHEQUEAR SI ES SAVE, O SAVEAS !!
                ((MainViewModel)this.DataContext).SaveSimulationCommand.Execute(null);

                this.Close();
            }
            break;

            case UI.SharedWPF.DialogResult.Cancel:
            {
                return;
            }
            }
            this.Close();
            logger.Info("Cerrar Ventana de Simulación.");
        }
示例#2
0
        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)); });
        }
示例#4
0
        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);
        }
示例#5
0
        private async void OKButton_ClickAsync(object sender, RoutedEventArgs e)
        {
            if (!await ViewModel.CreateArchiveAsync())
            {
                return;
            }

            // Close the dialog
            CloseDialog?.Invoke(this, new EventArgs());
        }
示例#6
0
 private void CheckNullInputParams(object catRepo, object categories)
 {
     if (catRepo == null || categories == null)
     {
         MessageBox.Show(
             "Непредвиденные данные контекста",
             "Ошибка",
             MessageBoxButton.OK,
             MessageBoxImage.Exclamation
             );
         CloseDialog?.Invoke(this, new EventArgs());
     }
 }
示例#7
0
文件: Gui.cs 项目: moisterrific/TSGui
 private void BtnClose_Click(object sender, EventArgs e)
 {
     if (main.HasWorldInitialized)
     {
         GuiClose.IsReallyQuitting = false;
         CloseDialog CloseDialog = new CloseDialog();
         CloseDialog.ShowDialog();
     }
     else
     {
         GuiClose.IsReallyQuitting = true;
     }
 }
示例#8
0
        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);
            };
        }
示例#9
0
        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
                    );
            }
        }
示例#10
0
        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
                    );
            }
        }
示例#11
0
        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
                    );
            }
        }
示例#12
0
        private void CloseRoutine()
        {
            var closeDialog = new CloseDialog(true);

            closeDialog.ShowDialog();

            switch (closeDialog.Result)
            {
            case Victoria.UI.SharedWPF.DialogResult.CloseWithOutSave:
            {
                //this.MyDesigner.setDebugButtonsVisibility(Visibility.Hidden)
                this.diagrama().StopDebugProcess();
                this.Close();
            }
            break;

            case Victoria.UI.SharedWPF.DialogResult.Cancel:
            {
                return;
            }
            }
            this.Close();
        }
示例#13
0
        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());
                }
            }
        }
示例#14
0
 protected void OnCloseDialog(DialogEventArgs args)
 {
     CloseDialog?.Invoke(args);
 }
示例#15
0
 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());
 }
示例#17
0
        protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
        {

            bool bootstrap = false;

            foreach (Peer p in peerList)
                if (p.machine.ReloadConfig.IsBootstrap)
                    bootstrap = true;

            if (peerList.Count > 0 && !bootstrap)
            {
                e.Cancel = true;
                CloseDialog closeDialog = new CloseDialog(peerList);
                closeDialog.Show();

                foreach (Peer p in peerList)
                {
                    if (!p.machine.ReloadConfig.IsBootstrap)
                        p.machine.SendCommand("Leave");
                }
            }
        }
示例#18
0
 private void CancelButton_Click(object sender, RoutedEventArgs e)
 {
     // Close the dialog
     CloseDialog?.Invoke(this, new EventArgs());
 }
示例#19
0
 private void stateBox_Click(object sender, RoutedEventArgs e)
 {
     CloseDialog close = new CloseDialog(peerList);
     close.Show();
 }
        /// <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);
                }
            }
        }
示例#21
0
 /// <summary>
 /// Raises the CloseDialog event and performs custom processing</summary>
 /// <param name="args">CloseDialogEventArgs containing event data</param>
 protected void RaiseCloseDialog(CloseDialogEventArgs args)
 {
     CloseDialog.Raise <CloseDialogEventArgs>(this, args);
 }