예제 #1
0
        /// <summary>
        /// This is the handler for when we change an item on the context menu
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void contextMenuItem_Click(object sender, EventArgs e)
        {
            // Uncheck any currently checked menu item
            foreach (IGMenuItem thisMenuItem in contextMenu1.MenuItems)
            {
                if (thisMenuItem.Checked)
                {
                    thisMenuItem.Checked = false;
                }
            }

            IGMenuItem menuItem = sender as IGMenuItem;

            if (menuItem != null)
            {
                if (menuItem.Tag is UltraListViewStyle)
                {
                    menuItem.Checked = true;
                    UltraListViewStyle view = (UltraListViewStyle)menuItem.Tag;
                    this.assetListView.View = view;
                    Properties.Settings.Default.ViewStyle = view;
                    Properties.Settings.Default.Save();
                    RefreshView();
                }
            }
        }
예제 #2
0
        /// <summary>
        /// 初始化MDI Manager右键菜单
        /// 用于将初始英文改成中文显示
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tabbedMdiManager_InitializeContextMenu(object sender, MdiTabContextMenuEventArgs e)
        {
            if (e.ContextMenuType != MdiTabContextMenu.Default)
            {
                return;
            }
            e.ContextMenu.MenuItems.Clear();
            var menuItem = new IGMenuItem("关闭")
            {
                Tag = e.Tab
            };

            menuItem.Click += OnCustomMenuItemClose;

            e.ContextMenu.MenuItems.Add(menuItem);
        }
예제 #3
0
        public ComputerTabView([ServiceDependency] WorkItem workItem)
        {
            this.workItem = workItem as LaytonWorkItem;
            InitializeComponent();

            // Set the List View style
            assetListView.ShowGroups = true;
            assetListView.View       = Properties.Settings.Default.ViewStyle;

            // Setup the context menu used by the list view
            assetListView.ContextMenu = this.contextMenu1;

            //	Populate the context menu with the constants of the UltraListViewStyle
            //	enumeration, so we can allow the end user to change the view. Note that we
            // will not support the 'Details' view as this is not really appropriate
            IGMenuItem menuItem = null;

            string[] enumNames  = Enum.GetNames(typeof(UltraListViewStyle));
            Array    enumValues = Enum.GetValues(typeof(UltraListViewStyle));

            for (int i = 0; i < enumValues.Length; i++)
            {
                // Skip details mode
                if (enumNames[i] == UltraListViewStyle.Details.ToString())
                {
                    continue;
                }

                menuItem = new IGMenuItem(enumNames[i], new EventHandler(this.contextMenuItem_Click));
                UltraListViewStyle enumValue = (UltraListViewStyle)enumValues.GetValue(i);
                menuItem.Tag = enumValue;

                //	If this value is the same one that the control's View
                //	property is set to, check it
                if (assetListView.View == enumValue)
                {
                    menuItem.Checked = true;
                }

                this.contextMenu1.MenuItems.Add(menuItem);
            }
        }
예제 #4
0
        private void exbarGroups_ContextMenuInitializing(object sender, Infragistics.Win.UltraWinExplorerBar.CancelableContextMenuInitializingEventArgs e)
        {
            if(e.ClickArea == ClickArea.GroupHeader)
            {
                e.Cancel = true;
            }

            var menuTarget = new ContextMenuHelper();
             if( e.ClickArea == ClickArea.Item)
             {
                 menuTarget.Item = e.Item;
                 menuTarget.Group = e.Item.Group;
             }
             else
             {
                 menuTarget.Group = e.Group;
             }

            this.exbarGroups.ResetGroupItemAreaContextMenu();
            this.exbarGroups.ResetItemContextMenu();

            var menuItemAdd = new IGMenuItem("Add", new EventHandler(this.OnMenuItemClicked));
            menuItemAdd.Tag = menuTarget;
            e.ContextMenu.MenuItems.Add(menuItemAdd);

            if(e.ClickArea == ClickArea.Item)
            {
                var menuItemEdit = new IGMenuItem("Edit / Delete", new EventHandler(this.OnMenuItemClicked));
                menuItemEdit.Tag = menuTarget;
                e.ContextMenu.MenuItems.Add(menuItemEdit);
            }
        }