Beispiel #1
0
        /// <summary>
        /// 绑定上方功能菜单数据,从子系统开始绑定
        /// </summary>
        /// <param name="toolbar"></param>
        /// <param name="list"></param>
        private void BandMainMemu(UltraToolbarsManager toolbar, List <SysFunction> list)
        {
            if (toolbar.Tools.Count > 0)
            {
                toolbar.Toolbars[0].Tools.Clear();
                toolbar.Tools.Clear();
                //使菜单栏居右
                LabelTool labelTool = new LabelTool("blankTool");
                labelTool.SharedProps.Spring = true;
                toolbar.Tools.Add(labelTool);
                toolbar.Toolbars[0].Tools.AddTool("blankTool");

                //子系统
                List <SysFunction> subSystemList = list.FindAll(f => f.FunctionType.Equals("1012"));
                foreach (SysFunction subSystem in subSystemList)
                {
                    PopupMenuTool pmt = new PopupMenuTool(subSystem.FunctionId);
                    pmt.SharedProps.Caption = PadPopupMenuToolCaption(subSystem.FunctionName);
                    pmt.DropDownArrowStyle  = DropDownArrowStyle.None;
                    pmt.Tag = subSystem;
                    pmt.Settings.IconAreaAppearance.BackColor = Color.FromArgb(171, 206, 228);
                    //pmt.CustomizedDisplayStyle = ToolDisplayStyle.ImageAndText;
                    //pmt.CustomizedImage = Image.FromFile("./resource/image/mainMenu/directory.png");
                    toolbar.Tools.Add(pmt);
                    toolbar.Toolbars[0].Tools.AddTool(subSystem.FunctionId);
                    BandMainMenuSubNode(toolbar, pmt, list);
                }
            }
        }
Beispiel #2
0
        public UcQueryResults()
        {
            InitializeComponent();
            _stopwatch  = new Stopwatch();
            _isPinned   = false;
            _sql        = string.Empty;
            _isBusy     = false;
            _maxResults = 100;

            _timingLabelTool                  = (LabelTool)_utm.Tools["Timing"];
            _rowCountLabelTool                = (LabelTool)_utm.Tools["Row Counts"];
            _flagTool                         = (StateButtonTool)_utm.Tools["Flag"];
            _showFilterTool                   = (StateButtonTool)_utm.Tools["Show Filter"];
            _activityIndicatorTool            = (ControlContainerTool)_utm.Tools["Activity Indicator"];
            _stopButton                       = (ButtonTool)_utm.Tools["Stop"];
            _exportToExcelTool                = (ButtonTool)_utm.Tools["Export to Excel"];
            _exportToCsvTool                  = (ButtonTool)_utm.Tools["Export to CSV"];
            _exportToTextTool                 = (ButtonTool)_utm.Tools["Export to Text"];
            _commitTool                       = (ButtonTool)_utm.Tools["Commit"];
            _rollbackTool                     = (ButtonTool)_utm.Tools["Rollback"];
            _fetchAllRowsTool                 = (ButtonTool)_utm.Tools["Fetch All Rows"];
            _fetchMoreRowsTool                = (ButtonTool)_utm.Tools["Fetch More Rows"];
            _refreshQueryResultsTool          = (ButtonTool)_utm.Tools["Refresh"];
            _copyTool                         = (ButtonTool)_utm.Tools["Copy"];
            _copyWithHeaders                  = (ButtonTool)_utm.Tools["Copy w/ Headers"];
            _copyForSql                       = (ButtonTool)_utm.Tools["Copy for SQL IN Clause"];
            _visualizedataTool                = (ButtonTool)_utm.Tools["Visualize Data"];
            _gridMenuTool                     = (PopupMenuTool)_utm.Tools["GridPopupMenu"];
            _gridMenuTool.BeforeToolDropdown += (sender, args) => RefreshUserInterface();

            RefreshUserInterface();
        }
        protected override void OnHostingFormLoaded(Form form)
        {
            if (Addon.Configuration == null)
            {
                Addon.Configuration = Settings.Load();
            }

            if (form is MainForm mainForm)
            {
                if (mainForm.ReferenceEditorElectronicLocationsToolbarsManager?
                    .Tools.Cast <ToolBase>()
                    .FirstOrDefault(tool => tool.Key.Equals("ReferenceEditorUriLocationsContextMenu")) is PopupMenuTool popupMenu)
                {
                    popupMenu.ToolbarsManager.Tools.Add(new PopupMenuTool(Key_Menu_OpenWith));
                    _menu = popupMenu.ToolbarsManager.Tools[Key_Menu_OpenWith] as PopupMenuTool;
                    popupMenu.Tools.Insert(4, _menu);
                    _menu.SharedProps.Caption = Properties.OpenWithResources.MenuCaption;
                    _menu.SharedProps.AppearancesSmall.Appearance.Image = Properties.OpenWithResources.addon;

                    _menu.ToolbarsManager.Tools.Add(new ButtonTool(Key_Button_Configurate));
                    _configurationButton = _menu.ToolbarsManager.Tools[Key_Button_Configurate] as ButtonTool;
                    _menu.Tools.Insert(0, _configurationButton);
                    _configurationButton.SharedProps.Caption = Properties.OpenWithResources.ConfigurationCaption;
                    Refresh();
                }
            }

            base.OnHostingFormLoaded(form);
        }
Beispiel #4
0
        public static ToolBase CreateMenuItem(UICommandDefinition menuEntry, bool isMenu)
        {
            PopupMenuTool toolBase = new PopupMenuTool(menuEntry.Name);

            if (isMenu)
            {
                toolBase.DropDownArrowStyle = DropDownArrowStyle.None;
            }
            SetStandardProperties(menuEntry, toolBase);
            return(toolBase);
        }
            internal ToolsCollectionAdapterImpl(ToolsCollectionBase tools)
            {
                // for a menu, store the tools collection of the root tool
                // in case the instance we were created for has been removed.
                if (tools.Owner is PopupMenuTool)
                {
                    PopupMenuTool menu = tools.Owner as PopupMenuTool;
                    tools = ((PopupMenuTool)menu.SharedProps.RootTool).Tools;
                }

                this.tools   = new WeakReference(tools);
                this.manager = new WeakReference(tools.ToolbarsManager);
            }
