/// <summary> /// 發出執行階段狀態事件 /// </summary> /// <param name="status">正在執行的狀態</param> private void RaiseStatusChanged(CommentLoaderStatus status) { this.Status = status; //Debug.WriteLine(String.Format("[OnStatusChanged] {0}", this.Status.ToString())); if (OnStatusChanged != null) { OnStatusChanged(this, status); } }
/// <summary> /// CommentLoader處理狀態改變 /// </summary> /// <param name="sender">CommentLoader</param> /// <param name="status">改變後的狀態</param> private void On_CommetLoader_StatusChanged(CommentLoader sender, CommentLoaderStatus status) { switch (status) { case CommentLoaderStatus.Null: this.StatusText = "已停止"; break; case CommentLoaderStatus.Started: this.StatusText = "開始"; this.IsStopped = false; this.IsEnableStop = false; break; case CommentLoaderStatus.GetLiveChatHtml: this.StatusText = "讀取聊天室"; break; case CommentLoaderStatus.ParseLiveChatHtml: this.StatusText = "解析聊天室內容"; break; case CommentLoaderStatus.GetComments: this.StatusText = "取得留言"; this.IsEnableStop = true; break; case CommentLoaderStatus.StopRequested: this.StatusText = "停止中"; break; case CommentLoaderStatus.Completed: this.StatusText = "已停止"; this.IsStopped = true; this.IsEnableStop = false; if (App.AppStartupParameter.IsParsed && App.AppStartupParameter.OutputFilePath != "" && App.AppStartupParameter.OutputFilePath != null) { ExportComment(App.AppStartupParameter.OutputFilePath); if (this.CloseWindow != null && (App.AppStartupParameter.IsHide || App.AppStartupParameter.IsClose)) { App.Current.Dispatcher.Invoke(() => { CloseWindow(); }); } } break; default: break; } }
/// <summary> /// CommentLoader處理狀態改變 /// </summary> /// <param name="sender">CommentLoader</param> /// <param name="status">改變後的狀態</param> private void On_CommetLoader_StatusChanged(CommentLoader sender, CommentLoaderStatus status) { switch (status) { case CommentLoaderStatus.Null: this.StatusText = "已停止"; break; case CommentLoaderStatus.Started: this.StatusText = "開始"; this.IsStopped = false; this.IsEnableStop = false; break; case CommentLoaderStatus.GetLiveChatHtml: this.StatusText = "讀取聊天室"; break; case CommentLoaderStatus.ParseYtCfgData: this.StatusText = "解析連線設定"; break; case CommentLoaderStatus.ParseLiveChatHtml: this.StatusText = "解析聊天室內容"; break; case CommentLoaderStatus.GetComments: this.StatusText = "取得留言"; this.IsEnableStop = true; break; case CommentLoaderStatus.StopRequested: this.StatusText = "停止中"; break; case CommentLoaderStatus.Completed: this.StatusText = "已停止"; this.IsStopped = true; this.IsEnableStop = false; break; default: break; } }