Browse Source

Добавлена блокировка изменения resultView при запуске задания. Добавлен waitOrPauseLabel для оповещения о длительной операции.

release
Никита 6 years ago
parent
commit
5bc8d5d81d
  1. 18
      fileFinder/MainForm.Designer.cs
  2. 6
      fileFinder/MainForm.cs

18
fileFinder/MainForm.Designer.cs

@ -36,6 +36,7 @@
this.handleSearchBtn = new System.Windows.Forms.Button(); this.handleSearchBtn = new System.Windows.Forms.Button();
this.innerQueryTextBox = new System.Windows.Forms.TextBox(); this.innerQueryTextBox = new System.Windows.Forms.TextBox();
this.queryTextBox = new System.Windows.Forms.TextBox(); this.queryTextBox = new System.Windows.Forms.TextBox();
this.waitOrPauseLabel = new System.Windows.Forms.Label();
this.bottomPanel = new System.Windows.Forms.Panel(); this.bottomPanel = new System.Windows.Forms.Panel();
this.infoLabel = new System.Windows.Forms.Label(); this.infoLabel = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
@ -47,6 +48,7 @@
// //
// resultViewer // resultViewer
// //
this.resultViewer.Cursor = System.Windows.Forms.Cursors.Arrow;
this.resultViewer.Dock = System.Windows.Forms.DockStyle.Top; this.resultViewer.Dock = System.Windows.Forms.DockStyle.Top;
this.resultViewer.Location = new System.Drawing.Point(0, 0); this.resultViewer.Location = new System.Drawing.Point(0, 0);
this.resultViewer.Name = "resultViewer"; this.resultViewer.Name = "resultViewer";
@ -90,6 +92,7 @@
// //
// splitContainer.Panel2 // splitContainer.Panel2
// //
this.splitContainer.Panel2.Controls.Add(this.waitOrPauseLabel);
this.splitContainer.Panel2.Controls.Add(this.resultViewer); this.splitContainer.Panel2.Controls.Add(this.resultViewer);
this.splitContainer.Panel2.Controls.Add(this.bottomPanel); this.splitContainer.Panel2.Controls.Add(this.bottomPanel);
this.splitContainer.Size = new System.Drawing.Size(800, 450); this.splitContainer.Size = new System.Drawing.Size(800, 450);
@ -123,6 +126,18 @@
this.queryTextBox.Tag = ""; this.queryTextBox.Tag = "";
this.queryTextBox.Text = "*.txt"; this.queryTextBox.Text = "*.txt";
// //
// waitOrPauseLabel
//
this.waitOrPauseLabel.Cursor = System.Windows.Forms.Cursors.AppStarting;
this.waitOrPauseLabel.Location = new System.Drawing.Point(203, 137);
this.waitOrPauseLabel.Name = "waitOrPauseLabel";
this.waitOrPauseLabel.Size = new System.Drawing.Size(395, 68);
this.waitOrPauseLabel.TabIndex = 7;
this.waitOrPauseLabel.Text = "Приложение выполняет поиск по заданным условиям. \r\nДля ознакомления с результатам" +
"и нажмите кнопку паузы\r\nили дождитесь окончания операции.";
this.waitOrPauseLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.waitOrPauseLabel.Visible = false;
//
// bottomPanel // bottomPanel
// //
this.bottomPanel.AutoSize = true; this.bottomPanel.AutoSize = true;
@ -152,7 +167,7 @@
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false; this.MaximizeBox = false;
this.Name = "MainForm"; this.Name = "MainForm";
this.Text = "fileFinder Utility Created by Defend"; this.Text = "fileFinder";
this.splitContainer.Panel1.ResumeLayout(false); this.splitContainer.Panel1.ResumeLayout(false);
this.splitContainer.Panel1.PerformLayout(); this.splitContainer.Panel1.PerformLayout();
this.splitContainer.Panel2.ResumeLayout(false); this.splitContainer.Panel2.ResumeLayout(false);
@ -176,6 +191,7 @@
private System.Windows.Forms.Label infoLabel; private System.Windows.Forms.Label infoLabel;
private System.Windows.Forms.TextBox queryTextBox; private System.Windows.Forms.TextBox queryTextBox;
private System.Windows.Forms.TextBox innerQueryTextBox; private System.Windows.Forms.TextBox innerQueryTextBox;
private System.Windows.Forms.Label waitOrPauseLabel;
} }
} }

6
fileFinder/MainForm.cs

@ -145,6 +145,8 @@ namespace fileFinder
if (mainController.isStopped) if (mainController.isStopped)
{ {
handleSearchBtn.Text = "Pause Task"; handleSearchBtn.Text = "Pause Task";
waitOrPauseLabel.Visible = true;
resultViewer.Enabled = false;
mainController.beginTask(); mainController.beginTask();
TreeNode tN = await Task.Run(() => buildResultTree(mainController, progress)); TreeNode tN = await Task.Run(() => buildResultTree(mainController, progress));
updateResultViewer(tN); updateResultViewer(tN);
@ -152,10 +154,14 @@ namespace fileFinder
} else if (mainController.isPaused) } else if (mainController.isPaused)
{ {
handleSearchBtn.Text = "Pause Task"; handleSearchBtn.Text = "Pause Task";
waitOrPauseLabel.Visible = true;
resultViewer.Enabled = false;
mainController.resumeTask(); mainController.resumeTask();
} else } else
{ {
handleSearchBtn.Text = "Resume Task"; handleSearchBtn.Text = "Resume Task";
waitOrPauseLabel.Visible = false;
resultViewer.Enabled = true;
mainController.pauseTask(); mainController.pauseTask();
} }
} }

Loading…
Cancel
Save