Exemple #1
0
 void CloseAll()
 {
     _startView.Close();
     _endView.Close();
     _hudView.Close();
     _winView.Close();
     _plotView.Close();
     _popupView.Close();
     _msgView.Close();
 }
        private void ProgressAction(string text, Action <Action <bool> > action, bool needRefresh = false, bool cancel = true)
        {
            BlockUI?.Invoke(true);
            var messageView = new MessageView();

            messageView.HeaderText  = "Выполнение операции";
            messageView.ContentText = text;
            messageView.Icon        = Icon.Hourglass;
            if (cancel)
            {
                messageView.SetItems(new[] {
                    new MessageItemInfo("Отмена", (m) => _manager.CancelOperation(_selectedController), Icon.Cancel)
                });
            }
            messageView.StartAnimateProgress();
            var callback = new Action <bool>((success) => {
                this.Dispatcher.BeginInvoke(new Action(() => {
                    BlockUI?.Invoke(false);
                    messageView.StopAnimateProgress();
                    if (!success)
                    {
                        messageView.Icon        = Icon.Cancel;
                        messageView.ContentText = "Операция не выполнена.";
                    }
                    else
                    {
                        messageView.Icon        = Icon.Check;
                        messageView.ContentText = "Операция выполнена успешно!";
                        if (needRefresh)
                        {
                            UpdateControllers();
                        }
                    }
                    messageView.SetItems(new[] {
                        new MessageItemInfo("OK", (m) => messageView.Close())
                    });
                }));
            });

            messageView.Show(mainGrid);
            try
            {
                action?.Invoke(callback);
            }
            catch (Exception e)
            {
                MessageView.ShowMessage(e.Message, "Ошибка!", Icon.Bug, mainGrid);
            }
        }
Exemple #3
0
        private MessageItemInfo CreateItemInfo(ValueGenre?genre, MessageView mview)
        {
            var caption = "All";

            if (genre != null)
            {
                caption = Enum.GetName(typeof(ValueGenre), genre);
            }
            return(new MessageItemInfo(caption, (m) =>
            {
                SelectGenre(genre);
                mview.Close();
            },
                                       focused: genre == SelectedGenre));
        }
Exemple #4
0
 public void ExecuteOkCommand(object obj)
 {
     mView.Close();
 }