예제 #1
0
        public void Save()
        {
            NSUserDefaults defaults = NSUserDefaults.StandardUserDefaults;

            defaults.SetBool(enabled.Active, EnabledKey);
            defaults.Synchronize();
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
        public static void setBatteryInterval(string batteryInterval)
        {
            NSUserDefaults prefs = NSUserDefaults.StandardUserDefaults;

            prefs.SetString(batteryInterval, "batteryInterval");
            prefs.Synchronize();
        }
예제 #4
0
        public static void setIsUseKeyAction(bool isUseKeyAction)
        {
            NSUserDefaults prefs = NSUserDefaults.StandardUserDefaults;

            prefs.SetBool(isUseKeyAction, "isUseKeyAction");
            prefs.Synchronize();
        }
예제 #5
0
        public override void DeleteData(string dataId)
        {
            NSUserDefaults prefs = NSUserDefaults.StandardUserDefaults;

            prefs.RemoveObject(new NSString(dataId));
            prefs.Synchronize();
        }
예제 #6
0
        public static void setMaskType(int maskType)
        {
            NSUserDefaults prefs = NSUserDefaults.StandardUserDefaults;

            prefs.SetInt(maskType, "maskType");
            prefs.Synchronize();
        }
예제 #7
0
        private void SavePublicationDownladProgress(int bytesDownloaded)
        {
            NSUserDefaults userDefault = NSUserDefaults.StandardUserDefaults;

            userDefault.SetInt(bytesDownloaded, BookTitle);
            userDefault.Synchronize();
        }
예제 #8
0
        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;
            }
        }
예제 #9
0
        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();
        }
예제 #11
0
        protected override void doSave(string dataId, string dataValue)
        {
            NSUserDefaults prefs = NSUserDefaults.StandardUserDefaults;

            prefs.SetValueForKey(new NSString(dataValue), new NSString(dataId));
            prefs.Synchronize();
        }
예제 #12
0
        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);
            }
예제 #16
0
        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);
        }
예제 #18
0
        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;
        }
예제 #19
0
 public void SetToDefaults(string key, string value)
 {
     if (!String.IsNullOrEmpty(value))
     {
         NSUserDefaults defaults = NSUserDefaults.StandardUserDefaults;
         defaults.SetString(value, key);
         defaults.Synchronize();
     }
 }
예제 #20
0
        public override void ViewWillDisappear(bool animated)
        {
            base.ViewWillDisappear(animated);
            btnReturn.TouchUpInside -= btnReturnTouchUpInside;

            var ser = JsonSerializer.SerializeToString(tvSource.checkedStates);

            userDefs.SetString(ser, "states");
            userDefs.Synchronize();
        }
예제 #21
0
 public static void SetStringOrClear(this NSUserDefaults instance, string data, string defaultName)
 {
     if (data.HasValue())
     {
         instance.SetString(data, defaultName);
     }
     else
     {
         instance.RemoveObject(defaultName);
     }
     instance.Synchronize();
 }
예제 #22
0
 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();
 }
예제 #23
0
        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");
        }
예제 #24
0
        private void RemovePublicationDownloadingProgress()
        {
            if (BookInfo.Name == null)
            {
                return;
            }

            NSUserDefaults userDefault = NSUserDefaults.StandardUserDefaults;

            userDefault.RemoveObject(BookInfo.Name);
            userDefault.Synchronize();
        }
예제 #25
0
        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);
        }
예제 #26
0
        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();
        }
예제 #27
0
 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);
     }
 }
예제 #28
0
        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);
        }
예제 #29
0
        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);
        }
예제 #30
0
        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);
                }
            });
        }
예제 #32
0
        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 ();
        }