Example #1
0
 private void button4_Click(object sender, EventArgs e)
 {
     FrmTips.ShowTipsError(this, "Error提示信息");
     FrmTips.ShowTipsInfo(this, "Info提示信息");
     FrmTips.ShowTipsSuccess(this, "Success提示信息");
     FrmTips.ShowTipsWarning(this, "Warning提示信息");
 }
Example #2
0
        private void tvMenu_AfterSelect(object sender, TreeViewEventArgs e)
        {
            panControl.Controls.Clear();
            string strName = e.Node.Text.Trim();

            this.Title = "HZHControls控件库DEMO--" + strName;
            switch (strName)
            {
            case "关于授权":
                AddControl(new UCShouQuan());
                break;

                #region 窗体    English:forms
            case "提示窗体":
                if (FrmDialog.ShowDialog(this, "是否再显示一个没有取消按钮的提示框?", "模式窗体测试", true) == System.Windows.Forms.DialogResult.OK)
                {
                    FrmDialog.ShowDialog(this, "这是一个没有取消按钮的提示框", "模式窗体测试");
                }
                break;

            case "多输入窗体":
                FrmInputs frm = new FrmInputs("动态多输入窗体测试",
                                              new string[] { "姓名", "电话", "身份证号", "住址" },
                                              new Dictionary <string, HZH_Controls.TextInputType>()
                {
                    { "电话", HZH_Controls.TextInputType.Regex }, { "身份证号", HZH_Controls.TextInputType.Regex }
                },
                                              new Dictionary <string, string>()
                {
                    { "电话", "^1\\d{0,10}$" }, { "身份证号", "^\\d{0,18}$" }
                },
                                              new Dictionary <string, KeyBoardType>()
                {
                    { "电话", KeyBoardType.UCKeyBorderNum }, { "身份证号", KeyBoardType.UCKeyBorderNum }
                },
                                              new List <string>()
                {
                    "姓名", "电话", "身份证号"
                });
                frm.ShowDialog(this);
                break;

            case "气泡提示窗体":
                FrmTips.ShowTipsError(this, "Error提示信息");
                FrmTips.ShowTipsInfo(this, "Info提示信息");
                FrmTips.ShowTipsSuccess(this, "Success提示信息");
                FrmTips.ShowTipsWarning(this, "Warning提示信息");
                FrmTips.ShowTips(this, "自定义提示信息", 2000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Medium, new Size(300, 50), TipsState.Success);
                break;

            case "有返回的窗体":
                new FrmTestFrmBack().ShowDialog(this);
                break;

            case "等待窗体":
                ControlHelper.ThreadRunExt(this, () =>
                {
                    Thread.Sleep(5000);
                    ControlHelper.ThreadInvokerControl(this, () =>
                    {
                        FrmTips.ShowTipsSuccess(this, "FrmWaiting测试");
                    });
                }, null, this);
                break;

            case "仅有标题的窗体":
                new FrmWithTitleTest().ShowDialog(this);
                break;

            case "确定取消窗体1":
                new FrmOKCancel1Test().ShowDialog(this);
                break;

            case "确定取消窗体2":
                new FrmOKCancel2Test().ShowDialog(this);
                break;

            case "资源加载窗体":
                FrmTestLoading frmLoading = new FrmTestLoading();
                frmLoading.BackgroundWorkAction = delegate()
                {
                    try
                    {
                        frmLoading.CurrentMsg = new KeyValuePair <int, string>(1, "正在初始化配置...");
                        Thread.Sleep(1000);
                        frmLoading.CurrentMsg = new KeyValuePair <int, string>(10, "正在加载第一个资源...");
                        Thread.Sleep(1000);
                        frmLoading.CurrentMsg = new KeyValuePair <int, string>(20, "正在加载第二个资源...");
                        Thread.Sleep(1000);
                        frmLoading.CurrentMsg = new KeyValuePair <int, string>(30, "正在加载第三个资源...");
                        Thread.Sleep(1000);
                        frmLoading.CurrentMsg = new KeyValuePair <int, string>(40, "正在加载第四个资源...");
                        Thread.Sleep(1000);
                        frmLoading.CurrentMsg = new KeyValuePair <int, string>(50, "正在加载第五个资源...");
                        Thread.Sleep(1000);
                        frmLoading.CurrentMsg = new KeyValuePair <int, string>(60, "正在加载第六个资源...");
                        Thread.Sleep(1000);
                        frmLoading.CurrentMsg = new KeyValuePair <int, string>(70, "正在加载第七个资源...");
                        Thread.Sleep(1000);
                        frmLoading.CurrentMsg = new KeyValuePair <int, string>(80, "正在加载第八个资源...");
                        Thread.Sleep(1000);
                        frmLoading.CurrentMsg = new KeyValuePair <int, string>(90, "正在加载第九个资源...");
                        Thread.Sleep(1000);
                        frmLoading.CurrentMsg = new KeyValuePair <int, string>(1000, "数据加载完成...");
                        Thread.Sleep(1000);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("加载资源时出现错误");
                    }
                };
                frmLoading.ShowDialog();
                break;
                #endregion

                #region 控件    English:control
            case "表单控件":
                AddControl(new UC.UCTestForms());
                break;

            case "按钮":
                AddControl(new UC.UCTestBtns());
                break;

            case "选项卡":
                AddControl(new UC.UCTestTab());
                break;

            case "树":
                AddControl(new UC.UCTestTreeview()
                {
                    Dock = DockStyle.Left
                });
                break;

            case "列表":
                AddControl(new UC.UCTestList()
                {
                    Dock = DockStyle.Left
                });
                break;

            case "平铺列表":
                AddControl(new UC.UCTestListView()
                {
                    Dock = DockStyle.Fill
                });
                break;

            case "垂直导航":
                AddControl(new UC.UCTestMenu()
                {
                    Dock = DockStyle.Left
                });
                break;

            case "横向列表":
                AddControl(new UC.UCTestHorizontalList());
                break;

            case "分页控件":
                AddControl(new UC.UCTestPage());
                break;

            case "表格":
                AddControl(new UC.UCTestGridTable());
                break;

            case "表格-自定义单元格":
                AddControl(new UC.UCTestGridTableCustom());
                break;

            case "树表格":
                AddControl(new UC.UCTestTreeGridTable());
                break;

            case "进度条":
                AddControl(new UC.UCTestProcess()
                {
                    Dock = DockStyle.Fill
                });
                break;

            case "步骤控件":
                AddControl(new UC.UCTestStep()
                {
                    Dock = DockStyle.Fill
                });
                break;

            case "面包屑导航":
                AddControl(new UC.UCTestNavigation()
                {
                    Dock = DockStyle.Fill
                });
                break;

            case "文字提示":
                AddControl(new UC.UCTestTips()
                {
                    Dock = DockStyle.Fill
                });
                break;

            case "滚动文字":
                AddControl(new UC.UCTestRollText()
                {
                    Dock = DockStyle.Fill
                });
                break;

            case "滑块":
                AddControl(new UC.UCTestTrackbar()
                {
                    Dock = DockStyle.Fill
                });
                break;

            case "水波":
                AddControl(new UC.UCTestWave()
                {
                    Dock = DockStyle.Fill
                });
                break;

            case "有标题的面板":
                AddControl(new UC.UCTestPanelTitle()
                {
                    Dock = DockStyle.Left
                });
                break;

            case "图标":
                AddControl(new UC.UCTestIcon()
                {
                    Dock = DockStyle.Fill
                });
                break;

            case "滚动条":
                AddControl(new UC.UCTestScrollbar()
                {
                    Dock = DockStyle.Fill
                });
                break;

            case "控件水印":
                AddControl(new UC.UCTestGraphicalOverlay());
                break;

            case "表单验证":
                AddControl(new UC.UCTestVerification()
                {
                    Dock = DockStyle.Fill
                });
                break;

            case "图片采样控件":
                AddControl(new UC.UCTestSampling());
                break;

            case "倒影":
                AddControl(new UC.UCTestShadow());
                break;

            case "内置颜色":
                AddControl(new UC.UCTestColors());
                break;

            case "导航菜单":
                AddControl(new UC.UCTestNavigationMenu());
                break;

            case "扩展导航菜单":
                AddControl(new UC.UCTestNavigationMenuExt());
                break;

            case "类Office导航菜单":
                AddControl(new UC.UCTestNavigationMenuOffice());
                break;

            case "分割线标签":
                AddControl(new UC.UCTestSplitLabel());
                break;

            case "时间轴":
                AddControl(new UC.UCTestTimeLine()
                {
                    Dock = DockStyle.Fill
                });
                break;

            case "穿梭框":
                AddControl(new UC.UCTestTransfer());
                break;

            case "引用区块":
                AddControl(new UC.UCTestPanelQuote());
                break;

            case "右键菜单":
                AddControl(new UC.UCTestContextMenu());
                break;
                #endregion

                #region 图表    English:Chart
            case "组织结构图":
                AddControl(new UC.UCTestMindMapping()
                {
                    Dock = DockStyle.Fill
                });
                break;

            case "滚动图表":
                AddControl(new UC.UCTestWaveChart()
                {
                    Dock = DockStyle.Fill
                });
                break;

            case "雷达图":
                AddControl(new UC.UCTestRadarChart()
                {
                    Dock = DockStyle.Fill
                });
                break;

            case "金字塔图":
                AddControl(new UC.UCTestFunnelChart());
                break;

            case "Live Charts":
                AddControl(new UC.UCTestLiveCharts());
                break;
                #endregion

                #region 工业    English:Industry
            case "LED文字":
                AddControl(new UC.UCTestLED()
                {
                    Dock = DockStyle.Fill
                });
                break;

            case "仪表":
                AddControl(new UC.UCTestMeter());
                break;

            case "管道":
                AddControl(new UC.UCTestConduit());
                break;

            case "阀门":
                AddControl(new UC.UCTestValve());
                break;

            case "鼓风机":
                AddControl(new UC.UCTestBlower());
                break;

            case "传送带":
                AddControl(new UC.UCTestConveyor());
                break;

            case "警示灯":
                AddControl(new UC.UCTestSignalLamp());
                break;

            case "箭头":
                AddControl(new UC.UCTestArrow());
                break;

            case "温度计":
                AddControl(new UC.UCTestThermometer());
                break;

            case "转子":
                AddControl(new UC.UCTestRotor());
                break;

            case "多通道转盘":
                AddControl(new UC.UCTestDialAisle());
                break;

            case "转盘":
                AddControl(new UC.UCTestTurntable());
                break;
                #endregion
            }
        }
