Example #1
0
        /// <summary>
        /// 加载当前窗口及软件版本日期
        /// </summary>
        /// <param name="fatherForm"></param>
        /// <param name="control"></param>
        /// <param name="guid"></param>
        public void OnShowDlg(Form fatherForm, Control control, string guid)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new Action <Form, Control, string>(OnShowDlg), fatherForm, control, guid);
            }
            else
            {
                this._father     = fatherForm;
                this._fatherGuid = guid;

                this.Dock            = DockStyle.Fill;
                this.TopLevel        = false;
                this.FormBorderStyle = FormBorderStyle.None;
                control.Controls.Add(this);
                this.Show();

                string er = string.Empty;

                CReflect.SendWndMethod(_father, EMessType.OnShowVersion, out er,
                                       new object[] { PROGRAM_VERSION, PROGRAM_DATE });

                loadAppSetting();
            }
        }
Example #2
0
        /// <summary>
        /// 停止监控
        /// </summary>
        public void OnStopRun()
        {
            if (MainWork.C_RUNNING)
            {
                MainWork.OnStop();

                MainWork.C_RUNNING = false;
            }

            string er = string.Empty;

            CReflect.SendWndMethod(_father, EMessType.OnShowStatus, out er, EIndicator.Idel);
        }
Example #3
0
        /// <summary>
        /// 停止监控
        /// </summary>
        public void OnStopRun()
        {
            if (MainWork != null)
            {
                MainWork.OnStop();

                MainWork.C_RUNNING = false;
            }

            string er = string.Empty;

            CReflect.SendWndMethod(_father, EMessType.OnShowStatus, out er, EIndicator.Idel);

            ShowAction(new CUIActionArgs(CLanguage.Lan("软件未启动运行,请启动软件运行."), Color.Red));
        }
Example #4
0
        /// <summary>
        /// 启动监控
        /// </summary>
        public void OnStartRun()
        {
            if (!MainWork.C_RUNNING && MainWork.C_DownLoad)
            {
                if (MainWork.OnRun())
                {
                    MainWork.C_RUNNING = true;
                }
            }

            if (MainWork.C_RUNNING)
            {
                string er = string.Empty;

                CReflect.SendWndMethod(_father, EMessType.OnShowStatus, out er, EIndicator.Auto);
            }
        }
Example #5
0
        private void menuEnglish_Click(object sender, EventArgs e)
        {
            ChangeLanguage(CLanguage.EL.英语);

            string er = string.Empty;

            foreach (string key in _childFormList.Keys)
            {
                Form childForm = (Form)_childFormList[key];

                if (!CReflect.SendWndMethod(childForm, EMessType.OnChangeLAN, out er, null))
                {
                    MessageBox.Show(er, "消息机制", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
            }
        }
Example #6
0
        private void exit()
        {
            if (MessageBox.Show("确定要退出系统?", "退出系统",
                                MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                string er = string.Empty;

                if (selObj != null)
                {
                    if (!CReflect.SendWndMethod((Form)selObj, EMessType.OnCloseDlg, out er, null))
                    {
                        MessageBox.Show(er, "消息机制", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }

                Application.Exit();
            }
        }
Example #7
0
        /// <summary>
        /// 启动监控
        /// </summary>
        public void OnStartRun()
        {
            if (!MainWork.C_RUNNING && MainWork.C_DownLoad)
            {
                if (MainWork.OnRun())
                {
                    MainWork.C_RUNNING = true;
                }
            }

            if (MainWork.C_RUNNING)
            {
                string er = string.Empty;

                CReflect.SendWndMethod(_father, EMessType.OnShowStatus, out er, EIndicator.Auto);

                ShowAction(new CUIActionArgs(CLanguage.Lan("软件已启动,等待系统检测状态"), Color.Black));
            }
        }
Example #8
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show(CLanguage.Lan("确定要保存系统参数设置?"), "Tip", MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    save();

                    string er = string.Empty;

                    CReflect.SendWndMethod(_father, EMessType.OnMessage, out er, new object[] { "btnOK", (int)ElPara.保存, 0 });

                    CUserApp.OnUserArgs.OnEvented(new CUserArgs("FrmSysPara", (int)ElPara.保存, 0));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Example #9
0
        /// <summary>
        /// 显示运行状态
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnIndicator(object sender, CUIInicatorArgs e)
        {
            string er = string.Empty;

            CReflect.SendWndMethod(_father, EMessType.OnShowStatus, out er, e.status);
        }
Example #10
0
        private void btnExit_Click(object sender, EventArgs e)
        {
            string er = string.Empty;

            CReflect.SendWndMethod(_father, EMessType.OnMessage, out er, new object[] { "btnExit", (int)ElPara.退出, 0 });
        }
Example #11
0
        /// <summary>
        /// 加载测试工位
        /// </summary>
        private void loadChildForm(string dlgName, Control fatherControl)
        {
            try
            {
                string er = string.Empty;

                if (selObj != null)
                {
                    if (!CReflect.SendWndMethod((Form)selObj, EMessType.OnCloseDlg, out er, null))
                    {
                        MessageBox.Show(er, "消息机制", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }

                selObj = null;

                string dlgFullName = "GJ.TOOL.Frm" + dlgName;

                string[] fileNames = Directory.GetFiles(Application.StartupPath);

                foreach (string file in fileNames)
                {
                    string fileName = Path.GetFileName(file);

                    if ((fileName.ToUpper().StartsWith("GJ")) && fileName.ToUpper().EndsWith(".DLL"))
                    {
                        try
                        {
                            //载入dll
                            Assembly asb = Assembly.LoadFrom(file);

                            Type[] types = asb.GetTypes();

                            foreach (Type t in types)
                            {
                                if (t.GetInterface("IChildMsg") != null)
                                {
                                    if (t.FullName == dlgFullName)
                                    {
                                        selObj = asb.CreateInstance(t.FullName);
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.ToString());
                            return;
                        }
                    }
                }
                if (selObj == null)
                {
                    //MessageBox.Show("加载动态库" + dlgFullName + "失败");
                    return;
                }

                Type type = selObj.GetType();

                MethodInfo OnWndDlg = type.GetMethod("OnShowDlg");

                if (OnWndDlg != null)
                {
                    foreach (Control obj in fatherControl.Controls)
                    {
                        fatherControl.Controls.Remove(obj);
                        obj.Dispose();
                    }

                    OnWndDlg.Invoke(selObj, new object[] { this, fatherControl, dlgName });
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }