private void UpdateFromCache(ICommandBarService commandBarService, Func<string, bool> f)
        {
            var toAdd = this.cache.Where(c => f(c.CommandInfo.BarName)).ToList();

            toAdd.ForEach(i =>
            {
                commandBarService.AddCommand(i.CommandInfo, i.Command);
                this.cache.Remove(i);
            });
        }
        private void UpdateFromCache(ICommandBarService commandBarService, Func <string, bool> f)
        {
            var toAdd = this.cache.Where(c => f(c.CommandInfo.BarName)).ToList();

            toAdd.ForEach(i =>
            {
                commandBarService.AddCommand(i.CommandInfo, i.Command);
                this.cache.Remove(i);
            });
        }
Example #3
0
 protected override void OnCreateContextMenuCommand()
 {
     if (base.Services.ProjectManager().CurrentSolution != null && base.Services.ProjectManager().CurrentSolution.IsSourceControlActive)
     {
         this.DestroyContextMenu();
     }
     if (this.projectContextMenu == null)
     {
         ICommandBarService commandBarService = base.Services.CommandBarService();
         commandBarService.CommandBars.Remove("Project_ProjectContextMenu");
         this.projectContextMenu = commandBarService.CommandBars.AddContextMenu("Project_ProjectContextMenu");
         this.projectContextMenu.Items.AddCheckBox("Project_SetStartupProject");
         this.projectContextMenu.Items.AddButton("Project_EditExternally", StringTable.ProjectItemContextMenuEditExternally);
         this.projectContextMenu.Items.AddButton("Project_EditVisualStudio", StringTable.ProjectItemContextMenuEditVisualStudio);
         this.projectContextMenu.Items.AddSeparator();
         this.projectContextMenu.Items.AddButton("Project_ConvertToSilverlight4", StringTable.ProjectItemContextMenuConvertSilverlight4);
         this.projectContextMenu.Items.AddButton("Project_ConvertToDotNet4", StringTable.ProjectItemContextMenuConvertFramework4);
         this.projectContextMenu.Items.AddSeparator();
         ProjectManager.AddSourceControlMenuItems(this.projectContextMenu.Items);
         this.projectContextMenu.Items.AddSeparator();
         if (base.Services.ProjectManager().CurrentSolution is WebProjectSolution)
         {
             this.projectContextMenu.Items.AddButton("Project_TestProject");
             this.projectContextMenu.Items.AddSeparator();
         }
         this.projectContextMenu.Items.AddButton("Application_AddNewItem", StringTable.ProjectItemContextMenuAddNewItem);
         this.projectContextMenu.Items.AddButton("Project_AddExistingItem", StringTable.ProjectItemContextMenuAddExistingItem);
         this.projectContextMenu.Items.AddButton("Project_LinkToExistingItem", StringTable.ProjectItemContextMenuLinkToExistingItem);
         this.projectContextMenu.Items.AddSeparator();
         this.projectContextMenu.Items.AddButton("Project_AddReference", StringTable.ProjectItemContextMenuAddReference);
         this.projectContextMenu.Items.AddDynamicMenu("Project_AddProjectReference", StringTable.ProjectItemContextMenuAddProjectReference);
         this.projectContextMenu.Items.AddSeparator();
         this.projectContextMenu.Items.AddButton("Project_NewFolder", StringTable.ProjectItemContextMenuNewFolder);
         this.projectContextMenu.Items.AddButton("Project_Refresh", StringTable.ProjectItemContextMenuRefresh);
         this.projectContextMenu.Items.AddSeparator();
         this.projectContextMenu.Items.AddButton("Project_Paste", StringTable.ProjectItemContextMenuPaste);
         this.projectContextMenu.Items.AddSeparator();
         this.projectContextMenu.Items.AddButton("Project_ExploreProject", StringTable.ProjectItemContextMenuExplore);
     }
     this.ContextMenu = (System.Windows.Controls.ContextMenu) this.projectContextMenu;
 }
