protected override void OnUnloaded() { if (IsDesignTime) { return; } if (Instance == this) { Instance = null; } this.DataContext = null; viewModel.Dispose(); viewModel = null; }
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; }