public async Task Load()
        {
            await Asa.Common.Core.Configuration.ResourceManager.Instance.LoadSubStorageIndependentResources();

            await Asa.Common.Core.Configuration.ResourceManager.Instance.DictionariesFolder.Download();

            DataUsersFile = new StorageFile(
                Asa.Common.Core.Configuration.ResourceManager.Instance.DictionariesFolder.RelativePathParts.Merge("Users.xml"));

            DataCoverFile = new StorageFile(
                Asa.Common.Core.Configuration.ResourceManager.Instance.DictionariesFolder.RelativePathParts.Merge("Add Cover.xml"));

            DataClientGoalsFile = new StorageFile(
                Asa.Common.Core.Configuration.ResourceManager.Instance.DictionariesFolder.RelativePathParts.Merge("Needs Analysis.xml"));

            DataLeadoffStatementFile = new StorageFile(
                Asa.Common.Core.Configuration.ResourceManager.Instance.DictionariesFolder.RelativePathParts.Merge("Intro Slide.xml"));

            DataTargetCustomersFile = new StorageFile(
                Asa.Common.Core.Configuration.ResourceManager.Instance.DictionariesFolder.RelativePathParts.Merge("Target Customer.xml"));

            TextResourcesFile = new StorageFile(new[]
            {
                FileStorageManager.IncomingFolderName,
                AppProfileManager.Instance.AppSubStorageIndependentFolderName,
                "AppSettings",
                "app_branding.xml"
            });
            if (await TextResourcesFile.Exists(true))
            {
                await TextResourcesFile.Download();
            }

            ImageResourcesFolder = new ArchiveDirectory(new[]
            {
                FileStorageManager.IncomingFolderName,
                AppProfileManager.Instance.AppSubStorageIndependentFolderName,
                "Resources"
            });
            if (await ImageResourcesFolder.Exists(true))
            {
                await ImageResourcesFolder.Download();
            }

            FormStyleConfigFile = new StorageFile(new[]
            {
                FileStorageManager.IncomingFolderName,
                AppProfileManager.Instance.AppSubStorageIndependentFolderName,
                "AppSettings",
                "style.xml"
            });
            if (await FormStyleConfigFile.Exists(true))
            {
                await FormStyleConfigFile.Download();
            }
        }
        public async Task LoadSubStorageDependentResources()
        {
            var folderNameParts = !String.IsNullOrEmpty(AppProfileManager.Instance.SubStorageName)
                ? new[]
            {
                FileStorageManager.IncomingFolderName,
                $"{FileStorageManager.CommonIncomingFolderName}_clients",
                AppProfileManager.Instance.SubStorageName,
            }
                : new[]
            {
                FileStorageManager.IncomingFolderName,
                FileStorageManager.CommonIncomingFolderName,
            };

            #region Remote
            DictionariesFolder = new ArchiveDirectory(folderNameParts.Merge(new[]
            {
                "ad_sales_data"
            }));

            MasterWizardsFolder = new ArchiveDirectory(folderNameParts.Merge(new[]
            {
                "Slides"
            }));
            await MasterWizardsFolder.Download();

            ThemesFolder = new ArchiveDirectory(folderNameParts.Merge(new[]
            {
                "SellerPointThemes"
            }));
            await ThemesFolder.Download();

            SlideMastersFolder = new ArchiveDirectory(folderNameParts.Merge(new[]
            {
                "SlidesTab"
            }));
            if (await SlideMastersFolder.Exists(true))
            {
                await SlideMastersFolder.Download();
            }

            ScheduleSlideTemplatesFolder = new ArchiveDirectory(folderNameParts.Merge(new[]
            {
                "ScheduleBuilders"
            }));

            CalendarSlideTemplatesFolder = new ArchiveDirectory(folderNameParts.Merge(new[]
            {
                "Calendar"
            }));

            ArtworkFolder = new ArchiveDirectory(folderNameParts.Merge(new[]
            {
                "Artwork"
            }));

            RateCardFolder = new ArchiveDirectory(folderNameParts.Merge(new[]
            {
                "RateCard"
            }));

            DefaultSlideSettingsFile = new StorageFile(folderNameParts.Merge(new[]
            {
                "AppSettings",
                "DefaultSlideSettings.xml"
            }));
            await DefaultSlideSettingsFile.Download();

            SlideSizeSettingsFile = new StorageFile(folderNameParts.Merge(new[]
            {
                "AppSettings",
                "SlideSizeSettings.xml"
            }));
            await SlideSizeSettingsFile.Download();

            HelpFile = new StorageFile(folderNameParts.Merge(new[]
            {
                "HelpUrls",
                HelpManager.GetFileName()
            }));
            await HelpFile.Download();

            HelpBrowserFile = new StorageFile(folderNameParts.Merge(new[]
            {
                "HelpUrls",
                "!Help_Browser.xml"
            }));
            await HelpBrowserFile.Download();

            OnlineListsFile = new StorageFile(
                DictionariesFolder.RelativePathParts.Merge("Online Strategy.xml"));

            DataSimpleSummaryFile = new StorageFile(
                DictionariesFolder.RelativePathParts.Merge("Closing Summary.xml"));

            #endregion
        }
        public async Task LoadSubStorageIndependentResources()
        {
            #region Local
            TempFolder = new StorageDirectory(new[]
            {
                "Temp"
            });
            if (!await TempFolder.Exists())
            {
                await StorageDirectory.CreateSubFolder(new string[] { }, "Temp");
            }

            AppSettingsFolder = new StorageDirectory(new[]
            {
                FileStorageManager.LocalFilesFolderName,
                AppProfileManager.Instance.AppSubStorageIndependentFolderName,
            });
            if (!await AppSettingsFolder.Exists())
            {
                await StorageDirectory.CreateSubFolder(new[] { FileStorageManager.LocalFilesFolderName }, AppProfileManager.Instance.AppSubStorageIndependentFolderName);
            }

            FavoriteImagesFolder = new StorageDirectory(new[]
            {
                FileStorageManager.LocalFilesFolderName,
                "image_favorites"
            });
            if (!await FavoriteImagesFolder.Exists())
            {
                await StorageDirectory.CreateSubFolder(new[] { FileStorageManager.LocalFilesFolderName }, "image_favorites");
            }

            UserListsFolder = new StorageDirectory(new[]
            {
                FileStorageManager.LocalFilesFolderName,
                "user_lists"
            });
            if (!await UserListsFolder.Exists())
            {
                await StorageDirectory.CreateSubFolder(new[] { FileStorageManager.LocalFilesFolderName }, "user_lists");
            }

            SharedSettingsFile = new StorageFile(new[]
            {
                FileStorageManager.LocalFilesFolderName,
                FileStorageManager.CommonIncomingFolderName,
                "Settings.xml"
            });
            SharedSettingsFile.AllocateParentFolder();

            AppSettingsFile = new StorageFile(new[]
            {
                FileStorageManager.LocalFilesFolderName,
                AppProfileManager.Instance.AppSubStorageIndependentFolderName,
                "Settings.xml"
            });
            AppSettingsFile.AllocateParentFolder();
            #endregion

            #region Remote
            LauncherTemplatesFolder = new ArchiveDirectory(new[]
            {
                FileStorageManager.IncomingFolderName,
                FileStorageManager.CommonIncomingFolderName,
                "LauncherTemplates"
            });
            await LauncherTemplatesFolder.Download();

            SpecialAppsFolder = new ArchiveDirectory(new[]
            {
                FileStorageManager.IncomingFolderName,
                FileStorageManager.CommonIncomingFolderName,
                "SpecialApps"
            });
            if (await SpecialAppsFolder.Exists(true))
            {
                await SpecialAppsFolder.Download();
            }
            #endregion
        }
