private static DefaultSettings RetrieveDefaultSettings ()
		{
			using (CachesClient c = new CachesClient ()) {
				ApplicationContext.Current.PerfStart ("[ -- RetrieveDefaultSettings -- ]");
				var appVersion = DefaultSettingsCache.ApplicationVersionLocator != null ? DefaultSettingsCache.ApplicationVersionLocator () : "";
				ApplicationContext.Current.PerfStart ("[ -- RetrieveDefaultSettings : Get From API -- ]");
				var response = c.GetDefaultSettings (appVersion).GetDefaultSettingsResult;
				ApplicationContext.Current.PerfEnd ("[ -- RetrieveDefaultSettings : Get From API -- ]");
				ApplicationContext.Current.PerfEnd ("[ -- RetrieveDefaultSettings -- ]");
				return response;
			}
		}
Esempio n. 2
0
		private void TimerCallbackAirlines (object state)
		{
			try {

				if (_startupTimer != null)
					_startupTimer.Dispose ();

				// all caches
				using (CachesClient c = new CachesClient ()) {
					// get the current cache list from the server
					// TODO: Short Term: check date on files on device, if less than a week old, don't download data
					//		 Long Term:Caches and versioning not stored on the server at this point.  At some point, add cache/version
					// 			logic on the server API so we don't have to pull all of the data all of the time
					//	CacheList serverCacheList = null;
					/*if (!c.GetCacheList().HasErrors)
                        serverCacheList = c.GetCacheListResult;					
                    */


					// airports
					//if (ShouldDownload(CacheId.Airport, serverCacheList))
					//{
					if (!c.GetAirports ().HasErrors) {
						_updatedCaches.Add (CacheId.Airport);
						CacheContext.Current.Airports = c.GetAirportsResult.Results;
						LogContext.Current.Log<CacheContext> ("TimerCallback.Airports", c.GetAirportsResult.Results.Count ());
					} else
						_cacheErrors.Add (CacheId.Airport, c.ErrorMessage);


					// airlines
					//	if (ShouldDownload(CacheId.Airline, serverCacheList))
					//	{
					if (!c.GetAirlines ().HasErrors) {
						_updatedCaches.Add (CacheId.Airline);
						CacheContext.Current.Airlines = c.GetAirlineResult.Results;
						LogContext.Current.Log<CacheContext> ("TimerCallback.Airlines", c.GetAirlineResult.Results.Count ());
					} else
						_cacheErrors.Add (CacheId.Airline, c.ErrorMessage);


					if (this.CachesLoaded != null)
						this.CachesLoaded (this);

				}

			} catch (Exception ex) {
				LogContext.Current.Log<CacheContext> ("TimerCallback.Error", ex);
				if (LogContext.CrashReportEnabled && Settings.Current.EnableCrashReportExecution) {
					Insights.Report (ex);
				}


				_startError = ex.Message;
			}

			//LoadContacts ();

			NotifyCompleted ();
		}