예제 #1
0
        /// <summary>
        /// Registers the menu.
        /// </summary>
        /// <param name="menu">The menu.</param>
        public void RegisterMenu(MenuItemEx menu)
        {
            if (string.IsNullOrWhiteSpace(menu.Name))
            {
                throw new ArgumentException("name must not be NULL");
            }

            var existingMenu = this.MenuItems.FirstOrDefault(mn => mn.Name.Equals(menu.Name));

            if (existingMenu != null)
            {
                throw new ArgumentException("Menu is already existing");
            }

            this.MenuItems.Add(menu);
        }
예제 #2
0
 public void BuildMenu()
 {
     this.cmuFile.MenuItems.Clear();
     if (this.isItem)
     {
         this.cmiRelat        = new MenuItemEx("Relation", "与数据类型关联", null, null);
         this.cmiRelat.Click += new EventHandler(this.cmiRelat_Click);
         this.cmuFile.MenuItems.Add(this.cmiRelat);
         MenuItemEx item = new MenuItemEx("-", "-", null, null);
         this.cmuFile.MenuItems.Add(item);
         this.cmiEdit            = new MenuItemEx("Edit", "属性", null, null);
         this.cmiEdit.ImageList  = ClientData.MyImageList.imageList;
         this.cmiEdit.ImageIndex = ClientData.MyImageList.GetIconIndex("ICO_PROPERTY");
         this.cmiEdit.Click     += new EventHandler(this.cmiEdit_Click);
         this.cmuFile.MenuItems.Add(this.cmiEdit);
         if (this.lvwFile.SelectedItems.Count > 0)
         {
             this.cmiRefreshFiles            = new MenuItemEx("Refresh Files", "更新业务对象文件类型", null, null);
             this.cmiRefreshFiles.ImageList  = ClientData.MyImageList.imageList;
             this.cmiRefreshFiles.ImageIndex = ClientData.MyImageList.GetIconIndex("ICO_REFRESH");
             this.cmiRefreshFiles.Click     += new EventHandler(this.cmiRefreshFiles_Click);
             this.cmuFile.MenuItems.Add(this.cmiRefreshFiles);
         }
         item = new MenuItemEx("-", "-", null, null);
         this.cmuFile.MenuItems.Add(item);
         this.cmiDel            = new MenuItemEx("Delete", "删除", null, null);
         this.cmiDel.ImageList  = ClientData.MyImageList.imageList;
         this.cmiDel.ImageIndex = ClientData.MyImageList.GetIconIndex("ICO_DELETE");
         this.cmiDel.Click     += new EventHandler(this.cmiDel_Click);
         this.cmuFile.MenuItems.Add(this.cmiDel);
     }
     else
     {
         MenuItemEx ex2 = new MenuItemEx("&New Browser", "新建文件类型(&N)", null, null);
         ex2.Click += new EventHandler(this.NewFileType);
         this.cmuFile.MenuItems.Add(ex2);
         ex2 = new MenuItemEx("-", "-", null, null);
         this.cmuFile.MenuItems.Add(ex2);
         ex2 = new MenuItemEx("Refresh", "刷新(&F)", null, null)
         {
             ImageList  = ClientData.MyImageList.imageList,
             ImageIndex = ClientData.MyImageList.GetIconIndex("ICO_REFRESH")
         };
         ex2.Click += new EventHandler(this.FileTypeRefresh);
         this.cmuFile.MenuItems.Add(ex2);
     }
 }
예제 #3
0
        private void ContextMenuClose(object sender, RoutedEventArgs e)
        {
            MenuItemEx menuItem = sender as MenuItemEx;

            var name = "N" + menuItem.Name.Split('_')[1];

            TreeViewExNode item = DataBaseList.FindName(name) as TreeViewExNode;

            var removeItems = new List <TabItemEx>();

            // 关闭关联视图
            if (menuItem.ItemType == ItemTypes.Server)
            {
                foreach (TabItemEx temp in TabController.Items)
                {
                    if (temp.DataSource == item.DataSource &&
                        temp.ConnectionId == item.ConnectionId)
                    {
                        removeItems.Add(temp);
                    }
                }
            }
            else if (menuItem.ItemType == ItemTypes.DataBase)
            {
                foreach (TabItemEx temp in TabController.Items)
                {
                    if (temp.DataBase == item.DataBase &&
                        temp.DataSource == item.DataSource &&
                        temp.ConnectionId == item.ConnectionId)
                    {
                        removeItems.Add(temp);
                    }
                }
            }

            foreach (TabItemEx temp in removeItems)
            {
                TabController.Items.Remove(temp);
            }

            if (item != null)
            {
                DockPanel1.UnregisterName(name);
                item.Items.Clear();
            }
        }
예제 #4
0
        /// <summary>
        /// 创建右键菜单
        /// </summary>
        /// <returns></returns>
        private void createContextMenu()
        {
            Style winxmenu = Current.Resources["WinXTaskBarContextMenuItemStyle"] as Style;

            _cmenu = new ContextMenuEx {
                Style = Current.Resources["WinXTaskBarContextMenuStyle"] as Style
            };
            MenuItemEx exit = new MenuItemEx {
                Style = winxmenu, LabelString = "退出", Command = MainVM.Singleton.Operation, CommandParameter = "CMD_EXIT"
            };
            MenuItemEx about = new MenuItemEx {
                Style = winxmenu, LabelString = "关于", Command = MainVM.Singleton.Operation, CommandParameter = "CMD_ABOUT"
            };

            _cmenu.Items.Add(about);
            _cmenu.Items.Add(exit);
        }
