예제 #1
0
        void IPackage.Load(IServiceProvider serviceProvider)
        {
            // Set this early so it is easily referenced
            myServiceProvider = serviceProvider;

            IAssemblyBrowser assemblyBrowser = (IAssemblyBrowser)serviceProvider.GetService(typeof(IAssemblyBrowser));

            assemblyBrowser.ActiveItemChanged += new EventHandler(OnActiveItemChanged);
            myLastActiveItem  = assemblyBrowser.ActiveItem;
            myAssemblyBrowser = assemblyBrowser;
            ILanguageManager languageManager = (ILanguageManager)serviceProvider.GetService(typeof(ILanguageManager));

            myLanguageManager = languageManager;
            myConfiguration   = new PLiXConfiguration(this);
            languageManager.ActiveLanguageChanged += new EventHandler(OnActiveLanguageChanged);
            ILanguage language = new PLiXLanguage((ITranslatorManager)serviceProvider.GetService(typeof(ITranslatorManager)), myConfiguration);

            languageManager.RegisterLanguage(language);
            myLanguage = language;

            // Add our PLiX menu item, activated when the plix language is active
            ICommandBarManager commandBarManager = (ICommandBarManager)serviceProvider.GetService(typeof(ICommandBarManager));
            ICommandBar        menuBar           = commandBarManager.CommandBars["MenuBar"];
            ICommandBarMenu    topMenu           = menuBar.Items.InsertMenu(menuBar.Items.Count - 1, "PLiXLanguageOptions", "PLi&X");

            topMenu.Visible   = false;
            topMenu.DropDown += new EventHandler(OnOpenTopMenu);

            ICommandBarItemCollection menuItems = topMenu.Items;

            myExampleLanguageMenu = menuItems.AddMenu("PLiXExampleLanguage", "&Example Language");
            menuItems.AddSeparator();
            myExpandCurrentNamespaceDeclarationButton = menuItems.AddButton("E&xpand Current Namespace Declaration", new EventHandler(OnExpandCurrentNamespaceDeclaration));
            myExpandCurrentTypeDeclarationButton      = menuItems.AddButton("E&xpand Current Type Declaration", new EventHandler(OnExpandCurrentTypeDeclaration));
            (myFullyExpandTypeDeclarationsCheckBox = menuItems.AddCheckBox("Ex&pand All Type Declarations")).Click += new EventHandler(OnFullyExpandTypeDeclarationsChanged);
            menuItems.AddSeparator();
            (myDisplayContextDataTypeQualifierCheckBox = menuItems.AddCheckBox("Display Context Type &Qualifier")).Click += new EventHandler(OnDisplayContextDataTypeQualifierChanged);
            ICommandBarMenu callStaticOptionsMenu = menuItems.AddMenu("PLiXStaticCallOptions", "&Static Call Options");

            menuItems = callStaticOptionsMenu.Items;
            (myExplicitStaticCallCheckBox = menuItems.AddCheckBox("&Explicit")).Click += new EventHandler(OnExplicitStaticCallCheckBoxChanged);
            (myImplicitCurrentTypeStaticCallCheckBox = menuItems.AddCheckBox("Implicit (&Current Type)")).Click += new EventHandler(OnImplicitCurrentTypeStaticCallCheckBoxChanged);
            (myImplicitBaseTypesStaticCallCheckBox = menuItems.AddCheckBox("Implicit (&Base Types)")).Click     += new EventHandler(OnImplicitBaseTypesStaticCallCheckBoxChanged);
            myTopMenu = topMenu;

            ICommandBarControl appRefresh1 = GetCommandbarControl(commandBarManager, "ToolBar", "Application.Refresh");

            if (appRefresh1 != null)
            {
                appRefresh1.Click += new EventHandler(OnApplicationRefresh);
            }
            ICommandBarControl appRefresh2 = GetCommandbarControl(commandBarManager, "View", "Application.Refresh");

            if (appRefresh2 != null && appRefresh2 != appRefresh1)
            {
                appRefresh2.Click += new EventHandler(OnApplicationRefresh);
            }
            //DumpMenus(commandBarManager);
        }
