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); } }
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); } }