private void SendCustomCommand(string cmd)
        {
            string ip      = txtBasic2IpAddress.Text;
            Int32  ipPort  = Convert.ToInt32(txtBasic2IpPort.Text);
            string comPort = cmbBasic2SerialPort.Text;

            try
            {
                //if (rbAutoDetect.Checked)
                //{
                //    DumpLine("Sending via Autodetect: " + cmd);

                //    //Mount.SendRawCommand(cmd);
                //}
                if (rbTcp.Checked || rbUdp.Checked)
                {
                    if (!ComManager.ConnectedToPmcNetwork)
                    {
                        DumpLine("Not connected to a PMC-8 network.  Can not send: " + cmd);
                        MessageBox.Show("Please connect to a PMC-8 network before using TCP or UDP", "Information");
                        return;
                    }
                }
                if (rbTcp.Checked)
                {
                    DumpLine("Sending via TCP: " + cmd);
                    string result = ComManager.SendTcpMessage(ip, ipPort, cmd);
                    DumpLine("Received: " + result);
                }
                if (rbSerial.Checked)
                {
                    DumpLine("Sending via Serial: " + cmd);
                    string result = ComManager.SendSerialMessage(comPort, cmd);
                    DumpLine("Received: " + result);
                }
                if (rbUdp.Checked)
                {
                    DumpLine("Sending via UDP: " + cmd);
                    string result = ComManager.SendUdpMessage(ip, ipPort, cmd);
                    DumpLine("Received: " + result);
                }
            }
            catch (Exception)
            {
                string msg = "An error has occured. Unable to send command.  Please make sure: " + Environment.NewLine;
                msg = msg + "1. you have selected the correct Communication Method below" + Environment.NewLine;
                msg = msg + "2. You are connected to the PMC-8 network, if required" + Environment.NewLine;
                msg = msg + "If that does not work, please restart the program.";
                //msg += Environment.NewLine + ex.ToString();
                Dump("Error: " + cmd);
                MessageBox.Show(msg, "Error");
            }
        }
Esempio n. 2
0
 public Form1()
 {
     InitializeComponent();
     MountManager = new EsMountManager();
     ComManager   = new ComManager();
     foreach (string s in System.IO.Ports.SerialPort.GetPortNames())
     {
         cmbBasic2SerialPort.Items.Add(s);
     }
     if (cmbBasic2SerialPort.Items.Count > 0)
     {
         cmbBasic2SerialPort.SelectedIndex = 0;
     }
     cmbBasic2MountType.SelectedIndex = 1;
     ComManager.SsidTimerHit         += ComManager_SsidTimerHit;
     EsEventManager.EsEventRaised    += EsEventManager_EsEventRaised;
     rbDefault.Checked = true;
 }
        //public bool SsIdIsChanging { get; set; }

        public Form1()
        {
            InitializeComponent();
            MountManager = new EsMountManager();
            ComManager   = new ComManager();
            foreach (string s in System.IO.Ports.SerialPort.GetPortNames())
            {
                cmbBasic2SerialPort.Items.Add(s);
            }
            if (cmbBasic2SerialPort.Items.Count > 0)
            {
                cmbBasic2SerialPort.SelectedIndex = 0;
            }
            cmbBasic2MountType.SelectedIndex = 1;
            ComManager.SsidTimerHit         += ComManager_SsidTimerHit;
            EsEventManager.EsEventRaised    += EsEventManager_EsEventRaised;
            rbDefault.Checked  = true;
            SsidTimer          = new System.Timers.Timer(SSID_CHANGING_TIMEOUT);
            SsidTimer.Elapsed += SsidTimer_Elapsed;
            rtbInstructions.LoadFile("COnnection Utility Instructions.rtf");
            cmbDrive.Enabled = false;
        }
Esempio n. 4
0
 public EsMountManager()
 {
     CommunicationsManager = new ComManager();
 }