コード例 #1
0
        protected override void OnUnloaded()
        {
            if (IsDesignTime)
            {
                return;
            }

            if (Instance == this)
            {
                Instance = null;
            }

            this.DataContext = null;
            viewModel.Dispose();
            viewModel = null;
        }
コード例 #2
0
        protected override void OnLoaded()
        {
            if (IsDesignTime)
            {
                return;
            }

            if (Instance != null)
            {
                throw new Exception(this.GetType() + " instance is already exists");
            }

            Instance = this;

            if (viewModel == null)
            {
                viewModel = new ViewModelHUD();
            }

            this.DataContext = viewModel;
        }