예제 #5
0
        MenuItemEx ConvertToEx(We7.CMS.Common.MenuItem menuItem, string keyword, int state)
        {
            if (state < 100)
            {
                if (state != menuItem.Type)
                {
                    return(null);
                }
                else if (!string.IsNullOrEmpty(keyword) && menuItem.Name.IndexOf(keyword) == -1)
                {
                    return(null);
                }
            }

            MenuItemEx menuItemEx = new MenuItemEx();

            menuItemEx.Import(menuItem);
            if (menuItem.Type == 99)
            {
                menuItemEx.MenuType             = "用户自定义菜单";
                menuItemEx.MenuDelVisble        = "";
                menuItemEx.MenuSystemVisble     = "none";
                menuItemEx.MenuSystemShowVisble = "none";
                menuItemEx.MenuDelUrl           = String.Format("javascript:DeleteConfirm('{0}','{1}');", menuItem.ID, menuItem.Name);
            }
            else if (menuItem.Type == 2)
            {
                menuItemEx.MenuType             = "隐藏菜单";
                menuItemEx.MenuDelVisble        = "none";
                menuItemEx.MenuSystemVisble     = "none";
                menuItemEx.MenuSystemShowVisble = "";
                menuItemEx.MenuSystemShowUrl    = String.Format("javascript:ShowConfirm('{0}','{1}');", menuItem.ID, menuItem.Name);
            }
            else
            {
                menuItemEx.MenuType             = "系统菜单";
                menuItemEx.MenuDelVisble        = "none";
                menuItemEx.MenuSystemVisble     = "";
                menuItemEx.MenuSystemShowVisble = "none";
                menuItemEx.MenuSystemUrl        = String.Format("javascript:HideConfirm('{0}','{1}');", menuItem.ID, menuItem.Name);
            }
            return(menuItemEx);
        }
예제 #6
0
 public MenuItemEx[] BuildEditMenuItems()
 {
     MenuItemEx[] exArray = new MenuItemEx[5];
     exArray[0]             = new MenuItemEx("ViewFrame &Property", "视图模型属性(&P)", null, null);
     exArray[0].Click      += new EventHandler(this.ViewFrameProperty);
     exArray[0].DefaultItem = true;
     exArray[0].ImageList   = ClientData.MyImageList.imageList;
     exArray[0].ImageIndex  = ClientData.MyImageList.GetIconIndex("ICO_PROPERTY");
     exArray[1]             = new MenuItemEx("-", "-", null, null);
     exArray[2]             = new MenuItemEx("ViewFrame &Refresh", "刷新(&R)", null, null);
     exArray[2].ImageList   = ClientData.MyImageList.imageList;
     exArray[2].ImageIndex  = ClientData.MyImageList.GetIconIndex("ICO_REFRESH");
     exArray[2].Click      += new EventHandler(this.ViewFrameRefresh);
     exArray[3]             = new MenuItemEx("-", "-", null, null);
     exArray[4]             = new MenuItemEx("ViewFrame &Close", "关闭(&C)", null, null);
     exArray[4].ImageList   = ClientData.MyImageList.imageList;
     exArray[4].ImageIndex  = ClientData.MyImageList.GetIconIndex("ICO_VIW_EXIT");
     exArray[4].Click      += new EventHandler(this.ViewFrameClose);
     return(exArray);
 }
예제 #7
0
        void CreateFileMenu()
        {
            miFile        = new MenuItemEx();
            miFile.Popup += new EventHandler(OnFilePopup);

            miOpen        = new MenuItemEx();
            miOpen.Click += new EventHandler(OnFileOpen);

            miClose        = new MenuItemEx();
            miClose.Click += new EventHandler(OnFileClose);

            miInfo        = new MenuItemEx();
            miInfo.Click += new EventHandler(OnFileInfo);

            miFile.MenuItems.AddRange(new MenuItem[] { miOpen, miClose });

            CreateCDRomMenu();

            miFile.MenuItems.AddRange(new MenuItem[] { sep.CloneMenu(), miInfo });
        }
예제 #8
0
        private void BuildVMMenu()
        {
            this.cmuVM.MenuItems.Clear();
            MenuItemEx item  = null;
            bool       flag  = ((DEViewModel)this.lvwViewModel.SelectedItems[0].Tag).Locker == Guid.Empty;
            bool       flag2 = ((DEViewModel)this.lvwViewModel.SelectedItems[0].Tag).Locker == ClientData.LogonUser.Oid;
            bool       flag3 = ((DEViewModel)this.lvwViewModel.SelectedItems[0].Tag).IsActive == 'U';

            item        = new MenuItemEx("&Open ViewModel", "打开视图模型(&O)", null, null);
            item.Click += new EventHandler(this.OpenViewModel);
            this.cmuVM.MenuItems.Add(item);
            if (flag || flag2)
            {
                item            = new MenuItemEx("&Delete ViewModel", "删除视图模型(&D)", null, null);
                item.Click     += new EventHandler(this.DeleteViewModel);
                item.ImageList  = ClientData.MyImageList.imageList;
                item.ImageIndex = ClientData.MyImageList.GetIconIndex("ICO_DELETE");
                this.cmuVM.MenuItems.Add(item);
            }
            item = new MenuItemEx("-", "-", null, null);
            this.cmuVM.MenuItems.Add(item);
            item        = new MenuItemEx("ViewModel &Property", "视图模型属性(&P)", null, null);
            item.Click += new EventHandler(this.ViewModelProperty);
            this.cmuVM.MenuItems.Add(item);
            if (flag && flag3)
            {
                item = new MenuItemEx("-", "-", null, null);
                this.cmuVM.MenuItems.Add(item);
                item        = new MenuItemEx("&Active ViewModel", "激活视图模型(&A)", null, null);
                item.Click += new EventHandler(this.ActiveViewModel);
                this.cmuVM.MenuItems.Add(item);
            }
            if (!flag3)
            {
                item = new MenuItemEx("-", "-", null, null);
                this.cmuVM.MenuItems.Add(item);
                item        = new MenuItemEx("&UnActive ViewModel", "取消激活(&U)", null, null);
                item.Click += new EventHandler(this.UnactiveViewModel);
                this.cmuVM.MenuItems.Add(item);
            }
        }
