private void _mainForm_GetLastDrawClick(object sender, EventArgs e) { try { this._selectedButton = sender as IElementButton; this._selectedElement = this._selectedButton.Element; if (this._cancellationTokenSource != null) { this._cancellationTokenSource.Cancel(); } this._cancellationTokenSource = new CancellationTokenSource(); this._task = Task.Factory.StartNew(() => this.GetDraw(), this._cancellationTokenSource.Token) .ContinueWith(task => { this._mainForm.SetLastDraw = task.Result; this._mainForm.SetLoaded(); }); } catch (Exception ex) { this._loggerFactory.ErrorLogged(ex); } }
private void _mainForm_StartButtonClick(object sender, EventArgs e) { this._selectedButton = sender as IElementButton; this._selectedElement = this._selectedButton.Element; if (this._cancellationTokenSource != null) { this._cancellationTokenSource.Cancel(); } this._cancellationTokenSource = new CancellationTokenSource(); this._mainForm.ClearListBox(); this._task = Task.Factory.StartNew(() => this.TaskBody(), this._cancellationTokenSource.Token); }
private void Button_ElementButtonClick(object sender, EventArgs e) { this.InvoceAction(new Action(() => { this.progressBar1.Value = 0; this.progressBar2.Value = 0; this.fileDataCurrrent.Text = string.Empty; this.fileDataAll.Text = string.Empty; this.labelLastDraw.Text = string.Empty; this.getLastDraw.Enabled = true; var btn = sender as IElementButton; this._selectedButton = btn; this.checkBox2.Enabled = !string.IsNullOrEmpty(btn.Element.FileAllName); })); }