コード例 #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("WcfMainUIFrame", "wcfclientLoginController", "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("WcfMainUIFrame", "wcfclientLoginController", "ShowForm", form, tabName, tabId);
                    }
                    else if (objs.Length == 3)
                    {
                        InvokeController("WcfMainUIFrame", "wcfclientLoginController", "ShowForm", objs);
                    }
                    return(true);

                case "Close":
                    if (objs[0] is Form)
                    {
                        string tabId = "view" + objs[0].GetHashCode();
                        InvokeController("WcfMainUIFrame", "wcfclientLoginController", "CloseForm", tabId);
                    }
                    else
                    {
                        InvokeController("WcfMainUIFrame", "wcfclientLoginController", "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);
            }
        }