private void TcpWatcherForm_Load(object sender, EventArgs e) { ServerConfig config = ServerConfig.GetConfig(); if (config == null) { MessageBoxHelper.Show("请先设置监听端口!"); return; } if (config != null && config.DefaultOpen) { this.Start(); } }
private void TcpServerConfig_Load(object sender, EventArgs e) { ServerConfig config = ServerConfig.GetConfig(); if (config != null) { this.cbDefaultStart.Checked = config.DefaultOpen; this.txtIp.Text = config.Ip; this.txtPort.Text = config.Port.ToString(); } else { this.txtIp.Text = HardwareManager.GetDefaultIp(); } }
/// <summary> /// 供所有程序启动时候调用,如果设置为自动打开,则默认打开,注意先设置MsgHandle /// </summary> public static void InitFirst() { ServerConfig config = ServerConfig.GetConfig(); if (config != null && config.DefaultOpen) { if (msgHandle == null) { MessageBoxHelper.Show("请先调用InitMsgHandle设置消息接收处理委托!"); return; } watcher = new TcpWatcherForm(msgHandle); watcher.Show(); watcher.Hide(); //System.Threading.Thread.Sleep(200); // watcher.Start(); } }
/// <summary> /// 启动监听,配置根据ServerConfig来 /// </summary> public override void Start() { this.Start(ServerConfig.GetConfig()); }