public static void SaveSettings(Context context) { ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(context); ISharedPreferencesEditor editor = prefs.Edit(); var se = new SecureEncryptor(context); string enc_username = se.Encrypt(Username); string enc_password = se.Encrypt(Password); editor.PutString(CRED_USERNAME, enc_username); editor.PutString(CRED_PASSWORD, enc_password); editor.PutString(PREF_SP_BEARER, BearerToken); editor.PutString(PREF_SP_OAUTHT, OAuthToken); editor.PutInt(PREF_SYNCINTERVAL, (int)SyncInterval); editor.PutInt(PREF_SYNCNOTIFY, (int)NotificationType); editor.PutString(PREF_LASTREFRESH, EncodeDateToString(LastTableRefresh)); editor.PutInt(PREF_BOTTOMNAV_ID, BottomNavigationSelectedId); editor.Apply(); }
//################################################################################### public static void LoadSettings(Context context) { ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(context); cc = context; //Anmeldung string get_username = prefs.GetString(CRED_USERNAME, string.Empty); string get_password = prefs.GetString(CRED_PASSWORD, string.Empty); var se = new SecureEncryptor(context); Username = se.Decrypt(get_username); Password = "******"; //Password = se.Decrypt(get_password); BearerToken = "jahsvbfdjahvsbkcjbas"; //BearerToken = prefs.GetString(PREF_SP_BEARER, string.Empty); //OAuthToken = prefs.GetString(PREF_SP_OAUTHT, string.Empty); OAuthToken = "jhbjcn skjcbkauhvslbajkbsljfchabskjdfhbal"; //Listen _tableFeed = new Dictionary <string, FeedEntry>(); _tableShifts = new Dictionary <string, ShiftsEntry>(); LastTableRefresh = DecodeStringToDate(prefs.GetString(PREF_LASTREFRESH, string.Empty), DateTime.MinValue); //Sync-Einstellungen SyncInterval = (SyncIntervalSetting)prefs.GetInt(PREF_SYNCINTERVAL, (int)SyncIntervalSetting.ONE_A_DAY); //Benachrichtigung-Einstellungen NotificationType = (Notification.NotifySettings.NotifySettingsType)prefs.GetInt(PREF_SYNCNOTIFY, (int)Notification.NotifySettings.NotifySettingsType.FEED_AND_SHIFTS); //MainActivity BottomNavigationSelectedId = prefs.GetInt(PREF_BOTTOMNAV_ID, Resource.Id.menu_feed); }