Example #4
0
 private static void InitializeContextMenu(ICommandBarService commandBarService)
 {
     commandBarService.CommandBars.Remove("Project_SolutionContextMenu");
     SolutionNode.solutionContextMenu = commandBarService.CommandBars.AddContextMenu("Project_SolutionContextMenu");
     SolutionNode.solutionContextMenu.Items.AddButton("Project_EditExternally", StringTable.ProjectItemContextMenuEditExternally);
     SolutionNode.solutionContextMenu.Items.AddButton("Project_EditVisualStudio", StringTable.ProjectItemContextMenuEditVisualStudio);
     SolutionNode.solutionContextMenu.Items.AddSeparator();
     ProjectManager.AddSourceControlMenuItems(SolutionNode.solutionContextMenu.Items);
     SolutionNode.solutionContextMenu.Items.AddButton("Project_RefreshStatus", StringTable.SourceControlContextMenuRefreshStatus);
     SolutionNode.solutionContextMenu.Items.AddButton("Project_GoOnline", StringTable.SourceControlContextMenuGoOnline);
     SolutionNode.solutionContextMenu.Items.AddButton("Project_ResolveConflicts", StringTable.SourceControlContextMenuResolve);
     SolutionNode.solutionContextMenu.Items.AddSeparator();
     SolutionNode.solutionContextMenu.Items.AddButton("Project_AddNewProject", StringTable.SolutionItemContextMenuAddNewProject);
     SolutionNode.solutionContextMenu.Items.AddButton("Project_AddExistingProject", StringTable.SolutionItemContextMenuAddExistingProject);
     SolutionNode.solutionContextMenu.Items.AddButton("Project_AddExistingWebsite", StringTable.SolutionItemContextMenuAddExistingWebsite);
     SolutionNode.solutionContextMenu.Items.AddSeparator();
     SolutionNode.solutionContextMenu.Items.AddButton("Project_Build");
     SolutionNode.solutionContextMenu.Items.AddButton("Project_Rebuild");
     SolutionNode.solutionContextMenu.Items.AddButton("Project_Clean");
     SolutionNode.solutionContextMenu.Items.AddButton("Project_TestProject");
     SolutionNode.solutionContextMenu.Items.AddSeparator();
     SolutionNode.solutionContextMenu.Items.AddButton("Project_ExploreProject", StringTable.ProjectItemContextMenuExplore);
 }