Beispiel #6
0
        private void setupConnectionTab()
        {
            var pmtConnect = new ButtonTool("ConnectToBrand");

            pmtConnect.SharedProps.Caption = "Connect...";
            pmtConnect.SharedProps.AppearancesSmall.Appearance.Image = 6;
            pmtConnect.InstanceProps.PreferredSizeOnRibbon           = RibbonToolSize.Large;
            pmtConnect.Tag = "ConnectToBrand";

//            foreach (ServerVersionId version in DatabaseManagerFactory.Instance.GetSupportedVendors())
//            {
//                var btServer = new ButtonTool(version.ToString());
//                btServer.SharedProps.Caption = version.ToString();
//
//				if (!_view.tbManager.Tools.Exists(btServer.Key))
//				{
//					_view.tbManager.Tools.Add(btServer);
//					pmtConnect.Tools.Add(btServer);
//				}
//            }

            var pmtRemove = new PopupMenuTool("Remove");

            pmtRemove.SharedProps.Caption = "Remove";
            pmtRemove.Tag = "RemoveConnection";


            _view.tbManager.Tools.Add(pmtConnect);
            _view.tbManager.Tools.Add(pmtRemove);


            var rtConnection       = new RibbonTab("rtConnection", "Connection");
            var rgConnect          = new RibbonGroup("rgConnect", "Connect");
            var rgKnownServers     = new RibbonGroup("rgKnownServers", "Known Novels");
            var rgEditKnownServers = new RibbonGroup("rgEditKnownServers", "Edit Servers");

            int connectId = rgConnect.Tools.Add(pmtConnect);

            rgConnect.Tools[connectId].Tag = pmtConnect.Tag;
            rtConnection.Groups.Add(rgConnect);
            rtConnection.Groups.Add(rgKnownServers);
            rtConnection.Groups.Add(rgEditKnownServers);

            int removetId = rgEditKnownServers.Tools.Add(pmtRemove);

            rgEditKnownServers.Tools[removetId].Tag = pmtRemove.Tag;

            _view.tbManager.Ribbon.Tabs.Add(rtConnection);
        }
    public void Create(string listName_)
    {
      if (m_toolManager != null)
      {
        return;
      }

      ListName = listName_;
      AutoSize = true;

      m_toolManager = new UltraToolbarsManager();
      m_menu = new PopupMenuTool("blah");
      m_toolManager.Tools.Add(m_menu);
      this.PopupItem = m_menu;

      {
        var remove = new RemoveButtonTool(this);
        m_toolManager.Tools.Add(remove);
        m_menu.Tools.AddTool(remove.Key);
      }

      {
        var rename = new RenameButtonTool(this);
        m_toolManager.Tools.Add(rename);
        m_menu.Tools.AddTool(rename.Key);
      }

      {
        var addsets = new AddSetsButtonTool(this);
        m_toolManager.Tools.Add(addsets);
        m_menu.Tools.AddTool(addsets.Key);
      }


      m_toolManager.ToolClick += async (x, y) =>
      {
        var bbc = m_toolManager.Tools[y.Tool.Key] as BaseButtonClass;

        if (bbc != null)
        {
          var t = bbc.Action();
          if (t != null)
            await t;
        }
      };
    }
        public UcExplainPlan()
        {
            InitializeComponent();
            _stopwatch = new Stopwatch();
            _isPinned  = false;
            _isBusy    = false;

            _timingLabelTool         = (LabelTool)_utm.Tools["Timing"];
            _flagTool                = (StateButtonTool)_utm.Tools["Flag"];
            _activityIndicatorTool   = (ControlContainerTool)_utm.Tools["Activity Indicator"];
            _stopButton              = (ButtonTool)_utm.Tools["Stop"];
            _refreshQueryResultsTool = (ButtonTool)_utm.Tools["Refresh"];
            _copyTool                = (ButtonTool)_utm.Tools["Copy"];
            PopupMenuTool gridMenuTool = (PopupMenuTool)_utm.Tools["GridPopupMenu"];

            gridMenuTool.BeforeToolDropdown += (sender, args) => RefreshUserInterface();

            RefreshUserInterface();
        }
Beispiel #9
0
        /// <summary>
        /// 绑定上方功能菜单子系统以下节点
        /// </summary>
        /// <param name="toolbar"></param>
        /// <param name="pmt"></param>
        /// <param name="list"></param>
        private void BandMainMenuSubNode(UltraToolbarsManager toolbar, PopupMenuTool pmt, List <SysFunction> list)
        {
            List <SysFunction> subList = list.FindAll(f => !string.IsNullOrEmpty(f.ParentId) && f.ParentId.Equals(pmt.Key));//根据上级节点获取子节点数据

            foreach (SysFunction subNode in subList)
            {
                if (subNode.FunctionType.Equals("1014"))
                {
                    ButtonTool bt = new ButtonTool(subNode.FunctionId);
                    bt.SharedProps.Caption = subNode.FunctionName;
                    bt.Tag = subNode;
                    if (!string.IsNullOrEmpty(subNode.Image))
                    {
                        bt.CustomizedDisplayStyle = ToolDisplayStyle.ImageAndText;
                        bt.CustomizedImage        = Image.FromFile("./resource/image/mainMenu/" + subNode.Image + ".png");
                    }

                    toolbar.Tools.Add(bt);
                    pmt.Tools.AddTool(subNode.FunctionId);
                }
                else
                {
                    PopupMenuTool subPmt = new PopupMenuTool(subNode.FunctionId);
                    subPmt.SharedProps.Caption = subNode.FunctionName;
                    subPmt.DropDownArrowStyle  = DropDownArrowStyle.None;
                    subPmt.Tag = subNode;
                    subPmt.Settings.IconAreaAppearance.BackColor = Color.FromArgb(171, 206, 228);
                    if (!string.IsNullOrEmpty(subNode.Image))
                    {
                        subPmt.CustomizedDisplayStyle = ToolDisplayStyle.ImageAndText;
                        subPmt.CustomizedImage        = Image.FromFile("./resource/image/mainMenu/" + subNode.Image + ".png");
                    }
                    toolbar.Tools.Add(subPmt);
                    pmt.Tools.AddTool(subNode.FunctionId);
                    BandMainMenuSubNode(toolbar, subPmt, list);
                }
            }
        }
