示例#1
0
        private static bool InitializeLicensingDialogResource(ILicenseService licenseService)
        {
            bool   flag  = licenseService.IsAnySkuEnabled(licenseService.SkusFromFeature(ExpressionFeatureMapper.SketchFlowFeature)) | licenseService.IsAnySkuEnabled(licenseService.SkusFromFeature(ExpressionFeatureMapper.HobbledSketchFlowFeature));
            string name1 = "Licensing\\AboutDialogResources.xaml";

            if (flag)
            {
                name1 = "Licensing\\AboutDialogResourcesSketchFlow.xaml";
            }
            string name2 = "Licensing\\LicensingDialogResources.xaml";

            if (flag)
            {
                name2 = "Licensing\\LicensingDialogResourcesSketchFlow.xaml";
            }
            licenseService.EstablishLicensingDialogs(FileTable.GetResourceDictionary(name2), FileTable.GetResourceDictionary(name1));
            licenseService.LicensingDialogResources[(object)"GetHelpLinkCommand"] = (object)new DelegateCommand((DelegateCommand.SimpleEventHandler)(() => BlendHelp.Instance.ShowHelpTopic("/html/9c3e6f16-85f3-4ca8-a372-a53dcbf014cb.htm")));
            return(flag);
        }
示例#2
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);
        }