Example #5
0
        public void Load(IServices services)
        {
            this.services = services;
            PerformanceUtility.StartPerformanceSequence(PerformanceEvent.FrameworkPackageLoad);
            UIThreadDispatcher.InitializeInstance();
            IExpressionMefHostingService mefHostingService = (IExpressionMefHostingService) new ExpressionMefHostingService(services);

            this.services.AddService(typeof(IExpressionMefHostingService), (object)mefHostingService);
            mefHostingService.AddInternalPart((object)mefHostingService);
            IMessageDisplayService messageDisplayService = (IMessageDisplayService) new MessageDisplayService(services.GetService <IExpressionInformationService>());

            this.services.AddService(typeof(IMessageDisplayService), (object)messageDisplayService);
            mefHostingService.AddInternalPart((object)this.services.GetService <IMessageDisplayService>());
            PerformanceUtility.MarkInterimStep(PerformanceEvent.FrameworkPackageLoad, "Create SchedulingService");
            this.services.AddService(typeof(ISchedulingService), (object)new SchedulingService());
            mefHostingService.AddInternalPart((object)this.services.GetService <ISchedulingService>());
            string str = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Microsoft\\Expression\\Blend 4");

            PerformanceUtility.MarkInterimStep(PerformanceEvent.FrameworkPackageLoad, "Create ConfigurationService");
            IConfigurationService configurationService = (IConfigurationService) new ConfigurationService(str);

            this.services.AddService(typeof(IConfigurationService), (object)configurationService);
            PerformanceUtility.MarkInterimStep(PerformanceEvent.FrameworkPackageLoad, "Create OptionsDialogService");
            IOptionsDialogService optionsDialogService = (IOptionsDialogService) new OptionsDialogService(configurationService);

            this.services.AddService(typeof(IOptionsDialogService), (object)optionsDialogService);
            PerformanceUtility.MarkInterimStep(PerformanceEvent.FrameworkPackageLoad, "Create CommandService");
            ICommandService commandService = (ICommandService) new CommandService(services.GetService <IFeedbackService>());

            this.services.AddService(typeof(ICommandService), (object)commandService);
            PerformanceUtility.MarkInterimStep(PerformanceEvent.FrameworkPackageLoad, "Add Commands");
            this.AddCommand("Application_Exit", (ICommand) new FrameworkPackage.ExitCommand());
            this.AddCommand("Application_Options", (ICommand) new FrameworkPackage.OptionsCommand(optionsDialogService));
            PerformanceUtility.MarkInterimStep(PerformanceEvent.FrameworkPackageLoad, "Create DocumentService");
            DocumentService documentService = (DocumentService) new BlendDocumentService(commandService, messageDisplayService);

            this.services.AddService(typeof(IDocumentService), (object)documentService);
            this.services.AddService(typeof(IViewService), (object)documentService);
            ICommandBarService commandBarService = (ICommandBarService) new CommandBarService(commandService);

            this.services.AddService(typeof(ICommandBarService), (object)commandBarService);
            PerformanceUtility.MarkInterimStep(PerformanceEvent.FrameworkPackageLoad, "Create WorkspaceService");
            WorkspaceService workspaceService = new WorkspaceService(configurationService["WorkspaceService"], Path.Combine(str, "Workspaces"), (IEnumerable <string>) new string[2]
            {
                StringTable.DesignWorkspaceName,
                StringTable.AnimationWorkspaceName
            }, (IEnumerable <Uri>) new Uri[2]
            {
                new Uri("pack://application:,,,/Shopdrawing.Application;Component/Resources/Workspaces/Design.xaml", UriKind.Absolute),
                new Uri("pack://application:,,,/Shopdrawing.Application;Component/Resources/Workspaces/Animation.xaml", UriKind.Absolute)
            }, messageDisplayService);

            commandService.AddTarget((ICommandTarget)workspaceService);
            this.services.AddService(typeof(IWorkspaceService), (object)workspaceService);
            this.frameworkIcons        = new ResourceDictionary();
            this.frameworkIcons.Source = new Uri("pack://application:,,,/Microsoft.Expression.Framework;Component/Resources/Icons/FrameworkIcons.xaml", UriKind.Absolute);
            List <Theme> list = new List <Theme>(2);
            Uri          resourceDictionaryUriToMerge1 = new Uri("pack://application:,,,/Shopdrawing.Application;Component/Resources/BlendDarkTheme.xaml", UriKind.Absolute);

            list.Add(new Theme(StringTable.ThemeNameExpressionDark, "Resources\\UserInterface\\ExpressionDark.xaml", resourceDictionaryUriToMerge1));
            Uri resourceDictionaryUriToMerge2 = new Uri("pack://application:,,,/Shopdrawing.Application;Component/Resources/BlendLightTheme.xaml", UriKind.Absolute);

            list.Add(new Theme(StringTable.ThemeNameExpressionLight, "Resources\\UserInterface\\ExpressionLight.xaml", resourceDictionaryUriToMerge2));
            PerformanceUtility.MarkInterimStep(PerformanceEvent.FrameworkPackageLoad, "Create WindowService");
            WindowService windowService = new WindowService(configurationService["WindowService"], commandBarService, commandService, (IViewService)documentService, (IWorkspaceService)workspaceService, messageDisplayService, services.GetService <IFeedbackService>(), services.GetService <IExpressionInformationService>().MainWindowRootElement, this.frameworkIcons, list.AsReadOnly(), this.suppressViewUI);

            this.services.AddService(typeof(Microsoft.Expression.Framework.UserInterface.IWindowService), (object)windowService);
            this.services.AddService(typeof(IOrderedViewProvider), (object)windowService);
            workspaceService.SetPaletteRegistry(windowService.PaletteRegistry);
            PerformanceUtility.MarkInterimStep(PerformanceEvent.FrameworkPackageLoad, "Register CommandTargets");
            commandService.AddTarget((ICommandTarget)this);
            commandService.AddTarget((ICommandTarget)documentService);
            this.services.AddService(typeof(IMessageLoggingService), (object)new FrameworkPackage.NullMessageLoggingService());
            this.services.AddService(typeof(IErrorService), (object)new FrameworkPackage.ErrorService());
            this.services.AddService(typeof(IImporterService), (object)new ImporterService(configurationService["ImporterService"], Path.Combine(str, "ImportersDataStore")));
            this.shellOptionsPage = new ShellOptionsPage((Microsoft.Expression.Framework.UserInterface.IWindowService)windowService);
            optionsDialogService.OptionsPages.Add((IOptionsPage)this.shellOptionsPage);
            Dialog.ServiceProvider = (IServiceProvider)services;
            PerformanceUtility.EndPerformanceSequence(PerformanceEvent.FrameworkPackageLoad);
        }
 public void RegisterDefaultCommandBarService(ICommandBarService commandBarService)
 {
     this.defaultCommandBarService = commandBarService;
     UpdateFromCache(commandBarService, string.IsNullOrEmpty);
 }
 public void RegisterCommandBarService(string barName, ICommandBarService commandBarService)
 {
     this.commandBarServices[barName] = commandBarService;
     UpdateFromCache(commandBarService, s => s == barName);
 }
 public void RegisterDefaultCommandBarService(ICommandBarService commandBarService)
 {
     this.defaultCommandBarService = commandBarService;
     UpdateFromCache(commandBarService, string.IsNullOrEmpty);
 }
 public void RegisterCommandBarService(string barName, ICommandBarService commandBarService)
 {
     this.commandBarServices[barName] = commandBarService;
     UpdateFromCache(commandBarService, s => s == barName);
 }