Beispiel #10
0
        private void setupOther()
        {
            // Quick Access

            var btConnect = new ButtonTool("btConnect");

            btConnect.SharedProps.Caption = "Connect...";
            btConnect.Tag = "ConnectToBrand";
            btConnect.SharedProps.AppearancesSmall.Appearance.Image = 6;

            _view.tbManager.Tools.Add(btConnect);

            _view.tbManager.Ribbon.QuickAccessToolbar.Tools.Add(btConnect);

            // Footer

            var btExit = new ButtonTool("btExit");

            btExit.SharedProps.Caption = "Exit Novel8r";
            btExit.SharedProps.AppearancesSmall.Appearance.Image = 2;
            btExit.SharedProps.DisplayStyle = ToolDisplayStyle.ImageAndText;
            btExit.ToolClick += RibbonEventHandlers.btExit_ToolClick;

            _view.tbManager.Tools.Add(btExit);

            _view.tbManager.Ribbon.ApplicationMenu.FooterToolbar.Tools.Add(btExit);

            // Left ToolArea

            var btOpenProject = new ButtonTool("btOpenProject");

            btOpenProject.SharedProps.Caption = "Open Project";

            var btImportProject = new ButtonTool("btImportProject");

            btImportProject.SharedProps.Caption = "Import Project";

            var pmtRecent = new PopupMenuTool("pmtRecent");

            pmtRecent.SharedProps.Caption = "Recent Projects";
            pmtRecent.Tag = "Recent";

            _view.tbManager.Tools.Add(btImportProject);
            _view.tbManager.Tools.Add(btOpenProject);
            _view.tbManager.Tools.Add(pmtRecent);

            _view.tbManager.Ribbon.ApplicationMenu.ToolAreaLeft.Tools.Add(btOpenProject);
            _view.tbManager.Ribbon.ApplicationMenu.ToolAreaLeft.Tools.Add(btImportProject);
            _view.tbManager.Ribbon.ApplicationMenu.ToolAreaLeft.Tools.Add(btConnect);

            int recentId = _view.tbManager.Ribbon.ApplicationMenu.ToolAreaLeft.Tools.Add(pmtRecent);

            _view.tbManager.Ribbon.ApplicationMenu.ToolAreaLeft.Tools[recentId].Tag = pmtRecent.Tag;

            // Right ToolArea

            var mdiWindowListTool = new MdiWindowListTool("MDIWindowList");

            _view.tbManager.Tools.Add(mdiWindowListTool);

            _view.tbManager.Ribbon.ApplicationMenu.ToolAreaRight.Tools.Add(mdiWindowListTool);
        }
Beispiel #11
0
        private void toolbarsManager_ToolClick(object sender, ToolClickEventArgs e)
        {
            // Server
            if (e.Tool.Key == "btCreateDatabase")
            {
                createDatabase();
            }

            else if (e.Tool.Key == "btCreateTable")
            {
                createTable();
            }

            // Windows
            else if (e.Tool.Key == "btEditorWindow")
            {
                OpenMdiTab(MdiTabKeys.RtfEditor);
            }
            else if (e.Tool.Key == "btSearchWindow")
            {
                OpenMdiTab(MdiTabKeys.Search);
            }

            // Panes
            else if (e.Tool.Key == "btFilePane")
            {
                OpenPane(DockedPaneKeys.Files);
            }
            else if (e.Tool.Key == "btDatabasePane")
            {
                OpenPane(DockedPaneKeys.Files);
            }

            // Options
//            else if (e.Tool.Key == "btSaveOptions")
//            {
//                saveSettings();
//            }
//            else if (e.Tool.Key == "btLoadOptions")
//            {
//                loadSettings();
//            }

            // Themes
            else if (e.Tool.Key == "btLoadTheme")
            {
                loadTheme();
            }


            // Main Icon Menu
            else if (e.Tool.Key == "btOpenProject")
            {
                var ofd = DialogFactory.Instance.GetOpenProjectDialog();
                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    ProjectPresenter.Instance.OpenProject(ofd.FileName);
                }
            }
            else if (e.Tool.Key == "btConnect")
            {
            }
            else if (e.Tool.OwningMenu != null)
            {
                PopupMenuTool pmt = e.Tool.OwningMenu;
                if (pmt.Tag.ToString() == "Recent")
                {
                    var path = (string)e.Tool.Tag;
                    ProjectPresenter.Instance.OpenProject(path);
                }
                else if (pmt.Tag.ToString() == "RemoveConnection")
                {
                    var btSvr = (ButtonTool)e.Tool.Tag;

                    RibbonPresenter.Instance.RemoveKnownServer(btSvr);
                    RibbonPresenter.Instance.RemoveKnownServer(e.Tool);
                }
                else if (pmt.Tag.ToString() == "ConnectToBrand")
                {
                    //if (e.Tool.Key == ServerVersionId.SqlServer_2005.ToString())
                    //{
                    //    var p = PresenterFactory.Instance.GetSelectDatabasePresenter(ServerVersionId.SqlServer_2005);
                    //    if (p.ShowDialog() == DialogResult.OK)
                    //    {
                    //        ServerConnectionSettings settings = p.GetConnection();
                    //        RibbonPresenter.Instance.AddKnownServer(settings);
                    //    }
                    //}
                    //else if (e.Tool.Key == ServerVersionId.SqlServer_2008.ToString())
                    //{
                    //}
                    //else if (e.Tool.Key == ServerVersionId.MySql_5.ToString())
                    //{
                    //    var p = PresenterFactory.Instance.GetSelectDatabasePresenter(ServerVersionId.MySql_5);
                    //    if (p.ShowDialog() == DialogResult.OK)
                    //    {
                    //        ServerConnectionSettings settings = p.GetConnection();
                    //        RibbonPresenter.Instance.AddKnownServer(settings);
                    //    }
                    //}
                    //else if (e.Tool.Key == ServerVersionId.SQLite.ToString())
                    //{
                    //    var p1 = ServerVersionId.Parse(e.Tool.Key);
                    //    var p = PresenterFactory.Instance.GetSelectDatabasePresenter(ServerVersionId.SQLite);
                    //    if (p.ShowDialog() == DialogResult.OK)
                    //    {
                    //        ServerConnectionSettings settings = p.GetConnection();
                    //        RibbonPresenter.Instance.AddKnownServer(settings);
                    //    }
                    //}
                }
            }
        }
