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()); } }
public void SyncSettings(bool sharedPreferencePrefer = true) { if (sharedPreferencePrefer) { Settings.ReadSettings(); } else { Settings.WriteSettings(); } }
void StartApplication(Settings settings) { Settings = settings; Settings.ReadSettings(); Settings.WriteSettings(); _logonScreen = new LogonScreen(BaseActivity, Settings, LoadApplication); _progressScreen = new ProgressScreen(BaseActivity, Settings); AppContext = new AndroidApplicationContext(BaseActivity, Settings, LoadComplete); AppContext.LoadingProgress += _progressScreen.Progress; AppContext.ReturnToStartMenu += OpenStartScreen; ExceptionHandler = new ExceptionHandler(Settings, BaseActivity, AppContext); HandleLastError(); }
void StartApplication(Settings settings) { Settings = settings; Settings.ReadSettings(); Settings.WriteSettings(); _logonScreen = new LogonScreen(_baseActivity, Settings, LoadApplication); _progressScreen = new ProgressScreen(_baseActivity, Settings); AppContext = new ApplicationContext(_baseActivity, Settings, LoadComplete); AppContext.LoadingProgress += _progressScreen.Progress; AppContext.ReturnToStartMenu += OpenStartScreen; ExceptionHandler = new ExceptionHandler(Settings, _baseActivity, AppContext); HandleLastError(Prepare); }