public static void SavePositions(string sFileName, bool bSaveReg) { DesktopRegistry _registry = new DesktopRegistry(); Desktop _desktop = new Desktop(); Storage _storage = new Storage(sFileName); var registryValues = bSaveReg ? _registry.GetRegistryValues() : new Dictionary <string, string>(); var iconPositions = _desktop.GetIconsPositions(); _storage.SaveIconPositions(iconPositions, registryValues); }
public static void RestorePositions(string sFileName, bool bLoadReg) { DesktopRegistry _registry = new DesktopRegistry(); Desktop _desktop = new Desktop(); Storage _storage = new Storage(sFileName); var registryValues = bLoadReg ? _storage.GetRegistryValues() : new Dictionary <string, string>(); _registry.SetRegistryValues(registryValues); var iconPositions = _storage.GetIconPositions(); //Console.WriteLine("Loaded {0} icons", System.Linq.Enumerable.Count(iconPositions)); _desktop.SetIconPositions(iconPositions); _desktop.Refresh(); }