Beispiel #12
0
        private void prcInitializeRibbon()
        {
            string strCaption = "Initializing Ribbon";

            try
            {
                //Configure Ribbon
                this.toolMan.Ribbon.Visible              = true;
                this.toolMan.DockWithinContainer         = this;
                this.toolMan.DockWithinContainerBaseType = typeof(System.Windows.Forms.Form);

                //Setup Style Of Ribbon
                toolMan.Style = Infragistics.Win.UltraWinToolbars.ToolbarStyle.Office2010;
                toolMan.Ribbon.FileMenuStyle = Infragistics.Win.UltraWinToolbars.FileMenuStyle.ApplicationMenu2010;

                //ImageList
                this.toolMan.ImageListLarge = ilLarge;
                this.toolMan.ImageListSmall = ilSmall;

                // Create Basic Ribbon Tab
                foreach (DataRow dr in dsMaster.Tables["Module"].Rows)
                {
                    strCaption = "Creating Tab";
                    RibbonTab rt = new RibbonTab(dr["moduleId"].ToString(), dr["moduleCaption"].ToString());
                    this.toolMan.Ribbon.Tabs.Add(rt);
                }

                //Creating Ribbon Group
                foreach (DataRow dr in dsMaster.Tables["Group"].Rows)
                {
                    strCaption = "Creating Group";
                    RibbonGroup rg = new RibbonGroup(dr["mMenuGroupId"].ToString(), dr["mMenuGroupCaption"].ToString());
                    this.toolMan.Ribbon.Tabs[dr["moduleId"].ToString()].Groups.Add(rg);
                }

                #region Creating Button
                //Creating Button
                foreach (DataRow dr in dsMaster.Tables["Menu"].Rows)
                {
                    strCaption = "Creating Button : " + dr["MenuCaption"].ToString();
                    #region Form Based Button
                    if (Int16.Parse(dr["isFormBased"].ToString()) != 0)
                    {
                        ButtonTool btn = new ButtonTool(dr["menuId"].ToString());
                        btn.SharedProps.Caption = dr["menuCaption"].ToString();

                        if (Int16.Parse(dr["menuImageExist"].ToString()) == 0)
                        {
                            //Picture does not Exist for menu
                            this.toolMan.Tools.Add(btn);
                            this.toolMan.Ribbon.Tabs[dr["moduleId"].ToString()].Groups[dr["mMenuGroupId"].ToString()].Tools.Add(btn);
                        }
                        else
                        {
                            //Picture Exist for menu
                            alMenuImage.Add(dr["menuId"].ToString());

                            //Picture Exist for menu
                            prcFillImageList(dr["menuImageName"].ToString(), Int16.Parse(dr["menuImageSize"].ToString()));
                            Common.Classes.clsMain.alMnuFrmName.Add(dr["frmName"].ToString());

                            if (Int16.Parse(dr["menuImageSize"].ToString()) != 2)
                            {
                                //Small Image
                                btn.SharedProps.AppearancesSmall.Appearance.Image = alMenuImage.Count - 1;//Common.Classes.clsMain.alMnuFrmName.Count - 1;
                            }
                            else
                            {
                                //Large Image
                                btn.SharedProps.AppearancesLarge.Appearance.Image = alMenuImage.Count - 1;
                            }
                            btn.SharedProps.DisplayStyle = ToolDisplayStyle.TextOnlyInMenus;

                            #region Normal Menu [No DropDown Menu]
                            if (Int16.Parse(dr["IsDropDown"].ToString()) == 0)
                            {
                                this.toolMan.Tools.Add(btn);

                                //Set Large Image for tool
                                ToolBase tb = this.toolMan.Ribbon.Tabs[dr["moduleId"].ToString()].Groups[dr["mMenuGroupId"].ToString()].Tools.AddTool(dr["MenuId"].ToString());
                                tb.CustomizedCaption = dr["menuCaption"].ToString();
                                if (Int16.Parse(dr["menuImageSize"].ToString()) == 2)
                                {
                                    tb.InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large;
                                }
                            }
                            #endregion Normal Menu [No DropDown Menu]

                            #region DropDown Menu
                            if (Int16.Parse(dr["IsDropDown"].ToString()) == 1)
                            {
                                if (Int16.Parse(dr["DropDownParentId"].ToString()) == 0)
                                {
                                    Infragistics.Win.Appearance ap1 = new Infragistics.Win.Appearance();
                                    ap1.Image = alMenuImage.Count - 1;

                                    PopupMenuTool pmt = new PopupMenuTool(dr["menuId"].ToString());
                                    pmt.DropDownArrowStyle                  = DropDownArrowStyle.Segmented;
                                    pmt.SharedPropsInternal.Caption         = dr["menuCaption"].ToString();
                                    pmt.SharedPropsInternal.Category        = "DROPDOWNPARENT"; //Used to stop working when click on the main menu
                                    pmt.SharedPropsInternal.ToolTipText     = "Select menu from list";
                                    pmt.InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large;

                                    //Setup Appearance
                                    pmt.SharedPropsInternal.AppearancesSmall.Appearance = ap1;

                                    toolMan.Tools.Add(pmt);
                                    toolMan.Ribbon.Tabs[dr["moduleId"].ToString()].Groups[dr["mMenuGroupId"].ToString()].Tools.AddTool(pmt.Key.ToString());
                                }
                                else
                                {
                                    StateButtonTool sbt = new StateButtonTool(dr["menuId"].ToString());

                                    sbt.SharedPropsInternal.Caption = dr["menuCaption"].ToString();
                                    sbt.CustomizedImage             = ilSmall.Images[alMenuImage.Count - 1];

                                    toolMan.Tools.Add(sbt);

                                    ((PopupMenuTool)(this.toolMan.Ribbon.Tabs[dr["moduleId"].ToString()].Groups[dr["mMenuGroupId"].ToString()].Tools[dr["DropdownParentId"].ToString()])).Tools.AddRange(new ToolBase[] { sbt });
                                }
                            }
                            #endregion DropDown Menu
                        }
                    }
                    #endregion Form Based Button

                    #region Combo Button
                    if ((dr["ContainerType"]).ToString() == "Combo")
                    {
                        //Crate Combobox tool
                        ComboBoxTool cbo = new ComboBoxTool("cbo" + dr["menuName"].ToString());

                        //Create ValueList For Loading Combo Data
                        ValueList valueList1 = new ValueList(0);
                        valueList1.DisplayStyle          = Infragistics.Win.ValueListDisplayStyle.DisplayText;
                        valueList1.PreferredDropDownSize = new System.Drawing.Size(0, 0);

                        string strDefault = "";
                        foreach (DataRow dr3 in dsMaster.Tables["Company"].Rows)
                        {
                            if (Int16.Parse(dr3["isDefault"].ToString()) != 0)
                            {
                                strDefault = dr3["comId"].ToString();
                            }
                            ValueListItem v1 = new ValueListItem();
                            v1.DataValue   = dr3["comId"].ToString();
                            v1.DisplayText = dr3["comName"].ToString();

                            valueList1.ValueListItems.Add(v1);
                        }
                        cbo.ValueList = valueList1;

                        this.toolMan.Tools.AddRange(new ToolBase[] { cbo });
                        ToolBase tbCompany = this.toolMan.Ribbon.Tabs[dr["moduleId"].ToString()].Groups[dr["mMenuGroupId"].ToString()].Tools.AddTool(cbo.Key);
                        //ToolBase tbCompany = ((RibbonGroup)dr["mMenuGroupId"]).Tools.AddTool(cbo.Key);

                        //Set Default Value
                        if (strDefault.Length > 0)
                        {
                            ((ComboBoxTool)toolMan.Tools[cbo.Key]).Value = Int16.Parse(strDefault);
                        }
                    }
                    #endregion Combo Button
                }
                #endregion Creating Button
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, strCaption);
            }
        }
