예제 #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 == 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)
            {
                //记录错误日志
                ZhyContainer.CreateException().HandleException(err, "HISPolicy");
                throw new Exception(err.Message);
            }
        }