Example #1
0
 /// <summary>
 /// Closes the current view.
 /// </summary>
 public void CloseCurrentView()
 {
     if (CurrentView != null && CurrentView != MainWindow)
     {
         CurrentView.Close();
     }
 }
Example #2
0
    private static void OnBack(object o)
    {
        if (CurrentView == null)
        {
            return;
        }
        if (CurrentView.GetType() == typeof(UIMainView))
        {
            return;
        }

        var prevViewType = PrevViewTypes[PrevViewTypes.Count - 1];

        if (_inClose)
        {
            return;
        }

        CurrentView.Close(() =>
        {
            if (prevViewType == typeof(UIMainView))
            {
                UIMainView.Show(false);
            }
            else
            {
                UiManager.ShowUIFromBack(prevViewType, null);
            }
            PrevViewTypes.Remove(prevViewType);
            _inClose = false;
        });
        _inClose = true;
        Sound.PlayUiAudioOneShot(1003);
    }
Example #3
0
        private void InitTitleBar(TitleBarViewModel titleBarViewModel)
        {
            TitleBarViewModel       = titleBarViewModel;
            TitleBarViewModel.Title = Resources.Title;

            TitleBarViewModel.CloseCommand = new DelegateCommand(o => CurrentView.Close());

            TitleBarViewModel.ChangeWindowStateCommand = new DelegateCommand(o =>
            {
                if (WindowState == WindowState.Maximized)
                {
                    WindowState = WindowState.Normal;
                    OnPropertyChanged(nameof(WindowState));
                }
                else if (WindowState == WindowState.Normal)
                {
                    WindowState = WindowState.Maximized;
                    OnPropertyChanged(nameof(WindowState));
                }
            });

            TitleBarViewModel.MinimizeCommand = new DelegateCommand(o =>
            {
                WindowState = WindowState.Minimized;
                OnPropertyChanged(nameof(WindowState));
            });
        }
Example #4
0
 private void closeToolStripMenuItem_Click(object sender, EventArgs e)
 {
     CurrentView?.Close();
     tabs.TabPages.Remove(tabs.SelectedTab);
     UpdateSaveButtons();
     if (tabs.TabPages.Count == 0)
     {
         closeToolStripMenuItem.Enabled = false;
     }
 }
Example #5
0
    //记录上一个选择的界面
    protected override void OnFullViewShow(bool fromBack)
    {
        _bOpening = true;

        if (GetType() != typeof(UIMainView))
        {
            Animator.Play("Open");
        }

        if (CurrentView != null)
        {
            if (!fromBack)
            {
                PrevViewTypes.Add(CurrentView.GetType());
            }
            CurrentView.Close();
        }

        CurrentView = this;
    }