示例#1
0
        private void notifyMenu_Exit_Click(object sender, EventArgs e)
        {
            try
            {
                if (mesServer != null && mesServer.State == ServerState.Running)
                {
                    if (DialogResult.Yes == MessageUtilSkin.ShowYesNoAndTips("服务正在运行,请先关闭服务."))
                    {
                        TabControl1.SelectedIndex = 0;

                        if (this.WindowState == FormWindowState.Minimized)
                        {
                            this.WindowState = FormWindowState.Maximized;
                            this.Show();
                            this.BringToFront();
                            this.Activate();
                            this.Focus();
                        }
                    }
                }
                else
                {
                    if (DialogResult.Yes == MessageUtilSkin.ShowYesNoAndTips("是否确定退出程序?"))
                    {
                        this.ShowInTaskbar = false;
                        Application.Exit();
                    }
                }
            }
            catch
            {
                // Nothing to do.
            }
        }
示例#2
0
        private void btnOpenFile_Click(object sender, EventArgs e)
        {
            string filePath = string.Empty;

            switch (tabControlLogType.SelectedIndex)
            {
            case 0:
                filePath = $@"{DirectoryUtil.GetCurrentDirectory()}\Logs\Data_{ DateTime.Now.ToString("yyyy-MM-dd")}.log";
                break;

            case 1:
                filePath = $@"{DirectoryUtil.GetCurrentDirectory()}\Logs\Heart_{ DateTime.Now.ToString("yyyy-MM-dd")}.log";
                break;
            }


            if (FileUtil.FileIsExist(filePath))
            {
                Process.Start("notepad++.exe", filePath);
            }
            else
            {
                MessageUtilSkin.ShowTips($"不存在文件:{filePath}");
            }
        }
示例#3
0
        private void tsmpMenu_Click(object sender, EventArgs e)
        {
            try
            {
                ToolStripMenuItem tsmp = sender as ToolStripMenuItem;
                if (mesServer == null)
                {
                    return;
                }
                IPEndPoint EndPoint = mesServer.Listeners[0].EndPoint;

                Frm_Msg frm = new Frm_Msg();
                frm.Text        = $"{ mesServer.Listeners[0].EndPoint} <<-- {tsmp.Text}";
                frm.txtMsg.Text = tsmp.Tag.ToString();
                frm.EndPoint    = EndPoint;
                if (frm.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageUtilSkin.ShowTips(ex.Message);
            }
        }
示例#4
0
        private void btnDebug_Click(object sender, EventArgs e)
        {
            try
            {
                isLineDebug      = true;
                btnDebug.Enabled = false;

                //初始化
                LoadProtocolFile("");
                tvProtocol.SelectedNode = null;

                lblSuccess.Text = "";
                Thread.Sleep(50);

                Protocol item = lstProtocol.Find(li => li.IsSend == false && li.ParentID != "null");
                if (!string.IsNullOrEmpty(item.Content))
                {
                    var data = Encoding.UTF8.GetBytes(item.Content + Environment.NewLine);
                    tcpClient.Send(new ArraySegment <byte>(data, 0, data.Length));
                    WriteInfo($"发送 {item.Content}");
                    item.IsSend = true;
                }
            }
            catch (Exception ex)
            {
                MessageUtilSkin.ShowError(ex.Message);
            }
        }
示例#5
0
        private void tsmItemDoc_Click(object sender, EventArgs e)
        {
            string filePath = $@"{DirectoryUtil.GetCurrentDirectory()}\Docs\MES&PLC通讯系统使用说明书.pdf";

            if (FileUtil.FileIsExist(filePath))
            {
                try
                {
                    Process.Start("FoxitReader.exe", filePath);
                }
                catch (Exception)
                {
                    Process.Start(filePath);
                }
            }
            else
            {
                MessageUtilSkin.ShowTips($"不存在文件:{filePath}");
            }
        }
示例#6
0
        private void pOPStartServerBackWork()
        {
            LoadFinish = false;
            if (m_Bootstrap == null)
            {
                MessageUtilSkin.ShowTips("数据服务器配置加载错误,请检查服务器IP,端口是否设置正确。");
                return;
            }

            StartResult startResult = m_Bootstrap.Start();

            if (startResult == StartResult.Success)
            {
                mesServer = m_Bootstrap.AppServers.Cast <MesServer>().FirstOrDefault();
            }
            else
            {
                mesServer = null;
            }
        }
示例#7
0
 private void tsmItemRestart_Click(object sender, EventArgs e)
 {
     if (mesServer != null && mesServer.State == ServerState.Running)
     {
         if (DialogResult.Yes == MessageUtilSkin.ShowYesNoAndTips("服务正在运行,请先关闭服务."))
         {
             TabControl1.SelectedIndex = 0;
             return;
         }
     }
     else
     {
         if (DialogResult.Yes == MessageUtilSkin.ShowYesNoAndTips("是否注销系统,重新登陆。"))
         {
             this.ShowInTaskbar = false;
             Application.Exit();
             Application.Restart();
             Environment.Exit(0);
         }
     }
 }
示例#8
0
        private void lnkClient_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            META_DevLinkInfo info = BLLFactory <META_DevLink> .Instance.FindSingle($"DevCode='OP010'");

            //测试
            META_ParameterInfo info2 = BLLFactory <META_Parameter> .Instance.FindSingle($"Key='WorkOrder'");

            info2.Value = "TEST002";
            BLLFactory <META_Parameter> .Instance.Update(info2, info2.ID);


            info2 = BLLFactory <META_Parameter> .Instance.FindSingle($"Key='OK_RE'");

            try
            {
                if (mesServer == null)
                {
                    MessageUtilSkin.ShowTips("请启动数据服务器.");
                    return;
                }
                TabControl1.SelectedIndex = 1;
                IPEndPoint EndPoint = mesServer.Listeners[0].EndPoint;

                Frm_Msg frm = new Frm_Msg();
                frm.Text        = $"{ EndPoint.Address}";
                frm.txtMsg.Text = string.Empty;
                frm.EndPoint    = EndPoint;
                if (frm.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageUtilSkin.ShowTips(ex.Message);
            }
        }