public void Save() { NSUserDefaults defaults = NSUserDefaults.StandardUserDefaults; defaults.SetBool(enabled.Active, EnabledKey); defaults.Synchronize(); }
public override void ViewWillDisappear(bool animated) { base.ViewWillDisappear(animated); btnReturn.TouchUpInside -= btnReturnTouchUpInside; btnMore.TouchUpInside -= btnMoreTouchUpInside; btnSearch.TouchUpInside -= btnSearchTouchUpInside; txtSearch.EditingChanged -= TxtSearchValueChangedHandler; btnVind.TouchUpInside -= btnVindTouchUpInside; _appController.UpdateCounter -= updateCounter; _appController.NavigationController.GotoTotemResultEvent -= gotoResultListHandler; var ser = JsonSerializer.SerializeToString(_appController.Eigenschappen); if (IsProfileNull) { userDefs.SetString(ser, "eigenschappen"); userDefs.Synchronize(); } else { _appController.AddOrUpdateEigenschappenSer(currProfiel.name, ser); } }
public static void setBatteryInterval(string batteryInterval) { NSUserDefaults prefs = NSUserDefaults.StandardUserDefaults; prefs.SetString(batteryInterval, "batteryInterval"); prefs.Synchronize(); }
public static void setIsUseKeyAction(bool isUseKeyAction) { NSUserDefaults prefs = NSUserDefaults.StandardUserDefaults; prefs.SetBool(isUseKeyAction, "isUseKeyAction"); prefs.Synchronize(); }
public override void DeleteData(string dataId) { NSUserDefaults prefs = NSUserDefaults.StandardUserDefaults; prefs.RemoveObject(new NSString(dataId)); prefs.Synchronize(); }
public static void setMaskType(int maskType) { NSUserDefaults prefs = NSUserDefaults.StandardUserDefaults; prefs.SetInt(maskType, "maskType"); prefs.Synchronize(); }
private void SavePublicationDownladProgress(int bytesDownloaded) { NSUserDefaults userDefault = NSUserDefaults.StandardUserDefaults; userDefault.SetInt(bytesDownloaded, BookTitle); userDefault.Synchronize(); }
static void ShowVoiceOverNotice() { var alert = new NSAlert(); alert.MessageText = GettextCatalog.GetString("Assistive Technology Detected"); alert.InformativeText = GettextCatalog.GetString("{0} has detected an assistive technology (such as VoiceOver) is running. Do you want to restart {0} and enable the accessibility features?", BrandingService.ApplicationName); alert.AddButton(GettextCatalog.GetString("Restart and enable")); alert.AddButton(GettextCatalog.GetString("No")); var result = alert.RunModal(); switch (result) { case 1000: NSUserDefaults defaults = NSUserDefaults.StandardUserDefaults; defaults.SetBool(true, EnabledKey); defaults.Synchronize(); IdeApp.Restart(); break; default: break; } }
public void SetToDefaults(string key, int value) { NSUserDefaults defaults = NSUserDefaults.StandardUserDefaults; defaults.SetInt(value, key); defaults.Synchronize(); }
partial void SearchProviderChanged(NSObject sender) { var userDefaults = new NSUserDefaults(); userDefaults.SetInt(CensusSearchProviderOutlet.SelectedIndex, "CensusProvider"); userDefaults.Synchronize(); }
protected override void doSave(string dataId, string dataValue) { NSUserDefaults prefs = NSUserDefaults.StandardUserDefaults; prefs.SetValueForKey(new NSString(dataValue), new NSString(dataId)); prefs.Synchronize(); }
public void RemoveAll() { NSUserDefaults defaults = NSUserDefaults.StandardUserDefaults; defaults.RemovePersistentDomain(NSBundle.MainBundle.BundleIdentifier); defaults.Synchronize(); }
public static void LockApplication() { NSUserDefaults settings = NSUserDefaults.StandardUserDefaults; settings.SetBool(true, "IsLocked"); settings.Synchronize(); }
private void SaveValueToStorage(string value, string key) { NSUserDefaults userDefaults = NSUserDefaults.StandardUserDefaults; userDefaults.SetString(value, key); userDefaults.Synchronize(); }
public override bool ShouldChangeCharacters(UITextField textField, NSRange range, string replacementString) { string str = outer.TextField.Text; str = str.Substring(0, (int)range.Location) + replacementString + str.Substring((int)range.Location + (int)range.Length); do { NSUserDefaults defaults = NSUserDefaults.StandardUserDefaults; nint tag = outer.Tag; if (tag == 104) { defaults.SetString(str, "DelayValue"); } else { break; } defaults.Synchronize(); } while(false); return(true); }
public void SetTimerUserDefaults() { NSUserDefaults defaults = NSUserDefaults.StandardUserDefaults; defaults.SetBool(Running, "running"); defaults.SetString(StartDate.Ticks.ToString(), "ticks"); defaults.Synchronize(); }
private bool DoRemove(string key) { if (IsRoaming) { _store.Remove(key); } else { _defaults.RemoveObject(key); if (_locality == ApplicationDataLocality.SharedLocal) { _defaults.Synchronize(); } } return(true); }
static Analytics() { #if __PC__ if (Settings.Default.GUID == "00000000-0000-0000-0000-000000000000") { Settings.Default.GUID = Guid.NewGuid().ToString(); Settings.Default.Save(); } GUID = Settings.Default.GUID; OperatingSystem os = Environment.OSVersion; trackerEnvironment = new SimpleTrackerEnvironment(os.Platform.ToString(), os.Version.ToString(), os.VersionString); analyticsSession = new AnalyticsSession(); tracker = new SimpleTracker("UA-125850339-2", analyticsSession, trackerEnvironment); AppVersion = MainForm.VERSION; OSVersion = SetWindowsVersion(os.Version.ToString()); bool windowsStoreApp = Application.ExecutablePath.Contains("WindowsApps"); bool debugging = Application.ExecutablePath.Contains("GitRepo"); DeploymentType = windowsStoreApp ? "Windows Store" : debugging ? "Development" : "Zip File"; string resolution = Screen.PrimaryScreen.Bounds.ToString(); #elif __MACOS__ var userDefaults = new NSUserDefaults(); GUID = userDefaults.StringForKey("AnalyticsKey"); if (string.IsNullOrEmpty(GUID)) { GUID = Guid.NewGuid().ToString(); userDefaults.SetString(GUID, "AnalyticsKey"); userDefaults.Synchronize(); } NSProcessInfo info = new NSProcessInfo(); OSVersion = $"MacOSX {info.OperatingSystemVersionString}"; trackerEnvironment = new SimpleTrackerEnvironment("Mac OSX", info.OperatingSystemVersion.ToString(), OSVersion); analyticsSession = new AnalyticsSession(); tracker = new SimpleTracker("UA-125850339-2", analyticsSession, trackerEnvironment); var app = (AppDelegate)NSApplication.SharedApplication.Delegate; AppVersion = FamilyTree.Instance.Version; DeploymentType = "Mac Website"; string resolution = NSScreen.MainScreen.Frame.ToString(); #elif __IOS__ var userDefaults = new NSUserDefaults(); GUID = userDefaults.StringForKey("AnalyticsKey"); if (string.IsNullOrEmpty(GUID)) { GUID = Guid.NewGuid().ToString(); userDefaults.SetString(GUID, "AnalyticsKey"); userDefaults.Synchronize(); } NSProcessInfo info = new NSProcessInfo(); OSVersion = $"MacOSX {info.OperatingSystemVersionString}"; trackerEnvironment = new SimpleTrackerEnvironment("Mac OSX", info.OperatingSystemVersion.ToString(), OSVersion); analyticsSession = new AnalyticsSession(); tracker = new SimpleTracker("UA-125850339-2", analyticsSession, trackerEnvironment); var app = (AppDelegate)UIApplication.SharedApplication.Delegate; AppVersion = FamilyTree.Instance.Version; DeploymentType = "Mac Website"; string resolution = UIScreen.MainScreen.Bounds.ToString(); #endif Resolution = resolution.Length > 11 ? resolution.Substring(9, resolution.Length - 10) : resolution; }
public void SetToDefaults(string key, string value) { if (!String.IsNullOrEmpty(value)) { NSUserDefaults defaults = NSUserDefaults.StandardUserDefaults; defaults.SetString(value, key); defaults.Synchronize(); } }
public override void ViewWillDisappear(bool animated) { base.ViewWillDisappear(animated); btnReturn.TouchUpInside -= btnReturnTouchUpInside; var ser = JsonSerializer.SerializeToString(tvSource.checkedStates); userDefs.SetString(ser, "states"); userDefs.Synchronize(); }
public static void SetStringOrClear(this NSUserDefaults instance, string data, string defaultName) { if (data.HasValue()) { instance.SetString(data, defaultName); } else { instance.RemoveObject(defaultName); } instance.Synchronize(); }
public static void SetSerializedObject <T> (this NSUserDefaults instance, T data, string defaultName) where T : class { if (data != null) { instance.SetString(data.Serialize(), defaultName); } else { instance.RemoveObject(defaultName); } instance.Synchronize(); }
public void SetString() { // confusing API for .NET developers since the parameters are 'value', 'key' // http://stackoverflow.com/q/12415054/220643 NSUserDefaults defaults = NSUserDefaults.StandardUserDefaults; defaults.RemoveObject("spid"); Assert.Null(defaults.StringForKey("spid"), "StringForKey-1"); defaults.SetString("coucou", "spid"); defaults.Synchronize(); Assert.That(defaults.StringForKey("spid"), Is.EqualTo("coucou"), "StringForKey-2"); }
private void RemovePublicationDownloadingProgress() { if (BookInfo.Name == null) { return; } NSUserDefaults userDefault = NSUserDefaults.StandardUserDefaults; userDefault.RemoveObject(BookInfo.Name); userDefault.Synchronize(); }
public bool SetValue(string key, string value) { bool result = false; System.Diagnostics.Debug.WriteLine(">>> SetValue, key = " + key + ", value = " + value); try { localSettings.SetString(value, key); // NOTE: It's value FIRST, THEN key!!!! localSettings.Synchronize(); result = true; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(">>> SetValue failed, exception:" + ex.ToString()); result = false; } System.Diagnostics.Debug.WriteLine(">>> result = " + result.ToString()); return(result); }
public override void ViewWillDisappear(bool animated) { base.ViewWillDisappear(animated); btnReturn.TouchUpInside -= btnReturnTouchUpInside; btnJa.TouchUpInside -= pushJa; btnNee.TouchUpInside -= pushNee; var ser = JsonSerializer.SerializeToString(_appController.Eigenschappen); userDefs.SetString(ser, "eigenschappen"); userDefs.Synchronize(); }
bool IsInitialized() { try { var settings = new NSUserDefaults($"group.{AboutThisApp.PackageName}", NSUserDefaultsType.SuiteName); settings.Synchronize(); return(settings.BoolForKey("FavoritesInitialized")); } catch (Exception e) { Console.WriteLine(e); return(false); } }
private static NSUserDefaults CreateUserDefaults() { NSUserDefaults userDefaults = new NSUserDefaults(GROUP_ID, NSUserDefaultsType.SuiteName); try { userDefaults.Synchronize(); } catch (Exception ex) { Console.WriteLine("Unable to synchronize on NSUserDefaults creation: {0}", ex.Message); } return(userDefaults); }
public static void AppLaunched(string appId) { AppId = appId; var version = NSBundle.MainBundle.InfoDictionary.ObjectForKey(new NSString("CFBundleVersion")).ToString(); if (settings.StringForKey("lastInstalledVersion") != version) { ResetWarningIndicators(); settings.SetString(version, "lastInstalledVersion"); settings.Synchronize(); } TryToRate(); RunCount += 1; Console.WriteLine("runcount" + RunCount); }
public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); tasks = AppDelegate.Database.GetItems(); // bind every time, to reflect deletion in the Detail view TableView.Source = new RootTableSource(tasks.ToArray()); NSUserDefaults shared = new NSUserDefaults("group.co.conceptdev.TodoToday", NSUserDefaultsType.SuiteName); shared.SetInt(tasks.Count, "TodoCount"); shared.Synchronize(); Console.WriteLine("Set NSUserDefaults TodoCount: " + tasks.Count); }
public override void ViewDidLoad() { base.ViewDidLoad (); _appController.ShowSelected += toggleShowSelected; userDefs = NSUserDefaults.StandardUserDefaults; UIApplication.Notifications.ObserveDidEnterBackground ((sender, args) => { var ser = JsonSerializer.SerializeToString (_appController.Eigenschappen); if (IsProfileNull) { userDefs.SetString (ser, "eigenschappen"); userDefs.Synchronize (); } else { _appController.AddOrUpdateEigenschappenSer (currProfiel.name, ser); } }); }
public void RespondToChangeEvent(object sender, CheckPointDataChangedEventArgs args) { ToastNotificationType type; switch (args.ActionOccurred) { case ActionType.Deleted: type = ToastNotificationType.Error; break; case ActionType.Written: type = ToastNotificationType.Warning; break; default: type = ToastNotificationType.Info; break; } var ud = new NSUserDefaults(AppGroupPathProvider.SuiteName, NSUserDefaultsType.SuiteName); ud.SetValueForKey(DateTime.Now.ToNSDate(), new NSString("MRU")); ud.Synchronize(); notify (args.Result.ToString(), string.Format ("{0} {1}", args.Entity, args.ActionOccurred.ToString ()), type); if (args.ConditionallyRefreshData) this.ConditionallyRefreshData (true); if (args.RespondToModelChanges&!args.ConditionallyRefreshData) this.RespondToModelChanges (); }