Example #3
0
        private void tvMenu_AfterSelect(object sender, TreeViewEventArgs e)
        {
            panControl.Controls.Clear();
            string strName = e.Node.Text.Trim();

            switch (strName)
            {
                #region 窗体    English:forms
            case "提示窗体":
                if (FrmDialog.ShowDialog(this, "是否再显示一个没有取消按钮的提示框?", "模式窗体测试", true) == System.Windows.Forms.DialogResult.OK)
                {
                    FrmDialog.ShowDialog(this, "这是一个没有取消按钮的提示框", "模式窗体测试");
                }
                break;

            case "多输入窗体":
                FrmInputs frm = new FrmInputs("动态多输入窗体测试",
                                              new string[] { "姓名", "电话", "身份证号", "住址" },
                                              new Dictionary <string, HZH_Controls.TextInputType>()
                {
                    { "电话", HZH_Controls.TextInputType.Regex }, { "身份证号", HZH_Controls.TextInputType.Regex }
                },
                                              new Dictionary <string, string>()
                {
                    { "电话", "^1\\d{0,10}$" }, { "身份证号", "^\\d{0,18}$" }
                },
                                              new Dictionary <string, KeyBoardType>()
                {
                    { "电话", KeyBoardType.UCKeyBorderNum }, { "身份证号", KeyBoardType.UCKeyBorderNum }
                },
                                              new List <string>()
                {
                    "姓名", "电话", "身份证号"
                });
                frm.ShowDialog(this);
                break;

            case "气泡提示窗体":
                FrmTips.ShowTipsError(this, "Error提示信息");
                FrmTips.ShowTipsInfo(this, "Info提示信息");
                FrmTips.ShowTipsSuccess(this, "Success提示信息");
                FrmTips.ShowTipsWarning(this, "Warning提示信息");
                FrmTips.ShowTips(this, "自定义提示信息", 2000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Medium, new Size(300, 50), TipsState.Success);
                break;

            case "有返回的窗体":
                new FrmTestFrmBack().ShowDialog(this);
                break;

            case "等待窗体":
                ControlHelper.ThreadRunExt(this, () =>
                {
                    Thread.Sleep(5000);
                    ControlHelper.ThreadInvokerControl(this, () =>
                    {
                        FrmTips.ShowTipsSuccess(this, "FrmWaiting测试");
                    });
                }, null, this);
                break;

            case "仅有标题的窗体":
                new FrmWithTitleTest().ShowDialog(this);
                break;

            case "确定取消窗体1":
                new FrmOKCancel1Test().ShowDialog(this);
                break;

            case "确定取消窗体2":
                new FrmOKCancel2Test().ShowDialog(this);
                break;
                #endregion

                #region 控件    English:control
            case "表单控件":
                AddControl(new UC.UCTestForms());
                break;

            case "按钮":
                AddControl(new UC.UCTestBtns());
                break;

            case "选项卡":
                AddControl(new UC.UCTestTab());
                break;

            case "树":
                AddControl(new UC.UCTestTreeview()
                {
                    Dock = DockStyle.Left
                });
                break;

            case "列表":
                AddControl(new UC.UCTestList()
                {
                    Dock = DockStyle.Left
                });
                break;

            case "平铺列表":
                AddControl(new UC.UCTestListView()
                {
                    Dock = DockStyle.Fill
                });
                break;

            case "垂直导航":
                AddControl(new UC.UCTestMenu()
                {
                    Dock = DockStyle.Left
                });
                break;

            case "横向列表":
                AddControl(new UC.UCTestHorizontalList());
                break;

            case "分页控件":
                AddControl(new UC.UCTestPage());
                break;

            case "表格":
                AddControl(new UC.UCTestGridTable()
                {
                    Dock = DockStyle.Fill
                });
                break;

            case "树表格":
                AddControl(new UC.UCTestTreeGridTable()
                {
                    Dock = DockStyle.Fill
                });
                break;

            case "进度条":
                AddControl(new UC.UCTestProcess()
                {
                    Dock = DockStyle.Fill
                });
                break;

            case "步骤控件":
                AddControl(new UC.UCTestStep()
                {
                    Dock = DockStyle.Fill
                });
                break;

            case "面包屑导航":
                AddControl(new UC.UCTestNavigation()
                {
                    Dock = DockStyle.Fill
                });
                break;

            case "文字提示":
                AddControl(new UC.UCTestTips()
                {
                    Dock = DockStyle.Fill
                });
                break;

            case "滚动文字":
                AddControl(new UC.UCTestRollText()
                {
                    Dock = DockStyle.Fill
                });
                break;

            case "滑块":
                AddControl(new UC.UCTestTrackbar()
                {
                    Dock = DockStyle.Fill
                });
                break;

            case "水波":
                AddControl(new UC.UCTestWave()
                {
                    Dock = DockStyle.Fill
                });
                break;

            case "有标题的面板":
                AddControl(new UC.UCTestPanelTitle()
                {
                    Dock = DockStyle.Left
                });
                break;

            case "图标":
                AddControl(new UC.UCTestIcon()
                {
                    Dock = DockStyle.Fill
                });
                break;

                #endregion

                #region 图表    English:Chart
            case "组织结构图":
                AddControl(new UC.UCTestMindMapping()
                {
                    Dock = DockStyle.Fill
                });
                break;

            case "柱状图":
                AddControl(new UC.UCTestBarcharts());
                break;

            case "滚动图表":
                AddControl(new UC.UCTestWaveChart()
                {
                    Dock = DockStyle.Fill
                });
                break;
                #endregion

                #region 工业    English:Industry
            case "LED文字":
                AddControl(new UC.UCTestLED()
                {
                    Dock = DockStyle.Fill
                });
                break;

            case "仪表":
                AddControl(new UC.UCTestMeter());
                break;

            case "管道":
                AddControl(new UC.UCTestConduit());
                break;

            case "阀门":
                AddControl(new UC.UCTestValve());
                break;

            case "鼓风机":
                AddControl(new UC.UCTestBlower());
                break;

            case "传送带":
                AddControl(new UC.UCTestConveyor());
                break;

            case "警示灯":
                AddControl(new UC.UCTestSignalLamp());
                break;

            case "箭头":
                AddControl(new UC.UCTestArrow());
                break;

            case "温度计":
                AddControl(new UC.UCTestThermometer());
                break;
                #endregion
            }
        }