예제 #9
0
 public void BuildMenu()
 {
     this.cmuBrowser.MenuItems.Clear();
     if (this.isItem)
     {
         this.cmiEdit             = new MenuItemEx("&Property", "属性(&P)", null, null);
         this.cmiEdit.DefaultItem = true;
         this.cmiEdit.ImageList   = ClientData.MyImageList.imageList;
         this.cmiEdit.ImageIndex  = ClientData.MyImageList.GetIconIndex("ICO_PROPERTY");
         this.cmiEdit.Click      += new EventHandler(this.cmiEdit_Click);
         this.cmuBrowser.MenuItems.Add(this.cmiEdit);
         if (!((DEBrowser)this.lvwBrowser.SelectedItems[0].Tag).IsSystem)
         {
             MenuItemEx item = new MenuItemEx("-", "-", null, null);
             this.cmuBrowser.MenuItems.Add(item);
             this.cmiDel            = new MenuItemEx("&Delete", "删除(&D)", null, null);
             this.cmiDel.ImageList  = ClientData.MyImageList.imageList;
             this.cmiDel.ImageIndex = ClientData.MyImageList.GetIconIndex("ICO_DELETE");
             this.cmiDel.Click     += new EventHandler(this.cmiDel_Click);
             this.cmuBrowser.MenuItems.Add(this.cmiDel);
         }
     }
     else
     {
         MenuItemEx ex2 = new MenuItemEx("New &Browser", "新增浏览器(&B)", null, null);
         ex2.Click += new EventHandler(this.frmMain.NewBrowser);
         this.cmuBrowser.MenuItems.Add(ex2);
         ex2        = new MenuItemEx("New &Editor", "新增编辑器(&E)", null, null);
         ex2.Click += new EventHandler(this.frmMain.NewEditor);
         this.cmuBrowser.MenuItems.Add(ex2);
         ex2 = new MenuItemEx("-", "-", null, null);
         this.cmuBrowser.MenuItems.Add(ex2);
         ex2 = new MenuItemEx("Browser Re&Fresh", "刷新(&F)", null, null)
         {
             ImageList  = ClientData.MyImageList.imageList,
             ImageIndex = ClientData.MyImageList.GetIconIndex("ICO_REFRESH")
         };
         ex2.Click += new EventHandler(this.frmMain.BrowserRefresh);
         this.cmuBrowser.MenuItems.Add(ex2);
     }
 }
예제 #10
0
 public MenuItemEx[] BuildViewRelationMenuItems()
 {
     if (!(((DEViewModel)this.thePanal.mainWindow.Tag).Locker == ClientData.LogonUser.Oid))
     {
         MenuItemEx[] exArray = new MenuItemEx[] { new MenuItemEx("ViewRelation &Property", "视图关系属性(&P)", null, null) };
         exArray[0].Click      += new EventHandler(this.ViewRelationProperty);
         exArray[0].DefaultItem = true;
         exArray[0].ImageList   = ClientData.MyImageList.imageList;
         exArray[0].ImageIndex  = ClientData.MyImageList.GetIconIndex("ICO_PROPERTY");
         return(exArray);
     }
     MenuItemEx[] exArray2 = new MenuItemEx[3];
     exArray2[0]             = new MenuItemEx("ViewRelation &Property", "视图关系属性(&P)", null, null);
     exArray2[0].Click      += new EventHandler(this.ViewRelationProperty);
     exArray2[0].DefaultItem = true;
     exArray2[0].ImageList   = ClientData.MyImageList.imageList;
     exArray2[0].ImageIndex  = ClientData.MyImageList.GetIconIndex("ICO_PROPERTY");
     exArray2[1]             = new MenuItemEx("-", "-", null, null);
     exArray2[2]             = new MenuItemEx("ViewRelation &Delete", "删除关系(&D)", null, null);
     exArray2[2].Click      += new EventHandler(this.ViewRelationDelete);
     return(exArray2);
 }
예제 #11
0
        private void BuildMenu(string VMName)
        {
            this.cmuVM.MenuItems.Clear();
            MenuItemEx item = null;
            string     str  = VMName;

            if (str != null)
            {
                if (str != "Thyt.TiPLM.DEL.Admin.View.DEViewModel")
                {
                    if (str != "Empty")
                    {
                        return;
                    }
                }
                else
                {
                    this.BuildVMMenu();
                    return;
                }
                item = new MenuItemEx("&New ViewModel", "新建视图(&N)", null, null)
                {
                    ImageList  = ClientData.MyImageList.imageList,
                    ImageIndex = ClientData.MyImageList.GetIconIndex("ICO_VIW_VIEW")
                };
                item.Click += new EventHandler(this.NewViewModel);
                this.cmuVM.MenuItems.Add(item);
                item = new MenuItemEx("-", "-", null, null);
                this.cmuVM.MenuItems.Add(item);
                item = new MenuItemEx("ViewModelList Re&Fresh", "刷新(&F)", null, null)
                {
                    ImageList  = ClientData.MyImageList.imageList,
                    ImageIndex = ClientData.MyImageList.GetIconIndex("ICO_REFRESH")
                };
                item.Click += new EventHandler(this.RefreshViewModelList);
                this.cmuVM.MenuItems.Add(item);
            }
        }
        void CreateAppMenu()
        {
            miApp        = new MenuItemEx();
            miApp.Popup += new EventHandler(OnAppPopup);

            miControlbar        = new MenuItemEx();
            miControlbar.Click += new EventHandler(OnSettingsControlbar);

            miPref        = new MenuItemEx();
            miPref.Click += new EventHandler(OnSettingsPreferences);

            miAbout        = new MenuItemEx();
            miAbout.Click += new EventHandler(OnHelpAbout);

            miAppLang        = new MenuItemEx();
            miAppLang.Popup += new EventHandler(miAppLang_Popup);
            EventHandler eh   = new EventHandler(OnMenuLangItem);
            MenuItemEx   item = new MenuItemEx();

            item.Tag    = new AppLang("default", "en-US");
            item.Click += eh;
            miAppLang.MenuItems.Add(item);
            item        = new MenuItemEx();
            item.Tag    = new AppLang("russian", "ru-RU");
            item.Click += eh;
            miAppLang.MenuItems.Add(item);

            miApp.MenuItems.AddRange(new MenuItem[]
                                     { miControlbar, sep.CloneMenu(), miAppLang, miPref, miAbout });

            miExit        = new MenuItemEx();
            miExit.Click += new EventHandler(OnClose);

            htCommands.Add(SettingsForm.strKeysPref, miPref);
            htCommands.Add(SettingsForm.strKeysAbout, miAbout);
            htCommands.Add(SettingsForm.strKeysExit, miExit);
        }
예제 #13
0
        public void UpdateMRU()
        {
            try {
                miMRUFiles.Enabled = (AppHost.Options.MRUFiles.Count > 0);
                miMRUFiles.Items.Clear();
                MenuMRU.Items.Clear();

                int num = AppHost.Options.MRUFiles.Count;
                for (int i = 0; i < num; i++)
                {
                    string fn = AppHost.Options.MRUFiles[i].FileName;

                    MenuItemEx mi = new MenuItemEx(fn, i);
                    mi.Click += MRUFileClick;
                    miMRUFiles.Items.Add(mi);

                    MenuItemEx tsmi = new MenuItemEx(fn, i);
                    tsmi.Click += MRUFileClick;
                    MenuMRU.Items.Add(tsmi);
                }
            } catch (Exception ex) {
                Logger.LogWrite("BaseWinSDI.UpdateMRU(): " + ex.Message);
            }
        }
예제 #14
0
 public void Insert(int index, MenuItemEx item)
 {
     List.Insert(index, item);
 }
예제 #15
0
 private void lvwNavigater_MouseUp(object sender, MouseEventArgs e)
 {
     if (((e.Button == MouseButtons.Right) && (this.lvwNavigater.SelectedItems.Count == 1)) && (this.frmMain != null))
     {
         TreeNode    tag  = (TreeNode)this.lvwNavigater.SelectedItems[0].Tag;
         ContextMenu menu = new ContextMenu();
         if (tag.Tag is DELProcessClass)
         {
             MenuItemEx item = new MenuItemEx("&RenameProClass", "重命名(&R)", null, null);
             item.Click += new EventHandler(this.RenameProClass);
             menu.MenuItems.Add(item);
             item = new MenuItemEx("New&ProTem", "新建模板(&P)", null, null)
             {
                 ImageList  = ClientData.MyImageList.imageList,
                 ImageIndex = ClientData.MyImageList.GetIconIndex("ICO_BPM_DEF")
             };
             item.Click += new EventHandler(this.frmMain.OnNewProTem);
             menu.MenuItems.Add(item);
             item = new MenuItemEx("&ImportTemplate", "导入模板(&I)", null, null)
             {
                 ImageList  = ClientData.MyImageList.imageList,
                 ImageIndex = ClientData.MyImageList.GetIconIndex("ICO_BPM_DEF")
             };
             item.Click += new EventHandler(this.frmMain.OnImportTemplate);
             menu.MenuItems.Add(item);
             item = new MenuItemEx("&OnPasteProTem", "粘贴模版(&V)", null, null)
             {
                 ImageList  = ClientData.MyImageList.imageList,
                 ImageIndex = ClientData.MyImageList.GetIconIndex("ICO_BPM_PASTE")
             };
             if (this.frmMain.getTheCuttingNode() == null)
             {
                 item.Enabled = false;
             }
             else if (this.frmMain.isCuttingNodeDeleted)
             {
                 item.Enabled = false;
             }
             else if (this.frmMain.getTheCuttingNode().Parent == tag)
             {
                 item.Enabled = false;
             }
             else
             {
                 item.Enabled = true;
             }
             item.Click += new EventHandler(this.frmMain.OnPasteProTem);
             menu.MenuItems.Add(item);
             item = new MenuItemEx("&DelProClass", "删除(&D)", null, null)
             {
                 ImageList  = ClientData.MyImageList.imageList,
                 ImageIndex = ClientData.MyImageList.GetIconIndex("ICO_DELETE")
             };
             item.Click += new EventHandler(this.frmMain.OnDelProClass);
             menu.MenuItems.Add(item);
         }
         if (tag.Tag is DELProcessDefProperty)
         {
             MenuItemEx ex2;
             this.frmMain.tvwNavigator.SelectedNode = tag;
             menu = this.frmMain.BuildMenu("Thyt.TiPLM.DEL.Admin.BPM.DELProcessDefProperty", this.frmMain.tvwNavigator.SelectedNode);
             if (this.frmMain.GetAllowCreateProcessManagement())
             {
                 ex2 = new MenuItemEx("-", "-", null, null);
                 menu.MenuItems.Add(ex2);
                 ex2 = new MenuItemEx("New&ProTem", "新建模板(&P)", null, null)
                 {
                     ImageList  = ClientData.MyImageList.imageList,
                     ImageIndex = ClientData.MyImageList.GetIconIndex("ICO_BPM_DEF")
                 };
                 ex2.Click += new EventHandler(this.frmMain.OnNewProTem);
                 menu.MenuItems.Add(ex2);
                 ex2 = new MenuItemEx("&ImportTemplate", "导入模板(&I)", null, null)
                 {
                     ImageList  = ClientData.MyImageList.imageList,
                     ImageIndex = ClientData.MyImageList.GetIconIndex("ICO_BPM_DEF")
                 };
                 ex2.Click += new EventHandler(this.frmMain.OnImportTemplate);
                 menu.MenuItems.Add(ex2);
             }
             ex2 = new MenuItemEx("&Refresh", "刷新(&R)", null, null)
             {
                 ImageList  = ClientData.MyImageList.imageList,
                 ImageIndex = ClientData.MyImageList.GetIconIndex("ICO_REFRESH")
             };
             ex2.Click += new EventHandler(this.frmMain.OnRefresh);
             menu.MenuItems.Add(ex2);
         }
         if (menu.MenuItems.Count > 0)
         {
             menu.Show(this.lvwNavigater, new Point(e.X, e.Y));
         }
     }
 }
예제 #16
0
        private ContextMenu BuildContextMenu()
        {
            ContextMenu menu = new ContextMenu();
            MenuItemEx  item = null;

            if (!this.m_tp.ReadOnly)
            {
                item = new MenuItemEx("Save", "保存", null, null)
                {
                    Icon = PLMImageList.GetIcon("ICO_ENV_SAVE").ToBitmap()
                };
                item.Click += new EventHandler(this.OnSave);
                menu.MenuItems.Add(item);
                item = new MenuItemEx("-", "-", null, null);
                menu.MenuItems.Add(item);
                item = new MenuItemEx("Import…", "当前页导入…", null, null)
                {
                    Icon = PLMImageList.GetIcon("ICO_PPM_PPCARDIMPORT").ToBitmap()
                };
                item.Click += new EventHandler(this.OnImport);
                menu.MenuItems.Add(item);
                item        = new MenuItemEx("ResetViewRange", "重新设置模板区域", null, null);
                item.Click += new EventHandler(this.OnResetViewRange);
                menu.MenuItems.Add(item);
            }
            item = new MenuItemEx("Export…", "导出当前页…", null, null)
            {
                Icon = PLMImageList.GetIcon("ICO_PPM_PPCARDEXPORT").ToBitmap()
            };
            item.Click += new EventHandler(this.OnExport);
            menu.MenuItems.Add(item);
            if (!this.m_tp.ReadOnly)
            {
                item        = new MenuItemEx("Page setup…", "页面设置…", null, null);
                item.Click += new EventHandler(this.OnPageSetup);
                menu.MenuItems.Add(item);
            }
            item = new MenuItemEx("Print preview", "当前页打印预览", null, null)
            {
                Icon = PLMImageList.GetIcon("ICO_PPM_PRINTPREVIEW").ToBitmap()
            };
            item.Click += new EventHandler(this.OnPrintPreview);
            menu.MenuItems.Add(item);
            if (!this.m_tp.ReadOnly)
            {
                item = new MenuItemEx("-", "-", null, null);
                menu.MenuItems.Add(item);
                item        = new MenuItemEx("Set as page range", "设为" + base.SelectedTab.Text + "有效区域", null, null);
                item.Click += new EventHandler(this.OnSetPageRange);
                menu.MenuItems.Add(item);
                item        = new MenuItemEx("Set as mid-table range", "设为" + base.SelectedTab.Text + "表中区域", null, null);
                item.Click += new EventHandler(this.OnSetMidTable);
                menu.MenuItems.Add(item);
            }
            item = new MenuItemEx("-", "-", null, null);
            menu.MenuItems.Add(item);
            if (ModelContext.MetaModel.IsCard(this.m_tp.TemplateType) && this.m_tp.CheckPageMidRegion())
            {
                bool flag = false;
                if (((this.m_tp.Item.State == ItemState.CheckOut) && (this.m_tp.Item.Holder != this.m_tp.UserOid)) || (this.m_tp.Item.State == ItemState.Abandoned))
                {
                    flag = true;
                }
                if (!flag || (this.m_tp.AutoNumber != null))
                {
                    item = new MenuItemEx("AutoNumber…", "自动编号规则设置…", null, null)
                    {
                        Icon = PLMImageList.GetIcon("ICO_PPM_AUTONUMBER").ToBitmap()
                    };
                    item.Click += new EventHandler(this.OnAutoNumber);
                    menu.MenuItems.Add(item);
                }
                if ((this.m_tp.AutoNumber != null) && !flag)
                {
                    item        = new MenuItemEx("Clear AutoNumber", "清除自动编号规则", null, null);
                    item.Click += new EventHandler(this.OnClearAutoNumber);
                    menu.MenuItems.Add(item);
                }
                if (!flag || (this.m_tp.AutoNumber != null))
                {
                    item = new MenuItemEx("-", "-", null, null);
                    menu.MenuItems.Add(item);
                }
                if (!this.m_tp.ReadOnly || (this.m_tp.ReadOnly && (this.m_tp.DataHiddenCol != null)))
                {
                    item        = new MenuItemEx("DataHiddenCol…", "数据隐藏列设置…", null, null);
                    item.Click += new EventHandler(this.OnSetDataHiddenCol);
                    menu.MenuItems.Add(item);
                }
                if (!this.m_tp.ReadOnly)
                {
                    item        = new MenuItemEx("Clear DataHiddenCol", "清除数据隐藏列设置", null, null);
                    item.Click += new EventHandler(this.OnClearDataHiddenCol);
                    menu.MenuItems.Add(item);
                }
                if (!this.m_tp.ReadOnly || (this.m_tp.ReadOnly && (this.m_tp.DataHiddenCol != null)))
                {
                    item = new MenuItemEx("-", "-", null, null);
                    menu.MenuItems.Add(item);
                }
            }
            if (base.Alignment == TabAlignment.Top)
            {
                item        = new MenuItemEx("Change label docking", "标签置底", null, null);
                item.Click += new EventHandler(this.OnChangeLabelDocking);
                menu.MenuItems.Add(item);
            }
            if (base.Alignment == TabAlignment.Bottom)
            {
                item        = new MenuItemEx("Change label docking", "标签置顶", null, null);
                item.Click += new EventHandler(this.OnChangeLabelDocking);
                menu.MenuItems.Add(item);
            }
            if (this.frmParent != null)
            {
                item        = new MenuItemEx("Close", "关闭", null, null);
                item.Click += new EventHandler(this.OnClose);
                menu.MenuItems.Add(item);
            }
            return(menu);
        }
예제 #17
0
        void BindingMenu()
        {
            List <We7.CMS.Common.MenuItem> allMenuItem = MenuHelper.GetMenus(We7Helper.EmptyGUID, 2, EntityID, true);
            List <MenuItemEx> allMenuItemEx            = new List <MenuItemEx>();

            if (allMenuItem != null)
            {
                foreach (We7.CMS.Common.MenuItem menuItem in allMenuItem)
                {
                    MenuItemEx mainEx = ConvertToEx(menuItem, Keyword, CurrentState);
                    if (mainEx != null)
                    {
                        allMenuItemEx.Add(mainEx);
                    }
                    foreach (We7.CMS.Common.MenuItem submenu in menuItem.Items)
                    {
                        MenuItemEx subEx = ConvertToEx(submenu, Keyword, CurrentState);
                        if (subEx != null)
                        {
                            subEx.Title = "├──" + subEx.Name.ToString();
                            allMenuItemEx.Add(subEx);
                        }
                        foreach (We7.CMS.Common.MenuItem thirdmenu in submenu.Items)
                        {
                            MenuItemEx thirdEx = ConvertToEx(thirdmenu, Keyword, CurrentState);
                            if (thirdEx != null)
                            {
                                thirdEx.Title = "├──├─" + thirdEx.Name.ToString();
                                allMenuItemEx.Add(thirdEx);
                            }
                        }
                    }
                }
            }

            Pager.RecorderCount = 0;
            if (allMenuItemEx != null)
            {
                Pager.RecorderCount = allMenuItemEx.Count;
            }

            if (Pager.Count < 0)
            {
                Pager.PageIndex = 0;
            }

            Pager.FreshMyself();

            if (Pager.RecorderCount > Pager.Begin + Pager.Count)
            {
                allMenuItemEx = allMenuItemEx.GetRange(Pager.Begin, Pager.Count);
            }
            else
            {
                allMenuItemEx = allMenuItemEx.GetRange(Pager.Begin, Pager.RecorderCount - Pager.Begin);
            }

            DataGridView.DataSource = allMenuItemEx;
            DataGridView.DataBind();
            StateLiteral.Text = BuildStateLinks();
        }
예제 #18
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            if(e.Button==MouseButtons.Right)
            {
                WordInfo wi=WordFromPos(new Point(e.X, e.Y));
                if(wi.word!=null)
                {
                    if(_spell.TestWord(wi.word)==false)
                    {
                        _spell.Suggest(wi.word);
                        ContextMenu menu=new ContextMenu();

                        foreach(string str in _spell.Suggestions)
                        {
                            MenuItemEx mnuitem=new MenuItemEx(str);
                            mnuitem.Click+=new EventHandler(OnSuggestedWordClick);
                            mnuitem.Tag=wi;

                            menu.MenuItems.Add(mnuitem);

                            // show only 7 suggestion
                            if(menu.MenuItems.Count>6) break;
                        }

                        if(menu.MenuItems.Count==0)
                        {
                            MenuItem nosug=new MenuItem("No suggestion");
                            nosug.Enabled=false;
                            menu.MenuItems.Add(nosug);
                        }

                        menu.MenuItems.Add(new MenuItem("-"));
                        MenuItemEx mnuIgnore=new MenuItemEx("Ignore");
                        mnuIgnore.Tag=wi;
                        mnuIgnore.Click+=new EventHandler(OnIgnoreWord);
                        menu.MenuItems.Add(mnuIgnore);

                        Point pt=PosFromChar(wi.start);

                        pt.Y+=Font.Height +1 ;

                        menu.Show(this, pt);
                    }
                }
            }
            Invalidate();
            base.OnMouseDown (e);
        }
