예제 #1
0
        public static void CreateDebugMenu(ICommandBar menuBar, IServices services)
        {
            if (!DebugCommands.IsDebugMenuEnabled())
            {
                return;
            }
            ICommandBarMenu commandBarMenu1 = menuBar.Items.AddMenu("Debug", "Debug");

            commandBarMenu1.Items.AddButton("Debug_FocusTracker", "Focus Tracker");
            commandBarMenu1.Items.AddButton("Debug_DisplayTimingInformation", "Display Timing");
            commandBarMenu1.Items.AddButton("Debug_GarbageCollect", "Force GC");
            commandBarMenu1.Items.AddButton("Debug_UndoManager_Dump", "Dump UndoService");
            commandBarMenu1.Items.AddButton("Debug_UndoManager_Clear", "Clear UndoService");
            ICommandBarMenu commandBarMenu2 = commandBarMenu1.Items.AddMenu("Scene", "Scene");

            commandBarMenu2.Items.AddButton("Debug_CreateDocumentNodeView", "Create DocumentNode View");
            commandBarMenu2.Items.AddButton("Debug_DumpInstanceDictionary", "Dump InstanceDictionary");
            commandBarMenu2.Items.AddButton("Debug_DumpViewNodeTree", "Dump View Node Tree");
            commandBarMenu1.Items.AddMenu("Tree", "Tree");
            if (!(services.GetService <ISourceControlService>() is SourceControlService))
            {
                return;
            }
            commandBarMenu1.Items.AddMenu("TFS", "TFS");
        }
예제 #2
0
 public DebugCommands(IServices services)
 {
     services.GetService <IExpressionInformationService>();
     if (!DebugCommands.IsDebugMenuEnabled())
     {
         return;
     }
     this.AddCommand("Debug_GarbageCollect", (ICommand) new DebugCommands.GarbageCollectCommand());
     this.AddCommand("Debug_DumpInstanceDictionary", (ICommand) new DebugCommands.DumpInstanceDictionaryCommand(services));
     this.AddCommand("Debug_DumpViewNodeTree", (ICommand) new DebugCommands.DumpActiveViewTreeCommand(services));
     this.AddCommand("Debug_DisplayTimingInformation", (ICommand) new DebugCommands.DisplayTimingInformationCommand());
 }