Example #4
0
 private void ucBtnExt5_BtnClick(object sender, EventArgs e)
 {
     LISLogBox.Clear();
     FrmTips.ShowTipsInfo(this, "清除LIS通信日志");
 }
Example #5
0
 private void ucBtnExt4_BtnClick(object sender, EventArgs e)
 {
     MacLogBox.Clear();
     FrmTips.ShowTipsInfo(this, "清除仪器通信日志");
 }
Example #6
0
        private void DM_Load(object sender, EventArgs e)
        {
            Properties.Settings.Default.StartTime = DateTime.Now;
            label7.Text                     = Assembly.GetExecutingAssembly().GetName().Version.ToString();
            this.MaximizeBox                = false;
            this.MinimumSize                = new Size(280, 563);
            this.Size                       = new Size(280, 563);
            this.FormBorderStyle            = FormBorderStyle.FixedSingle;
            splitContainer1.Panel1Collapsed = true;
            if (!System.IO.File.Exists(Application.StartupPath + "/Config.mdb"))
            {
                FrmTips.ShowTipsInfo(this, "检测不到中继数据库,正在生成,请稍候");
                //MessageBox.Show("检测不到数据库,自动生成,请重启程序后使用", "数据传输中继");
                byte[] config = Properties.Resources.Config;
                System.IO.File.WriteAllBytes(Application.StartupPath + "/Config.mdb", config);
                System.Diagnostics.Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location);
                System.Environment.Exit(0);
            }
            try
            {
                string      path = Application.ExecutablePath;
                RegistryKey rk   = Registry.LocalMachine;
                RegistryKey rk2  = rk.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run");
                string[]    rest = rk2.GetValueNames();
                foreach (string line in rest)
                {
                    if (line == "JcShutdown")
                    {
                        设为开机启动ToolStripMenuItem.Checked = true;
                    }
                }
            }
            catch (Exception ex)
            {
                FrmTips.ShowTipsWarning(this, "请使用管理员模式运行");
                //MessageBox.Show(ex.Message, "请使用管理员模式运行本程序");
            }
            if (Properties.Settings.Default.LogsReserve != "0")
            {
                LogsCleaningTimer.Start();
            }
            CleaningTimer.Start();
            LogPathTimer.Start();
            TransModuleRefresh.Start();
            LogPathTimer_Tick(null, null);
            try
            {
                fsw = new FileStream(logpath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite);
            }
            catch (Exception ex)
            {
                FrmDialog.ShowDialog(this, "写日志线程异常:" + ex.Message);
            }
            LogPrint("*************************************", 2);
            LogPrint("正在启动LIS系统网口仪器中继程序", 2);
            LogPrint("*************************************", 2);
            try
            {
                MachineName.Text               = Properties.Settings.Default.MachineName;
                MenuMachineName.Text           = "仪器:" + Properties.Settings.Default.MachineName;
                this.Text                      = Properties.Settings.Default.ProgramName;
                this.NotifyIcon.Text           = Properties.Settings.Default.ProgramName;
                this.NotifyIcon.BalloonTipText = Properties.Settings.Default.ProgramName;
                desktopenter                   = Properties.Settings.Default.ShortcutName;
                CleaningTimer.Interval         = int.Parse(Properties.Settings.Default.CleaningTimer);
                TransModuleRefresh.Interval    = int.Parse(Properties.Settings.Default.ApplyTimer);
                lisport            = Properties.Settings.Default.LISport.ToString();
                ConnectWay         = byte.Parse(Properties.Settings.Default.ConnectWay);
                serialportno       = Properties.Settings.Default.SerialPortNo.ToString();
                serialbaudrate     = Properties.Settings.Default.SerialBaudRate;
                serialparitycheck  = Properties.Settings.Default.SerialParityCheck;
                serialdatabit      = Properties.Settings.Default.SerialDataBit;
                serialstopbit      = Properties.Settings.Default.SerialStopBit;
                filenameextension  = Properties.Settings.Default.FileNameExtension;
                filepath           = Properties.Settings.Default.FilePath;
                filewritepath      = Properties.Settings.Default.FileWritePath;
                filewriteextension = Properties.Settings.Default.FileWriteExtension;
                clientport         = Properties.Settings.Default.ClientPort.ToString();
                serverport         = Properties.Settings.Default.ServerPort.ToString();
                timesleep          = int.Parse(Properties.Settings.Default.ClientTimer);
                FileTimer.Interval = int.Parse(Properties.Settings.Default.FileTimer);
                clientip           = IPAddress.Parse(Properties.Settings.Default.ClientIP.Replace(" ", ""));
            }
            catch (Exception ex)
            {
                FrmTips.ShowTipsError(this, "服务启动错误:" + ex.Message);
            }
            LogPrint("LIS连接IP:" + ip.ToString(), 0);
            LogPrint("LIS连接端口:" + lisport, 0);
            ConfigConsole terminal = new ConfigConsole(fsw);

            threadlis = new Thread(WaitLIS);
            threadlis.Start();
            terminal.start();

            ClearMemoryInfo.FlushMemory();

            switch (ConnectWay)
            {
            case 0:
                LogPrint("仪器连接方式:客户端连接", 1);
                LogPrint("仪器连接IP端口:" + ip + ":" + serverport, 1);
                threadmac = new Thread(WaitMac);
                threadmac.Start();
                LogPrint("*************************************", 2);
                break;

            case 1:
                LogPrint("仪器连接方式:服务端监听", 1);
                LogPrint("仪器监听IP端口:" + clientip + ":" + clientport, 1);
                threadmac = new Thread(ConnMac);
                threadmac.Start();
                LogPrint("*************************************", 2);
                break;

            case 2:
                LogPrint("仪器连接方式:串口连接", 1);
                LogPrint("仪器连接串口号:" + serialportno, 1);
                LogPrint("波特率:" + serialbaudrate, 1);
                LogPrint("校验:" + serialparitycheck, 1);
                LogPrint("数据位:" + serialdatabit, 1);
                LogPrint("停止位:" + serialstopbit, 1);
                LogPrint("RTS/CTS:" + Properties.Settings.Default.SerialRTSEnable, 1);
                threadmac = new Thread(SerialPort);
                threadmac.Start();
                LogPrint("*************************************", 2);
                break;

            case 3:
                LogPrint("仪器连接方式:读文件", 1);
                LogPrint("仪器数据目录:" + filepath + "\\*." + filenameextension, 1);
                LogPrint("写入数据目录:" + filewritepath + "\\*." + filewriteextension, 1);
                FileTimer.Start();
                ucWave1.WaveColor = Color.FromArgb(0, 155, 144);

                if (Properties.Settings.Default.FileConnectLIS)
                {
                    LogPrint("链接Cache模式", 1);
                    MACIP.Text = "读文件(链接Cache)模式";
                    Properties.Settings.Default.MacStatus = "读文件(链接Cache)模式";
                    string ret = operat.Login(Properties.Settings.Default.CacheHost, int.Parse(Properties.Settings.Default.CachePort), Properties.Settings.Default.CacheNamespace, Properties.Settings.Default.CacheUserID, Properties.Settings.Default.CachePassword);
                    if (ret == "Login Cache OK")
                    {
                        LogPrint("登录LIS数据库成功", 1);
                    }
                    else
                    {
                        LogPrint("登录LIS数据库失败:" + ret.Split(':')[1], 1);
                        FileTimer.Stop();
                        ucWave1.WaveColor = Color.FromArgb(255, 77, 59);
                    }
                }
                else
                {
                    LogPrint("转网络传输模式", 1);
                    MACIP.Text = "读文件(转网络)模式";
                    Properties.Settings.Default.MacStatus = "读文件(转网络)模式";
                }
                LogPrint("*************************************", 2);
                break;
            }
        }
Example #7
0
 private void 清空窗口日志ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     LISLogBox.Clear();
     MacLogBox.Clear();
     FrmTips.ShowTipsInfo(this, "清除日志窗口");
 }