Beispiel #1
0
        static void LoadSolutionInternal(string fileName)
        {
            if (!Path.IsPathRooted(fileName))
            {
                throw new ArgumentException("Path must be rooted!");
            }
            BeforeLoadSolution();
            OnSolutionLoading(fileName);
            try {
                openSolution = Solution.Load(fileName);
                CommandManager.InvalidateRequerySuggested();
                if (openSolution == null)
                {
                    return;
                }
            } catch (IOException ex) {
                LoggingService.Warn(ex);
                MessageService.ShowError(ex.Message);
                return;
            } catch (UnauthorizedAccessException ex) {
                LoggingService.Warn(ex);
                MessageService.ShowError(ex.Message);
                return;
            }
            AbstractProject.filesToOpenAfterSolutionLoad.Clear();
            try {
                string     file = GetPreferenceFileName(openSolution.FileName);
                Properties properties;
                if (FileUtility.IsValidPath(file) && File.Exists(file))
                {
                    properties = Properties.Load(file);
                }
                else
                {
                    properties = new Properties();
                }
                (openSolution.Preferences as IMementoCapable).SetMemento(properties);
            } catch (Exception ex) {
                MessageService.ShowException(ex);
            }
            try {
                ApplyConfigurationAndReadPreferences();
            } catch (Exception ex) {
                MessageService.ShowException(ex);
            }
            // Create project contents for solution
            ParserService.OnSolutionLoaded();

            Project.Converter.UpgradeViewContent.ShowIfRequired(openSolution);

            // preferences must be read before OnSolutionLoad is called to enable
            // the event listeners to read e.Solution.Preferences.Properties
            OnSolutionLoaded(new SolutionEventArgs(openSolution));
        }
Beispiel #2
0
        public static void LoadSolution(string fileName)
        {
            BeforeLoadSolution();
            try {
                openSolution = Solution.Load(fileName);
                if (openSolution == null)
                {
                    return;
                }
            } catch (UnauthorizedAccessException ex) {
                MessageService.ShowError(ex.Message);
                return;
            }
            AbstractProject.filesToOpenAfterSolutionLoad.Clear();
            try {
                string file = GetPreferenceFileName(openSolution.FileName);
                if (FileUtility.IsValidFileName(file) && File.Exists(file))
                {
                    (openSolution.Preferences as IMementoCapable).SetMemento(Properties.Load(file));
                }
                else
                {
                    (openSolution.Preferences as IMementoCapable).SetMemento(new Properties());
                }
            } catch (Exception ex) {
                MessageService.ShowError(ex);
            }
            try {
                ApplyConfigurationAndReadPreferences();
            } catch (Exception ex) {
                MessageService.ShowError(ex);
            }
            // Create project contents for solution
            ParserService.OnSolutionLoaded();

            // preferences must be read before OnSolutionLoad is called to enable
            // the event listeners to read e.Solution.Preferences.Properties
            OnSolutionLoaded(new SolutionEventArgs(openSolution));
        }