Beispiel #1
0
 /// <summary>
 /// 隐藏等待窗体。
 /// </summary>
 private void HideLoadingForm()
 {
     if (this.InvokeRequired)
     {
         this.Invoke(new Action(HideLoadingForm));
         return;
     }
     this.newGameTSBtn.Enabled = this.openGameTSBtn.Enabled = true;
     if (this.loadingForm != null)
     {
         this.loadingForm.Close();
         this.loadingForm.Dispose();
         this.loadingForm = null;
     }
     if (this.tokenCancelSource != null)
     {
         this.tokenCancelSource.Dispose();
         this.tokenCancelSource = null;
     }
 }
		/// <summary>
		/// 隐藏等待窗体。
		/// </summary>
		private void HideLoadingForm()
		{
			if (this.InvokeRequired)
			{
				this.Invoke(new Action(HideLoadingForm));
				return;
			}
			this.newGameTSBtn.Enabled = this.openGameTSBtn.Enabled = true;
			if (this.loadingForm != null)
			{
				this.loadingForm.Close();
				this.loadingForm.Dispose();
				this.loadingForm = null;
			}
			if (this.tokenCancelSource != null)
			{
				this.tokenCancelSource.Dispose();
				this.tokenCancelSource = null;
			}
		}
		/// <summary>
		/// 显示等待窗体。
		/// </summary>
		private void ShowLoadingForm()
		{
			this.newGameTSBtn.Enabled = this.openGameTSBtn.Enabled = false;
			if (this.loadingForm == null)
			{
				this.loadingForm = new LoadingForm();
			}
			this.loadingForm.Show(this);
			this.loadingForm.CenterParent();
			// 创建新的任务取消的通知。
			if (this.tokenCancelSource != null)
			{
				this.tokenCancelSource.Cancel();
				this.tokenCancelSource.Dispose();
			}
			this.tokenCancelSource = new CancellationTokenSource();
		}