public CommandForm(MainForm mainform) { m_mainform = mainform; m_atc = mainform.m_atc; m_spPort = mainform.m_spPort; //m_cmdClient = mainform.m_cmdClient; InitializeComponent(); m_atc.ReceivedEventHandle = OnReceivedCommand; //try //{ //if(m_mainform.IsNetworkConnected()) //{ //m_cmdClient = new TextCmdClient(); //m_cmdClient.Host = m_mainform.m_address;// "localhost"; //m_cmdClient.Port = MainForm.COMMANDS_PORT; //m_cmdClient.OnReceivedEventHandle = m_atc.ReceivedFunc; //m_atc.SendCmd = m_cmdClient.Send; //m_atc.ReceivedEventHandle = OnReceivedCommand; //m_cmdClient.Start(); //} //else //{ //m_atc.SendCmd = m_spPort.SendData; //m_spPort.ReceivedDataHandle = m_atc.ReceivedFunc; //m_atc.ReceivedEventHandle = OnReceivedCommand; //m_mainform.m_spPort.ReceivedDataHandle = OnReceivedCommand; //} //m_sw = new System.IO.StreamWriter(System.Windows.Forms.Application.StartupPath + "\\Debug" + System.DateTime.Now.ToShortDateString() + ".log", true, Encoding.ASCII); //} //catch //{ // MessageBox.Show("Connect Error!"); // this.Close(); //} }