static async System.Threading.Tasks.Task Secondary() { Console.WriteLine("Secondary"); DeepSeaWorldSQLiteConnectioniOS deepSeaWorld = new DeepSeaWorldSQLiteConnectioniOS(); MySqlDBCon mySql = new MySqlDBCon(); DataTb data = new DataTb(); data = await mySql.MySQLConnection(); // connection and data catch from mySQL db on server deepSeaWorld.TableAsync(); // table async - creation of local db tables await deepSeaWorld.InsertUpdateTables(data); // insert data to local db }
protected override async void OnCreate(Bundle savedInstanceState) { try { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); timer.Start(); timer.Interval = 2000; timer.Elapsed += Timer_Elapsed; PermissionCheck(); // storage permission ZXing.Net.Mobile.Forms.Android.Platform.Init(); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); app = new App(); //get and set screen width and height of device var width = Resources.DisplayMetrics.WidthPixels; var height = Resources.DisplayMetrics.HeightPixels; var density = Resources.DisplayMetrics.Density; App.ScreenWidth = (width - 0.5f) / density; App.ScreenHeight = (height - 0.5f) / density; LoadApplication(app); if (ActivityCompat.CheckSelfPermission(this, Manifest.Permission.Camera) == (int)Permission.Granted) { Toast.MakeText(this, "camera permission granted", ToastLength.Long).Show(); } else { RequestCameraPermission(); } // SQLite connection, table creation, update, insert and get class DeepSeaWorldSQLiteConnectionAndroid deepSeaWorld = new DeepSeaWorldSQLiteConnectionAndroid(); MySqlDBCon mySql = new MySqlDBCon(); DataTb data = new DataTb(); data = await mySql.MySQLConnection(); // connection and data catch from mySQL db on server deepSeaWorld.TableAsync(); // table async - creation of local db tables await deepSeaWorld.InsertUpdateTables(data); // insert data to local db } catch (Exception ex) { throw ex; } }