示例#1
0
        /// <summary>
        /// 界面控制事件
        /// </summary>
        /// <param name="eventname">事件名称</param>
        /// <param name="objs">参数数组</param>
        /// <returns></returns>
        public virtual object UI_ControllerEvent(string eventname, params object[] objs)
        {
            try
            {
                switch (eventname)
                {
                case "Show":
                    if (objs.Length > 0)
                    {
                        Form form = null;
                        if (objs[0] is String)
                        {
                            form = iBaseView[objs[0].ToString()] as Form;
                        }
                        else
                        {
                            form = objs[0] as Form;
                        }

                        if (objs.Length == 1)
                        {
                            string tabName = form.Text;
                            string tabId   = "view" + form.GetHashCode();
                            InvokeController("MainFrame.UI", "LoginController", "ShowForm", form, tabName, tabId);
                        }
                        else if (objs.Length == 2)
                        {
                            string tabName = objs[1].ToString();
                            string tabId   = "view" + form.GetHashCode();
                            InvokeController("MainFrame.UI", "LoginController", "ShowForm", form, tabName, tabId);
                        }
                    }
                    return(true);

                case "ShowDialog":
                    if (objs.Length > 0)
                    {
                        Form form = null;
                        if (objs[0] is String)
                        {
                            form = iBaseView[objs[0].ToString()] as Form;
                        }
                        else
                        {
                            form = objs[0] as Form;
                        }
                        return(form.ShowDialog());
                    }
                    return(false);

                case "Close":
                    if (objs[0] is Form)
                    {
                        string tabId = "view" + objs[0].GetHashCode();
                        InvokeController("MainFrame.UI", "LoginController", "CloseForm", tabId);
                    }
                    else
                    {
                        InvokeController("MainFrame.UI", "LoginController", "CloseForm", objs);
                    }
                    return(true);

                case "Exit":
                    WinformGlobal.Exit();
                    return(null);

                case "this":
                    return(this);

                case "AsynInitCompleted":
                    if (AsynInitCompletedFinish == false)
                    {
                        AsynInitCompletedFinish = true;
                        AsynInitCompleted();
                    }
                    return(true);

                case "MessageBoxShowSimple":
                    if (objs.Length > 0)
                    {
                        MessageBoxShowSimple(objs[0].ToString());
                    }
                    return(true);
                }

                MethodInfo meth = ControllerHelper.CreateMethodInfo(_pluginName + "@" + this.GetType().Name, eventname);
                return(meth.Invoke(this, objs));
            }
            catch (Exception err)
            {
                //记录错误日志
                EFWCoreLib.CoreFrame.EntLib.ZhyContainer.CreateException().HandleException(err, "HISPolicy");
                if (err.InnerException != null)
                {
                    throw new Exception(err.InnerException.Message);
                }
                throw new Exception(err.Message);
            }
        }
示例#2
0
        /// <summary>
        /// 界面控制事件
        /// </summary>
        /// <param name="eventname">事件名称</param>
        /// <param name="objs">参数数组</param>
        /// <returns></returns>
        public virtual object UI_ControllerEvent(string eventname, params object[] objs)
        {
            try
            {
                switch (eventname)
                {
                case "Show":
                    if (objs.Length == 1)
                    {
                        Form   form    = objs[0] as Form;
                        string tabName = form.Text;
                        string tabId   = "view" + form.GetHashCode();
                        InvokeController("WinMainUIFrame", "LoginController", "ShowForm", form, tabName, tabId);
                    }
                    else if (objs.Length == 2)
                    {
                        Form   form    = objs[0] as Form;
                        string tabName = objs[1].ToString();
                        string tabId   = "view" + form.GetHashCode();
                        InvokeController("WinMainUIFrame", "LoginController", "ShowForm", form, tabName, tabId);
                    }
                    else if (objs.Length == 3)
                    {
                        InvokeController("WinMainUIFrame", "LoginController", "ShowForm", objs);
                    }
                    return(true);

                case "Close":
                    if (objs[0] is Form)
                    {
                        string tabId = "view" + objs[0].GetHashCode();
                        InvokeController("WinMainUIFrame", "LoginController", "CloseForm", tabId);
                    }
                    else
                    {
                        InvokeController("WinMainUIFrame", "LoginController", "CloseForm", objs);
                    }
                    return(true);

                case "Exit":
                    AppGlobal.AppExit();
                    return(null);

                case "this":
                    return(this);
                }

                MethodInfo meth = ControllerHelper.CreateMethodInfo(_pluginName + "@" + this.GetType().Name, eventname);
                return(meth.Invoke(this, objs));
            }
            catch (Exception err)
            {
                //记录错误日志
                EFWCoreLib.CoreFrame.EntLib.ZhyContainer.CreateException().HandleException(err, "HISPolicy");
                if (err.InnerException != null)
                {
                    throw new Exception(err.InnerException.Message);
                }
                throw new Exception(err.Message);
            }
        }