public Form1() { InitializeComponent(); MyCall += new u2ec.OnChangeDevList(Form1_MyCall); u2ec.SetCallBackOnChangeDevList(MyCall); //u2ec.SetCallBackOnChangeDevList(this.ChangeDevList); }
public SwitchCoreServer() { InitializeComponent(); MyCall += new u2ec.OnChangeDevList(SwitchCoreServer_MyCall); u2ec.SetCallBackOnChangeDevList(MyCall); syspath = Environment.CurrentDirectory + "\\config.ini"; licf = new LoadIniConfigFile(syspath); Trace.WriteLine("Load Syspath configpath.ini file status is:--- --- " + licf.initConfig().ToString()); heartbeat = new Heartbeat(licf.Ic.Heartbeat.Hbpath); //获取所有的共享设备 showshared(); //判断是否有共享的设备,如果没有共享的设备,则判断是否配置文件有配置端口,如果有则开放该接口共享 if (lssharedport.Count < 1) { if (!licf.Ic.Server.Port.Equals(0)) { u2ec.ClientAddRemoteDevManually(licf.Ic.Server.Port.ToString()); showshared(); int SelectedIndex = 0; u2ec.ClientStartRemoteDev(HandleClient, SelectedIndex, true, ""); } else { MessageBox.Show("connect error,system config is null"); } } txt_port_stat.Text = "没有监听的接口状态"; for (int i = 0; i < lssharedport.Count; i++) { if (getPortStat(i).Split('/')[1].Equals(licf.Ic.Server.Port.ToString())) { txt_port_stat.Text = getPortStat(i); txt_connectcontext.Text = lssharedport[i]; } } //进入正常运行,判断端口状态 //监控程序运行 SwitchCoreServer_MyCall(); Console.WriteLine("System start finished in" + DateTime.Now.ToString()); Trace.WriteLine("System start finished in" + DateTime.Now.ToString()); }
public SmallAnt() { InitializeComponent(); //绑定设备变化监控操作过程接口 MyCall += new u2ec.OnChangeDevList(OnChangeDevList_MyCall); u2ec.SetCallBackOnChangeDevList(MyCall); //设置本地系统配置文件路径 syspath = Environment.CurrentDirectory + "\\config.ini"; //加载系统配置文件 licf = new LoadIniConfigFile(syspath); Trace.WriteLine("Load Syspath configpath.ini file status is:--- " + DateTime.Now.ToString() + " --- " + licf.initConfig().ToString()); //端口在这里,还是单机单端口版本 lbl_confport.Text = licf.Ic.Server.Port.ToString(); //初始化其余端口状态数值 lbl_kpDelay.Text = licf.Ic.Delay.Time.ToString(); lbl_listenport.Text = licf.Ic.Listen.Port.ToString(); this.Text = this.Text + "【" + licf.Ic.Heartbeat.Nsrsbh + ":" + licf.Ic.Heartbeat.Kjh + "】"; connectingLock = cb_waitclock.Checked; //心跳机制 heartbeat = new Heartbeat(licf.Ic.Heartbeat.Hbpath); //刷新显示目前所有共享设备状态 showshared(); /// /// 判断是否有共享的设备,如果没有共享的设备,则判断是否配置文件有配置端口 /// 如果有端口则开放该端口进行共享 /// 这里有逻辑问题!!!!!! /// if (lssharedport.Count < 1) { if (!licf.Ic.Server.Port.Equals(0)) { u2ec.ClientAddRemoteDevManually(licf.Ic.Server.Port.ToString()); showshared(); int SelectedIndex = 0; u2ec.ClientStartRemoteDev(HandleClient, SelectedIndex, true, ""); } else { Trace.WriteLine("init connect error,system config ini file is has null value"); MessageBox.Show(small_ant.Properties.Resources.iniPortError, small_ant.Properties.Resources.errorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); } } lbl_port_stat.Text = "没有监听的接口状态"; for (int i = 0; i < lssharedport.Count; i++) { btn_getstatus_Click(i, null); if (statusfull.Split('/')[1].Equals(licf.Ic.Server.Port.ToString())) { lbl_port_stat.Text = statusfull; lbl_connectcontext.Text = lssharedport[i]; } } //进入正常运行,判断端口状态 //监控程序运行 OnChangeDevList_MyCall(); }