예제 #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;
        }