本文整理汇总了C#中ISharedPreferences类的典型用法代码示例。如果您正苦于以下问题:C# ISharedPreferences类的具体用法?C# ISharedPreferences怎么用?C# ISharedPreferences使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ISharedPreferences类属于命名空间,在下文中一共展示了ISharedPreferences类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: OnSharedPreferenceChanged
public void OnSharedPreferenceChanged (ISharedPreferences sharedPreferences, string key) {
Preference pref = FindPreference (key);
if (pref == prefHoursNotifications) {
prefHoursNotifications.Summary = string.Format (Resources.GetString (Resource.String.settings_interval_description), Resources.GetStringArray(Resource.Array.hours).GetValue(int.Parse(prefs.GetString ("prefHoursNotifications", "4"))-1));
}
}
开发者ID:javiersantos,项目名称:WhatsAppBetaUpdater.Xamarin,代码行数:7,代码来源:SettingsActivity.cs
示例2: SaveCookie
public static void SaveCookie(ISharedPreferences sharedPreferences, string cookieKey, Cookie cookie)
{
var editor = sharedPreferences.Edit();
var cookieValueItems = new List<string>();
var itemFormat = "{0}:{1}";
cookieValueItems.Clear();
cookieValueItems.Add(string.Format(itemFormat, "Domain", cookie.Domain));
cookieValueItems.Add(string.Format(itemFormat, "Name", cookie.Name));
cookieValueItems.Add(string.Format(itemFormat, "Value", cookie.Value));
cookieValueItems.Add(string.Format(itemFormat, "Expires", cookie.Expires.ToString()));
cookieValueItems.Add(string.Format(itemFormat, "Comment", cookie.Comment));
cookieValueItems.Add(string.Format(itemFormat, "CommentUri", cookie.CommentUri != null ? cookie.CommentUri.AbsoluteUri : null));
cookieValueItems.Add(string.Format(itemFormat, "Discard", cookie.Discard));
cookieValueItems.Add(string.Format(itemFormat, "HttpOnly", cookie.HttpOnly));
cookieValueItems.Add(string.Format(itemFormat, "Path", cookie.Path));
cookieValueItems.Add(string.Format(itemFormat, "Port", cookie.Port));
cookieValueItems.Add(string.Format(itemFormat, "Secure", cookie.Secure));
cookieValueItems.Add(string.Format(itemFormat, "Version", cookie.Version));
editor.PutString(cookieKey, string.Join("|", cookieValueItems.ToArray()));
editor.Commit();
var logger = DependencyResolver.Resolve<ILoggerFactory>().Create(typeof(CookieManager));
logger.InfoFormat("Saved Cookie. Domain:{0}, Name:{1}, Value:{2}, Expires:{3}", cookie.Domain, cookie.Name, cookie.Value, cookie.Expires);
}
开发者ID:codesharp,项目名称:cooper,代码行数:27,代码来源:CookieManager.cs
示例3: OnSharedPreferenceChanged
public void OnSharedPreferenceChanged (ISharedPreferences sharedPreferences, string key)
{
Console.WriteLine ("Preference Changed: " + key);
switch (key) {
case "prefshowxamarin":
settings.ShowXamarinLogo = sharedPreferences.GetBoolean (key, true);
break;
case "pref24hourclock":
settings.Use24Clock = sharedPreferences.GetBoolean (key, false);
break;
case "prefshowdayofweek":
settings.ShowDayOfWeek = sharedPreferences.GetBoolean (key, true);
break;
case "prefshowdate":
settings.ShowDate = sharedPreferences.GetBoolean (key, true);
break;
}
settings.Save ();
Console.WriteLine ("Settings> " + settings);
var evt = OnSettingsChanged;
if (evt != null)
evt (settings);
}
开发者ID:Redth,项目名称:Xamarin.Wear.WatchFace,代码行数:26,代码来源:SettingsFragment.cs
示例4: Settings
public Settings(ISharedPreferences preferences, string systemLanguage, InfobaseManager.Infobase infobase)
{
_preferences = preferences;
Language = systemLanguage;
_name = infobase.Name;
BaseUrl = infobase.BaseUrl;
ApplicationString = infobase.ApplicationString;
FtpPort = infobase.FtpPort;
string lastUrl = _preferences.GetString("url", string.Empty);
if (BaseUrl == lastUrl)
{
UserName = _preferences.GetString("user", infobase.UserName);
Password = _preferences.GetString("password", infobase.Password);
}
else
{
UserName = infobase.UserName;
Password = infobase.Password;
}
ClearCacheOnStart = infobase.IsActive && _preferences.GetBoolean("clearCache", ForceClearCache);
infobase.IsActive = true;
infobase.IsAutorun = true;
WriteSettings();
}
开发者ID:Fedorm,项目名称:core-master,代码行数:31,代码来源:Settings.cs
示例5: OnSharedPreferenceChanged
public void OnSharedPreferenceChanged(ISharedPreferences sharedPreferences, string key)
{
if (key != "clearCache" && key != "anonymousAccess")
{
string value = sharedPreferences.GetString(key, string.Empty);
FillSummary(key, value);
if ((key == "user" || key == "password" || key == "url") && !sharedPreferences.GetBoolean("clearCache", true))
{
ISharedPreferencesEditor editor = sharedPreferences.Edit();
editor.PutBoolean("clearCache", true);
editor.Commit();
MakeToast(D.NEED_TO_REBOOT_FULL);
}
if (key == "application")
MakeToast(D.NEED_TO_REBOOT);
}
else
{
MakeToast(D.NEED_TO_REBOOT_FULL);
}
BitBrowserApp.Current.SyncSettings();
}
开发者ID:Fedorm,项目名称:core-master,代码行数:27,代码来源:PreferencesScreen.cs
示例6: OtherSettings
internal OtherSettings(ISharedPreferences sharedPrefs)
{
ConnectTimeout = int.Parse(sharedPrefs.GetString("pref_timeout_connect", "10000"));
ConnectCheckInterval = int.Parse(sharedPrefs.GetString("pref_interval_check_connect", "200"));
ToastLevel = (ToastLevel)int.Parse(sharedPrefs.GetString("pref_toasts_level", "2"));
IgnoreSslCertErrors = sharedPrefs.GetBoolean("pref_ignore_ssl_errors", true);
StartUrl = sharedPrefs.GetString("pref_start_url", null);
}
开发者ID:t-denis,项目名称:CiscoWLC.WebAuth.Client,代码行数:8,代码来源:OtherSettings.cs
示例7: MyDrawerToggle
public MyDrawerToggle(AppCompatActivity host, DrawerLayout drawerLayout, int openedResource, int closedResource,ISharedPreferences pref)
: base(host, drawerLayout, openedResource, closedResource)
{
_mHostActivity = host;
_mOpenedResource = openedResource;
_mClosedResource = closedResource;
_pref = pref;
}
开发者ID:takigava,项目名称:pikabu,代码行数:8,代码来源:MyDrawerToggle.cs
示例8: GetPref
public static ISharedPreferences GetPref(Context context)
{
if (pref == null)
{
pref = PreferenceManager.GetDefaultSharedPreferences(context);
}
return pref;
}
开发者ID:amay077,项目名称:DroidKaigi2016Xamarin,代码行数:8,代码来源:PrefUtil.cs
示例9: InfobasesScreen
public InfobasesScreen(BaseScreen activity, ISharedPreferences prefs, InfobaseSelected resultCallback)
: base(activity, null)
{
_prefs = prefs;
_resultCallback = resultCallback;
_manager = InfobaseManager.Current;
}
开发者ID:Fedorm,项目名称:core-master,代码行数:8,代码来源:Infobases.cs
示例10: GetPrefs
private ISharedPreferences GetPrefs()
{
if (prefs == null)
{
prefs = GetSharedPreferences("ACT_" + guide.Id, FileCreationMode.MultiProcess);
}
return prefs;
}
开发者ID:GSDan,项目名称:Speeching_Client,代码行数:9,代码来源:GuideActivity.cs
示例11: DisplayCurrentPreferenceValues
void DisplayCurrentPreferenceValues(ISharedPreferences sharedPreferences)
{
Preference pilotName = FindPreference("pref_pilotname");
string curPilotName = sharedPreferences.GetString("pref_pilotname", "");
if (curPilotName == "")
{
curPilotName = "Enter your pilot name";
}
pilotName.Summary = curPilotName;
}
开发者ID:sschocke,项目名称:JGCompanion,代码行数:10,代码来源:MyPreferencesFragment.cs
示例12: Create
public static AppPreferences Create(ISharedPreferences prefs)
{
return new AndroidAppPreferences(prefs)
{
FirtsTimeRunning = prefs.GetBoolean(AppPreferences.FirstTimeKey, true),
Ip = prefs.GetString(AppPreferences.IpKey, ""),
Port = prefs.GetInt(AppPreferences.PortKey, 0),
UseSounds = prefs.GetBoolean(AppPreferences.UseSoundsKey, true),
UseCache = prefs.GetBoolean(AppPreferences.UseCacheKey, true)
};
}
开发者ID:samiy-xx,项目名称:KeySndr.Clients,代码行数:11,代码来源:AndroidAppPreferences.cs
示例13: StorePreferences
public void StorePreferences(ISharedPreferences spr)
{
var prefsEditor = spr.Edit();
prefsEditor.PutInt("TableOf", TableOf);
prefsEditor.PutString("strRandomQuestions", RandomQuestions.ToString());
prefsEditor.PutInt("UpperLimit", UpperLimit);
prefsEditor.PutInt("CounterMin", CounterMin);
prefsEditor.PutInt("CounterMax", CounterMax);
prefsEditor.Commit();
}
开发者ID:Xtremrules,项目名称:dot42,代码行数:11,代码来源:Preferences.cs
示例14: OnSharedPreferenceChanged
public void OnSharedPreferenceChanged (ISharedPreferences sharedPreferences, string key)
{
switch (key) {
case Helpers.Settings.WeightKey:
this.SetWeight ();
break;
case Helpers.Settings.CadenceKey:
this.SetCadence ();
break;
}
}
开发者ID:magicdukeman,项目名称:Giannios_John_Portfolio,代码行数:11,代码来源:SettingsActivity.cs
示例15: OnSharedPreferenceChanged
public void OnSharedPreferenceChanged(ISharedPreferences sharedPreferences, string key)
{
Preference pref = FindPreference (key);
if (pref.GetType () == typeof(ListPreference)) {
var listPref = (ListPreference)pref;
pref.Summary = listPref.Entry;
} else {
pref.Summary = sharedPreferences.GetString (key,"");
}
var prefEditor = sharedPreferences.Edit ();
prefEditor.PutString (key,sharedPreferences.GetString (key,""));
prefEditor.Commit ();
}
开发者ID:Screech129,项目名称:MovieApp,代码行数:13,代码来源:SettingsFragment.cs
示例16: OnCreate
protected override void OnCreate (Bundle savedInstanceState)
{
base.OnCreate (savedInstanceState);
SetContentView(Resource.Layout.main_activity);
mAddGeofencesButton = FindViewById<Button>(Resource.Id.add_geofences_button);
mRemoveGeofencesButton = FindViewById<Button>(Resource.Id.remove_geofences_button);
mAddGeofencesButton.Click += AddGeofencesButtonHandler;
mRemoveGeofencesButton.Click += RemoveGeofencesButtonHandler;
mGeofenceList = new List<IGeofence>();
mGeofencePendingIntent = null;
mSharedPreferences = GetSharedPreferences(Constants.SHARED_PREFERENCES_NAME,
FileCreationMode.Private);
mGeofencesAdded = mSharedPreferences.GetBoolean(Constants.GEOFENCES_ADDED_KEY, false);
SetButtonsEnabledState();
PopulateGeofenceList();
BuildGoogleApiClient();
}
开发者ID:jingyul,项目名称:monodroid-samples,代码行数:25,代码来源:MainActivity.cs
示例17: OnCreate
public override void OnCreate ()
{
base.OnCreate ();
prefs = GetSharedPreferences (USER_PREFS, FileCreationMode.Private);
userName = prefs.GetString (KEY_USERNAME, null);
}
开发者ID:apcurium,项目名称:xamarin-bindings,代码行数:7,代码来源:BikestoreApplication.cs
示例18: OnCreate
public override void OnCreate()
{
base.OnCreate();
Instance = this;
// Load preferences
Preferences = GetSharedPreferences(SettingsFilename, FileCreationMode.Private);
// Default offline mode
D3Context.Instance.FetchMode = (Preferences.GetBoolean(SettingsOnlinemode, false) ? FetchMode.Online : FetchMode.OnlineIfMissing);
// Checks if some migration operations are needed
var upToDateVersion = Preferences.GetInt(UpToDateVersion, 1);
if (upToDateVersion < 20)
{
new MigrationTo20().DoMigration();
}
// Always start D3Api with cache available
var dataProvider = new CacheableDataProvider(new HttpRequestDataProvider())
{
FetchMode = D3Context.Instance.FetchMode
};
D3Api.DataProvider = dataProvider;
// Set english locale by default
D3Api.Locale = CultureInfo.CurrentCulture.TwoLetterISOLanguageName;
}
开发者ID:djtms,项目名称:D3-Android-by-ZTn,代码行数:28,代码来源:D3Calc.cs
示例19: OnCreate
protected override void OnCreate (Bundle savedInstanceState)
{
base.OnCreate (savedInstanceState);
SetContentView(Resource.Layout.Filter);
prefs = PreferenceManager.GetDefaultSharedPreferences(this);
RadioButton radio_gps = FindViewById<RadioButton>(Resource.Id.radioButton1);
RadioButton radio_fb = FindViewById<RadioButton>(Resource.Id.radioButton2);
prefs = PreferenceManager.GetDefaultSharedPreferences(this);
string localizationSetting = prefs.GetString("localization","");
if (localizationSetting == "facebook") {
radio_fb.Checked = true;
radio_gps.Checked = false;
}
else
{
radio_fb.Checked = false;
radio_gps.Checked = true;
}
radio_gps.Click += RadioButtonClick;
radio_fb.Click += RadioButtonClick;
Button backButton = FindViewById<Button>(Resource.Id.button1);
backButton.Click += (object sender, EventArgs e) => {
Intent intent = new Intent (this, typeof(MainActivity));
StartActivityForResult (intent, 0);
};
}
开发者ID:YourmumisEZ,项目名称:WTG,代码行数:27,代码来源:FilterActivity.cs
示例20: SharedPreferencesHelper
private SharedPreferencesHelper()
{
_favPrefs = Application.Context.GetSharedPreferences ("FavoriteVideos", FileCreationMode.Private);
_watchListPrefs = Application.Context.GetSharedPreferences ("WatchListVideos", FileCreationMode.Private);
_likedVidsPrefs = Application.Context.GetSharedPreferences ("LikedVideos", FileCreationMode.Private);
_dislikedVidsPrefs = Application.Context.GetSharedPreferences ("DislikedVideos", FileCreationMode.Private);
_watchedVidsPrefs = Application.Context.GetSharedPreferences ("WatchedVideos", FileCreationMode.Private);
}
开发者ID:yonifra,项目名称:Shortie,代码行数:8,代码来源:SharedPreferencesHelper.cs
注:本文中的ISharedPreferences类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论