コード例 #1
0
 /// <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;
         }
     }
 }
コード例 #2
0
 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 });
     }
 }
コード例 #3
0
 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 });
     }
 }
コード例 #4
0
 public void SetInt(int num)
 {
     if (potChaser.InvokeRequired)
     {
         SetIntCallback d = new SetIntCallback(SetInt);
         Invoke(d, new object[] { num });
     }
     else
     {
         potChaser.Value = num;
     }
 }
コード例 #5
0
ファイル: SaveVideoSplash.cs プロジェクト: zhjh-stack/ogama
        ///////////////////////////////////////////////////////////////////////////////
        // 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;
            }
        }
コード例 #6
0
 //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;
     }
 }
コード例 #7
0
        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;
            }
        }
コード例 #8
0
 /// <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); }
 }
コード例 #9
0
 /// <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); }
 }
コード例 #10
0
 private void SetVScrollMaximum(int value)
 {
     if (_vScrollBar.InvokeRequired)
     {
         SetIntCallback d = new SetIntCallback(SetVScrollMaximum);
         this.Invoke(d, new object[] { value });
     }
     else
     {
         this._vScrollBar.Maximum = value;
     }
 }
コード例 #11
0
ファイル: Form1.cs プロジェクト: aop007/Sipic
        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;

            }
        }
コード例 #12
0
ファイル: Form1.cs プロジェクト: aop007/Sipic
 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;
     }
 }
コード例 #13
0
ファイル: Audiometer.cs プロジェクト: jlaswell/Virtual_Lab
 private void SafeSetCh2VU(int i)
 {
     if (ch2VUmeter.InvokeRequired)
     {
         SetIntCallback d = new SetIntCallback(SafeSetCh2VU);
         this.Invoke(d, new object[] { i });
     }
     else
     {
         ch2VUmeter.Value = i;
     }
 }
コード例 #14
0
ファイル: SaveVideoSplash.cs プロジェクト: DeSciL/Ogama
    ///////////////////////////////////////////////////////////////////////////////
    // 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;
      }
    }