Exemplo n.º 1
0
        /// <summary>
        /// Loads the settings from file.
        /// </summary>
        /// <param name="settingsFilename">The full name and path of the settings file.</param>
        /// <returns>The psi studio settings object that was loaded.</returns>
        public static PsiStudioSettings Load(string settingsFilename)
        {
            // Create the settings instance
            var settings = new PsiStudioSettings();

            // Update the settings with those from the file on disk
            settings.LoadFromFile(settingsFilename);

            // Generate the additional assemblies list
            settings.AdditionalAssembliesList = new List <string>();
            if (!string.IsNullOrWhiteSpace(settings.AdditionalAssemblies))
            {
                foreach (string additionalAssembly in settings.AdditionalAssemblies.Split(';'))
                {
                    settings.AdditionalAssembliesList.Add(additionalAssembly.Trim());
                }
            }

            return(settings);
        }
Exemplo n.º 2
0
        ////private RelayCommand insertAnnotationCommand;
        ////private RelayCommand showSettingsWindowComand;

        /// <summary>
        /// Initializes a new instance of the <see cref="MainWindowViewModel"/> class.
        /// </summary>
        public MainWindowViewModel()
        {
            // Create and load the settings
            this.AppSettings = PsiStudioSettings.Load(Path.Combine(PsiStudioDocumentsPath, "PsiStudioSettings.xml"));

            // Wait until the main window is visible before initializing the visualizer
            // map as we may need to display some message boxes during this process.
            Application.Current.MainWindow.ContentRendered += this.MainWindow_Activated;

            // Listen for property change events from the visualization context (specifically when the visualization container changes)
            VisualizationContext.Instance.PropertyChanged += this.VisualizationContext_PropertyChanged;

            // Load the available layouts
            this.UpdateLayoutList();

            // Set the current layout if it's in the available layouts, otherwise make "new layout" the current layout
            LayoutInfo lastLayout = this.AvailableLayouts.FirstOrDefault(l => l.Name == this.AppSettings.CurrentLayoutName);

            this.currentLayout = lastLayout ?? this.AvailableLayouts[0];
        }