예제 #19
0
        public void BuildMenu()
        {
            this.cmuAddin.MenuItems.Clear();
            MenuItemEx item = null;

            if (this.isItem)
            {
                if ((this.lvwAddin.SelectedItems.Count == 1) && (this.lvwAddin.SelectedItems[0].Tag is DEAddinReg))
                {
                    this.cmiEdit             = new MenuItemEx("Addin Property", "属性", null, null);
                    this.cmiEdit.DefaultItem = true;
                    this.cmiEdit.ImageList   = ClientData.MyImageList.imageList;
                    this.cmiEdit.ImageIndex  = ClientData.MyImageList.GetIconIndex("ICO_PROPERTY");
                    this.cmiEdit.Click      += new EventHandler(this.OnShowProperty);
                    this.cmuAddin.MenuItems.Add(this.cmiEdit);
                    item = new MenuItemEx("-", "-", null, null);
                    this.cmuAddin.MenuItems.Add(item);
                    bool flag = false;
                    if (!(this.lvwAddin.SelectedItems[0].Tag as DEAddinReg).IsActivated)
                    {
                        item = new MenuItemEx("Addin Valid", "立即生效", null, null)
                        {
                            ImageList = ClientData.MyImageList.imageList
                        };
                        item.Click += new EventHandler(this.OnValid);
                        this.cmuAddin.MenuItems.Add(item);
                        flag = true;
                    }
                    int      num         = ((DEAddinReg)this.lvwAddin.SelectedItems[0].Tag).Module;
                    DEModule addinModule = this.GetAddinModule(num);
                    if ((addinModule != null) && addinModule.IsNeedGrant)
                    {
                        item        = new MenuItemEx("Authorize", "授权", null, null);
                        item.Click += new EventHandler(this.OnAuthorize);
                        this.cmuAddin.MenuItems.Add(item);
                        flag = true;
                    }
                    if (flag)
                    {
                        item = new MenuItemEx("-", "-", null, null);
                        this.cmuAddin.MenuItems.Add(item);
                    }
                }
                item        = new MenuItemEx("&Addin New", "新增插件(&N)", null, null);
                item.Click += new EventHandler(this.OnNewAddin);
                this.cmuAddin.MenuItems.Add(item);
                item        = new MenuItemEx("Addin &Export", "导出插件(&E)", null, null);
                item.Click += new EventHandler(this.OnExportAddin);
                this.cmuAddin.MenuItems.Add(item);
                item        = new MenuItemEx("Addin &Import", "导入插件(&I)", null, null);
                item.Click += new EventHandler(this.OnImport);
                this.cmuAddin.MenuItems.Add(item);
                item = new MenuItemEx("-", "-", null, null);
                this.cmuAddin.MenuItems.Add(item);
                this.cmiDel            = new MenuItemEx("Addin Delete", "删除插件", null, null);
                this.cmiDel.ImageList  = ClientData.MyImageList.imageList;
                this.cmiDel.ImageIndex = ClientData.MyImageList.GetIconIndex("ICO_DELETE");
                this.cmiDel.Click     += new EventHandler(this.OnDelete);
                this.cmuAddin.MenuItems.Add(this.cmiDel);
            }
            else
            {
                item        = new MenuItemEx("Addin &New", "新增插件(&N)", null, null);
                item.Click += new EventHandler(this.OnNewAddin);
                this.cmuAddin.MenuItems.Add(item);
                item = new MenuItemEx("-", "-", null, null);
                this.cmuAddin.MenuItems.Add(item);
                item        = new MenuItemEx("Addin &Import", "导入插件(&I)", null, null);
                item.Click += new EventHandler(this.OnImport);
                this.cmuAddin.MenuItems.Add(item);
            }
            item = new MenuItemEx("Addin Re&Fresh", "刷新(&F)", null, null)
            {
                ImageList  = ClientData.MyImageList.imageList,
                ImageIndex = ClientData.MyImageList.GetIconIndex("ICO_REFRESH")
            };
            item.Click += new EventHandler(this.OnRefresh);
            this.cmuAddin.MenuItems.Add(item);
        }