Beispiel #13
0
        private void initializeRibbon()
        {
            // by default, the ribbon is not visible. to show the ribbon
            // set the Visible property to true.
            ultraToolbarsManager1.Ribbon.Visible = true;

            // the ApplicationMenuButtonImage is used to specify the image
            // that will be displayed within the rounded application menu button
            // located at the upper left corner of the ribbon
            ultraToolbarsManager1.Ribbon.ApplicationMenuButtonImage = CondominioResources.sferanew_trasparente;

            var mdiWindowListTool = new MdiWindowListTool("WindowList")
            {
                DisplayArrangeIconsCommand = MdiWindowListCommandDisplayStyle.DisplayOnMenuAndDialog,
                DisplayCascadeCommand = MdiWindowListCommandDisplayStyle.DisplayOnMenuAndDialog,
                DisplayCloseWindowsCommand = MdiWindowListCommandDisplayStyle.DisplayOnMenuAndDialog,
                DisplayMinimizeCommand = MdiWindowListCommandDisplayStyle.DisplayOnMenuAndDialog,
                DisplayTileHorizontalCommand = MdiWindowListCommandDisplayStyle.DisplayOnDialog,
                DisplayTileVerticalCommand = MdiWindowListCommandDisplayStyle.DisplayOnMenuAndDialog
            };
            // Specify which window list commands to show.

            loadPlugins();

            // =====================================
            //  PopMenu - Layout
            // =====================================
            var salvaLayoutButton = createButtonTool("salvaLayoutTool", "Salva Layout", CondominioResources.export_large, CondominioResources.export_large);
            salvaLayoutButton.SharedProps.DescriptionOnMenu = @"Permette il salvataggio del layout delle liste in un file zippato a scelta dell'utente";
            salvaLayoutButton.ToolClick += salvaLayoutToolClick;

            var ripristinaLayoutButton = createButtonTool("ripristinaLayoutTool", "Ripristina Layout", CondominioResources.import_large, CondominioResources.import_large);
            ripristinaLayoutButton.SharedProps.DescriptionOnMenu = @"Permette il ripristino del layout delle liste da un file zip creato tramite la funzione di salvataggio del layout.";
            ripristinaLayoutButton.ToolClick += ripristinaLayoutToolClick;

            var resetLayoutButton = createButtonTool("resetLayoutTool", "Reset Layout", CondominioResources.reset_large, CondominioResources.reset_large);
            resetLayoutButton.SharedProps.DescriptionOnMenu = @"Permette di ripristinare il layout di default delle liste eliminando tutte le personalizzazioni.";
            resetLayoutButton.ToolClick += resetLayoutToolClick;

            var layoutPopup = new PopupMenuTool("layoutPopUpMenuTool");
            layoutPopup.SharedProps.Caption = @"Layout";
            layoutPopup.SharedProps.Priority = 90;
            layoutPopup.SharedProps.MergeOrder = 90;
            layoutPopup.InstanceProps.IsFirstInGroup = true;
            layoutPopup.SharedProps.AppearancesLarge.Appearance.Image = CondominioResources.column;
            layoutPopup.SharedProps.AppearancesSmall.Appearance.Image = CondominioResources.column;
            ultraToolbarsManager1.Tools.Add(layoutPopup);
            layoutPopup.Tools.AddToolRange(new[] { "salvaLayoutTool", "ripristinaLayoutTool", "resetLayoutTool" });
            ultraToolbarsManager1.Ribbon.ApplicationMenu.ToolAreaLeft.Tools.AddTool("layoutPopUpMenuTool");
            ultraToolbarsManager1.Ribbon.ApplicationMenu.ToolAreaLeft.Settings.UseLargeImages = DefaultableBoolean.True;


            // =====================================
            //  PopMenu - Guida
            // =====================================
            var relaeaseButton = createButtonTool("releasenoteTool", "Aggiornamenti", CondominioResources.release_small, CondominioResources.releaseNotes);
            relaeaseButton.SharedProps.DescriptionOnMenu = @"Visualizza quali aggiornamenti comprendono le ultime versioni di sfera rilasciate";
            ultraToolbarsManager1.Ribbon.TabItemToolbar.Tools.AddTool("releasenoteTool");
            relaeaseButton.ToolClick +=relaeaseButtonToolClick;

            var helpButton = createButtonTool("helpTool", "Guida", CondominioResources.help, CondominioResources.help);
            helpButton.SharedProps.DescriptionOnMenu = @"Visualizza la guida di sfera, la guida è navigabile e stampabile.";
            ultraToolbarsManager1.Ribbon.TabItemToolbar.Tools.AddTool("helpTool");
            helpButton.ToolClick += helpButtonToolClick;

            var popupHelp = new PopupMenuTool("popUpMenuTool");
            popupHelp.SharedProps.Caption = @"Guida";
            popupHelp.SharedProps.Priority = 90;
            popupHelp.SharedProps.MergeOrder = 90;
            popupHelp.InstanceProps.IsFirstInGroup = true;
            popupHelp.SharedProps.AppearancesLarge.Appearance.Image = CondominioResources.help;
            popupHelp.SharedProps.AppearancesSmall.Appearance.Image = CondominioResources.help;
            ultraToolbarsManager1.Tools.Add(popupHelp);
            popupHelp.Tools.AddToolRange(new[] { "helpTool", "releasenoteTool" });
            ultraToolbarsManager1.Ribbon.ApplicationMenu.ToolAreaLeft.Tools.AddTool("popUpMenuTool");
            ultraToolbarsManager1.Ribbon.ApplicationMenu.ToolAreaLeft.Settings.UseLargeImages = DefaultableBoolean.True;

            ultraToolbarsManager1.Tools.Add(mdiWindowListTool);
            ultraToolbarsManager1.Ribbon.ApplicationMenu.ToolAreaRight.Tools.AddTool("WindowList");
        }
