示例#1
0
 private void UpdataWaveForm()
 {
     #region
     if (Com1.SelectedIndex == 0)
     {
         if (Com2.SelectedIndex == 0)
         {
             mv.SetChartObserver(YVolateAndCn.ToArray(), XVolate, ChartPannel.Channel1);
             mv.SetChartObserver(YVolateAndCn2.ToArray(), XVolate, ChartPannel.Channel2);
             mv.SetChartObserver(YVolateAndCn3.ToArray(), XVolate, ChartPannel.Channel3);
             mv.SetChartObserver(YVolateAndCn4.ToArray(), XVolate, ChartPannel.Channel4);
         }
         else if (Com2.SelectedIndex == 1)
         {
             mv.SetChartObserver(YVolateAndCurrent.ToArray(), XVolate, ChartPannel.Channel1);
             mv.SetChartObserver(YVolateAndCurrent2.ToArray(), XVolate, ChartPannel.Channel2);
             mv.SetChartObserver(YVolateAndCurrent3.ToArray(), XVolate, ChartPannel.Channel3);
             mv.SetChartObserver(YVolateAndCurrent4.ToArray(), XVolate, ChartPannel.Channel4);
         }
         else if (Com2.SelectedIndex == 2)
         {
             mv.SetChartObserver(YVolateAndTan.ToArray(), XVolate, ChartPannel.Channel1);
             mv.SetChartObserver(YVolateAndTan2.ToArray(), XVolate, ChartPannel.Channel2);
             mv.SetChartObserver(YVolateAndTan3.ToArray(), XVolate, ChartPannel.Channel3);
             mv.SetChartObserver(YVolateAndTan4.ToArray(), XVolate, ChartPannel.Channel4);
         }
     }
     if (Com1.SelectedIndex == 1)
     {
         if (Com2.SelectedIndex == 0)
         {
             mv.SetChartObserver(YVolateAndCn.ToArray(), XFre, ChartPannel.Channel1);
             mv.SetChartObserver(YVolateAndCn2.ToArray(), XFre, ChartPannel.Channel2);
             mv.SetChartObserver(YVolateAndCn3.ToArray(), XFre, ChartPannel.Channel3);
             mv.SetChartObserver(YVolateAndCn4.ToArray(), XFre, ChartPannel.Channel4);
         }
         else if (Com2.SelectedIndex == 1)
         {
             mv.SetChartObserver(YVolateAndCurrent.ToArray(), XFre, ChartPannel.Channel1);
             mv.SetChartObserver(YVolateAndCurrent2.ToArray(), XFre, ChartPannel.Channel2);
             mv.SetChartObserver(YVolateAndCurrent3.ToArray(), XFre, ChartPannel.Channel3);
             mv.SetChartObserver(YVolateAndCurrent4.ToArray(), XFre, ChartPannel.Channel4);
         }
         else
         {
             mv.SetChartObserver(YVolateAndTan.ToArray(), XFre, ChartPannel.Channel1);
             mv.SetChartObserver(YVolateAndTan2.ToArray(), XFre, ChartPannel.Channel2);
             mv.SetChartObserver(YVolateAndTan3.ToArray(), XFre, ChartPannel.Channel3);
             mv.SetChartObserver(YVolateAndTan4.ToArray(), XFre, ChartPannel.Channel4);
         }
     }
     if (Com1.SelectedIndex == 2)
     {
         if (Com2.SelectedIndex == 0)
         {
             mv.SetChartObserver(YVolateAndCn.ToArray(), XTime, ChartPannel.Channel1);
             mv.SetChartObserver(YVolateAndCn2.ToArray(), XTime, ChartPannel.Channel2);
             mv.SetChartObserver(YVolateAndCn3.ToArray(), XTime, ChartPannel.Channel3);
             mv.SetChartObserver(YVolateAndCn4.ToArray(), XTime, ChartPannel.Channel4);
         }
         else if (Com2.SelectedIndex == 1)
         {
             mv.SetChartObserver(YVolateAndCurrent.ToArray(), XTime, ChartPannel.Channel1);
             mv.SetChartObserver(YVolateAndCurrent2.ToArray(), XTime, ChartPannel.Channel2);
             mv.SetChartObserver(YVolateAndCurrent3.ToArray(), XTime, ChartPannel.Channel3);
             mv.SetChartObserver(YVolateAndCurrent4.ToArray(), XTime, ChartPannel.Channel4);
         }
         else
         {
             mv.SetChartObserver(YVolateAndTan.ToArray(), XTime, ChartPannel.Channel1);
             mv.SetChartObserver(YVolateAndTan2.ToArray(), XTime, ChartPannel.Channel2);
             mv.SetChartObserver(YVolateAndTan3.ToArray(), XTime, ChartPannel.Channel3);
             mv.SetChartObserver(YVolateAndTan4.ToArray(), XTime, ChartPannel.Channel4);
         }
     }
     #endregion
     // Recor_Click(null, null);
 }
