示例#1
0
文件: FormFrame.cs 项目: Jackjet/BIP
        void form_KeyDown(object sender, KeyEventArgs e)
        {
            string    keys = (e.Control ? "1" : "0") + (e.Shift ? "1" : "0") + (e.Alt ? "1" : "0") + Convert.ToChar(e.KeyCode).ToString().ToUpper();
            Hashtable ht   = Globals.HotkeyList.Find(h => h["value"].ToString() == keys && h["key"].ToString().StartsWith("fun"));

            if (ht != null)
            {
                int     btnIdx = int.Parse(ht["key"].ToString().Replace("fun", "")) - 1;
                BipForm form   = sender as BipForm;
                if (btnIdx < form.ToolbarButtonList.Count)
                {
                    form.ToolClick(form.Toolbar, new ToolClickEventArgs(form.Toolbar.Tools[btnIdx], new ListToolItem(form.ToolbarButtonList[btnIdx].Key)));
                }
            }
        }
示例#2
0
文件: FormFrame.cs 项目: Jackjet/BIP
 private void ultraTabbedMdiManager1_TabActivated(object sender, Infragistics.Win.UltraWinTabbedMdi.MdiTabEventArgs e)
 {
     if (e.Tab.Form.GetType().IsSubclassOf(typeof(BipForm)))
     {
         BipForm       form     = e.Tab.Form as BipForm;
         List <string> pathList = new List <string>();
         UltraTreeNode pathNode = mainMenuTree.GetNodeByKey(form.Id);
         while (pathNode != null)
         {
             pathList.Add((pathNode.Tag as SysFunction).FunctionName);
             pathNode = pathNode.Parent;
         }
         pathList.Reverse();
         ultraStatusBar1.Panels["FormPath"].Text = String.Join("\\", pathList.ToArray());
     }
 }
