protected override Java.Lang.Object DoInBackground(params Java.Lang.Object[] @params) { List <Models.Synchronization> list = LDbConnection.GetSynchronization(); for (int i = 0; i < list.Count; i++) { if (list.ElementAt(i).Expo_Id != -1 && list.ElementAt(i).User_Id != -1) { DbConnection.FetchUserJoinExpoAsync(LDbConnection.GetUser(), LDbConnection.GetUserExpo(list.ElementAt(i).Expo_Id)); } else if (list.ElementAt(i).Expo_Id != -1 && list.ElementAt(i).Company_Id != -1) { //DbConnection.FetchCompanyJoinExpoAsync(LDbConnection.GetCompany(), LDbConnection.GetUserExpo(list.ElementAt(i).Expo_Id)); } else if (list.ElementAt(i).History_Id != -1) { DbConnection.FetchUserHistoryAsync(LDbConnection.GetHistoryUser(list.ElementAt(i).History_Id)); } else if (list.ElementAt(i).User_Id != -1) { //DbConnection.FetchUserSync(LDbConnection.GetUser()); } else if (list.ElementAt(i).Company_Id != -1) { // DbConnection.FetchCompanySync(LDbConnection.GetCompany()); } } return("Zsycnchronizowano"); }
private async Task parseandsetAsync() { expos = LDbConnection.GetUserExpo(); MyExpoListViewAdapter adapter = new MyExpoListViewAdapter(expos, this); list.SetAdapter(adapter); }
public void HomeNavigationView_NavigationItemSelected(object sender, Android.Support.Design.Widget.NavigationView.NavigationItemSelectedEventArgs e) { var menuItem = e.MenuItem; menuItem.SetChecked(!menuItem.IsChecked); Android.Content.Intent intent; switch (menuItem.ItemId) { case Resource.Id.nav_my_expos: intent = new Android.Content.Intent(this, typeof(MyExposActivity)); StartActivity(intent); break; case Resource.Id.nav_help: intent = new Android.Content.Intent(this, typeof(VideoActivity)); StartActivity(intent); break; case Resource.Id.nav_expos: intent = new Android.Content.Intent(this, typeof(ExposActivity)); StartActivity(intent); break; case Resource.Id.nav_prof: intent = new Android.Content.Intent(this, typeof(MyProfileActivity)); StartActivity(intent); break; case Resource.Id.nav_history: intent = new Android.Content.Intent(this, typeof(HistoryActivity)); StartActivity(intent); break; case Resource.Id.nav_logout: using (var conn = new SQLite.SQLiteConnection(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal).ToString(), "database.sqlite"))) { conn.DeleteAll <Login>(); if (conn.ExecuteScalar <int>("SELECT count(*) FROM sqlite_master WHERE type = 'table' AND name = 'User'") != 0) { if (LDbConnection.GetCompany() != null) { Company c = conn.Table <Company>().First(); conn.DropTable <Company>(); conn.DropTable <Login>(); conn.DropTable <Expo>(); conn.DropTable <HistoryU>(); File.Delete(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + c.Photo1)); File.Delete(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + c.Photo2)); File.Delete(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + c.Photo3)); File.Delete(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + c.Photo4)); File.Delete(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + c.Photo5)); File.Delete(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + c.StandPhoto)); File.Delete(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + c.CompanyLogo)); } if (LDbConnection.GetUser() != null) { User u = conn.Table <User>().First(); conn.DropTable <User>(); conn.DropTable <Login>(); conn.DropTable <Expo>(); conn.DropTable <HistoryU>(); File.Delete(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + u.Photo)); } if (LDbConnection.GetUserExpo() != null) { conn.DropTable <Expo>(); } if (LDbConnection.GetHistoryUser() != null) { if (LDbConnection.GetHistoryUser().Count != 0) { conn.DropTable <HistoryU>(); } } } conn.Commit(); conn.Close(); } intent = new Android.Content.Intent(this, typeof(MainActivity)); StartActivity(intent); Finish(); break; } }