Ejemplo n.º 1
0
        protected virtual void InternalBuildContextMenu()
        {
            DBFileMenuItem item;

            // Open
            item             = new DBFileMenuItem(this, true, false);
            item.Text        = Strings.Get("DBFile.Menu.OpenText");
            item.Click      += new EventHandler(OpenClicked);
            item.DefaultItem = true;
            ContextMenu.MenuItems.Add(item);

            // -
            ContextMenu.MenuItems.Add(new MenuItem("-"));

            // Save As...
            item        = new DBFileMenuItem(this, true, false);
            item.Text   = Strings.Get("DBFile.Menu.SaveAsText");
            item.Click += new EventHandler(SaveAsClicked);
            ContextMenu.MenuItems.Add(item);

            // Load...
            item        = new DBFileMenuItem(this, false, true);
            item.Text   = Strings.Get("DBFile.Menu.LoadText");
            item.Click += new EventHandler(LoadClicked);
            ContextMenu.MenuItems.Add(item);

            // -
            ContextMenu.MenuItems.Add(new MenuItem("-"));

            // TODO: Copy and paste commands

            //// Copy
            //LItem = new DBFileMenuItem(this, true, false);
            //LItem.Text = Strings.Get("DBFile.Menu.CopyText");
            //LItem.Click += new EventHandler(CopyClicked);
            //LItem.Shortcut = Shortcut.CtrlC;
            //ContextMenu.MenuItems.Add(LItem);

            //// Paste
            //LItem = new DBFileMenuItem(this, false, true);
            //LItem.Text = Strings.Get("DBFile.Menu.PasteText");
            //LItem.Click += new EventHandler(PasteClicked);
            //LItem.Shortcut = Shortcut.CtrlV;
            //ContextMenu.MenuItems.Add(LItem);

            // Clear
            item        = new DBFileMenuItem(this, true, true);
            item.Text   = Strings.Get("DBFile.Menu.ClearText");
            item.Click += new EventHandler(ClearClicked);
            ContextMenu.MenuItems.Add(item);

            if (OnBuildContextMenu != null)
            {
                OnBuildContextMenu(this, EventArgs.Empty);
            }
        }
Ejemplo n.º 2
0
        private void UpdateMenuItems()
        {
            if (ContextMenu != null)
            {
                foreach (MenuItem item in ContextMenu.MenuItems)
                {
                    DBFileMenuItem fileItem = item as DBFileMenuItem;
                    if (fileItem != null)
                    {
                        fileItem.UpdateEnabled();
                    }
                }

                if (OnUpdateMenuItems != null)
                {
                    OnUpdateMenuItems(this, EventArgs.Empty);
                }
            }
        }