public override void Execute() { PerformanceUtility.StartPerformanceSequence(PerformanceEvent.ProjectRun); if (this.IsEnabled) { Microsoft.Expression.Framework.UserInterface.IWindowService service = (Microsoft.Expression.Framework.UserInterface.IWindowService)base.Services.GetService(typeof(Microsoft.Expression.Framework.UserInterface.IWindowService)); if (service != null) { service.ReturnFocus(); } ISolution solution = this.Solution(); IProjectBuildContext projectBuildContext = solution.ProjectBuildContext; IExecutable startupProject = solution.StartupProject; string str = (projectBuildContext != null ? projectBuildContext.DisplayName : solution.DocumentReference.DisplayName); if (startupProject == null || !startupProject.IsExecuting) { this.HandleBasicExceptions(() => this.BuildAndRun(projectBuildContext, startupProject)); return; } CultureInfo currentCulture = CultureInfo.CurrentCulture; string runCommandUnableToRunDialogMessage = StringTable.RunCommandUnableToRunDialogMessage; object[] objArray = new object[] { str }; this.DisplayCommandFailedMessage(string.Format(currentCulture, runCommandUnableToRunDialogMessage, objArray)); } }
public void Unload() { IOptionsDialogService service1 = this.services.GetService <IOptionsDialogService>(); IConfigurationService service2 = this.services.GetService <IConfigurationService>(); Microsoft.Expression.Framework.UserInterface.IWindowService service3 = this.services.GetService <Microsoft.Expression.Framework.UserInterface.IWindowService>(); service1.OptionsPages.Remove((IOptionsPage)this.shellOptionsPage); service2["WindowService"].SetProperty("ActiveTheme", (object)service3.ActiveTheme, (object)service3.Themes[0].Name); service2.Save(); this.services.RemoveService(typeof(Microsoft.Expression.Framework.UserInterface.IWindowService)); this.services.RemoveService(typeof(IDocumentService)); this.services.RemoveService(typeof(IViewService)); this.services.RemoveService(typeof(ICommandService)); this.services.RemoveService(typeof(IConfigurationService)); this.services.RemoveService(typeof(IOptionsDialogService)); this.services.RemoveService(typeof(IMessageDisplayService)); this.services.RemoveService(typeof(IImporterService)); }
public void Unload() { Microsoft.Expression.Framework.UserInterface.IWindowService service = this.services.GetService <Microsoft.Expression.Framework.UserInterface.IWindowService>(); service.Closing -= new CancelEventHandler(this.WindowManager_Closing); Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Send, new DispatcherOperationCallback((object o) => { Application.Current.SessionEnding -= new SessionEndingCancelEventHandler(this.Current_SessionEnding); return(null); }), null); ICommandService commandService = this.services.GetService <ICommandService>(); IProjectManager projectManager = this.services.GetService <IProjectManager>(); projectManager.CloseSolution(); ProjectManager projectManager1 = (ProjectManager)projectManager; projectManager1.UpdateConfiguration(); commandService.RemoveTarget(projectManager1); IDocumentTypeManager documentTypeManager = this.services.GetService <IDocumentTypeManager>(); documentTypeManager.Unregister(this.assemblyDocumentType); documentTypeManager.Unregister(this.projectReferenceDocumentType); documentTypeManager.Unregister(this.folderDocumentType); documentTypeManager.Unregister(this.comReferenceDocumentType); documentTypeManager.Unregister(this.cursorDocumentType); documentTypeManager.Unregister(this.deepZoomDocumentType); IProjectTypeManager projectTypeManager = this.services.GetService <IProjectTypeManager>(); projectTypeManager.Unregister(this.websiteProjectType); projectTypeManager.Unregister(this.webApplicationProjectType); this.services.GetService <IOptionsDialogService>().OptionsPages.Remove(this.projectSystemOptionsPage); this.assemblyLoggingService.Unload(); this.services.RemoveService(typeof(IAssemblyLoggingService)); this.services.RemoveService(typeof(IProjectTypeManager)); this.services.RemoveService(typeof(IDocumentTypeManager)); this.services.RemoveService(typeof(IProjectManager)); this.services.RemoveService(typeof(ISolutionService)); this.services.AssemblyService().UnregisterLibraryResolver(this.blendSdkAssemblyResolver); this.services.AssemblyService().UnregisterLibraryResolver(this.blendAssemblyResolver); this.services.RemoveService(typeof(IAssemblyService)); this.services.RemoveService(typeof(ISatelliteAssemblyResolver)); this.assemblyService.Dispose(); }
internal CodeView(IDocument document, ICodeProject codeProject, IMessageDisplayService messageDisplayService, IViewService viewService, CodeOptionsModel codeOptionsModel, Microsoft.Expression.Framework.UserInterface.IWindowService windowService) : base(document) { Application.Current.Activated += new EventHandler(this.Application_Activated); this.codeDocument = (CodeDocument)document; this.messageDisplayService = messageDisplayService; this.viewService = viewService; this.codeOptionsModel = codeOptionsModel; this.actiproEditor = new ActiproEditor(this.codeDocument.Document, this.codeOptionsModel, this.messageDisplayService, this.viewService, codeProject, windowService); this.actiproEditor.CommandExecutionRequested += new EventHandler <CommandExecutionRequestedEventArgs>(this.ActiproEditor_CommandExecutionRequested); this.actiproEditor.EventInserted += new EventHandler <InsertEventHandlerEventArgs>(this.Editor_EventInserted); this.AddCommands(); }
public void Load(IServices services) { this.services = services; ICommandService service = (ICommandService)this.services.GetService(typeof(ICommandService)); IExpressionMefHostingService expressionMefHostingService = this.services.GetService <IExpressionMefHostingService>(); IDocumentTypeManager documentTypeManager = new DocumentTypeManager(new UnknownDocumentType()); this.services.AddService(typeof(IDocumentTypeManager), documentTypeManager); IProjectTypeManager projectTypeManager = new ProjectTypeManager(); this.services.AddService(typeof(IProjectTypeManager), projectTypeManager); IConfigurationService configurationService = this.services.GetService <IConfigurationService>(); ProjectManager projectManager = new ProjectManager(this.services, configurationService["ProjectManager"]); this.services.AddService(typeof(IProjectManager), projectManager); service.AddTarget(projectManager); this.services.AddService(typeof(IExternalChanges), projectManager); this.solutionService = new SolutionService(projectManager); this.services.AddService(typeof(ISolutionService), this.solutionService); this.assemblyLoggingService = new AssemblyLoggingService(configurationService.ConfigurationDirectoryPath); this.services.AddService(typeof(IAssemblyLoggingService), this.assemblyLoggingService); IProjectAdapterService projectAdapterService = new ProjectAdapterService(this.services); this.services.AddService(typeof(IProjectAdapterService), projectAdapterService); if (expressionMefHostingService != null) { expressionMefHostingService.AddInternalPart(projectAdapterService); expressionMefHostingService.AddInternalPart(this.solutionService); } IOptionsDialogService optionsDialogService = this.services.GetService <IOptionsDialogService>(); this.projectSystemOptionsPage = new ProjectSystemOptionsPage(projectManager, this.assemblyLoggingService); optionsDialogService.OptionsPages.Add(this.projectSystemOptionsPage); this.assemblyDocumentType = new AssemblyDocumentType(); documentTypeManager.Register(this.assemblyDocumentType); this.projectReferenceDocumentType = new ProjectReferenceDocumentType(); documentTypeManager.Register(this.projectReferenceDocumentType); this.folderDocumentType = new FolderDocumentType(); documentTypeManager.Register(this.folderDocumentType); this.comReferenceDocumentType = new ComReferenceDocumentType(); documentTypeManager.Register(this.comReferenceDocumentType); this.cursorDocumentType = new CursorDocumentType(); documentTypeManager.Register(this.cursorDocumentType); this.deepZoomDocumentType = new DeepZoomDocumentType(); documentTypeManager.Register(this.deepZoomDocumentType); this.websiteProjectType = new WebsiteProjectType(); projectTypeManager.Register(this.websiteProjectType); this.webApplicationProjectType = new WebApplicationProjectType(); projectTypeManager.Register(this.webApplicationProjectType); this.assemblyService = new AssemblyService(this.services); this.services.AddService(typeof(IAssemblyService), this.assemblyService); this.services.AddService(typeof(ISatelliteAssemblyResolver), this.assemblyService); this.blendSdkAssemblyResolver = new BlendSdkAssemblyResolver(); this.assemblyService.RegisterLibraryResolver(this.blendSdkAssemblyResolver); this.blendAssemblyResolver = new BlendAssemblyResolver(); this.assemblyService.RegisterLibraryResolver(this.blendAssemblyResolver); Microsoft.Expression.Framework.UserInterface.IWindowService windowService = this.services.GetService <Microsoft.Expression.Framework.UserInterface.IWindowService>(); windowService.Closing += new CancelEventHandler(this.WindowManager_Closing); Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Send, new DispatcherOperationCallback((object o) => { Application.Current.SessionEnding += new SessionEndingCancelEventHandler(this.Current_SessionEnding); return(null); }), null); UIThreadDispatcher.Instance.BeginInvoke(DispatcherPriority.SystemIdle, new Action(this.assemblyService.AssemblyCache.Clean)); }
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); }