Exemple #1
0
        private void RefreshViewModel()
        {
            if (this.WindowState != GameWindowState.Opened &&
                this.WindowState != GameWindowState.Opening)
            {
                return;
            }

            if (this.viewModel is not null)
            {
                if (this.privateState == this.viewModel.PrivateState)
                {
                    // already displayed
                    return;
                }

                this.DestroyViewModel();
            }

            if (this.privateState is null)
            {
                return;
            }

            this.viewModel   = new ViewModelWindowTrashCan(this.privateState);
            this.DataContext = this.viewModel;
        }
Exemple #2
0
        private void DestroyViewModel()
        {
            if (this.viewModel is null)
            {
                return;
            }

            this.DataContext = null;
            this.viewModel.Dispose();
            this.viewModel = null;
        }