internal void InitializeLayouts()
        {
            Logger.Info("Loading window layouts.");

            Layouts.Clear();

            try
            {
                // Load factory presets.
                string applicationFolder = EditorHelper.GetUserSettingsFolder(ConfigurationUserLevel.None);
                string layoutsFolder     = Path.Combine(applicationFolder, LayoutsFolder, PresetsFolder);
                Layouts.AddRange(Directory.EnumerateFiles(layoutsFolder, LayoutPattern)
                                 .Select(Path.GetFileNameWithoutExtension)
                                 .Select(name => new WindowLayout(name, true)));
            }
            catch (Exception exception)
            {
                Logger.Warn(exception, "Failed to load factory presets.");
            }

            try
            {
                // Load user presets.
                string applicationFolder = EditorHelper.GetUserSettingsFolder(ConfigurationUserLevel.PerUserRoamingAndLocal);
                string layoutsFolder     = Path.Combine(applicationFolder, LayoutsFolder, PresetsFolder);
                Layouts.AddRange(Directory.EnumerateFiles(layoutsFolder, LayoutPattern)
                                 .Select(Path.GetFileNameWithoutExtension)
                                 .Select(name => new WindowLayout(name, false)));
            }
            catch (Exception exception)
            {
                Logger.Warn(exception, "Failed to load user presets.");
            }

            // Add a dummy entry, if no presets are available.
            if (Layouts.Count == 0)
            {
                Layouts.Add(new WindowLayout(DefaultLayout, true));
            }

            // The window layout will be loaded in OnEditorActivated().
            ActiveLayout = null;
        }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LayoutQualifier"/> class.
 /// </summary>
 /// <param name="layouts">The layouts.</param>
 public LayoutQualifier(params LayoutKeyValue[] layouts) : this()
 {
     Layouts.AddRange(layouts);
 }