예제 #20
0
        MenuItemEx ConvertToEx(We7.CMS.Common.MenuItem menuItem, string keyword, int state)
        {
            if (state < 100)
            {
                if (state != menuItem.Type)
                {
                    return(null);
                }
                else if (!string.IsNullOrEmpty(keyword) && menuItem.Name.IndexOf(keyword) == -1)
                {
                    return(null);
                }
            }

            MenuItemEx menuItemEx = new MenuItemEx();

            menuItemEx.Import(menuItem);
            string suffix = "";

            switch (menuItem.MenuType)
            {
            case 0:
                suffix = "(普通)";
                break;

            case 1:
                suffix = "(顶级)";
                break;

            case 2:
                suffix = "(分组)";
                break;

            case 3:
                suffix = "(引用)";
                break;

            default:
                suffix = "(普通)";
                break;
            }
            if (menuItem.Type == 99)
            {
                menuItemEx.MenuType             = "用户自定义菜单" + suffix;
                menuItemEx.MenuDelVisble        = "";
                menuItemEx.MenuSystemVisble     = "none";
                menuItemEx.MenuSystemShowVisble = "none";
                menuItemEx.MenuDelUrl           = String.Format("javascript:DeleteConfirm('{0}','{1}');", menuItem.ID, menuItem.Name);
            }
            else if (menuItem.Type == 2)
            {
                menuItemEx.MenuType             = "隐藏菜单" + suffix;
                menuItemEx.MenuDelVisble        = "none";
                menuItemEx.MenuSystemVisble     = "none";
                menuItemEx.MenuSystemShowVisble = "";
                menuItemEx.MenuSystemShowUrl    = String.Format("javascript:ShowConfirm('{0}','{1}');", menuItem.ID, menuItem.Name);
            }
            else
            {
                menuItemEx.MenuType             = "系统菜单" + suffix;
                menuItemEx.MenuDelVisble        = "none";
                menuItemEx.MenuSystemVisble     = "";
                menuItemEx.MenuSystemShowVisble = "none";
                menuItemEx.MenuSystemUrl        = String.Format("javascript:HideConfirm('{0}','{1}');", menuItem.ID, menuItem.Name);
            }
            return(menuItemEx);
        }
 /// <summary>
 /// Unregisters the menu.
 /// </summary>
 /// <param name="menu">The menu.</param>
 public void UnregisterMenu(MenuItemEx menu)
 {
     this.MenuItems.Remove(menu);
 }
예제 #22
0
        private ContextMenu BuildContextMenu()
        {
            ContextMenu menu = new ContextMenu();
            MenuItemEx  item = null;

            item = new MenuItemEx("Property", "单元格属性", null, null)
            {
                Icon = PLMImageList.GetIcon("ICO_PPM_PPCARDCELLPROPERTY").ToBitmap()
            };
            item.Click += new EventHandler(this.OnShowCellProperty);
            menu.MenuItems.Add(item);
            item        = new MenuItemEx("Input", "输入文本", null, null);
            item.Click += new EventHandler(this.OnInputText);
            menu.MenuItems.Add(item);
            item = new MenuItemEx("-", "-", null, null);
            menu.MenuItems.Add(item);
            item        = new MenuItemEx("Insert page index", "插入页码", null, null);
            item.Click += new EventHandler(this.OnInsertPageIndex);
            menu.MenuItems.Add(item);
            item        = new MenuItemEx("Insert count of pages", "插入总页数", null, null);
            item.Click += new EventHandler(this.OnInsertPagesCount);
            menu.MenuItems.Add(item);
            item        = new MenuItemEx("Insert page index", "插入版本号", null, null);
            item.Click += new EventHandler(this.OnInsertCurrentVersion);
            menu.MenuItems.Add(item);
            item        = new MenuItemEx("Insert page index", "插入当时日期", null, null);
            item.Click += new EventHandler(this.OnInsertCurrentTime);
            menu.MenuItems.Add(item);
            item        = new MenuItemEx("Insert count of pages", "插入当时用户签名", null, null);
            item.Click += new EventHandler(this.OnInsertLogonUser);
            menu.MenuItems.Add(item);
            item = new MenuItemEx("-", "-", null, null);
            menu.MenuItems.Add(item);
            if (!ModelContext.MetaModel.IsForm(this.m_tp.TemplateType))
            {
                item = new MenuItemEx("Insert modify records", "插入修改记录", null, null)
                {
                    Icon = PLMImageList.GetIcon("ICO_PSM_REVISIONHISTORY").ToBitmap()
                };
                item.Click += new EventHandler(this.OnInsertModifyRecord);
                menu.MenuItems.Add(item);
                item = new MenuItemEx("Insert process record", "插入流程记录", null, null)
                {
                    Icon = PLMImageList.GetIcon("ICO_BPM_DEFROOT").ToBitmap()
                };
                item.Click += new EventHandler(this.OnInsertProcessRecord);
                menu.MenuItems.Add(item);
            }
            else
            {
                item        = new MenuItemEx("Insert form signature", "插入表单签字", null, null);
                item.Click += new EventHandler(this.OnFormSignature);
                menu.MenuItems.Add(item);
            }
            item        = new MenuItemEx("Insert picture", "插入图片", null, null);
            item.Click += new EventHandler(this.OnInsertPicture);
            menu.MenuItems.Add(item);
            if (base.Parent.Text != ConstCAPP.COVERLABEL)
            {
                MenuItemEx ex2 = new MenuItemEx("Function", "预定义公式", null, null);
                MenuItemEx ex3 = new MenuItemEx("SinglePageSum", "单页列小计", null, null);
                ex3.Click += new EventHandler(this.OnFunction);
                ex2.MenuItems.Add(ex3);
                ex3        = new MenuItemEx("AllPageSum", "全部页列总计", null, null);
                ex3.Click += new EventHandler(this.OnFunction);
                ex2.MenuItems.Add(ex3);
                menu.MenuItems.Add(ex2);
            }
            return(menu);
        }
예제 #23
0
 public bool Contains(MenuItemEx item)
 {
     return(InnerList.Contains(item));
 }
예제 #24
0
 public int IndexOf(MenuItemEx item)
 {
     return(InnerList.IndexOf(item));
 }
예제 #25
0
 public void Remove(MenuItemEx item)
 {
     List.Remove(item);
 }