Пример #1
0
 //--------//--------//--------//--------//--------//--------//--------//--------//--------
 private void serialPortReopenIfFailed()
 {
     if (DataHolder.i_faultyConter > 20)
     {
         if (ButtonDisConnect.IsEnabled)
         {
             DataHolder.i_faultyConter = 10;
             serialController.i_serialPort1.Close();
             serialController = new SerialPortController();
         }
     }
 }
Пример #2
0
        //--------//--------//--------//--------//--------//--------//--------//--------//--------
        public MainWindow()
        {
            InitializeComponent();

            DataChart = new DataChartWindow();
            DataGraph = new DataGraphWindow();

            DataGraph.Show();
            DataChart.Show();

            serialController = new SerialPortController();

            DispatcherTimer timer = new DispatcherTimer();

            timer.Interval  = new TimeSpan(0, 0, 0, 1);
            timer.Tick     += new EventHandler(timer_Tick);
            timer.IsEnabled = true;
        }