コード例 #1
0
 public Packet(Multimeter refer, DataHandler handler)
 {
     this.multimeter = refer;
     this.handler    = handler;
     count           = 0;
     data            = new byte[11];
 }
コード例 #2
0
 private void OnClosing(object sender, CancelEventArgs e)
 {
     for (int i = 0; i < multimeters.Count; i++)
     {
         try
         {
             Multimeter m = multimeters[i];
             m.Close();
         }
         catch (Exception ex)
         {
         }
     }
     Application.Current.Dispatcher.InvokeShutdown();
 }
コード例 #3
0
        public MultimeterOverview(MainWindow reference, Multimeter multi)
        {
            InitializeComponent();
            program    = reference;
            multimeter = multi;

            MeterName      = "Unknown";
            GoodPackets    = 0;
            InvalidPackets = 0;
            ElapsedTime    = new TimeSpan(0, 0, 0);
            MaxValue       = 0;
            MinValue       = 0;
            CurrentValue   = 0;
            CurrentUnits   = "Unknown";
            CurrentStatus  = "Idle";
        }
コード例 #4
0
        public DataHandler(Multimeter refer)
        {
            s            = new Stopwatch();
            g            = new Stopwatch();
            multimeter   = refer;
            currentMeter = "DMM " + (multimeter.Index + 1).ToString();

            totalStopWatch = new Stopwatch();
            totalLogTimer  = new DispatcherTimer(new TimeSpan(0, 0, 1), DispatcherPriority.Normal, delegate
            {
                multimeter.overview.ElapsedTimeDisplay.Text = String.Format("{0:hh\\:mm\\:ss}", totalStopWatch.Elapsed);
            }, Application.Current.Dispatcher);

            HorizontalDateTimeAxis axis = multimeter.dynamicChart.HorizontalAxis as HorizontalDateTimeAxis;

            loggedValues = new ObservableDataSource <DatePoint>();
            loggedValues.SetXMapping(p => axis.ConvertToDouble(p.X));
            loggedValues.SetYMapping(p => p.Y);
            graph = multimeter.dynamicChart.AddLineGraph(loggedValues, Colors.Blue, 2, currentMeter);
        }
コード例 #5
0
        private void AddNewTab(int index = 1)
        {
            TabItem t = new TabItem();

            MultimeterTabs.Items.Insert(index, t);
            Multimeter multimeter = new Multimeter(this, t, MultimeterTabs, multimeters.Count);

            multimeters.Add(multimeter);
            t.Content = multimeter;
            MultimeterTabs.SelectedIndex = index;

            HorizontalDateTimeAxis           axis   = dynamicChart.HorizontalAxis as HorizontalDateTimeAxis;
            ObservableDataSource <DatePoint> values = new ObservableDataSource <DatePoint>();

            values.SetYMapping(p => p.Y);
            values.SetXMapping(p => axis.ConvertToDouble(p.X));
            points.Add(values);
            graphs.Add(dynamicChart.AddLineGraph(values, 2, multimeter.handler.currentMeter));
            multimeter.graph = graphs.Last <LineGraph>();
        }