Пример #1
0
        protected override void OnPause()
        {
            base.OnPause();

            settings.UnregisterOnSharedPreferenceChangeListener(this);
            prefListener.OnPause();
        }
 /// <summary>
 /// A observable sequence of keys for changed shared preferences.
 /// </summary>
 /// <returns>The observable sequence of keys for changed shared preferences.</returns>
 /// <param name="sharedPreferences">The shared preferences to get the changes from.</param>
 public static IObservable <string?> PreferenceChanged(this ISharedPreferences sharedPreferences) =>
 Observable.Create <string?>(observer =>
 {
     var listener = new OnSharedPreferenceChangeListener(observer);
     sharedPreferences.RegisterOnSharedPreferenceChangeListener(listener);
     return(Disposable.Create(() => sharedPreferences.UnregisterOnSharedPreferenceChangeListener(listener)));
 });
Пример #3
0
 public void OnSharedPreferenceChanged(ISharedPreferences sharedPreferences, string key)
 {
     if (_preferenceManager == null)
     {
         sharedPreferences.UnregisterOnSharedPreferenceChangeListener(this);
         return;
     }
     _preferenceManager.FindPreference(key)?.TryRaiseAttachedEvent(AttachedMembers.Preference.ValueChangedEvent);
 }
Пример #4
0
        protected override void OnPause()
        {
            base.OnPause();
            ToggleButton bt = FindViewById <ToggleButton> (Resource.Id.toggleButton1);

            //var service = Binder.GetService();
            //service.ToneDetected -= OnToneDetected;
            //bt.CheckedChange -= OnToggleChecked;]
            lv_history.ItemClick -= HistoryItemClicked;
            try{
                var service = Binder.GetService();
                service.NewHistoryData -= OnNewHistoryData;
            }catch (Exception) {
            }
            ISharedPreferences pref = Global.GetSharedPreferences(this);

            pref.UnregisterOnSharedPreferenceChangeListener(this);
            bt.CheckedChange -= OnCheckedChange;
            UnbindService(connector);
        }
 public override void OnPause()
 {
     sharedPreferences.UnregisterOnSharedPreferenceChangeListener(this);
     base.OnPause();
 }
 private void RemoveMapChanged()
 {
     _preferences.UnregisterOnSharedPreferenceChangeListener(this);
 }
Пример #7
0
 public void RemoveOnChangeListener(object listener) =>
 sharedPreferences.UnregisterOnSharedPreferenceChangeListener(listener
                                                              as ISharedPreferencesOnSharedPreferenceChangeListener);
Пример #8
0
	    public void onDestroy() {
		    stop();
		    mSharedPreferences.UnregisterOnSharedPreferenceChangeListener(this);
	    }