Beispiel #14
0
        /// <summary>
        /// 构建菜单栏
        /// </summary>
        private void BuildMenuBar()
        {
            foreach (var toolbar in toolBarManager.Toolbars)
            {
                toolbar.DockedRow++;
            }

            //设置菜单栏
            var mainMenuBar = toolBarManager.Toolbars.AddToolbar(_menu.Name);

            mainMenuBar.IsMainMenuBar         = true;
            mainMenuBar.Settings.ShowToolTips = DefaultableBoolean.True;
            mainMenuBar.Text = _menu.Text;

            if (_menu.IsLarge)
            {
                mainMenuBar.Settings.ToolDisplayStyle        = ToolDisplayStyle.ImageAndText;
                mainMenuBar.Settings.UseLargeImages          = DefaultableBoolean.True;
                toolBarManager.MenuSettings.ToolDisplayStyle = ToolDisplayStyle.ImageAndText;
                toolBarManager.MenuSettings.UseLargeImages   = DefaultableBoolean.True;
            }
            else
            {
                mainMenuBar.Settings.ToolDisplayStyle        = ToolDisplayStyle.DefaultForToolType;
                mainMenuBar.Settings.UseLargeImages          = DefaultableBoolean.False;
                toolBarManager.MenuSettings.ToolDisplayStyle = ToolDisplayStyle.DefaultForToolType;
                toolBarManager.MenuSettings.UseLargeImages   = DefaultableBoolean.False;
            }

            mainMenuBar.Tag       = _menu;
            mainMenuBar.DockedRow = 0;
            var menus = mainMenuBar.Tools;
            var pops  = _menu.PopMenus;

            foreach (var pop in pops)
            {
                //设置菜单
                var menuTool = new PopupMenuTool(pop.Name);
                if (!pop.ShortCut.IsNullOrEmpty())
                {
                    pop.Text += "(&" + pop.ShortCut + ")";
                }

                menuTool.SharedProps.Caption = pop.Text;
                menuTool.Tag = pop;
                foreach (var item in pop.MenuItems)
                {
                    //设置菜单项
                    ToolBase menuItem = new ButtonTool(item.Name);
                    if (toolBarManager.Tools.Exists(item.Name))
                    {
                        menuItem = toolBarManager.Tools[item.Name];
                    }
                    if (!item.ShortCut.IsNullOrEmpty())
                    {
                        item.Text += "(&" + item.ShortCut + ")";
                    }

                    menuItem.SharedProps.Caption = item.Text;
                    menuItem.SharedProps.Enabled = SysInfo.Domains.Contains(item.DomainId);
                    if (!menuItem.SharedProps.Enabled)
                    {
                        menuItem.SharedProps.ToolTipText = @"您没有该权限";
                    }

                    menuItem.Tag             = item;
                    menuItem.SharedProps.Tag = item;
                    menuTool.Tools.Add(menuItem);
                }

                toolBarManager.Tools.Add(menuTool);
                menus.Add(menuTool);
            }
        }
Beispiel #15
0
        private ToolBase addPluginTool(RibbonGroup group, string key, GruppiMenuVoceDTO voce, Bitmap imageLarge, Bitmap imageSmall)
        {
            ToolBase tool;
            if (voce == null || string.IsNullOrEmpty(voce.NomeGruppoPopup))
                tool = group.Tools.AddTool(key);
            else
            {
                group.Settings.CanCollapse = DefaultableBoolean.False;
                PopupMenuTool popupMenuTool;

                // Creo e aggiungo il menu tool se non esiste ancora
                var menuKey = group.Key + "_" + voce.NomeGruppoPopup + "_Gruppo";
                if (!group.Tools.Exists(menuKey))
                {
                    popupMenuTool = new PopupMenuTool(menuKey) {AllowTearaway = true};

                    // Set some properties on the Popup menu
                    popupMenuTool.InstanceProps.MinimumSizeOnRibbon = RibbonToolSize.Large;
                    popupMenuTool.SharedProps.Caption = voce.NomeGruppoPopup;
                    popupMenuTool.SharedProps.AppearancesLarge.Appearance.Image = imageLarge;
                    popupMenuTool.SharedProps.AppearancesSmall.Appearance.Image = imageSmall;

                    group.Tab.Ribbon.ToolbarsManager.Tools.Add(popupMenuTool);
                    group.Tools.AddTool(menuKey);
                }
                else
                    popupMenuTool = (PopupMenuTool)group.Tools[menuKey];

                tool = popupMenuTool.Tools.AddTool(key);
            }

            return tool;
        }
