Example #1
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;
            }
        }
Example #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;
            }
        }
Example #3
0
        private void metroButtonClearHis_Click(object sender, EventArgs e)
        {
            Hashtable htBase = JSONUtil.Parse <Hashtable>(settings["base"].ToString());

            htBase["history"] = "";
            settings["base"]  = JSONUtil.ToJson(htBase);
            BipConfig.StoreObject(Globals.SettingConfigName, settings);
            metroButtonClearHis.Enabled = false;
            //MetroMessageBox.Show(this,"清空完成!");
        }
Example #4
0
        private void metroButtonBaseApply_Click(object sender, EventArgs e)
        {
            Hashtable htBase = JSONUtil.Parse <Hashtable>(settings["base"].ToString());

            htBase["hisFlag"] = metroToggleHisFlag.Checked ? "1" : "0";
            htBase["hisNum"]  = numericUpDownHisNum.Value;
            settings["base"]  = JSONUtil.ToJson(htBase);
            BipConfig.StoreObject(Globals.SettingConfigName, settings);
            metroButtonBaseApply.Enabled = false;
        }
Example #5
0
        private void ParseSettings()
        {
            if (settings != null && settings.Count > 0)
            {
                string    baseSettinStr = settings["base"].ToString();
                Hashtable htBase        = JSONUtil.Parse <Hashtable>(baseSettinStr);
                metroToggleHisFlag.Checked         = htBase["hisFlag"].ToString().Equals("1");
                numericUpDownHisNum.Enabled        = metroToggleHisFlag.Checked;
                numericUpDownHisNum.Value          = Convert.ToDecimal(htBase["hisNum"].ToString());
                metroButtonClearHis.Enabled        = metroToggleHisFlag.Checked && numericUpDownHisNum.Value > 0;
                metroToggleHisFlag.CheckedChanged += new EventHandler(metroToggleHisFlag_CheckedChanged);
                numericUpDownHisNum.ValueChanged  += new EventHandler(numericUpDownHisNum_ValueChanged);

                List <ServerConfig> srvList       = BipConfig.Load <ServerConfig>(Globals.ServerConfigName);
                ServerConfig        defaultServer = srvList.Find(s => s.Id == 0);
                String[]            srvAddrs      = defaultServer.Url.Split(new char[] { '/' });
                String[]            ip_port       = srvAddrs[2].Split(new char[] { ':' });
                String[]            ips           = ip_port[0].Split(new char[] { '.' });
                ultraTextEditor16.Text      = ips[0];
                ultraTextEditor17.Text      = ips[1];
                ultraTextEditor18.Text      = ips[2];
                ultraTextEditor19.Text      = ips[3];
                ultraTextEditor20.Text      = ip_port[1];
                ultraTextEditor1.Text       = srvAddrs[3];
                metroButtonSrvApply.Enabled = false;

                string           hotkeyStr  = settings["hotkey"].ToString();
                List <Hashtable> hotkeyList = JSONUtil.Parse <List <Hashtable> >(hotkeyStr);

                UltraTextEditor textEditor = null;
                foreach (Hashtable ht in hotkeyList)
                {
                    switch (ht["key"].ToString())
                    {
                    case "relogin":
                        textEditor = uteHkRelogin;
                        break;

                    case "lock":
                        textEditor = uteHkLock;
                        break;

                    case "fun1":
                        textEditor = uteHkFun1;
                        break;

                    case "fun2":
                        textEditor = uteHkFun2;
                        break;

                    case "fun3":
                        textEditor = uteHkFun3;
                        break;

                    case "fun4":
                        textEditor = uteHkFun4;
                        break;

                    case "fun5":
                        textEditor = uteHkFun5;
                        break;

                    case "fun6":
                        textEditor = uteHkFun6;
                        break;

                    case "fun7":
                        textEditor = uteHkFun7;
                        break;

                    case "fun8":
                        textEditor = uteHkFun8;
                        break;
                    }
                    if (textEditor != null)
                    {
                        char[] htValues = ht["value"].ToString().ToCharArray();

                        textEditor.Value = ((htValues[0] == '1') ? "Ctrl + " : "") + ((htValues[1] == '1') ? "Shift + " : "") + ((htValues[2] == '1') ? "Alt + " : "") + htValues[3].ToString().ToUpper();
                    }
                }
                metroButtonHkApply.Enabled = false;


                ultraTextEditor12.Text = user.Employee.EmployeeName;

                //BipRow row = new BipRow();
                //row.IsHeader = true;
                //row.Add(new BipCell() { Text = "系统名称", Width = 100 });
                //row.Add(new BipCell() { Text = "服务器" });
                //row.Add(new BipCell() { Text = "应用服务" });
                //row.Add(new BipCell() { Text = "数据库" });
                //bipTableView1.AddRow(row);
                //bipTableView1.Padding = new Padding(20, 10, 20, 10);
            }
        }
Example #6
0
        public static T LoadObject <T>(string configName)
        {
            string json = FileUtil.ReadTextFile(Globals.ConfigPath + "\\" + configName);

            return(JSONUtil.Parse <T>(json));
        }
Example #7
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);
                }
            }
        }