Beispiel #1
0
        private void Form_Onduty_Load(object sender, EventArgs e)
        {
            string localIP;
            string stationName;
            string serverIP;
            int    serverPort = 0;

            btn_Ok_Click(sender, e);

            try
            {
                string    filePath  = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "Config.ini");
                AccessIni accessIni = new AccessIni();
                localIP     = accessIni.ReadIni("Settings", "LocalIP", "", filePath);
                stationName = accessIni.ReadIni("Settings", "StationName", "", filePath);
                serverIP    = accessIni.ReadIni("Settings", "ServerIP", "", filePath);
                serverPort  = 0;
                int.TryParse(accessIni.ReadIni("Settings", "ServerPort", "0", filePath), out serverPort);

                if (SVMServerCommunicate == null && cf == null)
                {
                    SVMServerCommunicate = new SVMServerCommunicate(serverIP, serverPort, localIP);
                    SVMServerCommunicate.OnNewCommand += NewCommand;
                    SVMServerCommunicate.OnNewDuty    += NewDuty;

                    cf = new CommandForm(SVMServerCommunicate);
                    cf.lb_StationName.Text = stationName;
                    cf.StartPosition       = FormStartPosition.CenterParent;
                    cf.Hide();

                    SVMServerCommunicate.SocketCreateConnect();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #2
0
 public CommandForm(SVMServerCommunicate SVMServerCommunicate)
 {
     InitializeComponent();
     this.SVMServerCommunicate              = SVMServerCommunicate;
     SVMServerCommunicate.OnNewDispatchMsg += NewDispatchMsg;
 }