Beispiel #16
0
        public static void LoadItems(DataView dv, UltraToolbarsManager toolbar, PopupMenuTool popupMenuTool)
        {
            string id;
            string Shortcut = "";



            foreach (DataRowView drv in dv)
            {
                if (IsAvaible(drv))
                {
                    long IdHerramienta = ( long )drv["IdHerramienta"];
                    id = ( string )drv["id"];
                    System.Console.WriteLine(IdHerramienta);
                    System.Console.WriteLine(id);


                    if (HasChilds(dv.Table, IdHerramienta) || drv["IdHerramientaPadre"] == System.DBNull.Value)
                    {
                        PopupMenuTool newPopupMenuTool = new PopupMenuTool(id);

                        newPopupMenuTool.SharedProps.Caption = GetRecurso(ID_TIPO_RECURSO_TITULO, IdHerramienta);


                        UltraToolbar mainMenuBar = toolbar.Toolbars["Menú principal"];

                        toolbar.Tools.Add(newPopupMenuTool);

                        bool visible = Convert.ToBoolean(drv["Visible"]);
                        newPopupMenuTool.SharedProps.Visible = visible;

                        //German 20110329 - Tarea 0000093
                        newPopupMenuTool.DropDownArrowStyle = DropDownArrowStyle.None;
                        //Fin German 20110329 - Tarea 0000093

                        if (drv["IdHerramientaPadre"] == System.DBNull.Value)
                        {
                            mainMenuBar.Tools.Add(newPopupMenuTool);
                            //German 20110328 - Tarea 0000093
                            //newPopupMenuTool.SharedProps.DisplayStyle = ToolDisplayStyle.TextOnlyInMenus;

                            //Fin German 20110328 - Tarea 0000093
                        }
                        else
                        {
                            if (GetRecurso(ID_TIPO_RECURSO_SEPARATOR, IdHerramienta) != string.Empty)
                            {
                                newPopupMenuTool.InstanceProps.IsFirstInGroup = true;
                            }

                            popupMenuTool.Tools.Add(newPopupMenuTool);
                        }

                        LoadItems(new DataView(dv.Table, string.Format("IdHerramientaPadre = {0}", drv["IdHerramienta"]), null, DataViewRowState.OriginalRows), toolbar, newPopupMenuTool);
                    }
                    else
                    {
                        //Debería tomar de herramientas recursos idiomas
                        //ButtonTool newButtonTool = new ButtonTool( GetRecurso( ID_TIPO_RECURSO_TITULO, IdHerramienta ) );

                        ButtonTool newButtonTool = new ButtonTool(id);


                        newButtonTool.SharedProps.Caption = GetRecurso(ID_TIPO_RECURSO_TITULO, IdHerramienta);

                        if (drv["Shortcut"] != System.DBNull.Value)
                        {
                            Shortcut = (string )drv["Shortcut"];
                            newButtonTool.SharedProps.Shortcut = (System.Windows.Forms.Shortcut)Enum.Parse(typeof(System.Windows.Forms.Shortcut), Shortcut, true);
                        }
                        if (GetRecurso(ID_TIPO_RECURSO_IMAGEN, IdHerramienta) != string.Empty)
                        {
                            //German 20110329 - Tarea 0000093
                            ImageList ilSmall = toolbar.ImageListSmall;
                            string    prueba  =
                                string.Format(
                                    mz.erp.systemframework.Util.ResourcePath() + "\\resources\\Icons\\" +
                                    GetRecurso(ID_TIPO_RECURSO_IMAGEN, IdHerramienta), "16");
                            Image image1 = null;
                            try
                            {
                                System.Drawing.Icon c = new Icon(prueba);
                                image1 = c.ToBitmap();
                            }
                            catch (Exception e)
                            {
                                image1 = Image.FromFile(prueba);
                                //int smallIndexImage = ilSmall.Images.Add( Image.FromFile(  prueba), System.Drawing.Color.Magenta );
                            }
                            int smallIndexImage = ilSmall.Images.Add(image1, System.Drawing.Color.Magenta);

                            ImageList ilLarge = toolbar.ImageListLarge;
                            prueba =
                                string.Format(
                                    mz.erp.systemframework.Util.ResourcePath() + "\\resources\\Icons\\" +
                                    GetRecurso(ID_TIPO_RECURSO_IMAGEN, IdHerramienta), "24");
                            //int largeIndexImage = ilLarge.Images.Add(Image.FromFile(prueba), System.Drawing.Color.Magenta);
                            try
                            {
                                System.Drawing.Icon c = new Icon(prueba);
                                image1 = c.ToBitmap();
                            }
                            catch (Exception e)
                            {
                                image1 = Image.FromFile(prueba);
                                //int smallIndexImage = ilSmall.Images.Add( Image.FromFile(  prueba), System.Drawing.Color.Magenta );
                            }
                            int largeIndexImage = ilLarge.Images.Add(image1, System.Drawing.Color.Magenta);

                            //Fin German 20110329 - Tarea 0000093
                            newButtonTool.SharedProps.AppearancesSmall.Appearance.Image = smallIndexImage;
                            newButtonTool.SharedProps.AppearancesLarge.Appearance.Image = largeIndexImage;
                        }

                        newButtonTool.SharedProps.DisplayStyle = ToolDisplayStyle.ImageAndText;
                        string SepKey  = GetRecurso(ID_TIPO_RECURSO_SEPARATOR, IdHerramienta);
                        bool   visible = Convert.ToBoolean(drv["Visible"]);


                        toolbar.Tools.Add(newButtonTool);

                        try
                        {
                            popupMenuTool.Tools.Add(newButtonTool);
                            if (SepKey != string.Empty)
                            {
                                popupMenuTool.Tools[id].InstanceProps.IsFirstInGroup = true;
                                //newButtonTool.InstanceProps.IsFirstInGroup = true;
                            }
                            if (!visible)
                            {
                                popupMenuTool.Tools[id].InstanceProps.Visible = Infragistics.Win.DefaultableBoolean.False;
                            }
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e.Message);
                        }
                    }
                }
            }
        }
