Example #1
0
        private void OnCommandContextExecuted(object sender, CommandContextEventArgs e)
        {
            switch (e.Context.Properties.ID)
            {
            case (int)Contexts.Open:
                m_State.Load();
                break;

            case (int)Contexts.Save:
                m_State.Save();
                break;

            case (int)Contexts.FillStyle:
                NComboBoxCommandContext c    = (NComboBoxCommandContext)m_Manager.CommandManager.GetContext((int)Contexts.ComboBoxContext2);
                NComboBoxCommand        comm = (NComboBoxCommand)c.GetCommands()[0];

                comm.HostedControl.SuspendLayout();
                comm.Items.Clear();

                //NListBoxItem item;
                for (int i = 0; i < 200; i++)
                {
                    //item = new NListBoxItem(i, "NListBoxItem " + i, false);
                    comm.Items.Add("Item " + i);
                }

                comm.HostedControl.ResumeLayout();

                break;
            }
        }
Example #2
0
        internal void InitComboBoxContexts()
        {
            NComboBoxCommandContext c = new NComboBoxCommandContext();

            c.Properties.ImageList = MainForm.TestImages;
            c.Properties.Text      = "ComboBox";
            c.Properties.ID        = (int)Contexts.ComboBoxContext1;
            c.RangeID        = 6;
            c.PrefferedWidth = 150;
            NListBoxItem item;

            for (int i = 0; i < 20; i++)
            {
                item = new NListBoxItem(i, "NListBoxItem " + i, false);
                c.Items.Add(item);
            }

            m_Manager.Contexts.Add(c);

            c = new NComboBoxCommandContext();
            c.Properties.Text      = "Editable ComboBox";
            c.Properties.ImageList = MainForm.TestImages;
            c.Editable             = true;
            c.Properties.ID        = (int)Contexts.ComboBoxContext2;
            c.RangeID        = 6;
            c.PrefferedWidth = 150;
            for (int i = 0; i < 20; i++)
            {
                item = new NListBoxItem(i, "NListBoxItem " + i, false);
                c.Items.Add(item);
            }

            m_Manager.Contexts.Add(c);

            c = new NFontComboBoxCommandContext();
            c.Properties.Text = "Font Combo";
            c.Properties.ID   = (int)Contexts.ComboBoxContext3;
            c.RangeID         = 6;
            c.PrefferedWidth  = 200;

            m_Manager.Contexts.Add(c);
        }
        internal void InitStandardContexts()
        {
            NCommandContext context1, context2;

            //new project context
            context1 = NCommandContext.CreateContext("New Project...", -1, NIDELoadUC.StandardImageList, 0, (int)NIDELoadUC.RangeID.Standard, null, false);
            m_CommandBarsManager.Contexts.Add(context1);

            context2 = NCommandContext.CreateContext("New Project...", (int)NIDELoadUC.CommandID.NewProject, NIDELoadUC.StandardImageList, 0, (int)NIDELoadUC.RangeID.Standard, new NShortcut(Keys.N, Keys.Control | Keys.Shift), false);
            context1.Contexts.Add(context2);
            m_CommandBarsManager.Contexts.Add(context2);

            context2 = NCommandContext.CreateContext("New Blank Solution...", (int)NIDELoadUC.CommandID.NewBlankSolution, NIDELoadUC.StandardImageList, 1, (int)NIDELoadUC.RangeID.Standard, null, false);
            context1.Contexts.Add(context2);
            m_CommandBarsManager.Contexts.Add(context2);

            //add new item context
            context1 = NCommandContext.CreateContext("Add Ne&w Item...", -1, NIDELoadUC.StandardImageList, 2, (int)NIDELoadUC.RangeID.Standard, new NShortcut(Keys.A, Keys.Control | Keys.Shift), false);
            m_CommandBarsManager.Contexts.Add(context1);

            context2 = NCommandContext.CreateContext("Add Ne&w Item...", (int)NIDELoadUC.CommandID.AddNewItem, NIDELoadUC.StandardImageList, 2, (int)NIDELoadUC.RangeID.Standard, new NShortcut(Keys.A, Keys.Control | Keys.Shift), false);
            context1.Contexts.Add(context2);
            m_CommandBarsManager.Contexts.Add(context2);

            context2 = NCommandContext.CreateContext("Add Existin&g Item...", (int)NIDELoadUC.CommandID.AddExistingItem, NIDELoadUC.StandardImageList, 3, (int)NIDELoadUC.RangeID.Standard, new NShortcut(Keys.A, Keys.Alt | Keys.Shift), false);
            context1.Contexts.Add(context2);
            m_CommandBarsManager.Contexts.Add(context2);

            context2 = NCommandContext.CreateContext("Add Windows &Form", (int)NIDELoadUC.CommandID.AddWindowsForm, NIDELoadUC.StandardImageList, 4, (int)NIDELoadUC.RangeID.Standard, null, true);
            context1.Contexts.Add(context2);
            m_CommandBarsManager.Contexts.Add(context2);

            context2 = NCommandContext.CreateContext("Add &Inherited Form", (int)NIDELoadUC.CommandID.AddInheritedForm, NIDELoadUC.StandardImageList, 4, (int)NIDELoadUC.RangeID.Standard, null, false);
            context1.Contexts.Add(context2);
            m_CommandBarsManager.Contexts.Add(context2);

            context2 = NCommandContext.CreateContext("Add &User Control", (int)NIDELoadUC.CommandID.AddUsercontrol, NIDELoadUC.StandardImageList, 5, (int)NIDELoadUC.RangeID.Standard, null, false);
            context1.Contexts.Add(context2);
            m_CommandBarsManager.Contexts.Add(context2);

            context2 = NCommandContext.CreateContext("Add Inherited Con&trol", (int)NIDELoadUC.CommandID.AddInheritedControl, NIDELoadUC.StandardImageList, 5, (int)NIDELoadUC.RangeID.Standard, null, false);
            context1.Contexts.Add(context2);
            m_CommandBarsManager.Contexts.Add(context2);

            context2 = NCommandContext.CreateContext("Add Compo&nent", (int)NIDELoadUC.CommandID.AddComponent, NIDELoadUC.StandardImageList, 6, (int)NIDELoadUC.RangeID.Standard, null, false);
            context1.Contexts.Add(context2);
            m_CommandBarsManager.Contexts.Add(context2);

            context2 = NCommandContext.CreateContext("Add &Class...", (int)NIDELoadUC.CommandID.AddClass, NIDELoadUC.StandardImageList, 7, (int)NIDELoadUC.RangeID.Standard, null, false);
            context1.Contexts.Add(context2);
            m_CommandBarsManager.Contexts.Add(context2);

            //open context
            context1 = NCommandContext.CreateContext("&Open...", (int)NIDELoadUC.CommandID.Open, NIDELoadUC.StandardImageList, 8, (int)NIDELoadUC.RangeID.Standard, new NShortcut(Keys.O, Keys.Control), true);
            m_CommandBarsManager.Contexts.Add(context1);

            //save context
            context1 = NCommandContext.CreateContext("Sa&ve", (int)NIDELoadUC.CommandID.Save, NIDELoadUC.StandardImageList, 9, (int)NIDELoadUC.RangeID.Standard, new NShortcut(Keys.S, Keys.Control), false);
            m_CommandBarsManager.Contexts.Add(context1);

            //save all context
            context1 = NCommandContext.CreateContext("Save A&ll", (int)NIDELoadUC.CommandID.SaveAll, NIDELoadUC.StandardImageList, 10, (int)NIDELoadUC.RangeID.Standard, new NShortcut(Keys.S, Keys.Control | Keys.Shift), false);
            m_CommandBarsManager.Contexts.Add(context1);

            //cut context
            context1 = NCommandContext.CreateContext("Cu&t", (int)NIDELoadUC.CommandID.Cut, NIDELoadUC.StandardImageList, 11, (int)NIDELoadUC.RangeID.Standard, new NShortcut(Keys.X, Keys.Control), true);
            m_CommandBarsManager.Contexts.Add(context1);

            //copy context
            context1 = NCommandContext.CreateContext("&Copy", (int)NIDELoadUC.CommandID.Copy, NIDELoadUC.StandardImageList, 12, (int)NIDELoadUC.RangeID.Standard, new NShortcut(Keys.C, Keys.Control), false);
            m_CommandBarsManager.Contexts.Add(context1);

            //paste context
            context1 = NCommandContext.CreateContext("&Paste", (int)NIDELoadUC.CommandID.Paste, NIDELoadUC.StandardImageList, 13, (int)NIDELoadUC.RangeID.Standard, new NShortcut(Keys.V, Keys.Control), false);
            m_CommandBarsManager.Contexts.Add(context1);

            //undo context
            context1 = new NUndoRedoCommandContext();
            context1.Properties.ImageIndex = 14;
            context1.Properties.ID         = (int)NIDELoadUC.CommandID.Undo;
            context1.Properties.Text       = "&Undo";
            context1.Properties.ImageList  = NIDELoadUC.StandardImageList;
            context1.Properties.Shortcut   = new NShortcut(Keys.Z, Keys.Control);
            context1.Properties.BeginGroup = true;
            context1.RangeID = (int)NIDELoadUC.RangeID.Standard;
            m_CommandBarsManager.Contexts.Add(context1);

            //redo context
            context1 = new NUndoRedoCommandContext();
            context1.Properties.ImageIndex = 15;
            context1.Properties.Text       = "&Redo";
            context1.Properties.ID         = (int)NIDELoadUC.CommandID.Redo;
            context1.Properties.ImageList  = NIDELoadUC.StandardImageList;
            context1.Properties.Shortcut   = new NShortcut(Keys.Y, Keys.Control);
            context1.RangeID = (int)NIDELoadUC.RangeID.Standard;
            m_CommandBarsManager.Contexts.Add(context1);

            //navigate backward context
            context1 = NCommandContext.CreateContext("N&avigate Backward", (int)NIDELoadUC.CommandID.NavigateBackward, NIDELoadUC.StandardImageList, 16, (int)NIDELoadUC.RangeID.Standard, new NShortcut(Keys.OemMinus, Keys.Control), false);
            m_CommandBarsManager.Contexts.Add(context1);

            //navigate forward context
            context1 = NCommandContext.CreateContext("Navigate &Forward", (int)NIDELoadUC.CommandID.NavigateForward, NIDELoadUC.StandardImageList, 17, (int)NIDELoadUC.RangeID.Standard, new NShortcut(Keys.OemMinus, Keys.Control | Keys.Shift), false);
            m_CommandBarsManager.Contexts.Add(context1);

            //start debug context
            context1 = NCommandContext.CreateContext("Start / Continue", (int)NIDELoadUC.CommandID.StartContinue, NIDELoadUC.StandardImageList, 18, (int)NIDELoadUC.RangeID.Standard, null, true);
            m_CommandBarsManager.Contexts.Add(context1);

            //solution configuration context
            NComboBoxCommandContext context3 = new NComboBoxCommandContext();

            context3.Properties.ID = (int)NIDELoadUC.CommandID.SolutionConfigurations;
            context3.ListProperties.ColumnOnLeft = false;
            context3.ListProperties.ItemHeight   = 15;
            context3.ComboBox.DropDownWidth      = 160;
            context3.Properties.Text             = "Solution Configurations";
            context3.RangeID = (int)NIDELoadUC.RangeID.Standard;

            context3.Items.Add("Debug");
            context3.Items.Add("Release");
            context3.Items.Add("Configuration Manager...");
            context3.ComboBox.SelectedIndex = 0;
            m_CommandBarsManager.Contexts.Add(context3);

            //solution explorer context
            context1 = NCommandContext.CreateContext("Solution &Explorer", (int)NIDELoadUC.CommandID.SolutionExplorer, NIDELoadUC.StandardImageList, 19, (int)NIDELoadUC.RangeID.Standard, new NShortcut(Keys.L, Keys.Control | Keys.Alt), true);
            m_CommandBarsManager.Contexts.Add(context1);

            //properties window context
            context1 = NCommandContext.CreateContext("Properties &Window", (int)NIDELoadUC.CommandID.Properties, NIDELoadUC.StandardImageList, 20, (int)NIDELoadUC.RangeID.Standard, null, false);
            m_CommandBarsManager.Contexts.Add(context1);

            //object browser context
            context1 = NCommandContext.CreateContext("Ob&ject Browser", (int)NIDELoadUC.CommandID.ObjectBrowser, NIDELoadUC.StandardImageList, 21, (int)NIDELoadUC.RangeID.Standard, new NShortcut(Keys.J, Keys.Control | Keys.Alt), false);
            m_CommandBarsManager.Contexts.Add(context1);

            //toolbox context
            context1 = NCommandContext.CreateContext("Toolbo&x", (int)NIDELoadUC.CommandID.Toolbox, NIDELoadUC.StandardImageList, 22, (int)NIDELoadUC.RangeID.Standard, new NShortcut(Keys.X, Keys.Control | Keys.Alt), false);
            m_CommandBarsManager.Contexts.Add(context1);

            //class view context
            context1 = NCommandContext.CreateContext("Cl&ass View", -1, NIDELoadUC.StandardImageList, 23, (int)NIDELoadUC.RangeID.Standard, new NShortcut(Keys.C, Keys.Control | Keys.Shift), false);
            m_CommandBarsManager.Contexts.Add(context1);

            context2 = NCommandContext.CreateContext("Cl&ass View", (int)NIDELoadUC.CommandID.ClassView, NIDELoadUC.StandardImageList, 23, (int)NIDELoadUC.RangeID.Standard, new NShortcut(Keys.C, Keys.Control | Keys.Shift), false);
            context1.Contexts.Add(context2);
            m_CommandBarsManager.Contexts.Add(context2);

            context2 = NCommandContext.CreateContext("Ser&ver Explorer", (int)NIDELoadUC.CommandID.ServerExplorer, NIDELoadUC.StandardImageList, 24, (int)NIDELoadUC.RangeID.Standard, new NShortcut(Keys.S, Keys.Control | Keys.Alt), false);
            context1.Contexts.Add(context2);
            m_CommandBarsManager.Contexts.Add(context2);

            context2 = NCommandContext.CreateContext("&Resource View", (int)NIDELoadUC.CommandID.ResourceView, NIDELoadUC.StandardImageList, 25, (int)NIDELoadUC.RangeID.Standard, new NShortcut(Keys.E, Keys.Control | Keys.Shift), false);
            context1.Contexts.Add(context2);
            m_CommandBarsManager.Contexts.Add(context2);

            context2 = NCommandContext.CreateContext("&Task List", (int)NIDELoadUC.CommandID.TaskList, NIDELoadUC.StandardImageList, 26, (int)NIDELoadUC.RangeID.Standard, new NShortcut(Keys.K, Keys.Control | Keys.Alt), false);
            context1.Contexts.Add(context2);
            m_CommandBarsManager.Contexts.Add(context2);

            context2 = NCommandContext.CreateContext("Comma&nd Window", (int)NIDELoadUC.CommandID.CommandWindow, NIDELoadUC.StandardImageList, 27, (int)NIDELoadUC.RangeID.Standard, new NShortcut(Keys.A, Keys.Control | Keys.Alt), false);
            context1.Contexts.Add(context2);
            m_CommandBarsManager.Contexts.Add(context2);

            context2 = NCommandContext.CreateContext("&Output", (int)NIDELoadUC.CommandID.Output, NIDELoadUC.StandardImageList, 28, (int)NIDELoadUC.RangeID.Standard, new NShortcut(Keys.O, Keys.Control | Keys.Alt), false);
            context1.Contexts.Add(context2);
            m_CommandBarsManager.Contexts.Add(context2);

            context2 = NCommandContext.CreateContext("Find S&ymbol Results", (int)NIDELoadUC.CommandID.FindSymbolResults, NIDELoadUC.StandardImageList, 29, (int)NIDELoadUC.RangeID.Standard, new NShortcut(Keys.F12, Keys.Control | Keys.Alt), false);
            context1.Contexts.Add(context2);
            m_CommandBarsManager.Contexts.Add(context2);
        }