private void PromptWithUnsupportedProjectDetails(IProjectStore projectStore, IProjectCreateError projectCreateError) { string invalidStoreUnsupportedError = StringTable.InvalidStoreUnsupportedError; string identifier = null; if (projectStore is InvalidProjectStore) { string safeExtension = Microsoft.Expression.Framework.Documents.PathHelper.GetSafeExtension(projectStore.DocumentReference.Path); if (!string.IsNullOrEmpty(safeExtension)) { identifier = string.Concat("DoNotWarnAboutExtension", safeExtension.ToUpperInvariant()); } } else if (projectCreateError != null) { invalidStoreUnsupportedError = projectCreateError.Message; identifier = projectCreateError.Identifier; } else if (projectStore.StoreVersion != CommonVersions.Version4_0) { CultureInfo currentUICulture = CultureInfo.CurrentUICulture; string invalidStoreBadToolsVersion = StringTable.InvalidStoreBadToolsVersion; object[] objArray = new object[] { "4.0" }; invalidStoreUnsupportedError = string.Format(currentUICulture, invalidStoreBadToolsVersion, objArray); identifier = "DoNotWarnAboutBadToolsVersion"; } else if (!ProjectStoreHelper.IsKnownLanguage(projectStore)) { invalidStoreUnsupportedError = StringTable.InvalidStoreUnknownLanguage; identifier = "DoNotWarnAboutUnknownLanguage"; } else if (!WindowsExecutableProjectType.IsSupportedOutputType(projectStore)) { invalidStoreUnsupportedError = StringTable.InvalidStoreUnsupportedOutputType; identifier = "DoNotWarnAboutUnsupportedOutputType"; } else if (ProjectStoreHelper.IsSketchFlowProject(projectStore)) { FrameworkName targetFrameworkName = ProjectStoreHelper.GetTargetFrameworkName(projectStore); if (targetFrameworkName == null || targetFrameworkName.Version != CommonVersions.Version4_0) { CultureInfo cultureInfo = CultureInfo.CurrentUICulture; string invalidStoreUnsupportedSketchflow = StringTable.InvalidStoreUnsupportedSketchflow; object[] objArray1 = new object[] { (targetFrameworkName.Identifier == "Silverlight" ? "Silverlight 4" : ".NET Framework 4.0") }; invalidStoreUnsupportedError = string.Format(cultureInfo, invalidStoreUnsupportedSketchflow, objArray1); identifier = "DoNotWarnAboutUnsupportedSketchflowProject"; } } CultureInfo currentUICulture1 = CultureInfo.CurrentUICulture; string unsupportedProjectWithDescription = StringTable.UnsupportedProjectWithDescription; object[] displayName = new object[] { projectStore.DocumentReference.DisplayName, invalidStoreUnsupportedError }; string str = string.Format(currentUICulture1, unsupportedProjectWithDescription, displayName); if (string.IsNullOrEmpty(identifier)) { this.Services.MessageDisplayService().ShowError(str); return; } IServiceProvider services = this.Services; MessageBoxArgs messageBoxArg = new MessageBoxArgs() { Button = MessageBoxButton.OK, Image = MessageBoxImage.Exclamation, Message = str, AutomationId = "UnsupportedProjectErrorDialog" }; services.ShowSuppressibleWarning(messageBoxArg, identifier, MessageBoxResult.OK); }
protected INamedProject InitializeProject(IProjectStore projectStore) { INamedProject namedProject; INamedProject unlicensedProject = null; try { IProjectType projectTypeForProject = this.Services.ProjectTypeManager().GetProjectTypeForProject(projectStore); if (projectTypeForProject != null) { IProjectCreateError projectCreateError = projectTypeForProject.CanCreateProject(projectStore); if (projectCreateError != null) { projectTypeForProject = this.Services.ProjectTypeManager().UnknownProjectType; } if (projectTypeForProject is UnknownProjectType && SolutionBase.IsReloadPromptEnabled()) { InvalidProjectStore invalidProjectStore = projectStore as InvalidProjectStore; if (invalidProjectStore == null || string.IsNullOrEmpty(invalidProjectStore.InvalidStateDescription)) { this.PromptWithUnsupportedProjectDetails(projectStore, projectCreateError); } else { IMessageDisplayService messageDisplayService = this.Services.MessageDisplayService(); ErrorArgs errorArg = new ErrorArgs(); CultureInfo currentUICulture = CultureInfo.CurrentUICulture; string unsupportedProjectWithDescription = StringTable.UnsupportedProjectWithDescription; object[] displayName = new object[] { projectStore.DocumentReference.DisplayName, invalidProjectStore.InvalidStateDescription }; errorArg.Message = string.Format(currentUICulture, unsupportedProjectWithDescription, displayName); errorArg.AutomationId = "OpenProjectErrorDialog"; messageDisplayService.ShowError(errorArg); } } LicenseState licenseState = LicensingHelper.IsProjectLicensed(projectStore, this.serviceProvider); if (!licenseState.IsExpired) { if (!licenseState.FullyLicensed) { LicensingHelper.UnlicensedProjectLoadAttempted(); } unlicensedProject = projectTypeForProject.CreateProject(projectStore, this.GetCodeDocumentTypeFromProject(projectStore), this.serviceProvider); } else { LicensingHelper.UnlicensedProjectLoadAttempted(); unlicensedProject = new UnlicensedProject(projectStore, this.serviceProvider); } return(unlicensedProject); } else { namedProject = null; } } catch (Exception exception) { if (unlicensedProject != null) { projectStore.Dispose(); unlicensedProject.Dispose(); unlicensedProject = null; } throw; } return(namedProject); }