public void UnloadViewModel() { if (this._context != null) { this._context.PageLoading -= new EventHandler(Context_PageLoading); this._context.PageLoaded -= new EventHandler<PageLoadedEventArgs>(Context_PageLoaded); this._context.Sending -= new EventHandler(Context_Sending); this._context.SendFailed -= new EventHandler(Context_SendFailed); this._context.SendSucessful -= new EventHandler(Context_SendSuccessful); } this._context = null; }
public void SetViewModel(ThreadViewerViewModel viewModel) { this._context = viewModel; this.DataContext = viewModel; if (viewModel != null) { this.ThreadPageLabel.Visibility = System.Windows.Visibility.Visible; this._context.PageLoading += new EventHandler(Context_PageLoading); this._context.PageLoaded += new EventHandler<PageLoadedEventArgs>(Context_PageLoaded); this._context.Sending += new EventHandler(Context_Sending); this._context.SendFailed += new EventHandler(Context_SendFailed); this._context.SendSucessful += new EventHandler(Context_SendSuccessful); } }