diff --git a/HeliosPlus.Shared/ProfileRepository.cs b/HeliosPlus.Shared/ProfileRepository.cs index 829e778..c1c28c3 100644 --- a/HeliosPlus.Shared/ProfileRepository.cs +++ b/HeliosPlus.Shared/ProfileRepository.cs @@ -32,7 +32,8 @@ namespace HeliosPlus.Shared { #region Class Variables // Common items to the class - private static List _allProfiles = null; + private static List _allProfiles = new List(); + private static bool _profilesLoaded = false; public static Version Version = new Version(1, 0, 0); // Other constants that are useful public static string AppDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "HeliosPlus"); @@ -72,7 +73,7 @@ namespace HeliosPlus.Shared { get { - if (_allProfiles == null) + if (!_profilesLoaded) // Load the Profiles from storage if they need to be LoadProfiles(); return _allProfiles; @@ -102,9 +103,11 @@ namespace HeliosPlus.Shared { get { - if (_allProfiles == null) + if (!_profilesLoaded) // Load the Profiles from storage if they need to be LoadProfiles(); + + return _allProfiles.Count; } } @@ -364,15 +367,17 @@ namespace HeliosPlus.Shared ProfileBitmap = _currentProfile.ProfileIcon.ToBitmap(256, 256) }; - foreach (ProfileItem loadedProfile in ProfileRepository.AllProfiles) + if (ProfileRepository.ProfileCount > 0) { - if (activeProfile.Equals(loadedProfile)) + foreach (ProfileItem loadedProfile in ProfileRepository.AllProfiles) { - _currentProfile = loadedProfile; - return; + if (activeProfile.Equals(loadedProfile)) + { + _currentProfile = loadedProfile; + return; + } } } - _currentProfile = activeProfile; } @@ -468,6 +473,7 @@ namespace HeliosPlus.Shared _currentProfile.ProfileIcon = new ProfileIcon(_currentProfile); _currentProfile.ProfileBitmap = _currentProfile.ProfileIcon.ToBitmap(256, 256); } + _profilesLoaded = true; return true; } diff --git a/HeliosPlus.ShellExtension/HeliosPlus.ShellExtension.csproj b/HeliosPlus.ShellExtension/HeliosPlus.ShellExtension.csproj index 3831b78..ea1293a 100644 --- a/HeliosPlus.ShellExtension/HeliosPlus.ShellExtension.csproj +++ b/HeliosPlus.ShellExtension/HeliosPlus.ShellExtension.csproj @@ -68,6 +68,9 @@ + + 1.2.0.1 + 2.7.2 diff --git a/HeliosPlus/HeliosPlus.csproj b/HeliosPlus/HeliosPlus.csproj index 5de8d64..8580f36 100644 --- a/HeliosPlus/HeliosPlus.csproj +++ b/HeliosPlus/HeliosPlus.csproj @@ -185,8 +185,11 @@ 2.8.0.16 + + 1.2.0.1 + - 1.11.23 + 1.11.24 1.0.2.1-beta @@ -204,7 +207,7 @@ 3.0.0 - 3.0.0 + 3.3.0-beta2.final runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/HeliosPlus/ShortcutRepository.cs b/HeliosPlus/ShortcutRepository.cs index d7c4b55..80d4401 100644 --- a/HeliosPlus/ShortcutRepository.cs +++ b/HeliosPlus/ShortcutRepository.cs @@ -24,7 +24,8 @@ namespace HeliosPlus { #region Class Variables // Common items to the class - private static List _allShortcuts = null; + private static List _allShortcuts = new List(); + private static bool _shortcutsLoaded = false; // Other constants that are useful private static string _shortcutStorageJsonPath = Path.Combine(Program.AppDataPath, $"Shortcuts"); private static string _shortcutStorageJsonFileName = Path.Combine(_shortcutStorageJsonPath, $"Shortcuts_{Version.ToString(2)}.json"); @@ -45,18 +46,10 @@ namespace HeliosPlus { get { - if (_allShortcuts == null) + if (!_shortcutsLoaded) // Load the Shortcuts from storage LoadShortcuts(); -/* if (LoadShortcuts() && ShortcutCount > 0) - { - // Work out the starting NextShortcutId value - long max = _allShortcuts.Max(item => item.Id); - _lastShortcutId = Convert.ToUInt32(max); - } - else - _lastShortcutId = 0; -*/ + return _allShortcuts; } } @@ -66,6 +59,10 @@ namespace HeliosPlus { get { + if (!_shortcutsLoaded) + // Load the Shortcuts from storage + LoadShortcuts(); + return _allShortcuts.Count; } } @@ -336,6 +333,7 @@ namespace HeliosPlus } } } + _shortcutsLoaded = true; return true; }