public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case Resource.Id.LogOut: Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this); alert.SetTitle("Log Out"); alert.SetMessage("Do you want Log Out?"); alert.SetNeutralButton("Yes", delegate { ISharedPreferences preferences = Application.Context.GetSharedPreferences("RememberMe", FileCreationMode.Private); ISharedPreferencesEditor editor = preferences.Edit(); editor.Clear(); editor.Apply(); Intent intent = new Intent(this, typeof(MainActivity)); this.StartActivity(intent); this.Finish(); alert.Dispose(); }); alert.SetNegativeButton("No", delegate { alert.Dispose(); }); alert.Show(); return(true); default: return(base.OnOptionsItemSelected(item)); } }
private void DeleteAccount_Click(object sender, EventArgs e) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle("Czy na pewno chcesz usunąć konto?"); alert.SetPositiveButton("TAK", async(senderAlert, args) => { scrollView.PageScroll(FocusSearchDirection.Down); progressBar.Visibility = ViewStates.Visible; if (await APIHelper.DeleteUser(GlobalMemory._user)) { if (GlobalHelper.isSavedUser()) { ISharedPreferences pref = Application.Context.GetSharedPreferences("savedUser", FileCreationMode.Private); ISharedPreferencesEditor edit = pref.Edit(); edit.Clear(); edit.Apply(); } StartActivity(typeof(LoginActivity)); GlobalMemory._user = null; this.Finish(); } else { Toast.MakeText(this, "Coś poszło nie tak", ToastLength.Long).Show(); } progressBar.Visibility = ViewStates.Invisible; }); alert.SetNegativeButton("NIE", (senderAlert, args) => { Toast.MakeText(this, "Dobry wybór", ToastLength.Long).Show(); }); RunOnUiThread(() => { alert.Show(); }); }
public static void ClearUserPreferences() { ISharedPreferencesEditor Editor = GetUserInfoEditor(); Editor.Clear(); Editor.Apply(); }
private void ShowLogoutDialog() { builder = new Android.App.AlertDialog.Builder(mainActivity); alertDialog = builder.Create(); alertDialog.SetMessage("Do you want to log out?"); alertDialog.SetButton("Yes", (s1, e1) => { var auth = sessionManager.GetFirebaseAuth(); editor = preferences.Edit(); LoginManager.Instance.LogOut(); auth.SignOut(); editor.Clear(); editor.Commit(); var intent = new Intent(Application.Context, typeof(OnboardingActivity)); intent.SetFlags(ActivityFlags.ClearTask | ActivityFlags.ClearTop | ActivityFlags.NewTask); StartActivity(intent); mainActivity.Finish(); }); alertDialog.SetButton2("No", (s2, e2) => { alertDialog.Dismiss(); }); alertDialog.Show(); }
}//end of LoadList //this method updates the stored key/value pairs we holding in shared preferences public void UpdatedStoredData() { //remove the current items in shared preferences ISharedPreferencesEditor editor = prefs.Edit(); editor.Clear(); editor.Commit(); //add all of the items in the list to the shared preferences //so if the app is closed we can re-open the list editor = prefs.Edit(); //key that keeps track of how many items we have stored in SP editor.PutInt("itemCount", Items.Count); int counter = 0; //loop through each item in the list and add it to the shared preferences //list to be written foreach (string item in Items) { editor.PutString(counter.ToString(), item); counter++; } //write to SP editor.Apply(); }
private void SaveButton_Click(object sender, EventArgs e) { client = GlobalMemory.m_client; if (client.Password == GlobalHelper.getMD5(actualPass.Text.Trim()) && newPass1.Text.Trim() == newPass2.Text.Trim()) { client.Password = GlobalHelper.getMD5(newPass1.Text.Trim()); if (MySQLHelper.UpdateDataBase(client, connection)) { setAlert("Nowe has³o ustawiono pomyœlnie"); // czyszczenie zapisanego konta ISharedPreferences pref = Application.Context.GetSharedPreferences("UserInfo", FileCreationMode.Private); ISharedPreferencesEditor edit = pref.Edit(); edit.Clear(); edit.Apply(); this.Finish(); } else { setAlert("Brak po³¹czenia internetowego"); } } else { actualPass.Text = ""; newPass1.Text = ""; newPass2.Text = ""; actualPass.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder)); newPass1.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder)); newPass2.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.editTextBorder)); setAlert("Poda³eœ z³e haslo lub podane nowe has³a nie s¹ identyczne"); } }
public void OnMapReady(MapboxMap mapbox) { this.mapbox = mapbox; mapbox.SetStyle("mapbox://styles/luisortizs/ckdeotksa59vs1imw35jiqemz"); ISharedPreferences preff = PreferenceManager.GetDefaultSharedPreferences(this); var latitud = preff.GetString("LATITUD", ""); var lognitud = preff.GetString("LONGITUD", ""); Console.WriteLine(latitud, lognitud); double ltd = double.Parse(latitud); double lng = double.Parse(lognitud); var position = new CameraPosition.Builder() .Target(new LatLng(ltd, lng)) .Zoom(13) .Build(); mapbox.AnimateCamera(CameraUpdateFactory.NewCameraPosition(position)); ISharedPreferencesEditor edita = preff.Edit(); edita.Clear(); edita.Apply(); }
public override bool OnOptionsItemSelected(IMenuItem item) { if (item != null) { switch (item.ItemId) { case Resource.Id.settingsButton: count++; if (count == 5) { edtr.Clear(); edtr.Commit(); StartActivity(typeof(InitialSettings)); this.Finish(); } else { Toast.MakeText(this, "You are " + (5 - count) + " more taps from clearing your initial settings", ToastLength.Short).Show(); } break; } } return(base.OnOptionsItemSelected(item)); }
private async void MainToolbar_MenuItemClick(object sender, SupportToolBar.MenuItemClickEventArgs e) { switch (e.Item.ItemId) { case Resource.Id.menu_logout: ProgressDialog dialog = ProgressDialog.Show(this, "", "Logging out..."); await MeritMoneyBrain.LogOut(); ProfileDatabase pdb = new ProfileDatabase(); pdb.DeleteDatabase(); UsersDatabase udb = new UsersDatabase(); udb.DeleteDatabase(); ISharedPreferences info = Application.Context.GetSharedPreferences(Application.Context.GetString(Resource.String.ApplicationInfo), FileCreationMode.Private); ISharedPreferencesEditor editor = info.Edit(); editor.Clear(); editor.Apply(); dialog.Dismiss(); Intent LogInIntent = new Intent(this, typeof(LogInActivity)); this.StartActivityForResult(LogInIntent, LOG_IN_REQUEST); break; } }
private void Btn_okSelRates_Click(object sender, EventArgs e) { var intentMainActivity = new Intent(this, typeof(MainActivity)); var listOfPairs = new List <ListForSharedPref>(); ListForSharedPref o; for (var i = 0; i < selectedCurrencies_Names.Count; i++) { o = new ListForSharedPref() { Name = selectedCurrencies_Names[i], Value = selectedCurrencies_Values[i] }; listOfPairs.Add(o); } string json = JsonConvert.SerializeObject(listOfPairs); string jsonElements = JsonConvert.SerializeObject(elements); ISharedPreferences pref = Application.Context.GetSharedPreferences("ListPref", FileCreationMode.Private); ISharedPreferencesEditor edit = pref.Edit(); edit.Clear(); var _date = date.ToString(); edit.PutString("dateOfUpdate", _date); edit.PutString("elementsList", jsonElements); edit.PutString("list", json); //przekazuje zaserializowany obiekt zeby elementy 2 list nie byly segregowane niezaleznie od siebie edit.Apply(); this.StartActivity(intentMainActivity); }
private void DoClear() { ISharedPreferencesEditor editor = _preferences.Edit(); editor.Clear(); editor.Commit(); }
public static bool check_saved_account(out string login, out string password, MySqlConnection connection) { ISharedPreferences pref = Application.Context.GetSharedPreferences("UserInfo", FileCreationMode.Private); string userName = pref.GetString("UserName", ""); string pass = pref.GetString("Password", ""); if (userName.Trim() == String.Empty || pass.Trim() == String.Empty) { login = null; password = null; return(false); } else { Helper.Client client; bool result = Helper.MySQLHelper.check_if_account_is_correct(userName, pass, connection, out client); if (result) { GlobalMemory.m_client = client; login = userName; password = pass; return(true); } else { ISharedPreferencesEditor edit = pref.Edit(); edit.Clear(); edit.Apply(); login = null; password = null; return(false); } } }
//** public void clearUserData() { ISharedPreferencesEditor spEditor = userLocalDatabase.Edit(); spEditor.Clear(); spEditor.Commit(); }
/* * public override bool OnPrepareOptionsMenu(IMenu menu) * { * MenuInflater.Inflate(Resource.Menu.actionbar_main, menu); * * return base.OnPrepareOptionsMenu(menu); * }*/ public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case Resource.Id.menu: Toast.MakeText(this, "About Us", ToastLength.Long).Show(); //do something return(true); case Resource.Id.new_game: Toast.MakeText(this, "Contact Us", ToastLength.Long).Show(); //do something return(true); case Resource.Id.help: Toast.MakeText(this, "Help item", ToastLength.Long).Show(); ISharedPreferences prefs = Application.Context.GetSharedPreferences("UserInfo", FileCreationMode.Private); ISharedPreferencesEditor editor = prefs.Edit(); editor.Clear(); editor.Apply(); StartActivity(typeof(MainActivity)); return(true); } return(base.OnOptionsItemSelected(item)); }
private void GetPreferences() { EditText txtPurchasePrice = FindViewById <EditText>(Resource.Id.txtPurchasePrice); EditText txtDownPayment = FindViewById <EditText>(Resource.Id.txtDownPayment); EditText txtInterestRate = FindViewById <EditText>(Resource.Id.txtInterestRate); //to do only on startup PreferenceManager.GetDefaultSharedPreferences(Application.Context).Dispose(); ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(Application.Context); ISharedPreferencesEditor editor = prefs.Edit(); editor.Clear(); editor.Apply(); //************************************************************************************ double purchasePrice = prefs.GetFloat("purchase_price_key", 0); double deposit = prefs.GetFloat("down_payment_key", 0); double interestRate = prefs.GetFloat("interest_rate_key", 0); if (purchasePrice != 0) { txtPurchasePrice.Text = Convert.ToString(purchasePrice); } txtDownPayment.Text = Convert.ToString(deposit); txtInterestRate.Text = Convert.ToString(interestRate); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.SplashScreen); ActionBar.Hide(); pref = PreferenceManager.GetDefaultSharedPreferences(this); editor = pref.Edit(); editor.Clear(); editor.Apply(); string folder = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "Zen"); Directory.CreateDirectory(folder); string databaseFileName = Path.Combine(folder, "Zen.db"); SQLite3.Config(SQLite3.ConfigOption.Serialized); //database.Reset(); if db structure changes database.createDatabase(); client.DownloadDataCompleted += client_DownloadDataCompleted; client.DownloadDataAsync(uri); client.Dispose(); }
protected override void OnCreate(Bundle savedInstanceState) { // ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true; base.OnCreate(savedInstanceState); try { Xamarin.Essentials.Platform.Init(this, savedInstanceState); Forms.Init(this, savedInstanceState); FormsMaps.Init(this, savedInstanceState); Forms.SetTitleBarVisibility(this, AndroidTitleBarVisibility.Never); App ap = new MEI.App(); LoadApplication(ap); //this.ActionBar.Hide(); CachedImageRenderer.Init(enableFastRenderer: true); RoundedBoxViewRenderer.Init(); RequestPermissions(permisons, 0); App.ScreenWidth = (int)Resources.DisplayMetrics.WidthPixels; App.ScreenHeight = (int)Resources.DisplayMetrics.HeightPixels; App.CopyToClipBoard = CopyText; App.createContact = CreateContact; App.localPushNotification = LocalNotification; App.SaveUser = SaveUserID; App.GetUserEvent = SetGetUser; App.AppVersion = ApplicationContext.PackageManager.GetPackageInfo(ApplicationContext.PackageName, 0).VersionName; App.cropImage = CropImage; App.ResetUser = ResetUserID; App.closeApp = CloseApp; App.SetDomainData = SetDomainData; App.SetNotificaiton = SetNotification; App.resetRoundView = ResetRoundView; App.SetNotificationSounds = SetNotificationSound; App.SetUserData = SetUserData; App.PushNotification = AndroidPushNotification; App.AddEventReminder = SetCurrentEventReminder; ISharedPreferences pref = GetSharedPreferences("MEI_UserPreferences", FileCreationMode.Private); bool hasDirectory = pref.Contains("DomainDirectory"); if (!hasDirectory) { ISharedPreferencesEditor editor = pref.Edit(); editor.Clear(); editor.Apply(); editor.PutBoolean("DomainDirectory", App.NotificationSounds); editor.Apply(); } GetDomainData(); GetNotification(); GetUserData(); GetNotificationSound(); //FirebasePushNotificationManager.ProcessIntent(this, Intent); ap.StartApp(); } catch (Exception e) { Console.WriteLine(e.ToString()); Log.Debug("Creation Error", "Error in creating Application.."); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Main); Button button1 = FindViewById <Button>(Resource.Id.button1); button1.Click += delegate { Intent intent = new Intent(this, typeof(Notes)); this.StartActivity(intent); }; Button button2 = FindViewById <Button>(Resource.Id.button2); button2.Click += delegate { ISharedPreferences prefs = GetSharedPreferences(NOTES_PREFERENCES, FileCreationMode.Private); ISharedPreferencesEditor editor = prefs.Edit(); editor.PutInt("NotePosition", -1); editor.Apply(); Intent intent = new Intent(this, typeof(NoteEditor)); this.StartActivity(intent); }; Button button3 = FindViewById <Button>(Resource.Id.button3); button3.Click += delegate { ISharedPreferences prefs = GetSharedPreferences(NOTES_PREFERENCES, FileCreationMode.Private); ISharedPreferencesEditor editor = prefs.Edit(); editor.Clear(); editor.Apply(); }; }
private void BackToMainMenu() { string menu_kbn = prefs.GetString("menu_kbn", ""); string driver_nm = prefs.GetString("driver_nm", ""); string souko_cd = prefs.GetString("souko_cd", ""); string souko_nm = prefs.GetString("souko_nm", ""); string driver_cd = prefs.GetString("driver_cd", ""); string kitaku_cd = prefs.GetString("kitaku_cd", ""); string def_tokuisaki_cd = prefs.GetString("def_tokuisaki_cd", ""); string tsuhshin_kbn = prefs.GetString("tsuhshin_kbn", ""); string souko_kbn = prefs.GetString("souko_kbn", ""); editor.Clear(); editor.Commit(); editor.PutString("menu_kbn", menu_kbn); editor.PutString("driver_nm", driver_nm); editor.PutString("souko_cd", souko_cd); editor.PutString("souko_nm", souko_nm); editor.PutString("driver_cd", driver_cd); editor.PutString("kitaku_cd", kitaku_cd); editor.PutString("def_tokuisaki_cd", def_tokuisaki_cd); editor.PutString("tsuhshin_kbn", tsuhshin_kbn); editor.PutString("souko_kbn", souko_kbn); editor.Apply(); FragmentManager.PopBackStack(FragmentManager.GetBackStackEntryAt(0).Id, 0); }
/// <summary> /// Process the result. Starts the next activity or shows an error dialog. /// </summary> private void ProcessResult(int result) { switch (result) { case CredentialsProvider.NoError: if (_saveLoginCheckBox.Checked) { _prefsEditor.PutBoolean("saveLogin", true); _prefsEditor.PutString("username", _username); _prefsEditor.PutString("password", _password); _prefsEditor.Apply(); } else { _prefsEditor.Clear(); _prefsEditor.Apply(); } StartActivity(new Intent(ApplicationContext, typeof(ChooseTeamActivity))); Finish(); break; case CredentialsProvider.NoCredentials: { var dialog = new ErrorDialog(this, Resource.String.dlg_no_credentials_title, Resource.String.dlg_no_credentials); dialog.Display(); break; } case CredentialsProvider.NoUsername: { var dialog = new ErrorDialog(this, Resource.String.dlg_no_username_title, Resource.String.dlg_no_username); dialog.Display(); break; } case CredentialsProvider.NoPassword: { var dialog = new ErrorDialog(this, Resource.String.dlg_no_password_title, Resource.String.dlg_no_password); dialog.Display(); break; } case CredentialsProvider.WrongCredentials: { var dialog = new ErrorDialog(this, Resource.String.dlg_bad_credentials_title, Resource.String.dlg_bad_credentials); dialog.Display(); break; } case CredentialsProvider.DatabaseConnectionError: { var dialog = new ErrorDialog(this, Resource.String.dlg_database_error_title, Resource.String.dlg_database_error); dialog.Display(); break; } } }
public void CleanSharedPreferences() { ISharedPreferences pref = Application.Context.GetSharedPreferences("UserInfo", FileCreationMode.Private); ISharedPreferencesEditor edit = pref.Edit(); edit.Clear(); edit.Apply(); }
public void PositionClear() { flag = false; positionBrojInput.Text = ""; positionBrojOznakaInput.Text = ""; positionInput.Text = ""; localAnketaEdit.Clear().Commit(); }
private void clearFile() { ISharedPreferencesEditor edit = Planner.editTasks(); edit.Clear(); edit.Commit(); updateTaskList(); }
public void ClearSP() { //setup the shared preferences file where event items will be stored ISharedPreferencesEditor editor = prefs.Edit(); editor.Clear(); editor.Commit(); }
public void ClearSaves() { AndroidSharedPreferences = PreferenceManager.GetDefaultSharedPreferences(Application.Context); ISharedPreferencesEditor sharedPreferencesEditor = AndroidSharedPreferences.Edit(); sharedPreferencesEditor.Clear(); sharedPreferencesEditor.Apply(); }
public void logoutSession() { editor.Clear(); editor.Commit(); cleardatetime(); Intent logout = new Intent(context, typeof(MainActivity)); // Closing all the Activities logout.AddFlags(ActivityFlags.ClearTop); // Add new Flag to start new Activity logout.SetFlags(ActivityFlags.NewTask); context.StartActivity(logout); }
public override void CleanUp() { // Manually clear out any saved preferences ISharedPreferencesEditor spe = sp.Edit(); spe.Clear(); spe.Commit(); }
public override void RemoveAll() { ISharedPreferencesEditor prefs = mPrefs.Edit(); prefs.Clear(); // Commit the changes prefs.Commit(); }
/// <summary> /// Deletes local database. /// </summary> public void Delete() { ISharedPreferencesEditor editor = _preferences.Edit(); editor.Clear(); editor.Commit(); Dispose(); }
private void clearPreferences(object sender, Android.Support.V7.Preferences.Preference.PreferenceClickEventArgs e) { var prefs = PreferenceManager.SharedPreferences; ISharedPreferencesEditor editor = prefs.Edit(); editor.Clear(); editor.Apply(); Acr.UserDialogs.UserDialogs.Instance.ShowSuccess("Preferences cleared!"); }