/// <summary> /// Used to edit the value of the progress bar, can also change the max value of said bar /// </summary> /// <param name="time"></param> /// <param name="maxValue"></param> private void setTimeProgress(float time, Boolean maxValue) { if (this.timeBar.InvokeRequired) { SetIntCallback d = new SetIntCallback(setTimeProgress); try { this.Invoke(d, new object[] { time, maxValue }); }catch (Exception e) { Console.WriteLine(e.StackTrace.ToString()); } } else { if (maxValue) { this.timeBar.Maximum = (int)time; } else { this.timeBar.Value = (int)time; } } }
private void SetDownloaderJobDoneInQueue(int value) { if (this.Dispatcher.CheckAccess()) { this.viewModel.AwaitingDownDownloadJobs = value; } else { SetIntCallback d = new SetIntCallback(SetDownloaderJobDoneInQueue); this.Dispatcher.Invoke(d, new object[] { value }); } }
private void SetDownloaderJobProcessing(int value) { if (this.Dispatcher.CheckAccess()) { this.viewModel.DownloadJobsCurrentlyProcessing = value; } else { SetIntCallback d = new SetIntCallback(SetDownloaderJobProcessing); this.Dispatcher.Invoke(d, new object[] { value }); } }
public void SetInt(int num) { if (potChaser.InvokeRequired) { SetIntCallback d = new SetIntCallback(SetInt); Invoke(d, new object[] { num }); } else { potChaser.Value = num; } }
/////////////////////////////////////////////////////////////////////////////// // Methods and Eventhandling for Background tasks // /////////////////////////////////////////////////////////////////////////////// #region THREAD #endregion //THREAD /////////////////////////////////////////////////////////////////////////////// // Methods for doing main class job // /////////////////////////////////////////////////////////////////////////////// #region PRIVATEMETHODS /// <summary> /// Thread safe version of this.progressBar.Value = percentage; /// </summary> /// <param name="percentage">An <see cref="Int32"/> with the new progress /// bar value in percent.</param> private void SetPercentage(int percentage) { // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (this.progressBar.InvokeRequired) { SetIntCallback d = new SetIntCallback(this.SetPercentage); this.progressBar.BeginInvoke(d, new object[] { percentage }); } else { this.progressBar.Value = percentage; } }
//for threadsafe setting of Windows Forms control private void SetScrollBar(int text) { // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (this.vScrollBar1.InvokeRequired) { SetIntCallback d = new SetIntCallback(SetScrollBar); this.Invoke(d, new object[] { text }); } else { this.vScrollBar1.Value = this.vScrollBar1.Value + text; } }
private void SetHeight(int value) { if (value == 0) return; if (this.InvokeRequired) { SetIntCallback d = new SetIntCallback(SetHeight); this.Invoke(d, new object[] { value }); } else { this.Height = value; } }
/// <summary> /// Updates the CPU% bar in the chart /// Note that this proc does NOT cause the chart to refresh. /// that is done in UpdateTPS(), which should be called after this proc. /// </summary> private void UpdateCPUChart(int CPU) { try { if (this.statusStrip1.InvokeRequired) { SetIntCallback d = new SetIntCallback(UpdateCPUChart); this.Invoke(d, new object[] { CPU }); } else { CPU = (CPU == 0) ? 1 : CPU; this.chtCPU.Series["CPUUsage"].Points.Clear(); this.chtCPU.Series["CPUUsage"].Points.Add(new DataPoint(0, CPU)); this.chtCPU.Update(); } } catch (Exception ex) { ShowThreadExceptionDialog("UpdateCPUChart", ex); } }
private void SetVScrollMaximum(int value) { if (_vScrollBar.InvokeRequired) { SetIntCallback d = new SetIntCallback(SetVScrollMaximum); this.Invoke(d, new object[] { value }); } else { this._vScrollBar.Maximum = value; } }
public void SetCodeLineInvoke(int val) { if (this.codeGridView.InvokeRequired) { SetIntCallback d = new SetIntCallback(SetCodeLineInvoke); try { this.BeginInvoke(d, new object[] { val }); } catch { } } else { int lastDisplayedScrollLine = codeGridView.FirstDisplayedScrollingRowIndex; codeGridView.FirstDisplayedScrollingRowIndex = val; codeGridView.Rows[lastDisplayedScrollLine].Cells[0].Style.BackColor = Color.White; codeGridView.Rows[lastDisplayedScrollLine].Cells[0].Style.ForeColor = Color.Black; codeGridView.Rows[val].Cells[0].Style.BackColor = Color.Black; codeGridView.Rows[val].Cells[0].Style.ForeColor = Color.Yellow; } }
public void SetPCInvoke(int val) { if (this.numPC.InvokeRequired) { SetIntCallback d = new SetIntCallback(SetPCInvoke); try { this.BeginInvoke(d, new object[] { val }); } catch { } } else { numPC.Value = val; } }
private void SafeSetCh2VU(int i) { if (ch2VUmeter.InvokeRequired) { SetIntCallback d = new SetIntCallback(SafeSetCh2VU); this.Invoke(d, new object[] { i }); } else { ch2VUmeter.Value = i; } }