public LoadingViewModel(Type mainpage, INavigation navigation) { _mainpage = mainpage; string dbSql = DependencyService.Get <ISQLite>().GetLocalFilePath("db.sqlite3"); _jsonService = new JsonService(); _versionService = new VersionService(dbSql); _getClientParamService = new GetClientParamService(dbSql); IsLoading = true; TextLoading = "Vérification du fichier de configuration..."; // Get config file var jsonObject = Utils.DeserializeFromJson <JsonModel>(_jsonService.GetJson()); //var jsonObject = Utils.DeserializeFromJson<JsonModel>("{\"Version\": \"1.0.0.0\",\"Companies\": [{\"CompanyName\": \"e-Kenz\",\"Url\": \"http://navapi.saas.e-kenz.com\", \"Domain\": \"SAAS\"},{\"CompanyName\": \"Company1\",\"Url\": \"URL1\", \"Domain\": \"Domain1\"},{\"CompanyName\": \"Company2\",\"Url\": \"URL2\", \"Domain\": \"Domain2\"}]}"); CreateTables(dbSql); PopulateDb(dbSql, jsonObject); //Task.Run(async () => await CreateTablesAsync(dbSql)); //Task.Run(async () => await PopulateDb(dbSql, jsonObject)); Device.StartTimer(TimeSpan.FromSeconds(2), () => { Device.BeginInvokeOnMainThread(async() => await SwitchPage()); return(false); }); }
public MainPageViewModel(Type signinpage, Type dashboardpage, INavigation navigation) { string dbSql = DependencyService.Get <ISQLite>().GetLocalFilePath("db.sqlite3"); _pageService = new PageService(); _signInPage = signinpage; _dashboardPage = dashboardpage; _navigation = navigation; //_userLoginService = new UserLoginService(); _readFileService = new ReadFileService(); _getClientParamService = new GetClientParamService(dbSql); //var stream = _readFileService.GetFileStream("Navision.ControleDocuments.Services.DB.db.sqlite3"); GetClientParamService t = new GetClientParamService(dbSql); var result = t.GetClient(); IsBusy = false; }