示例#2
0
        private void Recor_Click(object sender, RoutedEventArgs e)
        {
            #region 设置基础值
            double VolateD = 0;
            string Volate  = "0V";
            try
            {
                if (AutoStateStatic.SState.mv.HVVoltage.ToString() != "NaN")
                {
                    Volate = mv.HVVoltage.ToString();
                    PhysicalVariable a = NumericsConverter.Text2Value(Volate);
                    VolateD = (double)a.value;
                }
            }
            catch
            {
            }
            var Fre  = mv.HVFrequency.ToString();
            var Time = DateTime.Now.ToString();

            float Cn      = (float)NumericsConverter.Text2Value(AutoStateStatic.SState.mv.Capacitance1).value;
            var   Current = (float)NumericsConverter.Text2Value(AutoStateStatic.SState.mv.Current1).value;
            var   Tan     = (float)NumericsConverter.Text2Value(AutoStateStatic.SState.mv.DissipationFactor1).value;

            var Cn2      = (float)NumericsConverter.Text2Value(AutoStateStatic.SState.mv.Capacitance2).value;
            var Current2 = (float)NumericsConverter.Text2Value(AutoStateStatic.SState.mv.Current2).value;
            var Tan2     = (float)NumericsConverter.Text2Value(AutoStateStatic.SState.mv.DissipationFactor2).value;

            var Cn3      = (float)NumericsConverter.Text2Value(AutoStateStatic.SState.mv.Capacitance3).value;
            var Current3 = (float)NumericsConverter.Text2Value(AutoStateStatic.SState.mv.Current3).value;
            var Tan3     = (float)NumericsConverter.Text2Value(AutoStateStatic.SState.mv.DissipationFactor3).value;

            var Cn4      = (float)NumericsConverter.Text2Value(AutoStateStatic.SState.mv.Capacitance4).value;
            var Current4 = (float)NumericsConverter.Text2Value(AutoStateStatic.SState.mv.Current4).value;
            var Tan4     = (float)NumericsConverter.Text2Value(AutoStateStatic.SState.mv.DissipationFactor4).value;
            if (Com1.SelectedIndex == 0)
            {
                XVolate.Add(Volate);

                if (Com2.SelectedIndex == 0)
                {
                    YVolateAndCn.Add(Cn);
                    YVolateAndCn2.Add(Cn2);
                    YVolateAndCn3.Add(Cn3);
                    YVolateAndCn4.Add(Cn4);

                    mv.SetChartObserver(YVolateAndCn.ToArray(), XVolate, ChartPannel.Channel1);
                    mv.SetChartObserver(YVolateAndCn2.ToArray(), XVolate, ChartPannel.Channel2);
                    mv.SetChartObserver(YVolateAndCn3.ToArray(), XVolate, ChartPannel.Channel3);
                    mv.SetChartObserver(YVolateAndCn4.ToArray(), XVolate, ChartPannel.Channel4);
                }
                else if (Com2.SelectedIndex == 1)
                {
                    YVolateAndCurrent.Add((double)Current);
                    YVolateAndCurrent2.Add((double)Current2);
                    YVolateAndCurrent3.Add((double)Current3);
                    YVolateAndCurrent4.Add((double)Current4);
                    mv.SetChartObserver(YVolateAndCurrent.ToArray(), XVolate, ChartPannel.Channel1);
                    mv.SetChartObserver(YVolateAndCurrent2.ToArray(), XVolate, ChartPannel.Channel2);
                    mv.SetChartObserver(YVolateAndCurrent3.ToArray(), XVolate, ChartPannel.Channel3);
                    mv.SetChartObserver(YVolateAndCurrent4.ToArray(), XVolate, ChartPannel.Channel4);
                }
                else if (Com2.SelectedIndex == 2)
                {
                    YVolateAndTan.Add((double)Tan);
                    YVolateAndTan2.Add((double)Tan2);
                    YVolateAndTan3.Add((double)Tan3);
                    YVolateAndTan4.Add((double)Tan4);
                    mv.SetChartObserver(YVolateAndTan.ToArray(), XVolate, ChartPannel.Channel1);
                    mv.SetChartObserver(YVolateAndTan2.ToArray(), XVolate, ChartPannel.Channel2);
                    mv.SetChartObserver(YVolateAndTan3.ToArray(), XVolate, ChartPannel.Channel3);
                    mv.SetChartObserver(YVolateAndTan4.ToArray(), XVolate, ChartPannel.Channel4);
                }
            }
            if (Com1.SelectedIndex == 1)
            {
                XFre.Add(Fre);
                if (Com2.SelectedIndex == 0)
                {
                    YVolateAndCn.Add((double)Cn);
                    YVolateAndCn2.Add((double)Cn2);
                    YVolateAndCn3.Add((double)Cn3);
                    YVolateAndCn4.Add((double)Cn4);
                    mv.SetChartObserver(YVolateAndCn.ToArray(), XFre, ChartPannel.Channel1);
                    mv.SetChartObserver(YVolateAndCn2.ToArray(), XFre, ChartPannel.Channel2);
                    mv.SetChartObserver(YVolateAndCn3.ToArray(), XFre, ChartPannel.Channel3);
                    mv.SetChartObserver(YVolateAndCn4.ToArray(), XFre, ChartPannel.Channel4);
                }
                else if (Com2.SelectedIndex == 1)
                {
                    YVolateAndCurrent.Add((double)Current);
                    YVolateAndCurrent2.Add((double)Current2);
                    YVolateAndCurrent3.Add((double)Current3);
                    YVolateAndCurrent4.Add((double)Current4);
                    mv.SetChartObserver(YVolateAndCurrent.ToArray(), XFre, ChartPannel.Channel1);
                    mv.SetChartObserver(YVolateAndCurrent2.ToArray(), XFre, ChartPannel.Channel2);
                    mv.SetChartObserver(YVolateAndCurrent3.ToArray(), XFre, ChartPannel.Channel3);
                    mv.SetChartObserver(YVolateAndCurrent4.ToArray(), XFre, ChartPannel.Channel4);
                }
                else
                {
                    YVolateAndTan.Add((double)Tan);
                    YVolateAndTan2.Add((double)Tan2);
                    YVolateAndTan3.Add((double)Tan3);
                    YVolateAndTan4.Add((double)Tan4);
                    mv.SetChartObserver(YVolateAndTan.ToArray(), XFre, ChartPannel.Channel1);
                    mv.SetChartObserver(YVolateAndTan2.ToArray(), XFre, ChartPannel.Channel2);
                    mv.SetChartObserver(YVolateAndTan3.ToArray(), XFre, ChartPannel.Channel3);
                    mv.SetChartObserver(YVolateAndTan4.ToArray(), XFre, ChartPannel.Channel4);
                }
            }
            if (Com1.SelectedIndex == 2)
            {
                XFre.Add(Time);
                if (Com2.SelectedIndex == 0)
                {
                    YVolateAndCn.Add((double)VolateD);
                    YVolateAndCn2.Add((double)VolateD);
                    YVolateAndCn3.Add((double)VolateD);
                    YVolateAndCn4.Add((double)VolateD);
                    mv.SetChartObserver(YVolateAndCn.ToArray(), XTime, ChartPannel.Channel1);
                    mv.SetChartObserver(YVolateAndCn2.ToArray(), XTime, ChartPannel.Channel2);
                    mv.SetChartObserver(YVolateAndCn3.ToArray(), XTime, ChartPannel.Channel3);
                    mv.SetChartObserver(YVolateAndCn4.ToArray(), XTime, ChartPannel.Channel4);
                }
                else if (Com2.SelectedIndex == 1)
                {
                    YVolateAndCurrent.Add((double)Current);
                    YVolateAndCurrent2.Add((double)Current2);
                    YVolateAndCurrent3.Add((double)Current3);
                    YVolateAndCurrent4.Add((double)Current4);
                    mv.SetChartObserver(YVolateAndCurrent.ToArray(), XTime, ChartPannel.Channel1);
                    mv.SetChartObserver(YVolateAndCurrent2.ToArray(), XTime, ChartPannel.Channel2);
                    mv.SetChartObserver(YVolateAndCurrent3.ToArray(), XTime, ChartPannel.Channel3);
                    mv.SetChartObserver(YVolateAndCurrent4.ToArray(), XTime, ChartPannel.Channel4);
                }
                else
                {
                    YVolateAndTan.Add((double)Tan);
                    YVolateAndTan2.Add((double)Tan2);
                    YVolateAndTan3.Add((double)Tan3);
                    YVolateAndTan4.Add((double)Tan4);
                    mv.SetChartObserver(YVolateAndTan.ToArray(), XTime, ChartPannel.Channel1);
                    mv.SetChartObserver(YVolateAndTan2.ToArray(), XTime, ChartPannel.Channel2);
                    mv.SetChartObserver(YVolateAndTan3.ToArray(), XTime, ChartPannel.Channel3);
                    mv.SetChartObserver(YVolateAndTan4.ToArray(), XTime, ChartPannel.Channel4);
                }
            }
            #endregion
        }