コード例 #1
0
        private void login()
        {
            using (FLogin lf = new FLogin(Application.StartupPath + "\\clusters.txt"))
            {
                lf.tbCallsign.Text = settings.cs;
                lf.tbHost.Text     = settings.host;
                if (settings.port != 0)
                {
                    lf.tbPort.Text = settings.port.ToString();
                }
                if (lf.ShowDialog() == DialogResult.OK)
                {
                    string host     = lf.tbHost.Text;
                    int    port     = Convert.ToInt32(lf.tbPort.Text);
                    string callsign = lf.tbCallsign.Text;
                    if (!callsign.Equals(settings.cs))
                    {
                        settings.cs = callsign;
                    }
                    if (!host.Equals(settings.host))
                    {
                        settings.host = host;
                    }
                    if (port != settings.port)
                    {
                        settings.port = port;
                    }
                    writeConfig();

                    if (host == "test")
                    {
                        using (StreamReader sr = new StreamReader(Application.StartupPath + "\\test.txt"))
                            do
                            {
                                LineReceivedEventArgs e = new LineReceivedEventArgs();
                                e.line = sr.ReadLine();
                                lineReceived(this, e);
                            } while (sr.Peek() >= 0);
                    }
                    else
                    {
                        clusterCn = new AsyncConnection();
                        clusterCn.lineReceived += lineReceived;
                        if (clusterCn.connect(host, port))
                        {
                            clusterCn.sendCommand(callsign);
                            this.Text += " connected to " + host + ":" + port.ToString();
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: Jerome.cs プロジェクト: alexbzg/NetRotator5-
 private void processQuee()
 {
     if (cmdQuee.Count > 0 && currentCmd == null)
     {
         lock (cmdQueeLock)
         {
             currentCmd = cmdQuee[0];
             cmdQuee.RemoveAt(0);
         }
         connection.sendCommand("$KE," + currentCmd.cmd);
         replyTimer = new Timer(obj => replyTimeout(), null, timeout, Timeout.Infinite);
     }
 }
コード例 #3
0
        private void processQueue()
        {
            if (!connected || disconnecting)
            {
                return;
            }
            CmdEntry bufCmd;

            if (currentCmd == null && cmdQueue.TryDequeue(out bufCmd))
            {
                currentCmd = bufCmd;
#if DEBUG
#if DEBUG_JEROME_COMM
                System.Diagnostics.Debug.WriteLine(bufCmd.cmd);
#endif
#endif
                connection.sendCommand("$KE" + (bufCmd.cmd.Equals(String.Empty) ? "" : "," + bufCmd.cmd));
                replyTimer = new System.Threading.Timer(obj => replyTimeout(), null, timeout, Timeout.Infinite);
            }
        }
コード例 #4
0
 private void sendCmd(string cmd)
 {
     clusterCn.sendCommand(cmd);
 }