예제 #3
0
        protected override void OnStartup(StartupEventArgs e)
        {
            this.InitializeUnhandledExceptionHandlers();
            CultureManager.ForceCulture(Path.GetDirectoryName(this.GetType().Module.FullyQualifiedName), "en");
            SplashService splashService = new SplashService("{5d76ab22-cd7a-42ea-9756-629f133abd8ex}", this.RegistryPath);

            this.ReplaceWithWelcomeSplashScreen(splashService.GetSplashVersion() == 1 ? "pack://application:,,,/Shopdrawing.Application;Component/licensing/SplashScreenSketchFlow.png" : "pack://application:,,,/Shopdrawing.Application;Component/licensing/SplashScreen.png");
            this.DoEvents();
            PerformanceUtility.MarkInterimStep(PerformanceEvent.ApplicationStartup, "Creating Services and ExpressionInformationService");
            this.CreateInitialServices(ExpressionApplication.Version);
            this.ExpressionInformationService.MainWindowRootElement = FileTable.GetElement("MainWindow.xaml");
            //this.InitializeLicenseService(ExpressionFeatureMapper.Blend, (ApplicationLicenses) new BlendTrialRtmV4Licenses(), (ApplicationLicenses) new BlendMobileRtmV4Licenses());
            FrameworkPackage.RegisterCommandLineService(this.Services);
            ICommandLineService service1 = this.Services.GetService <ICommandLineService>();

            this.CreateFeedbackService("Shopdrawing", BlendFeedbackValues.CommandToFeedbackValues);
            this.Services.AddService(typeof(SplashService), (object)splashService);
            string name = service1.GetArgument("culture");

            if (!string.IsNullOrEmpty(name))
            {
                Thread.CurrentThread.CurrentCulture   = new CultureInfo(name);
                Thread.CurrentThread.CurrentUICulture = new CultureInfo(name);
            }
            PerformanceUtility.MarkInterimStep(PerformanceEvent.ApplicationStartup, "Load resources");
            PerformanceUtility.MarkInterimStep(PerformanceEvent.ApplicationStartup, "Register FrameworkPackage");
            this.Services.RegisterPackage((IPackage) new FrameworkPackage());
            IExpressionMefHostingService service2 = this.Services.GetService <IExpressionMefHostingService>();

            Microsoft.Expression.Framework.UserInterface.IWindowService service3 = this.Services.GetService <Microsoft.Expression.Framework.UserInterface.IWindowService>();
            service3.Title = StringTable.ApplicationTitle;
            FocusScopeManager.SetFocusScopePriority((DependencyObject)System.Windows.Application.Current.MainWindow, 0);
            //FocusScopeManager.Instance.ReturnFocusCallback = new ReturnFocusCallback(((ExpressionApplication)this).FocusScopeManagerReturnFocusCallback);
            this.Services.RegisterPackage((IPackage) new WebServerPackage());
            this.Services.RegisterPackage((IPackage) new SourceControlPackage());
            this.Services.RegisterPackage((IPackage) new ProjectPackage());
            this.Services.RegisterPackage((IPackage) new CodePackage());
            PlatformPackage platformPackage = new PlatformPackage();

            this.Services.RegisterPackage((IPackage)platformPackage);
            if (service2 != null)
            {
                service2.AddInternalPart((object)platformPackage);
            }
            this.Services.RegisterPackage((IPackage) new DesignerPackage());
            this.Services.GetService <IHelpService>().RegisterHelpProvider((IHelpProvider) new BlendSDKHelpProvider());
            PerformanceUtility.MarkInterimStep(PerformanceEvent.ApplicationStartup, "Discovering external packages");
            BlendApplication.disableWhitecap = service1.GetArgument("DisableWhitecap") != null;
            if (BlendApplication.disableWhitecap)
            {
                this.Services.ExcludeAddIn("Microsoft.Expression.PrototypeHostEnvironment.dll");
            }
            this.Services.LoadAddIns("Microsoft.Expression.*.addin");
            this.Services.LoadAddIns("AddIns\\*.addin");
            this.InitializeMefHostingService(service1);
            ICommandService service4 = this.Services.GetService <ICommandService>();

            service4.AddTarget((ICommandTarget) new ApplicationCommandTarget(this.Services));
            PerformanceUtility.MarkInterimStep(PerformanceEvent.ApplicationStartup, "Creating Menu");
            ICommandBar menuBar = this.Services.GetService <ICommandBarService>().CommandBars.AddMenuBar("MainMenu");

            MenuBar.Create(menuBar, this.Services);
            DebugCommands.CreateDebugMenu(menuBar, this.Services);
            this.DoEvents();
            PerformanceUtility.MarkInterimStep(PerformanceEvent.ApplicationStartup, "Show ApplicationWindow");
            PerformanceUtility.StartPerformanceSequence(PerformanceEvent.ShowMainWindow);
            service3.Initialized     += new EventHandler(this.MainWindow_SourceInitialized);
            service3.IsVisible        = true;
            this.MainWindow           = service3.MainWindow;
            this.MainWindow.IsEnabled = false;
            PerformanceUtility.EndPerformanceSequence(PerformanceEvent.ShowMainWindow);
            this.Services.GetService <IWorkspaceService>().LoadConfiguration(service1.GetArgument("DefaultWorkspace") != null);
            service4.AddTarget((ICommandTarget) new DebugCommands(this.Services));
            PerformanceUtility.MarkInterimStep(PerformanceEvent.ApplicationStartup, "Initializing Project System");
            IProjectManager service5 = this.Services.GetService <IProjectManager>();

            service5.SolutionOpened   += new EventHandler <SolutionEventArgs>(this.ProjectManager_SolutionOpened);
            service5.SolutionClosed   += new EventHandler <SolutionEventArgs>(this.ProjectManager_SolutionClosed);
            service5.SolutionMigrated += new EventHandler <SolutionEventArgs>(this.ProjectManager_SolutionMigrated);
            this.DoEvents();
            BlendServer.StartRemoteService((IServiceProvider)this.Services);
            if (service1.GetArgument("ExceptionLog") != null)
            {
                ExceptionHandler.Attach(AppDomain.CurrentDomain);
                DebugVariables.Instance.ExceptionHandlerEnabled = true;
            }
            string[] arguments = service1.GetArguments("addin");
            if (arguments != null)
            {
                foreach (string fileName in arguments)
                {
                    try
                    {
                        this.Services.LoadAddIn(fileName);
                    }
                    catch (Exception ex)
                    {
                        IMessageDisplayService service6 = this.Services.GetService <IMessageDisplayService>();
                        if (service6 != null)
                        {
                            service6.ShowError(string.Format((IFormatProvider)CultureInfo.CurrentCulture, StringTable.ApplicationAssemblyLoadErrorDialogMessage, new object[2]
                            {
                                (object)fileName,
                                (object)ex.Message
                            }));
                        }
                    }
                }
            }
            this.OnStartupIdleProcessing();
            base.OnStartup(e);
        }