Exemple #1
0
        public MainWindow()
        {
            InitializeComponent();

            ves      = new ValueElement[112];
            averages = new double[112];

            for (int i = 0; i < 28; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    ValueElement ve = new ValueElement();
                    ve.Width  = 50;
                    ve.Height = 50;
                    ve.HorizontalAlignment = HorizontalAlignment.Left;
                    ve.VerticalAlignment   = VerticalAlignment.Top;
                    ve.Margin      = new Thickness(50 * j, 50 * i, 0, 0);
                    ves[i * 4 + j] = ve;
                    ViewArea.Children.Add(ve);
                }
            }

            Closing += MainWindow_Closing;

            sp = new SerialPortConnector("COM10", 115200, System.IO.Ports.Parity.None, 8, System.IO.Ports.StopBits.One);
            sp.DataReceived += Sp_DataReceived;
            sp.Start();

            //sp.WriteData("a");
        }
        public static void ReceiveWork(object target)
        {
            SerialPortConnector my = target as SerialPortConnector;

            my.ReceiveData();
        }