Esempio n. 4
0
        public async Task Load()
        {
            #region Local
            TempFolder = new StorageDirectory(new[]
            {
                "Temp"
            });
            if (!await TempFolder.Exists())
            {
                await StorageDirectory.CreateSubFolder(new string[] { }, "Temp");
            }

            AppSettingsFolder = new StorageDirectory(new[]
            {
                FileStorageManager.LocalFilesFolderName,
                AppProfileManager.Instance.AppSubStorageDependentFolderName,
            });
            if (!await AppSettingsFolder.Exists())
            {
                await StorageDirectory.CreateSubFolder(new[] { FileStorageManager.LocalFilesFolderName }, AppProfileManager.Instance.AppSubStorageIndependentFolderName);
            }

            AppSettingsFile = new StorageFile(new[]
            {
                FileStorageManager.LocalFilesFolderName,
                AppProfileManager.Instance.AppSubStorageIndependentFolderName,
                "Settings.xml"
            });
            AppSettingsFile.AllocateParentFolder();
            #endregion

            #region Remote
            AppConfigFile = new StorageFile(new[]
            {
                FileStorageManager.IncomingFolderName,
                AppProfileManager.Instance.AppSubStorageIndependentFolderName,
                "AppSettings",
                "Config.xml"
            });
            await AppConfigFile.Download();

            TabsConfigFile = new StorageFile(new[]
            {
                FileStorageManager.IncomingFolderName,
                AppProfileManager.Instance.AppSubStorageIndependentFolderName,
                "AppSettings",
                "TabNames.xml"
            });
            await TabsConfigFile.Download();

            WatchedProcessesFile = new StorageFile(new[]
            {
                FileStorageManager.IncomingFolderName,
                AppProfileManager.Instance.AppSubStorageIndependentFolderName,
                "AppSettings",
                "HideList.xml"
            });
            await WatchedProcessesFile.Download();

            MaintenanceConfigFile = new StorageFile(new[]
            {
                FileStorageManager.IncomingFolderName,
                AppProfileManager.Instance.AppSubStorageIndependentFolderName,
                "AppSettings",
                "maintenance.xml"
            });
            if (await MaintenanceConfigFile.Exists(true))
            {
                await MaintenanceConfigFile.Download();
            }

            PatchUpdaterConfigFile = new StorageFile(new[]
            {
                FileStorageManager.IncomingFolderName,
                AppProfileManager.Instance.AppSubStorageIndependentFolderName,
                "AppSettings",
                "sfx_update.xml"
            });
            if (await PatchUpdaterConfigFile.Exists(true))
            {
                await PatchUpdaterConfigFile.Download();
            }

            UpdaterConfigFile = new StorageFile(new[]
            {
                FileStorageManager.IncomingFolderName,
                AppProfileManager.Instance.AppSubStorageIndependentFolderName,
                "AppSettings",
                "updater.xml"
            });
            if (await UpdaterConfigFile.Exists(true))
            {
                await UpdaterConfigFile.Download();
            }

            NoSyncConfigFile = new StorageFile(new[]
            {
                FileStorageManager.IncomingFolderName,
                AppProfileManager.Instance.AppSubStorageIndependentFolderName,
                "Resources",
                "NoSync.xml"
            });
            if (await NoSyncConfigFile.Exists(true))
            {
                await NoSyncConfigFile.Download();
            }

            SyncFormColorConfigFile = new StorageFile(new[]
            {
                FileStorageManager.IncomingFolderName,
                AppProfileManager.Instance.AppSubStorageIndependentFolderName,
                "Resources",
                "sync_color.xml"
            });
            if (await SyncFormColorConfigFile.Exists(true))
            {
                await SyncFormColorConfigFile.Download();
            }

            IconFile = new StorageFile(new[]
            {
                FileStorageManager.IncomingFolderName,
                AppProfileManager.Instance.AppSubStorageIndependentFolderName,
                "Resources",
                "icon.ico"
            });
            if (await IconFile.Exists(true))
            {
                await IconFile.Download();
            }

            LoginLogoFile = new StorageFile(new[]
            {
                FileStorageManager.IncomingFolderName,
                AppProfileManager.Instance.AppSubStorageIndependentFolderName,
                "Resources",
                "app_logo.png"
            });
            if (await LoginLogoFile.Exists(true))
            {
                await LoginLogoFile.Download();
            }

            SplashLogoFile = new StorageFile(new[]
            {
                FileStorageManager.IncomingFolderName,
                AppProfileManager.Instance.AppSubStorageIndependentFolderName,
                "Resources",
                "splash_logo.png"
            });
            if (await SplashLogoFile.Exists(true))
            {
                await SplashLogoFile.Download();
            }

            SyncFormCloseImageFile = new StorageFile(new[]
            {
                FileStorageManager.IncomingFolderName,
                AppProfileManager.Instance.AppSubStorageIndependentFolderName,
                "Resources",
                "ProgressCancel.png"
            });
            if (await SyncFormCloseImageFile.Exists(true))
            {
                await SyncFormCloseImageFile.Download();
            }

            UndockFormImageFile = new StorageFile(new[]
            {
                FileStorageManager.IncomingFolderName,
                AppProfileManager.Instance.AppSubStorageIndependentFolderName,
                "Resources",
                "undock_arrow.png"
            });
            if (await UndockFormImageFile.Exists(true))
            {
                await UndockFormImageFile.Download();
            }

            DockRegularImageFile = new StorageFile(new[]
            {
                FileStorageManager.IncomingFolderName,
                AppProfileManager.Instance.AppSubStorageIndependentFolderName,
                "Resources",
                "dock_arrow_ribbon.png"
            });
            if (await DockRegularImageFile.Exists(true))
            {
                await DockRegularImageFile.Download();
            }

            DockFloaterImageFile = new StorageFile(new[]
            {
                FileStorageManager.IncomingFolderName,
                AppProfileManager.Instance.AppSubStorageIndependentFolderName,
                "Resources",
                "dock_arrow_floater.png"
            });
            if (await DockFloaterImageFile.Exists(true))
            {
                await DockFloaterImageFile.Download();
            }

            ExpandFormImageFile = new StorageFile(new[]
            {
                FileStorageManager.IncomingFolderName,
                AppProfileManager.Instance.AppSubStorageIndependentFolderName,
                "Resources",
                "undocked_expand.png"
            });
            if (await ExpandFormImageFile.Exists(true))
            {
                await ExpandFormImageFile.Download();
            }

            CollapseFormImageFile = new StorageFile(new[]
            {
                FileStorageManager.IncomingFolderName,
                AppProfileManager.Instance.AppSubStorageIndependentFolderName,
                "Resources",
                "undocked_collapse.png"
            });
            if (await CollapseFormImageFile.Exists(true))
            {
                await CollapseFormImageFile.Download();
            }

            FloaterLogoFile = new StorageFile(new[]
            {
                FileStorageManager.IncomingFolderName,
                AppProfileManager.Instance.AppSubStorageIndependentFolderName,
                "Resources",
                "collapsed_undocked_logo.png"
            });
            if (await FloaterLogoFile.Exists(true))
            {
                await FloaterLogoFile.Download();
            }

            FloaterCancelImageFile = new StorageFile(new[]
            {
                FileStorageManager.IncomingFolderName,
                AppProfileManager.Instance.AppSubStorageIndependentFolderName,
                "Resources",
                "undockedCancel.png"
            });
            if (await FloaterCancelImageFile.Exists(true))
            {
                await FloaterCancelImageFile.Download();
            }

            SharedAssembliesFolder = new ArchiveDirectory(new[]
            {
                FileStorageManager.IncomingFolderName,
                FileStorageManager.CommonIncomingFolderName,
                "SharedAssemblies"
            });
            if (await SharedAssembliesFolder.Exists(true))
            {
                await SharedAssembliesFolder.DownloadTo(SharedAssemblyHelper.SharedAssemblyLocationPath);
            }

            SpecialAppsFolder = new ArchiveDirectory(new[]
            {
                FileStorageManager.IncomingFolderName,
                FileStorageManager.CommonIncomingFolderName,
                "SpecialApps"
            });
            if (await SpecialAppsFolder.Exists(true))
            {
                await SpecialAppsFolder.Download();
            }

            DataFolder = new ArchiveDirectory(new[]
            {
                FileStorageManager.IncomingFolderName,
                AppProfileManager.Instance.AppSubStorageIndependentFolderName,
                "Data",
            });

            SyncFilesFolder = new ArchiveDirectory(new[]
            {
                FileStorageManager.IncomingFolderName,
                AppProfileManager.Instance.AppSubStorageIndependentFolderName,
                "Data",
                "SyncFiles"
            });
            if (await SyncFilesFolder.Exists(true))
            {
                await SyncFilesFolder.Download();
            }

            CloudFilesFolder = new StorageDirectory(new[]
            {
                FileStorageManager.IncomingFolderName,
                FileStorageManager.CommonIncomingFolderName,
                "CloudFiles",
            });
            #endregion

            #region Make local copy
            if (NoSyncConfigFile.ExistsLocal())
            {
                File.Copy(NoSyncConfigFile.LocalPath, Path.Combine(AppRootFolderPath, Path.GetFileName(NoSyncConfigFile.LocalPath)), true);
            }
            if (UpdaterConfigFile.ExistsLocal())
            {
                File.Copy(UpdaterConfigFile.LocalPath, Path.Combine(AppRootFolderPath, Path.GetFileName(UpdaterConfigFile.LocalPath)), true);
            }
            if (SyncFormColorConfigFile.ExistsLocal())
            {
                File.Copy(SyncFormColorConfigFile.LocalPath, Path.Combine(AppRootFolderPath, Path.GetFileName(SyncFormColorConfigFile.LocalPath)), true);
            }
            if (IconFile.ExistsLocal())
            {
                File.Copy(IconFile.LocalPath, Path.Combine(AppRootFolderPath, Path.GetFileName(IconFile.LocalPath)), true);
            }
            if (LoginLogoFile.ExistsLocal())
            {
                File.Copy(LoginLogoFile.LocalPath, Path.Combine(AppRootFolderPath, Path.GetFileName(LoginLogoFile.LocalPath)), true);
            }
            if (SyncFormCloseImageFile.ExistsLocal())
            {
                File.Copy(SyncFormCloseImageFile.LocalPath, Path.Combine(AppRootFolderPath, Path.GetFileName(SyncFormCloseImageFile.LocalPath)), true);
            }
            #endregion
        }
        private async Task LoadSubStorageDependentResources()
        {
            await Asa.Common.Core.Configuration.ResourceManager.Instance.LoadSubStorageDependentResources();

            await Asa.Common.Core.Configuration.ResourceManager.Instance.DictionariesFolder.Download();

            await Asa.Common.Core.Configuration.ResourceManager.Instance.ScheduleSlideTemplatesFolder.Download();

            await Asa.Common.Core.Configuration.ResourceManager.Instance.CalendarSlideTemplatesFolder.Download();

            await Asa.Common.Core.Configuration.ResourceManager.Instance.ArtworkFolder.Download();

            await Asa.Common.Core.Configuration.ResourceManager.Instance.RateCardFolder.Download();

            var folderNameParts = !String.IsNullOrEmpty(AppProfileManager.Instance.SubStorageName)
                ? new[]
            {
                FileStorageManager.IncomingFolderName,
                AppProfileManager.Instance.AppSubStorageDependentFolderName,
                AppProfileManager.Instance.SubStorageName,
            }
                : new[]
            {
                FileStorageManager.IncomingFolderName,
                AppProfileManager.Instance.AppSubStorageIndependentFolderName,
            };

            FormStyleConfigFile = new StorageFile(folderNameParts.Merge(new[]
            {
                "AppSettings",
                "style.xml"
            }));
            await FormStyleConfigFile.Download();

            MainAppTitleTextFile = new StorageFile(folderNameParts.Merge(new[]
            {
                "AppSettings",
                "app_brand.txt"
            }));
            if (await MainAppTitleTextFile.Exists(true))
            {
                await MainAppTitleTextFile.Download();
            }

            ConfigFile = new StorageFile(folderNameParts.Merge(new[]
            {
                "AppSettings",
                "app_common_config.xml"
            }));
            if (await ConfigFile.Exists(true))
            {
                await ConfigFile.Download();
            }

            TextResourcesFile = new StorageFile(folderNameParts.Merge(new[]
            {
                "AppSettings",
                "app_text_config.xml"
            }));
            if (await TextResourcesFile.Exists(true))
            {
                await TextResourcesFile.Download();
            }

            AdditionalTextResourcesFile = new StorageFile(folderNameParts.Merge(new[]
            {
                "AppSettings",
                String.Format("{0}_subtab_names.xml", MediaMetaData.Instance.DataTypeString.ToLower())
            }));
            if (await AdditionalTextResourcesFile.Exists(true))
            {
                await AdditionalTextResourcesFile.Download();
            }

            SyncFormColorConfigFile = new StorageFile(folderNameParts.Merge(new[]
            {
                "AppSettings",
                "sync_color.xml"
            }));
            if (await SyncFormColorConfigFile.Exists(true))
            {
                await SyncFormColorConfigFile.Download();
            }

            SyncFormTextConfigFile = new StorageFile(folderNameParts.Merge(new[]
            {
                "AppSettings",
                "sync_text.xml"
            }));
            if (await SyncFormTextConfigFile.Exists(true))
            {
                await SyncFormTextConfigFile.Download();
            }

            TabsConfigFile = new StorageFile(folderNameParts.Merge(new[]
            {
                "AppSettings",
                $"{MediaMetaData.Instance.DataTypeString.ToLower()}_tab_names.xml"
            }));
            await TabsConfigFile.Download();

            BrowserConfigFile = new StorageFile(folderNameParts.Merge(new[]
            {
                "AppSettings",
                "eo.xml"
            }));
            await BrowserConfigFile.Download();

            Gallery1ConfigFile = new StorageFile(folderNameParts.Merge(new[]
            {
                "AppSettings",
                "Gallery1.xml"
            }));
            await Gallery1ConfigFile.Download();

            Gallery2ConfigFile = new StorageFile(folderNameParts.Merge(new[]
            {
                "AppSettings",
                "Gallery2.xml"
            }));
            await Gallery2ConfigFile.Download();

            SolutionsConfigFile = new StorageFile(folderNameParts.Merge(new[]
            {
                "AppSettings",
                "solution_templates.xml"
            }));
            await SolutionsConfigFile.Download();

            IdleSettingsFile = new StorageFile(folderNameParts.Merge(new[]
            {
                "AppSettings",
                "autoclose.xml"
            }));
            if (await IdleSettingsFile.Exists(true))
            {
                await IdleSettingsFile.Download();
            }

            ImageResourcesFolder = new ArchiveDirectory(folderNameParts.Merge(new[]
            {
                "Resources"
            }));
            if (await ImageResourcesFolder.Exists(true))
            {
                await ImageResourcesFolder.Download();
            }

            SolutionsDataFolder = new StorageDirectory(folderNameParts.Merge(new[]
            {
                "Solution Templates"
            }));

            MediaListsFile = new StorageFile(
                Asa.Common.Core.Configuration.ResourceManager.Instance.DictionariesFolder.RelativePathParts.Merge(
                    String.Format("{0} Strategy.xml", MediaMetaData.Instance.DataTypeString)));

            #region Make local copy

            if (SyncFormColorConfigFile.ExistsLocal())
            {
                File.Copy(SyncFormColorConfigFile.LocalPath, Path.Combine(Asa.Common.Core.Configuration.ResourceManager.Instance.AppRootFolderPath, Path.GetFileName(SyncFormColorConfigFile.LocalPath)), true);
            }
            if (SyncFormTextConfigFile.ExistsLocal())
            {
                File.Copy(SyncFormTextConfigFile.LocalPath, Path.Combine(Asa.Common.Core.Configuration.ResourceManager.Instance.AppRootFolderPath, Path.GetFileName(SyncFormTextConfigFile.LocalPath)), true);
            }

            #endregion
        }