Пример #1
0
        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);
        }
Пример #2
0
        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();
        }