Ejemplo n.º 1
0
        void MainFormFormClosing(object sender, FormClosingEventArgs e)
        {
            if (Core.InProgram && System.Windows.Forms.MessageBox.Show(Strings.ExitAnyway, "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) != System.Windows.Forms.DialogResult.Yes)
            {
                e.Cancel = true;
            }

            if (!e.Cancel)
            {
                Core.CloseCom(true);
                Settings.SetObject("Mainform Size and Position", new object[] { Size, Location, WindowState });
                Settings.Save();
            }
        }
Ejemplo n.º 2
0
        //private static System.Text.RegularExpressions.Regex ComRX = new System.Text.RegularExpressions.Regex(@"(?'wholecom'(?:^|[ (])COM(?'comno'\d+)(?:[) ]|$))", System.Text.RegularExpressions.RegexOptions.Compiled);
        //private System.Collections.Generic.SortedDictionary<int, string> GetPortDictionary()
        //{
        //	System.Collections.Generic.SortedDictionary<int, string> rv = new System.Collections.Generic.SortedDictionary<int, string>();
        //
        //	try //add using managment object
        //	{
        //		using (System.Management.ManagementObjectSearcher searcher = new System.Management.ManagementObjectSearcher(@"\\.\root\cimv2", "SELECT * FROM Win32_PnPEntity"))
        //		{
        //			System.Management.ManagementObjectCollection moc = searcher.Get();
        //			foreach (System.Management.ManagementObject mo in moc)
        //			{
        //				string caption = (string)mo["Caption"];
        //				if (caption != null && ComRX.IsMatch(caption))
        //				{
        //					System.Text.RegularExpressions.Match m = ComRX.Match(caption);
        //					if (m != null && m.Groups["comno"] != null)
        //					{
        //						int no = int.Parse(m.Groups["comno"].Value);
        //						string wholecom = m.Groups["wholecom"].Value;
        //						if (!rv.ContainsKey(no))
        //							rv.Add(int.Parse(m.Groups["comno"].Value), caption.Replace(wholecom, "").Trim());
        //					}
        //				}
        //			}
        //
        //		}
        //	}
        //	catch { }
        //
        //	try //add using SerialPort.GetPortNames
        //	{
        //		foreach (string dirty in System.IO.Ports.SerialPort.GetPortNames())
        //		{
        //			string comno = dirty;
        //			if (!char.IsDigit(comno[comno.Length - 1]))
        //				comno = comno.Substring(0, comno.Length - 1);
        //
        //			string caption = comno;
        //			if (caption != null && ComRX.IsMatch(caption))
        //			{
        //				System.Text.RegularExpressions.Match m = ComRX.Match(caption);
        //				if (m != null && m.Groups["comno"] != null)
        //				{
        //					int no = int.Parse(m.Groups["comno"].Value);
        //					if (!rv.ContainsKey(no))
        //						rv.Add(int.Parse(m.Groups["comno"].Value), "Generic COM Port");
        //				}
        //			}
        //		}
        //	}
        //	catch { }
        //
        //	return rv;
        //}


        void BtnConnectDisconnectClick(object sender, EventArgs e)
        {
            if (Core.MachineStatus == GrblCore.MacStatus.Disconnected)
            {
                Core.OpenCom();
            }
            else if (!(Core.InProgram && System.Windows.Forms.MessageBox.Show(Strings.DisconnectAnyway, "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) != System.Windows.Forms.DialogResult.Yes))
            {
                Core.CloseCom(true);
            }

            TimerUpdate();
        }
Ejemplo n.º 3
0
        void BtnConnectDisconnectClick(object sender, EventArgs e)
        {
            if (Core.MachineStatus == GrblCore.MacStatus.Disconnected)
            {
                Core.OpenCom();
            }
            else
            {
                Core.CloseCom(false);
            }

            TimerUpdate();
        }
Ejemplo n.º 4
0
        void BtnConnectDisconnectClick(object sender, EventArgs e)
        {
            if (Core.MachineStatus == GrblCore.MacStatus.Disconnected && CBSpeed.SelectedItem != null && CBPort.SelectedItem != null)
            {
                Core.OpenCom();
            }
            else
            {
                Core.CloseCom(false);
            }

            TimerUpdate();
        }
Ejemplo n.º 5
0
 void MainFormFormClosing(object sender, FormClosingEventArgs e)
 {
     Core.CloseCom(false);
     Settings.SetObject("Mainform Size and Position", new object[] { Size, Location, WindowState });
     Settings.Save();
 }
Ejemplo n.º 6
0
 void MainFormFormClosing(object sender, FormClosingEventArgs e)
 {
     Core.CloseCom();
 }
Ejemplo n.º 7
0
 void MainFormFormClosing(object sender, FormClosingEventArgs e)
 {
     DockArea.SaveAsXml("LaserGRBL.Docking.xml");
     Core.CloseCom();
 }