示例#3
0
文件: FormFrame.cs 项目: Jackjet/BIP
        private void GenerateUltraToolBar(BipForm form, List <SysFunction> list)
        {
            if (list == null || list.Count == 0)
            {
                return;
            }
            Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _FrmBase_Toolbars_Dock_Area_Left   = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
            Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _FrmBase_Toolbars_Dock_Area_Right  = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
            Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _FrmBase_Toolbars_Dock_Area_Top    = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
            Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _FrmBase_Toolbars_Dock_Area_Bottom = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
            form.Toolbar = new Infragistics.Win.UltraWinToolbars.UltraToolbarsManager(null);
            Infragistics.Win.UltraWinToolbars.UltraToolbar ultraToolbar = new Infragistics.Win.UltraWinToolbars.UltraToolbar("ultraToolbar1");
            System.Windows.Forms.Panel toolbarPanel = new System.Windows.Forms.Panel();


            ((System.ComponentModel.ISupportInitialize)(form.Toolbar)).BeginInit();

            //
            //ButtonTool
            //
            foreach (SysFunction bfun in list)
            {
                string     btnkey   = bfun.Key;
                ButtonTool toolItem = new ButtonTool(btnkey);

                toolItem.SharedProps.Caption = bfun.FunctionName;
                //toolItem.SharedProps.Enabled = sb.Enable;
                toolItem.SharedProps.DisplayStyle = ToolDisplayStyle.ImageAndText;
                if (!String.IsNullOrEmpty(bfun.Image) && File.Exists("./resource/image/button/" + bfun.Image + ".png"))
                {
                    toolItem.CustomizedImage = Image.FromFile("./resource/image/button/" + bfun.Image + ".png");
                }
                //toolItem.InstanceProps.IsFirstInGroup = true;
                ultraToolbar.Tools.Add(toolItem);
            }

            //
            //UltraToolbar
            //
            ultraToolbar.DockedColumn            = 0;
            ultraToolbar.DockedRow               = 0;
            ultraToolbar.Text                    = "ultraToolbar";
            ultraToolbar.Settings.FillEntireRow  = Infragistics.Win.DefaultableBoolean.True;
            ultraToolbar.Settings.AllowCustomize = Infragistics.Win.DefaultableBoolean.False;
            ultraToolbar.Settings.AllowFloating  = Infragistics.Win.DefaultableBoolean.False;
            ultraToolbar.Settings.AllowHiding    = Infragistics.Win.DefaultableBoolean.False;
            //ultraToolbar.Settings.Appearance.BackColor = Color.LightBlue;
            //
            //UltraToolbarsManager
            //
            form.Toolbar.ToolClick += new ToolClickEventHandler(form.ToolClick);
            form.Toolbar.ShowQuickCustomizeButton = false;
            //ultraToolbarsManager.Toolbars.AddRange(new Infragistics.Win.UltraWinToolbars.UltraToolbar[] { ultraToolbar1 });
            form.Toolbar.Toolbars.Add(ultraToolbar);
            form.Toolbar.DockWithinContainer = toolbarPanel;
            //form.Toolbar.Style = Infragistics.Win.UltraWinToolbars.ToolbarStyle.Office2007;
            form.Toolbar.Appearance.BackColor        = Color.FromArgb(171, 206, 228);
            form.Toolbar.UseFlatMode                 = Infragistics.Win.DefaultableBoolean.True;
            form.Toolbar.LockToolbars                = true;
            form.Toolbar.RuntimeCustomizationOptions = RuntimeCustomizationOptions.None;
            //
            // _FrmBase_Toolbars_Dock_Area_Left
            //
            _FrmBase_Toolbars_Dock_Area_Left.AccessibleRole  = System.Windows.Forms.AccessibleRole.Grouping;
            _FrmBase_Toolbars_Dock_Area_Left.BackColor       = System.Drawing.SystemColors.Control;
            _FrmBase_Toolbars_Dock_Area_Left.DockedPosition  = Infragistics.Win.UltraWinToolbars.DockedPosition.Left;
            _FrmBase_Toolbars_Dock_Area_Left.ForeColor       = System.Drawing.SystemColors.ControlText;
            _FrmBase_Toolbars_Dock_Area_Left.Location        = new System.Drawing.Point(0, 25);
            _FrmBase_Toolbars_Dock_Area_Left.Name            = "_BipForm_Toolbars_Dock_Area_Left";
            _FrmBase_Toolbars_Dock_Area_Left.Size            = new System.Drawing.Size(0, 237);
            _FrmBase_Toolbars_Dock_Area_Left.ToolbarsManager = form.Toolbar;
            //
            // _FrmBase_Toolbars_Dock_Area_Right
            //
            _FrmBase_Toolbars_Dock_Area_Right.AccessibleRole  = System.Windows.Forms.AccessibleRole.Grouping;
            _FrmBase_Toolbars_Dock_Area_Right.BackColor       = System.Drawing.SystemColors.Control;
            _FrmBase_Toolbars_Dock_Area_Right.DockedPosition  = Infragistics.Win.UltraWinToolbars.DockedPosition.Right;
            _FrmBase_Toolbars_Dock_Area_Right.ForeColor       = System.Drawing.SystemColors.ControlText;
            _FrmBase_Toolbars_Dock_Area_Right.Location        = new System.Drawing.Point(446, 25);
            _FrmBase_Toolbars_Dock_Area_Right.Name            = "_BipForm_Toolbars_Dock_Area_Right";
            _FrmBase_Toolbars_Dock_Area_Right.Size            = new System.Drawing.Size(0, 237);
            _FrmBase_Toolbars_Dock_Area_Right.ToolbarsManager = form.Toolbar;
            //
            // _FrmBase_Toolbars_Dock_Area_Top
            //
            _FrmBase_Toolbars_Dock_Area_Top.AccessibleRole  = System.Windows.Forms.AccessibleRole.Grouping;
            _FrmBase_Toolbars_Dock_Area_Top.BackColor       = System.Drawing.SystemColors.Control;
            _FrmBase_Toolbars_Dock_Area_Top.DockedPosition  = Infragistics.Win.UltraWinToolbars.DockedPosition.Top;
            _FrmBase_Toolbars_Dock_Area_Top.ForeColor       = System.Drawing.SystemColors.ControlText;
            _FrmBase_Toolbars_Dock_Area_Top.Location        = new System.Drawing.Point(0, 0);
            _FrmBase_Toolbars_Dock_Area_Top.Name            = "_BipForm_Toolbars_Dock_Area_Top";
            _FrmBase_Toolbars_Dock_Area_Top.Size            = new System.Drawing.Size(446, 25);
            _FrmBase_Toolbars_Dock_Area_Top.ToolbarsManager = form.Toolbar;
            //
            // _FrmBase_Toolbars_Dock_Area_Bottom
            //
            _FrmBase_Toolbars_Dock_Area_Bottom.AccessibleRole  = System.Windows.Forms.AccessibleRole.Grouping;
            _FrmBase_Toolbars_Dock_Area_Bottom.BackColor       = System.Drawing.SystemColors.Control;
            _FrmBase_Toolbars_Dock_Area_Bottom.DockedPosition  = Infragistics.Win.UltraWinToolbars.DockedPosition.Bottom;
            _FrmBase_Toolbars_Dock_Area_Bottom.ForeColor       = System.Drawing.SystemColors.ControlText;
            _FrmBase_Toolbars_Dock_Area_Bottom.Location        = new System.Drawing.Point(0, 262);
            _FrmBase_Toolbars_Dock_Area_Bottom.Name            = "_BipForm_Toolbars_Dock_Area_Bottom";
            _FrmBase_Toolbars_Dock_Area_Bottom.Size            = new System.Drawing.Size(446, 0);
            _FrmBase_Toolbars_Dock_Area_Bottom.ToolbarsManager = form.Toolbar;

            //
            // toolbarPanel
            //
            toolbarPanel.Controls.Add(_FrmBase_Toolbars_Dock_Area_Left);
            toolbarPanel.Controls.Add(_FrmBase_Toolbars_Dock_Area_Right);
            toolbarPanel.Controls.Add(_FrmBase_Toolbars_Dock_Area_Top);
            toolbarPanel.Controls.Add(_FrmBase_Toolbars_Dock_Area_Bottom);
            toolbarPanel.Cursor   = System.Windows.Forms.Cursors.Default;
            toolbarPanel.Dock     = System.Windows.Forms.DockStyle.Fill;
            toolbarPanel.Location = new System.Drawing.Point(0, 0);
            toolbarPanel.Name     = "toolbarPanel";
            toolbarPanel.Size     = new System.Drawing.Size(284, 262);
            toolbarPanel.TabIndex = 0;


            form.Controls.Add(_FrmBase_Toolbars_Dock_Area_Bottom);
            form.Controls.Add(_FrmBase_Toolbars_Dock_Area_Left);
            form.Controls.Add(_FrmBase_Toolbars_Dock_Area_Right);
            form.Controls.Add(_FrmBase_Toolbars_Dock_Area_Top);

            form.ToolbarButtonList = list;

            ((System.ComponentModel.ISupportInitialize)(form.Toolbar)).EndInit();
        }
示例#4
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);
                }
            }
        }