Beispiel #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());
        }
Beispiel #2
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;
            }
        }
Beispiel #3
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;
            }
        }
Beispiel #4
0
        private void metroButtonHkApply_Click(object sender, EventArgs e)
        {
            List <Hashtable> hkList = new List <Hashtable>();
            Hashtable        ht     = new Hashtable();

            ht.Add("key", "relogin");
            ht.Add("value", TranslateHotKey(uteHkRelogin.Text));
            hkList.Add(ht);

            ht = new Hashtable();
            ht.Add("key", "lock");
            ht.Add("value", TranslateHotKey(uteHkLock.Text));
            hkList.Add(ht);

            ht = new Hashtable();
            ht.Add("key", "fun1");
            ht.Add("value", TranslateHotKey(uteHkFun1.Text));
            hkList.Add(ht);

            ht = new Hashtable();
            ht.Add("key", "fun2");
            ht.Add("value", TranslateHotKey(uteHkFun2.Text));
            hkList.Add(ht);

            ht = new Hashtable();
            ht.Add("key", "fun3");
            ht.Add("value", TranslateHotKey(uteHkFun3.Text));
            hkList.Add(ht);

            ht = new Hashtable();
            ht.Add("key", "fun4");
            ht.Add("value", TranslateHotKey(uteHkFun4.Text));
            hkList.Add(ht);

            ht = new Hashtable();
            ht.Add("key", "fun5");
            ht.Add("value", TranslateHotKey(uteHkFun5.Text));
            hkList.Add(ht);

            ht = new Hashtable();
            ht.Add("key", "fun6");
            ht.Add("value", TranslateHotKey(uteHkFun6.Text));
            hkList.Add(ht);

            ht = new Hashtable();
            ht.Add("key", "fun7");
            ht.Add("value", TranslateHotKey(uteHkFun7.Text));
            hkList.Add(ht);

            ht = new Hashtable();
            ht.Add("key", "fun8");
            ht.Add("value", TranslateHotKey(uteHkFun8.Text));
            hkList.Add(ht);

            settings["hotkey"] = JSONUtil.ToJson(hkList);
            BipConfig.StoreObject(Globals.SettingConfigName, settings);
            Globals.HotkeyList         = hkList;//快捷键设置更改后立即更新
            metroButtonHkApply.Enabled = false;
        }
Beispiel #5
0
        private void ReadConfig()
        {
            List <ServerConfig> list          = BipConfig.Load <ServerConfig>(Globals.ServerConfigName);
            ServerConfig        defaultServer = list.Find(s => s.Id == 0);

            this.Action = new BipAction();
            Action.Url  = defaultServer.Url;
        }
Beispiel #6
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,"清空完成!");
        }
Beispiel #7
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;
        }
Beispiel #8
0
 private new void Update()
 {
     isUpdating = true;
     if (updateVersionList.Count > 0)
     {
         int step = updateVersionList.Count;
         int i    = 0;
         foreach (FileVersion fileVersion in updateVersionList)
         {
             com.ccf.bip.framework.server.file.FileInfo fileInfo = this.FindOne <com.ccf.bip.framework.server.file.FileInfo>(Globals.PROGRAM_UPDATE_SERVICE_NAME, "download", new object[] { fileVersion.GetFullName() });
             //无法从服务器获取文件时忽略该文件更新,下次重新更新
             if (fileInfo == null)
             {
                 FileVersion tempVersion = remoteVersionList.Find(r => r.GetFullName().Equals(fileVersion.GetFullName()));
                 if (tempVersion != null)
                 {
                     if (tempVersion.Version > 1)
                     {
                         tempVersion.Version = tempVersion.Version - 1;
                     }
                     else
                     {
                         remoteVersionList.Remove(tempVersion);
                     }
                 }
                 continue;
             }
             string fullName = Globals.AppPath + Path.DirectorySeparatorChar.ToString() + fileVersion.GetFullName();
             string fullPath = Globals.AppPath + Path.DirectorySeparatorChar.ToString() + fileVersion.Directory;
             if (!Directory.Exists(fullPath))
             {
                 Directory.CreateDirectory(fullPath);
             }
             else
             {
                 if (File.Exists(fullName))
                 {
                     File.Delete(fullName);
                 }
             }
             File.WriteAllBytes(fullName, fileInfo.Content);
             Invoke(new ShowDelegete(UpdateProgressValue), new object[] { (++i) * 100 / step < 100 ? i * 100 / step : 100 });
             Thread.Sleep(1000);
             //progressBar1.Value = (++i) * 100 / step < 100 ? i * 100 / step : 100;
         }
         //update version
         BipConfig.StoreObject(Globals.FileVersionConfigName, remoteVersionList);
     }
     isUpdating = false;
     //run bip
     Invoke(new UpdateDelegate(RunBip));
 }
