Exemplo n.º 1
0
        private void DlgSettings_Load(object sender, EventArgs e)
        {
            previousActiveLabel = metroLabel1;
            metroPanelBase.BringToFront();

            settings = BipConfig.LoadObject <Hashtable>(Globals.SettingConfigName);

            ParseSettings();

            MetroLabel lbl = null;

            switch (activeIndex)
            {
            case 1:
                lbl = metroLabel2;
                break;

            case 2:
                lbl = metroLabel3;
                break;

            case 3:
                lbl = metroLabel4;
                break;

            case 4:
                lbl = metroLabel5;
                break;

            default:
                lbl = metroLabel1;
                break;
            }
            metroLabel_Click(lbl, new EventArgs());
        }
Exemplo n.º 2
0
        /// <summary>
        /// 显示左上角弹出菜单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FormFrame_IconClick(object sender, EventArgs e)
        {
            this.contextMenuStripStart.Show(this, 10, 20);
            Hashtable        htSettings = BipConfig.LoadObject <Hashtable>("setting.bip");
            Hashtable        htBase     = JSONUtil.Parse <Hashtable>(htSettings["base"].ToString());
            List <Hashtable> listHis    = JSONUtil.Parse <List <Hashtable> >(htBase["history"].ToString());

            tsmiHistory.DropDown = null;
            contextMenuStripHis.Items.Clear();
            if (listHis != null && listHis.Count > 0)
            {
                ToolStripItem[] items = new ToolStripItem[listHis.Count];
                int             i     = 0;
                foreach (Hashtable ht in listHis)
                {
                    items[i]           = new ToolStripMenuItem();
                    items[i].Name      = ht["formId"].ToString();
                    items[i].Text      = ht["formName"].ToString();
                    items[i].BackColor = Color.FromArgb(171, 206, 228);
                    items[i].Click    += new EventHandler(FormFrameHis_Click);
                    i++;
                }
                contextMenuStripHis.Items.AddRange(items);
                tsmiHistory.DropDown = contextMenuStripHis;
            }
        }
Exemplo n.º 3
0
        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;
            }
        }
Exemplo n.º 4
0
        /// <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);
                }
            }
        }