Beispiel #17
0
        //绘制内容菜单
        private void createDrawContextMenu()
        {
            ButtonTool btnUndo       = new ButtonTool("btnUndo");
            ButtonTool btnLeftCorner = new ButtonTool("btnLeftCorner");
            ButtonTool btnFixAzim    = new ButtonTool("btnFixAzim");
            ButtonTool btnLengthAzim = new ButtonTool("btnLengthAzim");
            ButtonTool btnSideLength = new ButtonTool("btnSideLength");
            ButtonTool btnFixLength  = new ButtonTool("btnFixLength");
            ButtonTool btnAbsXYZ     = new ButtonTool("btnAbsXYZ");
            ButtonTool btnRelaXYZ    = new ButtonTool("btnRelaXYZ");
            ButtonTool btnParllel    = new ButtonTool("btnParllel");
            ButtonTool btnRt         = new ButtonTool("btnRt");
            ButtonTool btnColse      = new ButtonTool("btnColse");
            ButtonTool btnEnd        = new ButtonTool("btnEnd");
            ButtonTool btnESC        = new ButtonTool("btnESC");

            btnUndo.SharedProps.Caption       = "键回退(&U)";
            btnLeftCorner.SharedProps.Caption = "输入左折角(&N)...";
            btnFixAzim.SharedProps.Caption    = "输入方位角(&O)...";
            btnFixLength.SharedProps.Caption  = "输入长度(&D)...";
            btnLengthAzim.SharedProps.Caption = "长度+方位角(&F)..";
            btnSideLength.SharedProps.Caption = "矩形边长(&B)...";
            btnAbsXYZ.SharedProps.Caption     = "绝对坐标(&A)...";
            btnRelaXYZ.SharedProps.Caption    = "相对坐标(&R)...";
            btnParllel.SharedProps.Caption    = "平行(&P)...";
            btnRt.SharedProps.Caption         = "直角(&S)...";
            btnColse.SharedProps.Caption      = "封闭完成(&C)";
            btnEnd.SharedProps.Caption        = "完成(&E)";
            btnESC.SharedProps.Caption        = "取消(ESC)";


            PopupMenuTool drawPopupMenuTool = new PopupMenuTool("drawPopupMenuTool");

            drawPopupMenuTool.Tools.Add(btnUndo);
            drawPopupMenuTool.Tools.Add(btnLeftCorner);
            drawPopupMenuTool.Tools.Add(btnFixAzim);
            drawPopupMenuTool.Tools.Add(btnFixLength);
            drawPopupMenuTool.Tools.Add(btnLengthAzim);
            drawPopupMenuTool.Tools.Add(btnSideLength);
            drawPopupMenuTool.Tools.Add(btnAbsXYZ);
            drawPopupMenuTool.Tools.Add(btnRelaXYZ);
            drawPopupMenuTool.Tools.Add(btnParllel);
            drawPopupMenuTool.Tools.Add(btnRt);
            drawPopupMenuTool.Tools.Add(btnColse);
            drawPopupMenuTool.Tools.Add(btnEnd);
            drawPopupMenuTool.Tools.Add(btnESC);

            PopupMenuTool modifyPopupMenuTool = new PopupMenuTool("modifyPopupMenuTool");

            modifyPopupMenuTool.Tools.Add(btnFixAzim);
            modifyPopupMenuTool.Tools.Add(btnFixLength);
            modifyPopupMenuTool.Tools.Add(btnParllel);
            modifyPopupMenuTool.Tools.Add(btnESC);


            drawPopupMenuTool.Tools["btnLeftCorner"].InstanceProps.IsFirstInGroup = true;
            drawPopupMenuTool.Tools["btnFixAzim"].InstanceProps.IsFirstInGroup    = true;
            drawPopupMenuTool.Tools["btnSideLength"].InstanceProps.IsFirstInGroup = true;
            drawPopupMenuTool.Tools["btnAbsXYZ"].InstanceProps.IsFirstInGroup     = true;
            drawPopupMenuTool.Tools["btnParllel"].InstanceProps.IsFirstInGroup    = true;
            drawPopupMenuTool.Tools["btnColse"].InstanceProps.IsFirstInGroup      = true;

            modifyPopupMenuTool.Tools["btnParllel"].InstanceProps.IsFirstInGroup = true;
            modifyPopupMenuTool.Tools["btnESC"].InstanceProps.IsFirstInGroup     = true;


            toolbarsManager.Tools.Add(btnUndo);
            toolbarsManager.Tools.Add(btnLeftCorner);
            toolbarsManager.Tools.Add(btnFixAzim);
            toolbarsManager.Tools.Add(btnFixLength);
            toolbarsManager.Tools.Add(btnLengthAzim);
            toolbarsManager.Tools.Add(btnSideLength);
            toolbarsManager.Tools.Add(btnAbsXYZ);
            toolbarsManager.Tools.Add(btnRelaXYZ);
            toolbarsManager.Tools.Add(btnParllel);
            toolbarsManager.Tools.Add(btnRt);
            toolbarsManager.Tools.Add(btnColse);
            toolbarsManager.Tools.Add(btnEnd);
            toolbarsManager.Tools.Add(btnESC);
            toolbarsManager.Tools.Add(drawPopupMenuTool);
            toolbarsManager.Tools.Add(modifyPopupMenuTool);
        }
Beispiel #18
0
		private ToolBase getTool(string key, ToolbarType type)
		{
            ToolBase _tool;

            if (_toolbarsManager.Tools.Exists(key))
                _tool = _toolbarsManager.Tools[key];
            else
            {
                switch (type)
                {
                    case ToolbarType.Button:
                        _tool = new ButtonTool(key);
                        break;
                    case ToolbarType.PopUpMenu:
                        _tool = new PopupMenuTool(key);
                        break;
                    case ToolbarType.RibbonTab:
                        _tool = new ButtonTool(key);
                        break;
                    default:
                        _tool = new ButtonTool(key);
                        break;
                }

                _toolbarsManager.Tools.Add(_tool);
            }

            return _tool;
		}