Ejemplo n.º 1
0
        void LoadApplication()
        {
            try
            {
                if (DAL == null)
                {
                    EntityFactory.CreateInstance = Entity.CreateInstance;
                    EntityFactory.DbRefFactory = DbRef.CreateInstance;
                    EntityFactory.CustomDictionaryFactory = () => new CustomDictionary();

                    IDictionary<string, string> deviceInfo = BitBrowserApp.Current.GetDeviceInfo();
                    
                    XmlDocument document = LoadMetadata();
                    var uri = new Uri(_settings.Url);
                    
                    Database.Init(_settings.BaseUrl);
                    IsolatedStorageOfflineContext context = new OfflineContext(document, uri.Host, uri);

                    var configuration = document.DocumentElement;
					Settings.ConfigName = configuration.Attributes ["Name"].Value;
					Settings.ConfigVersion = configuration.Attributes ["Version"].Value;
					Settings.WriteSettings();

                    DAL = new DAL(context
                        , _settings.Application
                        , _settings.Language
                        , _settings.UserName
                        , _settings.Password
						, Settings.ConfigName
						, Settings.ConfigVersion
                        , deviceInfo
                        , (total, processed) =>
                        {
                            if (LoadingProgress != null)
                                LoadingProgress(total, processed, D.LOADING_SOLUTION);
                        }, CacheRequestFactory);
                }

                DAL.UpdateCredentials(_settings.UserName, _settings.Password);

                DAL.LoadSolution(_settings.ClearCacheOnStart, _settings.SyncOnStart, LoadComplete);
            }
            catch (CustomException e)
            {
                ReturnToStartMenu(e.FriendlyMessage, e.Report);
            }
            catch (UriFormatException)
            {
                ReturnToStartMenu(D.INVALID_ADDRESS, D.INVALID_ADDRESS);
            }
            catch (Exception e)
            {
                ReturnToStartMenu(D.LOADING_ERROR, e.ToString());
            }
        }
Ejemplo n.º 2
0
 private void ClearSyncConflict(SyncConflict syncConflict, OfflineContext context)
 {
 }
Ejemplo n.º 3
0
 public void AddConflicts(IEnumerable<SyncConflict> conflicts, OfflineContext context)
 {
 }
Ejemplo n.º 4
0
 public void AddSerializedError(SyncError error, OfflineContext context)
 {
 }
Ejemplo n.º 5
0
 public void AddSyncError(SyncError error, OfflineContext context)
 {
 }
Ejemplo n.º 6
0
 public void AddErrors(IEnumerable<SyncError> errors, OfflineContext context)
 {
 }
Ejemplo n.º 7
0
 public void AddSerializedConflict(SyncConflict conflict, OfflineContext context)
 {
 }
Ejemplo n.º 8
0
		void LoadApplication (bool clearCache)
		{
			if (String.IsNullOrEmpty (Settings.UserName) || String.IsNullOrEmpty (Settings.Password)) {
				Logon (clearCache);
				return;
			}

			try {
				_backgroundTaskId =	UIApplication.SharedApplication.BeginBackgroundTask (() => {
				});

				if (this.DAL == null) {
					EntityFactory.CreateInstance = Entity.CreateInstance;
					EntityFactory.DbRefFactory = DbRef.CreateInstance;
					EntityFactory.CustomDictionaryFactory = () => new CustomDictionary ();

					XmlDocument document = LoadMetadata ();
					Uri uri = new Uri (Settings.Url);

					//to create db here
					BitMobile.DbEngine.Database.Init (Settings.BaseUrl);
					IsolatedStorageOfflineContext context = new OfflineContext (document, uri.Host, uri);

					var configuration = document.DocumentElement;
					Settings.ConfigName = configuration.Attributes ["Name"].Value;
					Settings.ConfigVersion = configuration.Attributes ["Version"].Value;
					Settings.WriteSettings();

					IDictionary<string, string> deviceInfo = GetDeviceInfo ();

					this.DAL = new DAL (context
						, Settings.Application
						, Settings.Language
						, Settings.UserName
						, Settings.Password
						, Settings.ConfigName
						, Settings.ConfigVersion
						, deviceInfo
						, UpdateLoadStatus
						, CacheRequestFactory);

					this._commonData = new BitMobile.ValueStack.CommonData ();

					this.Settings.ConfigName = DAL.ConfigName;
					this.Settings.ConfigVersion = DAL.ConfigVersion;
				}

				LogonComplete (clearCache);

			} catch (CustomException ex) {
				Logon (clearCache, ex.FriendlyMessage);
			} catch (UriFormatException) {
				Logon (clearCache, D.INVALID_ADDRESS);
			}
		}