public MainWindow()
        {
            InitializeComponent();

            comConnect = new COM();

            System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
            dispatcherTimer.Tick    += OnDataUpdate;
            dispatcherTimer.Interval = TimeSpan.FromSeconds(1);
            dispatcherTimer.Start();


            comConnect.comPort.DataReceived += DataReceived;
        }
Exemplo n.º 2
0
        public Connect()
        {
            InitializeComponent();

            string[] ports = COM.GetPorts();

            foreach (var port in ports)
            {
                this.ports.Items.Add(port);
            }

            int[] rates = COM.GetRates();

            foreach (var rate in rates)
            {
                this.rates.Items.Add(rate);
            }

            this.rates.SelectedIndex = 4;
        }