コード例 #1
0
ファイル: FormFrame.cs プロジェクト: Jackjet/BIP
        private void InitForm()
        {
            //显示导航界面
            FormWelcome form = new FormWelcome();

            form.MdiParent = this;
            form.Text      = "首页";
            BipStyleBuilder.SetFormStyle(form);
            form.Show();
            ultraTabbedMdiManager1.TabFromForm(form).Settings.TabCloseAction        = Infragistics.Win.UltraWinTabbedMdi.MdiTabCloseAction.None;    //不允许关闭首页
            ultraTabbedMdiManager1.TabFromForm(form).Settings.CloseButtonVisibility = Infragistics.Win.UltraWinTabs.TabCloseButtonVisibility.Never; //首页Tab Header不显示关闭按钮

            LoadMainMemu();
            //加载快捷键
            Hashtable settings = BipConfig.LoadObject <Hashtable>(Globals.SettingConfigName);

            Globals.HotkeyList = JSONUtil.Parse <List <Hashtable> >(settings["hotkey"].ToString());
            Hashtable ht = Globals.HotkeyList.Find(h => h["key"].ToString() == "relogin");

            if (ht != null)
            {
                char[] keys      = ht["value"].ToString().ToCharArray();
                string reloginHk = (keys[0] == '1' ? "Ctrl+" : "") + (keys[1] == '1' ? "Shift+" : "") + (keys[2] == '1' ? "Alt+" : "") + keys[3].ToString();
                tsmiRelogin.Text += "               " + reloginHk;
            }
        }
コード例 #2
0
ファイル: FormFrame.cs プロジェクト: Jackjet/BIP
        /// <summary>
        /// 打开业务功能界面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mainMenuTree_OnBipFormOpenning(object sender, OpenFormEventArgs e)
        {
            bool        isOpenBipForm = false;
            SysFunction function      = e.Fucntion;

            string formId;

            foreach (Form mdiChild in this.MdiChildren)
            {
                if (mdiChild.GetType().IsSubclassOf(typeof(BipForm)))
                {
                    formId = (mdiChild as BipForm).Id;
                    if (formId.Equals(function.FunctionId))
                    {
                        mdiChild.Activate();
                        isOpenBipForm = true;
                        break;
                    }
                }
            }
            Assembly bipFormAssembly = Assembly.Load(function.Assemblyname);
            Type     type            = bipFormAssembly.GetType(function.Url);

            if (!isOpenBipForm && type.IsSubclassOf(typeof(BipForm)))
            {
                BipForm form = Activator.CreateInstance(type, true) as BipForm;
                form.MdiParent         = this;
                form.Id                = function.FunctionId;
                form.Text              = function.FunctionName;
                form.User              = this.User;
                form.CustomInformation = function.Tag;
                //从树菜单根节点系统获取服务端URL
                UltraTreeNode node = mainMenuTree.GetNodeByKey(function.FunctionId);
                while (node.Parent != null)
                {
                    node = node.Parent;
                }
                string url = (node.Tag as SysFunction).Url;
                //未配置系统后台服务Url则使用平台默认URL
                if (String.IsNullOrEmpty(url))
                {
                    url = Globals.ServerList.Find(s => s.Id == 0).Url;
                }
                form.Action = new BipAction(url);
                //ultraTabbedMdiManager1.TabFromForm(form).Settings.TabCloseAction = Infragistics.Win.UltraWinTabbedMdi.MdiTabCloseAction.None;//不允许关闭界面
                BipStyleBuilder.SetFormStyle(form);//设置样式
                //设置界面toolbar及功能按钮
                List <SysFunction> buttonList = new List <SysFunction>();
                buttonList.AddRange(this.Find <SysFunction>("com.ccf.bip.biz.system.authorization.service.FunctionService", "findButtonList", new object[] { form.Id }));
                GenerateUltraToolBar(form, buttonList);
                form.Show();
                isOpenBipForm = true;

                //使用快捷键
                if (function.UseHotKey)
                {
                    form.KeyPreview = true;
                    form.KeyDown   += new KeyEventHandler(form_KeyDown);
                }
            }

            if (isOpenBipForm)
            {
                //记录界面打开记录
                //读取本地配置文件
                Hashtable        htSettings    = BipConfig.LoadObject <Hashtable>("setting.bip");
                string           baseSettinStr = htSettings["base"].ToString();
                Hashtable        htBase        = JSONUtil.Parse <Hashtable>(baseSettinStr);
                bool             hisFlag       = htBase["hisFlag"].ToString().Equals("1");
                Decimal          hisNum        = Convert.ToDecimal(htBase["hisNum"].ToString());
                List <Hashtable> listHis       = JSONUtil.Parse <List <Hashtable> >(htBase["history"].ToString());
                if (hisFlag)
                {
                    if (listHis == null)
                    {
                        listHis = new List <Hashtable>();
                    }

                    Hashtable swapHt = null;
                    foreach (Hashtable h in listHis)
                    {
                        if (h["formId"].ToString().Equals(function.FunctionId))
                        {
                            swapHt = h;
                            break;
                        }
                    }
                    if (swapHt != null)
                    {
                        listHis.Remove(swapHt);
                        listHis.Insert(0, swapHt);
                    }
                    else
                    {
                        Hashtable ht = new Hashtable();
                        ht["formId"]   = function.FunctionId;
                        ht["formName"] = function.FunctionName;
                        listHis.Insert(0, ht);
                    }
                    while (listHis.Count > hisNum)
                    {
                        listHis.RemoveAt(listHis.Count - 1);
                    }
                    htBase["history"]  = JSONUtil.ToJson(listHis);
                    htSettings["base"] = JSONUtil.ToJson(htBase);
                    BipConfig.StoreObject("setting.bip", htSettings);
                }
            }
        }