Example #10
0
 public ModuleBootstrapper(IActivityService activityService, ICommandBarService commandBarService)
 {
     this.activityService   = activityService;
     this.commandBarService = commandBarService;
 }
Example #11
0
 public void SetCommandService(ICommandBarService commandBarService, ICommandService commandService)
 {
     this.commandService    = commandService;
     this.commandBarService = commandBarService;
     this.commandService.AddTarget((ICommandTarget)this.workspaceService);
 }
Example #12
0
 public WindowService(IConfigurationObject configuration, ICommandBarService commandBarService, ICommandService commandService, IViewService viewService, IWorkspaceService workspaceService, IMessageDisplayService messageDisplayService, IFeedbackService feedbackService, FrameworkElement mainWindowRootElement, ResourceDictionary icons, ReadOnlyCollection <Theme> themes, bool suppressViewUI)
 {
     PerformanceUtility.StartPerformanceSequence(PerformanceEvent.WindowServiceConstructor);
     this.applicationWindow                    = new ApplicationWindow(configuration, feedbackService);
     this.applicationWindow.Closed            += new EventHandler(this.ApplicationWindow_Closed);
     this.applicationWindow.Closing           += new CancelEventHandler(this.ApplicationWindow_Closing);
     this.applicationWindow.ClosingCanceled   += new EventHandler(this.ApplicationWindow_ClosingCanceled);
     this.applicationWindow.KeyDown           += new KeyEventHandler(this.ApplicationWindow_KeyDown);
     this.applicationWindow.PreviewKeyDown    += new KeyEventHandler(this.ApplicationWindow_PreviewKeyDown);
     this.applicationWindow.ThemeChanged      += new EventHandler(this.ApplicationWindow_ThemeChanged);
     this.applicationWindow.StateChanged      += new EventHandler(this.ApplicationWindow_StateChanged);
     this.applicationWindow.SourceInitialized += new EventHandler(this.ApplicationWindow_SourceInitialized);
     EventManager.RegisterClassHandler(typeof(GroupControl), UIElement.GotKeyboardFocusEvent, (Delegate) new KeyboardFocusChangedEventHandler(this.OnTabGroupGotKeyboardFocus));
     EventManager.RegisterClassHandler(typeof(DocumentGroupControl), UIElement.KeyDownEvent, (Delegate) new KeyEventHandler(this.OnDocumentGroupKeyDownOrUp));
     EventManager.RegisterClassHandler(typeof(DocumentGroupControl), UIElement.KeyUpEvent, (Delegate) new KeyEventHandler(this.OnDocumentGroupKeyDownOrUp));
     this.commandService   = commandService;
     this.viewService      = viewService;
     this.workspaceService = workspaceService;
     if (icons != null)
     {
         this.AddResourceDictionary(icons);
     }
     if (themes.Count > 0)
     {
         foreach (ITheme theme in themes)
         {
             this.Themes.Add(theme);
         }
         if (configuration != null)
         {
             this.ActiveTheme = (string)configuration.GetProperty("ActiveTheme", (object)this.Themes[0].Name);
             int num = -1;
             for (int index = 0; index < this.Themes.Count; ++index)
             {
                 if (this.Themes[index].Name == this.ActiveTheme)
                 {
                     num = index;
                     break;
                 }
             }
             if (feedbackService != null)
             {
                 feedbackService.SetData(25, num + 1);
             }
         }
     }
     PerformanceUtility.MarkInterimStep(PerformanceEvent.WindowServiceConstructor, "Create PaletteRegistry");
     this.paletteRegistry       = new PaletteRegistry(workspaceService);
     ViewElementFactory.Current = (ViewElementFactory) new ExpressionViewElementFactory();
     if (!suppressViewUI)
     {
         this.dockingViewManager = new ExpressionViewManager();
         ViewManager.Instance    = (ViewManager)this.dockingViewManager;
         DockManager.Instance    = (DockManager) new ExpressionDockManager();
         if (viewService != null)
         {
             this.viewBridge = new ViewBridge(this.workspaceService, this.viewService, messageDisplayService);
         }
     }
     PerformanceUtility.MarkInterimStep(PerformanceEvent.WindowServiceConstructor, "Create CommandBarService");
     this.commandBarService = commandBarService;
     TextBoxHelper.RegisterType(typeof(TextBox));
     PerformanceUtility.MarkInterimStep(PerformanceEvent.WindowServiceConstructor, "Load Window Content");
     this.mainBody = mainWindowRootElement;
     if (this.mainBody != null)
     {
         this.mainBody.DataContext = (object)this;
         FrameworkElement frameworkElement = this.commandBarService as FrameworkElement;
         if (frameworkElement != null)
         {
             frameworkElement.Name = "CommandBarService";
             frameworkElement.VerticalAlignment = VerticalAlignment.Top;
             frameworkElement.SetValue(Grid.ColumnSpanProperty, (object)2);
             ((Panel)this.mainBody).Children.Insert(0, (UIElement)frameworkElement);
         }
     }
     PerformanceUtility.MarkInterimStep(PerformanceEvent.WindowServiceConstructor, "Hookup Tree to Window Content");
     this.applicationWindow.Content = (object)mainWindowRootElement;
     PerformanceUtility.EndPerformanceSequence(PerformanceEvent.WindowServiceConstructor);
 }
Example #13
0
 public WindowService(IConfigurationObject configuration, ICommandBarService commandBarService, ICommandService commandService, IDocumentService documentService, IViewService viewService, IWorkspaceService workspaceService, IMessageDisplayService messageDisplayService, IFeedbackService feedbackService, FrameworkElement mainWindowRootElement, ResourceDictionary icons, ReadOnlyCollection <Theme> themes)
     : this(configuration, commandBarService, commandService, viewService, workspaceService, messageDisplayService, feedbackService, mainWindowRootElement, icons, themes, false)
 {
 }
Example #14
0
 public WindowService(IConfigurationObject configuration, ICommandBarService commandBarService, ICommandService commandService, IDocumentService documentService, IViewService viewService, IWorkspaceService workspaceService, IMessageDisplayService messageDisplayService, FrameworkElement mainWindowRootElement)
     : this(configuration, commandBarService, commandService, viewService, workspaceService, messageDisplayService, (IFeedbackService)null, mainWindowRootElement, (ResourceDictionary)null, new List <Theme>().AsReadOnly(), false)
 {
 }
 public ModuleBootstrapper(IActivityService activityService, ICommandBarService commandBarService)
 {
     this.activityService = activityService;
     this.commandBarService = commandBarService;
 }