Exemple #1
0
 private void ListenToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (listenForm.IsDisposed != true)
     {
         listenForm.Show();  //弹出这个窗口
         listenForm.Focus(); //激活显示
     }
     else
     {
         listenForm = new ListenForm();
         listenForm.Show();  //弹出这个窗口
         listenForm.Focus(); //激活显示
     }
 }
Exemple #2
0
        /// <summary>
        /// Shows the filter.
        /// </summary>
        /// <param name="opt">The opt.</param>
        public void ShowListen(UserControlsOpts opt)
        {
            rightContainer.Controls.Clear();
            UserControl control = null;

            if (windowFormControls.ContainsKey(opt))
            {
                windowFormControls.TryGetValue(opt, out control);
            }
            if (control != null && !control.IsDisposed)
            {
                listenForm = control as ListenForm;
                this.rightContainer.Controls.Add(control);
            }
            else
            {
                listenForm = new ListenForm(this);
                this.rightContainer.Controls.Add(listenForm);
                windowFormControls.Add(opt, listenForm);
            }
            SetListenBg();
        }
Exemple #3
0
        private void MDIParent1_Load(object sender, EventArgs e)
        {
            //初始化系统参数
            XmlHelper.InitDebug();

            int delay = 30;

            UdpSever.Shell.WriteNotice(delay, "系统消息", "系统启动...");
            UdpSever.Shell.WriteNotice(delay, "系统消息", "加载调试信息...");

            UdpSever.Shell.WriteNotice(delay, "系统消息", "获取本机IP...");


            UdpSever.Shell.WriteNotice(delay, "系统消息", "加载服务器配置...");

            UdpSever.Shell.WriteLine(delay, "[服务器][服务器地址][ServerAddress][{0}]", UdpSever.ServerAddress);
            UdpSever.Shell.WriteLine(delay, "[服务器][设备数][DeviceNum][{0}]", UdpSever.DeviceNum);
            UdpSever.Shell.WriteLine(delay, "[服务器][寄存器数][RegisterNum][{0}]", UdpSever.RegisterNum);
            UdpSever.Shell.WriteLine(delay, "[服务器][单帧数据长度][FrameLen][{0}]", UdpSever.FrameLen);
            UdpSever.Shell.WriteLine(delay, "[服务器][心跳周期][HeartCycle][{0}]秒", UdpSever.HeartCycle);
            UdpSever.Shell.WriteLine(delay, "[服务器][重发次数][RepeatNum][{0}]", UdpSever.RepeatNum);
            UdpSever.Shell.WriteLine(delay, "[服务器][超时时间][ResponseTimeout][{0}]", UdpSever.ResponseTimeout);
            UdpSever.Shell.WriteLine(delay, "[服务器][响应帧缓冲池容量][RESPONSE_MAX_LEN][{0}]", UdpSever.RESPONSE_MAX_LEN);
            UdpSever.Shell.WriteLine(delay, "[服务器][设备总数][DeviceNum][{0}]\r\n", UdpSever.DeviceNum);

            #region 获取本机IP,自动开启服务器
            string      name      = Dns.GetHostName();
            IPAddress[] ipadrlist = Dns.GetHostAddresses(name);
            foreach (IPAddress ipa in ipadrlist)
            {
                if (ipa.AddressFamily == AddressFamily.InterNetwork)
                {
                    UdpSever.Shell.WriteNotice(delay, "系统消息", "本机IP:[{0}]", ipa.ToString());
                    UdpSever.ipaddress = ipa;
                }
            }
            //自动启动服务器
            UdpSever.Resault rs = UdpSever.Start();
            //更新界面
            udpConfigForm_MyEvent();
            #endregion


            treeView1.Nodes.Clear();

            try
            {
                if (listenForm.IsDisposed != true)
                {
                    listenForm.Show();  //弹出这个窗口
                    listenForm.Focus(); //激活显示
                }
                else
                {
                    listenForm = new ListenForm();
                    listenForm.Show();  //弹出这个窗口
                    listenForm.Focus(); //激活显示
                }
            }
            catch
            {
            }
        }