Exemple #1
0
        private void onAmplifierDisconnected(object sender)
        {
            UpdateDisplayCallback cb = new UpdateDisplayCallback(updateDisplay);

            this.Invoke(cb, new object[] {
                (UInt32)0, (UInt32)0
            });
        }
Exemple #2
0
        private void onStatusReceived(object sender, UInt32 sequence, UInt32 windowSize)
        {
            UpdateDisplayCallback cb = new UpdateDisplayCallback(updateDisplay);

            this.Invoke(cb, new object[] {
                sequence, windowSize
            });
        }
Exemple #3
0
        private void UpdateDisplay()
        {
            if (lblActions.InvokeRequired)
            {
                UpdateDisplayCallback d = new UpdateDisplayCallback(UpdateDisplay);
                this.Invoke(d);
            }
            else
            {
                lblActions.Text      = actions.ToString();
                lblTicks.Text        = ticks.ToString();
                lblRatio.Text        = getRatio().ToString("P");
                lblSkillLast.Text    = (rel * 3600).ToString("G5");
                lblSkillTicks.Text   = (srel * 3600).ToString("G5");
                lblSkillActions.Text = (trel * 3600).ToString("G5");
                lblTotalSkill.Text   = totalSkill.ToString("G5");

                lblTotalTime.Text = new TimeSpan(0, 0, totalTime).ToString();
                lblSkillTime.Text = new TimeSpan(0, 0, skillTime).ToString();
            }
        }
Exemple #4
0
        void SafeDisplayPullRequests(IList <CEGitHubPullRequest> requests)
        {
            UpdateDisplayCallback cb = new UpdateDisplayCallback(DisplayPullRequests);

            this.Invoke(cb, new object[] { requests });
        }
Exemple #5
0
        private void UpdateDisplay()
        {
            if (lblActions.InvokeRequired)
            {
                UpdateDisplayCallback d = new UpdateDisplayCallback(UpdateDisplay);
                this.Invoke(d);
            }
            else
            {
                lblActions.Text = actions.ToString();
                lblTicks.Text = ticks.ToString();
                lblRatio.Text = getRatio().ToString("P");
                lblSkillLast.Text = (rel * 3600).ToString("G5");
                lblSkillTicks.Text = (srel * 3600).ToString("G5");
                lblSkillActions.Text = (trel * 3600).ToString("G5");
                lblTotalSkill.Text = totalSkill.ToString("G5");

                lblTotalTime.Text = new TimeSpan(0,0,totalTime).ToString();
                lblSkillTime.Text = new TimeSpan(0,0,skillTime).ToString();

            }
        }
        private void WorkComplete(Sensor sensor)
        {
            try
            {
                Button button = (Button)pDevices.Controls[sensor.DeviceId];

                if (button.InvokeRequired)
                {   //Use the delegate to get this back onto the main thread
                    UpdateDisplayCallback d = new UpdateDisplayCallback(WorkComplete);
                    Invoke(d, new object[] { sensor });
                }
                else
                {   //On same thread, pass device data back
                    switch (sensor.State)
                    {
                    case DeviceState.Transmit:
                        //Yellow ball on
                        pStatus.Controls[sensor.StatusWindow].Visible = true;

                        //Set the Sensor's Temperature color on the buildings
                        switch (sensor.TemperatureIndicator)
                        {
                        case SensorState.Cold:
                            button.BackColor = Color.Blue;
                            break;

                        case SensorState.Normal:
                            button.BackColor = Color.Green;
                            break;

                        case SensorState.Hot:
                            button.BackColor = Color.Red;
                            break;
                        }

                        //Update List View of Device Readings
                        string deviceId  = sensor.DeviceId.ToString();
                        string currTemp  = String.Format("{0:0.0}", sensor.CurrentTemperature);
                        string timeStamp = DateTime.UtcNow.ToString("s");     //sortable DateTimne Format

                        //Add sensor data to the list
                        var item1 = new ListViewItem(new[] { deviceId, currTemp, timeStamp });
                        lvSensorData.Items.Add(item1);
                        break;

                    case DeviceState.Ready:
                        //Yellow Ball visible
                        pStatus.Controls[sensor.StatusWindow].Visible = false;
                        break;
                    }
                    //Pass sensor data to container
                    button.Tag = sensor;

                    //Loop
                    if (!stopQueue)
                    {
                        queue.QueueTask(() => DoWork(sensor));
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }