コード例 #1
0
        private void InitializeAsync()
        {
            var oemMonitorInfo = _device.GetOemMonitorInfo();

            if (oemMonitorInfo != null && oemMonitorInfo.Valid)
            {
                _oemString  = oemMonitorInfo.OemString;
                _oemVersion = oemMonitorInfo.Version;
            }
            int retries = 3;

            do
            {
                try
                {
                    _deviceInfo = _device.MFDeviceInfo;
                }
                catch
                {
                    _deviceInfo = null;
                    System.Threading.Thread.Sleep(500);
                }
            } while (--retries > 0 && _deviceInfo == null);
            if (retries == 0 && _deviceInfo == null)
            {
                throw new Exception("Failed to initialize board");
            }
            _configBytes = ReadConfiguration();
            OnPropertyChanged("IsFirmataInstalled");
            OnPropertyChanged("FirmataAppVersion");
            OnPropertyChanged("FirmataAppName");
        }
コード例 #2
0
ファイル: MFDeployForm.cs プロジェクト: yisea123/NETMF-LPC
        private void buttonPing_Click(object sender, EventArgs e)
        {
            DumpToOutput(Properties.Resources.StatusPinging, false);
            Thread.Sleep(0);

            Cursor old = Cursor;

            this.Cursor = Cursors.WaitCursor;

            MFDevice dev = ConnectToSelectedDevice();

            if (dev != null)
            {
                DumpToOutput(dev.Ping().ToString());

                OemMonitorInfo omi = dev.GetOemMonitorInfo();
                if (omi != null && omi.Valid)
                {
                    DumpToOutput(omi.ToString());
                }
                DisconnectFromSelectedDevice();
            }
            Cursor = old;
        }