Beispiel #9
0
        private void FormUpdate_Load(object sender, EventArgs e)
        {
            ReadConfig();
            //find new version
            updateVersionList = new List <FileVersion>();
            List <FileVersion> localVersionList = null;

            try
            {
                localVersionList = BipConfig.Load <FileVersion>(Globals.FileVersionConfigName);
            }
            catch (Exception ex)
            {
            }
            remoteVersionList = this.FindList <FileVersion>(Globals.PROGRAM_UPDATE_SERVICE_NAME, "findFileVersionList", new object[0]);
            //update program
            if (remoteVersionList != null)
            {
                if (localVersionList == null)
                {
                    localVersionList = new List <FileVersion>();
                }
                //排除文件路径、文件名相同且版本号小于等于当前版本的文件
                updateVersionList.AddRange(remoteVersionList.Except <FileVersion>(localVersionList, new FileVersionCompare()));
            }
            if (updateVersionList.Count > 0)
            {
                //检测主程序是否已经运行
                Process[] processesUI = Process.GetProcessesByName("BIP");
                if (processesUI.Length > 0)
                {
                    if (MetroMessageBox.Show(this, "系统有更新,是否关闭所有客户端进行更新?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        foreach (Process process in processesUI)
                        {
                            process.Kill();
                        }
                    }
                    else
                    {
                        RunBip();
                    }
                }
            }
            else
            {
                RunBip();
            }
            updateThread = new Thread(new ThreadStart(Update));
            updateThread.Start();
        }
Beispiel #10
0
        private void metroButtonSrvApply_Click(object sender, EventArgs e)
        {
            string ip = ultraTextEditor16.Text.Trim() + "." + ultraTextEditor17.Text.Trim() + "." + ultraTextEditor18.Text.Trim() + "." + ultraTextEditor19.Text.Trim();

            if (String.IsNullOrEmpty(ultraTextEditor16.Text.Trim()) || String.IsNullOrEmpty(ultraTextEditor17.Text.Trim()) || String.IsNullOrEmpty(ultraTextEditor18.Text.Trim()) || String.IsNullOrEmpty(ultraTextEditor19.Text.Trim()) ||
                !StringUtil.MatchIp(ip))
            {
                label1.Text = "IP址址不正确!";
                return;
            }
            int port = 0;

            if (String.IsNullOrEmpty(ultraTextEditor20.Text.Trim()) || !int.TryParse(ultraTextEditor20.Text.Trim(), out port) || port == 0 || port > 65535)
            {
                label1.Text = "端口不正确!";
                return;
            }
            string srvName = ultraTextEditor1.Text.Trim();

            if (String.IsNullOrEmpty(srvName))
            {
                label1.Text = "请输入服务名!";
                return;
            }

            label1.Text = "";
            List <object> srvList = new List <object>();
            ServerConfig  sc      = new ServerConfig();

            sc.Id   = 0;
            sc.Mode = "Hessian";
            sc.Name = "BIP";
            sc.Url  = "http://" + ip + ":" + port.ToString() + "/" + srvName;
            srvList.Add(sc);
            BipConfig.Store(Globals.ServerConfigName, srvList);
            metroButtonSrvApply.Enabled = false;
        }
Beispiel #11
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);
            }
        }
Beispiel #12
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);
                }
            }
        }