예제 #2
0
 private void MinimizeExpandedUI(ICommandBarItem command)
 {
     if (Children.Count > 1)
     {
         Children.RemoveAt(1);
         Width -= _expandedWidth;
     }
 }
예제 #3
0
        public void Remove(ICommandBarItem item)
        {
            int index = this.items.IndexOf((object)item);

            if (index == -1)
            {
                return;
            }
            this.RemoveAt(index);
        }
예제 #4
0
        protected override Task OnInitializedAsync()
        {
            onReduceData = (data) =>
            {
                if (data.PrimaryItems.Count > 0)
                {
                    ICommandBarItem movedItem = data.PrimaryItems[ShiftOnReduce ? 0 : data.PrimaryItems.Count - 1];
                    movedItem.RenderedInOverflow = true;

                    data.OverflowItems.Insert(0, movedItem);
                    data.PrimaryItems.Remove(movedItem);

                    data.CacheKey = ComputeCacheKey(data);

                    OnDataReduced.InvokeAsync(movedItem);

                    return(data);
                }
                else
                {
                    return(null);
                }
            };

            onGrowData = (data) =>
            {
                if (data.OverflowItems.Count > data.MinimumOverflowItems)
                {
                    ICommandBarItem?movedItem = data.OverflowItems[0];
                    movedItem.RenderedInOverflow = false;
                    data.OverflowItems.Remove(movedItem);

                    if (ShiftOnReduce)
                    {
                        data.PrimaryItems.Insert(0, movedItem);
                    }
                    else
                    {
                        data.PrimaryItems.Add(movedItem);
                    }

                    data.CacheKey = ComputeCacheKey(data);

                    OnDataGrown.InvokeAsync(movedItem);

                    return(data);
                }
                else
                {
                    return(null);
                }
            };

            return(base.OnInitializedAsync());
        }
예제 #5
0
        protected override Task OnInitializedAsync()
        {
            onReduceData = (data) =>
            {
                if (data !.PrimaryItems?.Count > 0)
                {
                    ICommandBarItem movedItem = data.PrimaryItems[ShiftOnReduce ? 0 : data.PrimaryItems.Count - 1];
                    movedItem.RenderedInOverflow = true;

                    data.OverflowItems?.Insert(0, movedItem);
                    data.PrimaryItems.Remove(movedItem);

                    data.CacheKey = ComputeCacheKey(data);

                    OnDataReduced.InvokeAsync(movedItem);

                    return(data);
                }
예제 #6
0
 private void CommandOnShouldClose(ICommandBarItem command)
 {
     MinimizeExpandedUI(command);
     command.ShouldClose -= CommandOnShouldClose;
 }
예제 #7
0
 public void Add(ICommandBarItem value)
 {
     // TODO:  Add CommandBarItemCollection.Add implementation
 }
예제 #8
0
 public int IndexOf(ICommandBarItem item)
 {
     // TODO:  Add CommandBarItemCollection.IndexOf implementation
     return(0);
 }
예제 #9
0
 public bool Contains(ICommandBarItem item)
 {
     // TODO:  Add CommandBarItemCollection.Contains implementation
     return(false);
 }
예제 #10
0
 public void Remove(ICommandBarItem item)
 {
     // TODO:  Add CommandBarItemCollection.Remove implementation
 }
예제 #11
0
 public void Insert(int index, ICommandBarItem value)
 {
     // TODO:  Add CommandBarItemCollection.Insert implementation
 }
예제 #12
0
 public void Add(ICommandBarItem item)
 {
     this.items.Add((object)item);
 }
예제 #13
0
 public int IndexOf(ICommandBarItem item)
 {
     return(this.items.IndexOf((object)item));
 }
예제 #14
0
 public bool Contains(ICommandBarItem item)
 {
     return(this.items.Contains((object)item));
 }
예제 #15
0
 public void Insert(int index, ICommandBarItem item)
 {
     this.items.Insert(index, (object)item);
 }