예제 #1
0
        public async Task ReloadOemProfiles(IProgress <SyncReportType> syncReport = null)
        {
            // In public builds this won't be assigned to and we should exit
            if (ApplicationController.GetPublicProfileList == null)
            {
                return;
            }

            await ApplicationController.LoadCacheableAsync <OemProfileDictionary>(
                "oemprofiles.json",
                "public-profiles",
                async() =>
            {
                var result = await ApplicationController.GetPublicProfileList();
                if (result != null)
                {
                    // Refresh the in memory instance any time the server responds with updated content - caller will serialize
                    OemProfiles = result;

                    SetManufacturers(result.Keys.ToDictionary(oem => oem));
                }

                return(result);
            });

            await DownloadMissingProfiles(syncReport);
        }
예제 #2
0
        public async Task ReloadOemProfiles(IProgress <SyncReportType> syncReport = null)
        {
            // In public builds this won't be assigned to and we should abort and exit early
            if (ApplicationController.GetPublicProfileList == null)
            {
                return;
            }

            var oemProfilesDict = await ApplicationController.LoadCacheableAsync <OemProfileDictionary>(
                "oemprofiles.json",
                "public-profiles",
                async() =>
            {
                var result = await ApplicationController.GetPublicProfileList();
                if (result != null)
                {
                    OemProfiles = result;

                    var manufactures = result.Keys.ToDictionary(oem => oem);
                    SetManufacturers(manufactures);
                }

                return(result);
            },
                Path.Combine("Profiles", "oemprofiles.json"));

            if (oemProfilesDict != null)
            {
                await DownloadMissingProfiles(syncReport);
            }
        }
예제 #3
0
        private void Deserialized(StreamingContext context)
        {
            // Load from StaticData to prepopulate oemProfiles for when user create a printer before load cacheable is done
            OemProfiles = JsonConvert.DeserializeObject <OemProfileDictionary>(StaticData.Instance.ReadAllText(Path.Combine("Profiles", "oemprofiles.json")));

            var manufacturesList = OemProfiles.Keys.ToDictionary(oem => oem).ToList();

            SetManufacturers(manufacturesList);
        }
예제 #4
0
        private void Deserialized(StreamingContext context)
        {
            // Load local OemProfile content during initial startup
            OemProfiles = this.LoadOemProfiles();

            var manufacturesList = OemProfiles.Keys.ToDictionary(oem => oem);

            SetManufacturers(manufacturesList);
        }
예제 #5
0
        public async Task ReloadOemProfiles(IProgress <SyncReportType> syncReport = null)
        {
            // In public builds this won't be assigned to and we should abort and exit early
            if (ApplicationController.GetPublicProfileList == null)
            {
                return;
            }

            var oemProfiles = await ApplicationController.LoadCacheableAsync <OemProfileDictionary>(
                "oemprofiles.json",
                "profiles",
                ApplicationController.GetPublicProfileList);

            // If we failed to get anything from load cacheable don't override potentially populated fields
            if (oemProfiles != null)
            {
                OemProfiles = oemProfiles;

                var manufactures = oemProfiles.Keys.ToDictionary(oem => oem);
                SetManufacturers(manufactures);

                await DownloadMissingProfiles(syncReport);
            }
        }
예제 #6
0
		public async Task ReloadOemProfiles(IProgress<SyncReportType> syncReport = null)
		{
			// In public builds this won't be assigned to and we should abort and exit early
			if (ApplicationController.GetPublicProfileList == null)
			{
				return;
			}

			var oemProfilesDict = await ApplicationController.LoadCacheableAsync<OemProfileDictionary>(
				"oemprofiles.json",
				"public-profiles",
				async () =>
				{
					var result = await ApplicationController.GetPublicProfileList();
					if (result != null)
					{
						OemProfiles = result;

						var manufactures = result.Keys.ToDictionary(oem => oem);
						SetManufacturers(manufactures);
					}

					return result;
				},
				Path.Combine("Profiles", "oemprofiles.json"));

			if (oemProfilesDict != null)
			{
				await DownloadMissingProfiles(syncReport);
			}
		}
예제 #7
0
		private void Deserialized(StreamingContext context)
		{
			// Load from StaticData to prepopulate oemProfiles for when user create a printer before load cacheable is done
			OemProfiles = JsonConvert.DeserializeObject<OemProfileDictionary>(StaticData.Instance.ReadAllText(Path.Combine("Profiles", "oemprofiles.json")));

			var manufacturesList = OemProfiles.Keys.ToDictionary(oem => oem).ToList();
			SetManufacturers(manufacturesList);
		}
예제 #8
0
		public async Task ReloadOemProfiles(IProgress<SyncReportType> syncReport = null)
		{
			// In public builds this won't be assigned to and we should exit
			if (ApplicationController.GetPublicProfileList == null)
			{
				return;
			}

			await ApplicationController.LoadCacheableAsync<OemProfileDictionary>(
				"oemprofiles.json",
				"public-profiles",
				async () =>
				{
					var result = await ApplicationController.GetPublicProfileList();
					if (result != null)
					{
						// Refresh the in memory instance any time the server responds with updated content - caller will serialize
						OemProfiles = result;

						SetManufacturers(result.Keys.ToDictionary(oem => oem));
					}

					return result;
				});

			await DownloadMissingProfiles(syncReport);
		}
예제 #9
0
		private void Deserialized(StreamingContext context)
		{
			// Load local OemProfile content during initial startup
			OemProfiles = this.LoadOemProfiles();

			var manufacturesList = OemProfiles.Keys.ToDictionary(oem => oem);
			SetManufacturers(manufacturesList);
		}