示例#1
0
 /// <summary>
 /// Starts the service's background threads. Should only be called once.
 /// </summary>
 public static void Initialize()
 {
     if (speedometer != null)
     {
         return;
     }
     Logger.Info("Speedometer Initializing.");
     speedometer               = new Speedometer(settings, null);
     speedometer.OnStop       += Speedometer_OnStop;
     speedometer.SpeedUpdated += Speedometer_SpeedUpdated;
     speedometer.Start();
 }
        private void BtnLoadStream_Click(object sender, EventArgs e)
        {
            if (meter != null)
            {
                meter.Stop();
                meter = null;
                btnLoadStream.Text = "LOAD";
            }
            else
            {
                meter                         = new Speedometer(ServiceWrapper.settings, RenderFrame);
                meter.OnError                += Meter_OnError;
                meter.OnStop                 += Meter_OnStop;
                meter.SpeedUpdated           += Meter_SpeedUpdated;
                meter.HighlightTrackedObjects = cbPreviewObjectTracking.Checked;
                meter.Start();

                btnLoadStream.Text = "STOP";
            }
        }
 private void Meter_OnStop(object sender, EventArgs e)
 {
     btnLoadStream.Text = "LOAD";
     meter = null;
 }