コード例 #1
0
 private void DoTempCheck(Func <bool> Breakout) // need to develop further for async
 {
     if (andor is AndorTempControlled)
     {
         AndorTempControlled camct = CameraAs <AndorTempControlled>();
         if (camct.TemperatureStatus != AndorTempControlled.Temp_Stabilized)
         {
             bool equil = (bool)Invoke(new Func <bool>(TemperatureStabilizedDialog));
             if (equil)
             {
                 if (camct.StabilizeUntil(Breakout))
                 {
                     return;
                 }
             }
         }
     }
 }
コード例 #2
0
        private async Task UpdateTemperature()
        {
            AndorTempControlled camct = CameraAs <AndorTempControlled>();

            if (camct != null)
            {
                if (TemperatureCts != null)
                {
                    TemperatureCts.Cancel();
                }
                TemperatureCts = new CancellationTokenSource();

                if (numericTemp.Value > camct.Temperature)
                {
                    labelTemperature.Text = "Warming";
                }
                if (numericTemp.Value < camct.Temperature)
                {
                    labelTemperature.Text = "Cooling";
                }
                labelTemperature.BackColor = Color.Red;

                await camct.StabilizeTemperatureAsync((int)numericTemp.Value, TemperatureCts.Token); // Wait for 3 deg threshold

                LogTextBox.AppendText("ANDOR: Temp stabilizing...\r\n");
                labelTemperature.BackColor = Color.Gold;
                if (numericTemp.Value > camct.Temperature)
                {
                    labelTemperature.Text = "Warming";
                }
                if (numericTemp.Value < camct.Temperature)
                {
                    labelTemperature.Text = "Cooling";
                }

                await camct.StabilizeTemperatureAsync(TemperatureCts.Token); // Wait for driver signal

                LogTextBox.AppendText("Ready.\r\n");
                labelTemperature.BackColor = Color.RoyalBlue;
                UpdateTemperatureLabel();
                TemperatureCts = null;
            }
        }