예제 #1
0
        private void RefreshSolution()
        {
            MessageBoxResult messageBoxResult;

            if (this.SolutionFileInformation != null && this.SolutionFileInformation.HasChanged())
            {
                string solutionChangedDialogMessage = StringTable.SolutionChangedDialogMessage;
                string path = base.DocumentReference.Path;
                if (!SolutionBase.IsReloadPromptEnabled())
                {
                    messageBoxResult = MessageBoxResult.Yes;
                }
                else
                {
                    MessageBoxArgs messageBoxArg        = new MessageBoxArgs();
                    CultureInfo    currentCulture       = CultureInfo.CurrentCulture;
                    object[]       shortApplicationName = new object[] { path, this.Services.ExpressionInformationService().ShortApplicationName };
                    messageBoxArg.Message = string.Format(currentCulture, solutionChangedDialogMessage, shortApplicationName);
                    messageBoxArg.Button  = MessageBoxButton.YesNo;
                    messageBoxArg.Image   = MessageBoxImage.Exclamation;
                    MessageBoxArgs messageBoxArg1 = messageBoxArg;
                    messageBoxResult = this.Services.MessageDisplayService().ShowMessage(messageBoxArg1);
                }
                if (messageBoxResult == MessageBoxResult.Yes && this.Save(false))
                {
                    this.Services.ExceptionHandler(() => {
                        this.CloseAllProjects();
                        ((ProjectManager)this.Services.ProjectManager()).OnSolutionClosed(new SolutionEventArgs(this));
                        this.LoadInternal();
                        ((ProjectManager)this.Services.ProjectManager()).OnSolutionOpened(new SolutionEventArgs(this));
                        this.reloadDocuments = true;
                        if (this.IsUnderSourceControl)
                        {
                            ISourceControlProvider sourceControlProvider = this.Services.SourceControlProvider();
                            if (sourceControlProvider != null)
                            {
                                sourceControlProvider.OpenProject(base.DocumentReference.Path, false);
                            }
                        }
                        if (this.Services.ProjectManager().ItemSelectionSet.Count == 0)
                        {
                            this.Services.ProjectManager().ItemSelectionSet.SetSelection(this);
                        }
                    }, () => string.Format(CultureInfo.CurrentCulture, StringTable.DialogRefreshFailedMessage, new object[] { base.DocumentReference.Path }));
                }
                this.UpdateFileInformation();
            }
        }
예제 #2
0
        private void Project_ProjectChanged(object o, ProjectEventArgs e)
        {
            MessageBoxResult messageBoxResult;

            if (this.IsDisposed)
            {
                return;
            }
            if (e.Project == null)
            {
                return;
            }
            string projectChangedDialogMessage = StringTable.ProjectChangedDialogMessage;
            string path = e.Project.DocumentReference.Path;

            if (!SolutionBase.IsReloadPromptEnabled())
            {
                messageBoxResult = MessageBoxResult.Yes;
            }
            else
            {
                MessageBoxArgs messageBoxArg        = new MessageBoxArgs();
                CultureInfo    currentCulture       = CultureInfo.CurrentCulture;
                object[]       shortApplicationName = new object[] { path, this.Services.ExpressionInformationService().ShortApplicationName };
                messageBoxArg.Message = string.Format(currentCulture, projectChangedDialogMessage, shortApplicationName);
                messageBoxArg.Button  = MessageBoxButton.YesNo;
                messageBoxArg.Image   = MessageBoxImage.Exclamation;
                MessageBoxArgs messageBoxArg1 = messageBoxArg;
                messageBoxResult = this.Services.MessageDisplayService().ShowMessage(messageBoxArg1);
            }
            if (messageBoxResult == MessageBoxResult.Yes)
            {
                IProject project = e.Project;
                if (project != null && this.Save(false) && this.RefreshProject(project) && this.Services.ProjectManager().ItemSelectionSet.Count == 0)
                {
                    this.Services.ProjectManager().ItemSelectionSet.SetSelection(this);
                }
            }
        }
예제 #3
0
        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);
        }
예제 #4
0
 protected static bool IsReloadPromptEnabled()
 {
     return(SolutionBase.IsReloadPromptEnabled());
 }