Example #1
0
 private void UpdatePorts(bool scan = true)
 {
     _ports = SerialPort.GetPortNames();
     if (comports.Items.Count == _ports.Length)
     {
         return;
     }
     if (_ports.Length > comports.Items.Count && !scan)
     {
         scan = true;
     }
     comports.DataSource = _ports;
     if (comports.Items.Count > 0 && scan)
     {
         DeviceControl.SetNORWayPort();
         if (comports.SelectedIndex < comports.Items.Count)
         {
             comports.SelectedIndex = 0;
         }
     }
     else if (scan)
     {
         comports.Text = "";
     }
 }
Example #2
0
        public MainForm()
        {
            InitializeComponent();
            var ver = Assembly.GetExecutingAssembly().GetName().Version;

#if DEBUG
            Text = string.Format(Text, ver.Major, ver.Minor, "DEBUG Build");
#elif BETA
            Text = string.Format(Text, ver.Major, ver.Minor, ver.Revision > 0 ? string.Format("BETA{0}", ver.Revision) : "BETA");
#elif ALPHA
            Text = string.Format(Text, ver.Major, ver.Minor, ver.Revision > 0 ? string.Format("ALPHA{0}", ver.Revision) : "ALPHA");
#else
            Text = string.Format(Text, ver.Major, ver.Minor, "");
#endif

#if DEBUG || BETA || ALPHA
            donateToolStripMenuItem.Visible = false;
#else
            donateToolStripMenuItem.Visible = true;
#endif
            PythonHandler.Error  += ProcOut;
            PythonHandler.Output += ProcOut;
            Icon = System.Drawing.Icon.ExtractAssociatedIcon(Application.ExecutablePath);
            DeviceControl.SetUpReceive(Handle);
        }
Example #3
0
 private void UpdatePorts()
 {
     _ports = SerialPort.GetPortNames();
     if (comports.Items.Count == _ports.Length)
     {
         return;
     }
     comports.DataSource = _ports;
     if (_ports.Length > comports.Items.Count)
     {
         DeviceControl.SetNORWayPort();
     }
 }
Example #4
0
 protected override void WndProc(ref Message m)
 {
     base.WndProc(ref m);
     switch (m.Msg)
     {
     case 0x219:
         if (DeviceControl.CheckIfWayDeviceArrived(ref m))
         {
             UpdatePorts();
         }
         else
         {
             UpdatePorts(false);
         }
         break;
     }
 }
Example #5
0
 private void MainFormFormClosing(object sender, FormClosingEventArgs e)
 {
     DeviceControl.RemoveReceive();
 }