public override bool OnPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference)
        {
            Type cls = null;
            var title = preference.Title;

			if (title.Equals(GetString(Resource.String.left_and_right)))
				cls = typeof(LeftAndRightActivity);

//            if (title.Equals(GetString(Resource.String.properties)))
//                cls = typeof(PropertiesActivity);
//            else if (title.Equals(GetString(Resource.String.attach)))
//                cls = typeof(AttachExample);
//            else if (title.Equals(GetString(Resource.String.changing_fragments)))
//                cls = typeof(FragmentChangeActivity);
//            else if (title.Equals(GetString(Resource.String.left_and_right)))
//                cls = typeof(LeftAndRightActivity);
//            else if (title.Equals(GetString(Resource.String.responsive_ui)))
//                cls = typeof(ResponsiveUIActivity);
//            else if (title.Equals(GetString(Resource.String.viewpager)))
//                cls = typeof(ViewPagerActivity);
//            else if (title.Equals(GetString(Resource.String.title_bar_slide)))
//                cls = typeof(SlidingTitleBar);
//            else if (title.Equals(GetString(Resource.String.title_bar_content)))
//                cls = typeof(SlidingContent);
//            else if (title.Equals(GetString(Resource.String.anim_zoom)))
//                cls = typeof(ZoomAnimation);
//            else if (title.Equals(GetString(Resource.String.anim_scale)))
//                cls = typeof(ScaleAnimation);
//            else if (title.Equals(GetString(Resource.String.anim_slide)))
//                cls = typeof(SlideAnimation);

            var intent = new Intent(this, cls);
            StartActivity(intent);
            return true;
        }
        private void BindPreferencesSummaryToValue(Preference preference)
        {
            preference.OnPreferenceChangeListener = this;

            OnPreferenceChange(preference,
                PreferenceManager.GetDefaultSharedPreferences(preference.Context).GetString(preference.Key, ""));
        }
示例#3
0
        public override bool OnPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference)
        {
            if (preference.Key == "dropbox_login")
            {
                OnDropboxLoginLogout();
            }
            else if (preference.Key == "cloud_resume_playback_enabled")
            {

            }
            else if (preference.Key == "cloud_sync_playlists")
            {
                
            }
            else if (preference.Key == "cloud_sync_presets")
            {
                
            }
            else if (preference.Key == "cloud_sync_wifi_only")
            {
                
            }

            return base.OnPreferenceTreeClick(preferenceScreen, preference);
        }
示例#4
0
 internal static void OnRememberKeyFileHistoryChanged(object sender, Preference.PreferenceChangeEventArgs eventArgs)
 {
     if (!(bool)eventArgs.NewValue)
     {
         App.Kp2a.FileDbHelper.DeleteAllKeys();
     }
 }
 protected void HandlePreferenceChange(object sender, Preference.PreferenceChangeEventArgs e)
 {
     if (e.Preference == Preference)
     {
         FireValueChanged(e.NewValue);
         e.Handled = true;
     }
 }
示例#6
0
		public static void SetBool(Preference preference, bool state){
			if (preferencesLookup == null) {
				preferencesLookup= new Dictionary<Preference, bool>();			
			}
			if (preferencesLookup.ContainsKey (preference)) {
				preferencesLookup[preference]=state;			
			}
			EditorPrefs.SetBool (preference.ToString(), state);
		}
示例#7
0
		public double GetTransformedValue(Preference pref) 
		{
			double factor;
            if (iufFactors.Value.TryGetValue(pref.Item, out factor))
			{
				return pref.Value * factor;
			}
			return pref.Value;
		}
示例#8
0
 private void CacheSwitch_PreferenceChange(object sender, Preference.PreferenceChangeEventArgs e)
 {
     prefsEdit.PutBoolean("cache", (bool)e.NewValue);
     prefsEdit.Commit();
     if ((bool)e.NewValue == false)
     {
         DeleteAllCache();
     }
 }
        public override void OnDependencyChanged(Preference dependency, bool disableDependent)
        {
            base.OnDependencyChanged (dependency, disableDependent);

            //Disable movement of seek bar when dependency is false
            if (seekBar != null) {
                seekBar.Enabled = !disableDependent;
            }
        }
        public UserPreferences()
        {
            TfsUri = new Preference<Uri>(
                "CollectionUri",
                uri => uri != null && uri.ToString().HasValue(),
                uri => uri.ToString(),
                obj => new Uri((string)obj));

            TestProject = new Preference<string>(
                "Project",
                str => str.HasValue());

            WorkItemToolbarTop = new BooleanPreference("WorkItemToolbarTop");
            WorkItemToolbarTop.Value = true;

            FindToolbarTop = new BooleanPreference("FindToolbarTop");
            FindToolbarTop.Value = false;

            WorkItemIdMru = new Preference<BindingList<int>>(
                "WorkItemIdMRU",
                list => list != null && list.Count > 0,
                list => String.Join(",", list),
                IntBindingListFromObj);
            WorkItemIdMru.Value = new BindingList<int>();

            WindowSize = new Preference<Size>(
                "WindowSize",
                size => !size.IsEmpty,
                size => size.Width + "," + size.Height,
                obj =>
                {
                    var sizeTokens = ((string)obj).Split(',');
                    return new Size(
                        Int32.Parse(sizeTokens[0]),
                        Int32.Parse(sizeTokens[1]));
                });

            WindowLocation = new Preference<Point>(
                "WindowLocation",
                point => !point.IsEmpty,
                point => point.X + "," + point.Y,
                obj =>
                {
                    var pointTokens = ((string)obj).Split(',');
                    return new Point(
                        Int32.Parse(pointTokens[0]),
                        Int32.Parse(pointTokens[1]));
                });

            _preferenceCollection.Preferences.AddRange(
                new List<IPreference>
                {
                    TfsUri, TestProject, WorkItemToolbarTop, FindToolbarTop,
                    WorkItemIdMru, WindowSize, WindowLocation
                });
        }
示例#11
0
		private static void DrawPreference(Preference preference,string label, bool defaultValue){
			GUILayout.BeginHorizontal ();
			bool state = GetBool (preference,defaultValue);
			bool state2 = EditorGUILayout.Toggle (GUIContent.none, state,GUILayout.Width(18));
			if (state != state2) {
				SetBool (preference, state2);
			}
			GUILayout.Label (label,FsmEditorStyles.wrappedLabel);
			GUILayout.EndHorizontal ();
		}
示例#12
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            Settings.Instance.Load ();

            // Create your application here
            AddPreferencesFromResource (Resource.Layout.Settings);

            prefBlacklist = FindPreference ("pref_blacklist");
            prefReorder = FindPreference ("pref_reorder");

            prefDisableHomeDetect = (CheckBoxPreference)FindPreference ("pref_disablecheck");
            prefWallpaperUrl = (EditTextPreference)FindPreference ("pref_WallpaperUrl");

            prefBlacklist.PreferenceClick += delegate {
                StartActivity (typeof (SettingsAppShowHideActivity));
            };
            prefReorder.PreferenceClick += delegate {
                StartActivity (typeof (ReorderActivity));
            };

            // Start the intent service, it will decide to stop itself or not
            prefDisableHomeDetect.PreferenceChange += (sender, e) =>
                StartService (new Intent (this, typeof(ExcuseMeService)));

            prefWallpaperUrl.PreferenceChange += (sender, e) => {
                AndHUD.Shared.Show(this, "Downloading Wallpaper...");

                var url = prefWallpaperUrl.EditText.Text;

                Task.Factory.StartNew (() => {

                    try {
                        var http = new System.Net.WebClient ();
                        var bytes = http.DownloadData (url);
                        var path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);
                        var filename = System.IO.Path.Combine(path, "wallpaper.png");
                        System.IO.File.WriteAllBytes (filename, bytes);

                        AndHUD.Shared.Dismiss (this);
                    } catch (Exception ex) {

                        AndHUD.Shared.Dismiss (this);

                        Settings.Instance.WallpaperUrl = string.Empty;

                        Toast.MakeText (this, "Failed to Download Wallpaper", ToastLength.Long).Show ();
                        Log.Error ("Downloading Wallpaper Failed", ex);
                    }
                });
            };
        }
		protected override void OnCreate (Bundle bundle) {
			base.OnCreate (bundle);
			AddPreferencesFromResource (Resource.Layout.settings_prefs);

			prefs = PreferenceManager.GetDefaultSharedPreferences(this);
			prefs.RegisterOnSharedPreferenceChangeListener(this);

			prefVersion = FindPreference ("prefVersion");
			prefVersion.Title = Resources.GetString(Resource.String.app_name) + " v" + ApplicationContext.PackageManager.GetPackageInfo (ApplicationContext.PackageName, 0).VersionName + " (" + ApplicationContext.PackageManager.GetPackageInfo (ApplicationContext.PackageName, 0).VersionCode + ")";

			prefHoursNotifications = FindPreference ("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));

		}
示例#14
0
		public static bool GetBool(Preference preference){
			if (preferencesLookup == null) {
				preferencesLookup= new Dictionary<Preference, bool>();			
			}
			
			bool value;
			if (!PreferencesEditor.preferencesLookup.TryGetValue(preference, out value))
			{
				value = EditorPrefs.GetBool (preference.ToString());
				PreferencesEditor.preferencesLookup.Add(preference, value);
			}
			
			return value;
		}
示例#15
0
		void handlePreferenceChange (object sender, Preference.PreferenceChangeEventArgs e)
		{
			var listPreference = e.Preference as ListPreference;

			int val = 0;

			if (listPreference != null && int.TryParse (e.NewValue.ToString (), out val))
			{
				listPreference.Summary = listPreference.GetEntries () [val];
			}
			else
			{
				e.Preference.Summary = e.NewValue.ToString ();
			}
		}
		protected override void OnCreate (Android.OS.Bundle savedInstanceState)
		{
			base.OnCreate (savedInstanceState);
			GoogleAnalyticsManager.ReportScreenEnter (GetType ().FullName);

			AddPreferencesFromResource (Resource.Xml.preferences);

			_soundPref = FindPreference (SoundSettingKey);
			var soundPrefValue = PreferenceManager.GetDefaultSharedPreferences (this).GetString (SoundSettingKey, "");
			_soundPref.Summary = string.IsNullOrEmpty (soundPrefValue) ? GetString (Resource.String.settings_sound_sum) :
                RingtoneManager.GetRingtone (this, Android.Net.Uri.Parse (soundPrefValue)).GetTitle (this);
			_soundPref.PreferenceClick += SoundPreferenceClick;     

			_adsPref = FindPreference (AdsSettingKey);
			_adsPref.PreferenceClick += AdsPreferenceClick;
		}
示例#17
0
        public void StringPref()
        {
            const string defaultValue = "hello";
            var          pref         = new Preference <string> ("StringPref", defaultValue);

            pref.GetValue().ShouldEqual(defaultValue);
            pref.SetValue(null);
            // NSUserDefaults does not support null, so we specify that we always write empty
            pref.GetValue().ShouldBeEmpty();
            pref.SetValue(String.Empty);
            pref.GetValue().ShouldBeEmpty();
            pref.SetValue("something else");
            pref.GetValue().ShouldEqual("something else");
            pref.Reset();
            pref.GetValue().ShouldEqual(defaultValue);
        }
示例#18
0
        public IActionResult SectionPreference()
        {
            var preferences = new List <Preference>();
            var sections    = _preferenceLogic.GetAllSections();

            foreach (var section in sections)
            {
                Preference preference = new Preference {
                    Task = section
                };
                preferences.Add(preference);
            }

            TempData["Title"] = "Sections";
            return(View("SubmitPreferences", preferences));
        }
        public WindowHome()
        {
            InitializeComponent();

            Preference preference = SettingManager.Appearance;

            Left   = preference.WindowHome.X;
            Top    = preference.WindowHome.Y;
            Width  = preference.WindowHome.W;
            Height = preference.WindowHome.H;

            Visibility = preference.IsWindowHomeVisible ? Visibility.Visible : Visibility.Hidden;

            DataContext = new HomeVModel();
            Closing    += Window_Closing;
        }
示例#20
0
        public static void Save(Preference P, string FileName)
        {
            var X = new XmlSave(FileName);

            X.StartXML("preferences");

            foreach (var ID in P.ID)
            {
                X.StartTag("pref");
                X.Attribute("id", ID);
                X.Attribute("value", P.Get(ID));
                X.EndTag();
            }
            X.EndXML();
            X.Close();
        }
示例#21
0
        /**
         * Binds a preference's summary to its value. More specifically, when the
         * preference's value is changed, its summary (line of text below the
         * preference title) is updated to reflect the value. The summary is also
         * immediately updated upon calling this method. The exact display format is
         * dependent on the type of preference.
         *
         * @see #sBindPreferenceSummaryToValueListener
         */
        private static void BindPreferenceSummaryToValue(Preference preference)
        {
            // Set the listener to watch for value changes.
            preference.PreferenceChange += Preference_PreferenceChange;

            //preference.OnPreferenceChangeListener = new BindPreferenceSummaryToValueListener();

            // Trigger the listener immediately with the preference's
            // current value.

            Preference_PreferenceChange(preference,
                                        new Preference.PreferenceChangeEventArgs(true, preference,
                                                                                 PreferenceManager.GetDefaultSharedPreferences(preference.Context).GetString(preference.Key, "")));
            //preference.OnPreferenceChangeListener.OnPreferenceChange(preference,
            //    PreferenceManager.GetDefaultSharedPreferences(preference.Context).GetString(preference.Key, ""));
        }
示例#22
0
        protected override void OnCreate(Android.OS.Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            GoogleAnalyticsManager.ReportScreenEnter(GetType().FullName);

            AddPreferencesFromResource(Resource.Xml.preferences);

            _soundPref = FindPreference(SoundSettingKey);
            var soundPrefValue = PreferenceManager.GetDefaultSharedPreferences(this).GetString(SoundSettingKey, "");

            _soundPref.Summary = string.IsNullOrEmpty(soundPrefValue) ? GetString(Resource.String.settings_sound_sum) :
                                 RingtoneManager.GetRingtone(this, Android.Net.Uri.Parse(soundPrefValue)).GetTitle(this);
            _soundPref.PreferenceClick += SoundPreferenceClick;

            _adsPref = FindPreference(AdsSettingKey);
            _adsPref.PreferenceClick += AdsPreferenceClick;
        }
示例#23
0
        private void button_PreferenceClick(object sender, Preference.PreferenceClickEventArgs e)
        {
            Android.Support.V7.App.AlertDialog alert = new Android.Support.V7.App.AlertDialog.Builder(Activity)
                .SetTitle("Revoke access to your Google account?")
                .SetMessage("This will result in the deletion of some of your user data. Are you really sure?")
                .SetNegativeButton("Cancel", (arg1, arg2) => { })
                .SetPositiveButton("Delete Data", (arg1, arg2) =>
                {
                    AppData.Session = null;
                    AppData.SaveCurrentData();

                    Intent intent = new Intent(Activity, typeof(LoginActivity));
                    intent.PutExtra("revokeGoogle", true);
                    StartActivity(intent);

                    Activity.Finish();
                })
                .Create();
            alert.Show();
        }
示例#24
0
        protected virtual Token GetNextTokenxx(Preference preference)
        {
            Token token;

            if (this.ResidueToken != null)
            {
                token = this.ResidueToken;
                this.ResidueToken = null;
                return token;
            }

            do
            {
                token = this.Scanner.GetToken(preference);

                //if ((parent.Comments != null) && (token is CommentToken))
                //    parent.Comments.Add((CommentToken)token);

            } while (token is WhitespaceToken);
            return token;
        }
示例#25
0
        public bool OnPreferenceChange(Preference preference, Object newValue)
        {
            var stringValue = newValue.ToString();
            var listPreference = preference as ListPreference;

            // for list preferences
            if (listPreference != null)
            {
                int prefIndex = listPreference.FindIndexOfValue(stringValue);
                if (prefIndex >= 0)
                {
                    preference.Summary = listPreference.GetEntries()[prefIndex];
                }
            }
            // any other preference just set the summary
            else
            {
                preference.Summary = stringValue;
            }

            return true;
        }
示例#26
0
 private void NotificationSwitch_PreferenceChange(object sender, Preference.PreferenceChangeEventArgs e)
 {
     prefsEdit.PutBoolean("notifications", (bool)e.NewValue);
     prefsEdit.Commit();
     if ((bool)e.NewValue == false)
     {
         UnregisterFromNotifications();
     }
     else
     {
         RegisterToNotifications();
     }
 }
示例#27
0
 private void DeleteCache_PreferenceClick(object sender, Preference.PreferenceClickEventArgs e)
 {
     DeleteAllCache();
     Toast.MakeText(this, "La cache è stata pulita.", ToastLength.Short).Show();
 }
示例#28
0
 private void AnimationSwitch_PreferenceChange(object sender, Preference.PreferenceChangeEventArgs e)
 {
     prefsEdit.PutBoolean("animations", (bool)e.NewValue);
     prefsEdit.Commit();
 }
示例#29
0
        public LastfmPreferences (LastfmSource source)
        {
            var service = ServiceManager.Get<PreferenceService> ();
            if (service == null) {
                return;
            }

            this.source = source;

            service.InstallWidgetAdapters += OnPreferencesServiceInstallWidgetAdapters;
            source_page = new Banshee.Preferences.SourcePage (source) {
                (account_section = new Section ("lastfm-account", Catalog.GetString ("Account"), 20) {
                    (username_preference = new SchemaPreference<string> (LastfmSource.LastUserSchema,
                        Catalog.GetString ("_Username")) {
                        ShowLabel = false
                    }),
                    new VoidPreference ("lastfm-signup")
                }),
                (prefs_section = new Section ("lastfm-settings", Catalog.GetString ("Preferences"), 30))
            };

            scrobbler = ServiceManager.Get<Banshee.Lastfm.Audioscrobbler.AudioscrobblerService> ();
            if (scrobbler != null) {
                reporting_preference = new Preference<bool> ("enable-song-reporting",
                    Catalog.GetString ("_Enable Song Reporting"), null, scrobbler.Enabled);
                reporting_preference.ValueChanged += root => scrobbler.Enabled = reporting_preference.Value;
                prefs_section.Add (reporting_preference);
            }
        }
 protected override void Refresh()
 {
     var collectionViewManager = GetCollectionViewManager();
     if (collectionViewManager == null)
     {
         var oldValues = new Preference[_preference.PreferenceCount];
         for (int i = 0; i < _preference.PreferenceCount; i++)
             oldValues[i] = _preference.GetPreference(i);
         _preference.RemoveAll();
         for (int i = 0; i < oldValues.Length; i++)
             oldValues[i].SetBindingMemberValue(AttachedMembers.Object.Parent, BindingExtensions.NullValue);
     }
     else
         collectionViewManager.Clear(_preference);
     Add(0, ItemsSource.Count());
 }
		public bool OnPreferenceChange (Preference preference, Java.Lang.Object newValue){

			if(preference.Equals(deviceListPref)){
				preference.Summary = (string) newValue;
			}
			if(preference.Equals(portNumberPref)){
				preference.Summary = (string) newValue;
			}
			if(preference.Equals(listenForClientsPref)){
				if((bool) newValue){
					preference.Summary = "Client can connect to tunnel";
				}
				else{
					preference.Summary = "Client can not connect to tunnel";
				}
			}
			if (preference.Equals (enableStreaming)) {
				SetVideoSettingsSensitive((bool) newValue);
			}
			if (preference.Equals (rtspPort)) {
				preference.Summary = (string) newValue;
			}
			if (preference.Equals (videoPort)) {
				preference.Summary = (string) newValue;
			}
			if (preference.Equals (resolution)) {
				preference.Summary = (string) newValue;
			}
			if (preference.Equals (videoQuality)) {
				preference.Summary = (string) newValue;
			}
			if (preference.Equals (frameRate)) {
				preference.Summary = (string) newValue + " fps";
			}
			return true;
		}
		public bool OnPreferenceClick(Preference preference){
			return true;
		}
 void autoLogin_PreferenceChange(object sender, Preference.PreferenceChangeEventArgs e)
 {
     User user = userDao.getUser();
     user.autoLogin = (bool)e.NewValue;
     userDao.addUser(user);
 }
 public MvxPreferenceValueTargetBinding(Preference preference)
     : base(preference)
 { }
示例#35
0
 internal CharacterClassification Classify(Preference preference)
 {
     if (this.EndOfFile)
         return CharacterClassification.EndOfFile;
     if (this.IsLetter())
         return CharacterClassification.Letter;
     if (this.IsDigit())
         return CharacterClassification.Digit;
     if (((preference & Preference.VerticalBar) != 0) && this.IsVerticalBar())
         return CharacterClassification.VerticalBar;
     if (((preference & Preference.NegativeSign) != 0) && this.IsNegativeSign())
         return CharacterClassification.NegativeSign;
     if (this.IsBinaryCharacter())
         return CharacterClassification.BinaryCharacter;
     if (this.IsWhitespace())
         return CharacterClassification.Whitespace;
     if (this.IsCommentDelimiter())
         return CharacterClassification.CommentDelimiter;
     if (this.IsStringDelimiter())
         return CharacterClassification.StringDelimiter;
     if (this.IsAssignmentOperatorCharacter1())
         return CharacterClassification.AssignmentOperatorCharacter1;
     if (this.IsHashedStringDelimiter())
         return CharacterClassification.HashedDelimiter;
     if (this.IsCharacterDelimiter())
         return CharacterClassification.CharacterDelimiter;
     if (this.IsReturnOperator())
         return CharacterClassification.ReturnOperator;
     return CharacterClassification.Undefined;
 }
示例#36
0
文件: Util.cs 项目: pythe/wristpass
        public static void PrepareNoDonatePreference(Context ctx, Preference preference)
        {
            ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(ctx);

            long usageCount = prefs.GetLong(ctx.GetString(Resource.String.UsageCount_key), 0);

            #if DEBUG
            preference.Enabled = (usageCount > 1);
            #else
            preference.Enabled = (usageCount > 50);
            #endif
            preference.PreferenceChange += delegate(object sender, Preference.PreferenceChangeEventArgs args)
                {
                    if ((bool) args.NewValue)
                    {
                        new AlertDialog.Builder(ctx)
                            .SetTitle(ctx.GetString(AppNames.AppNameResource))
                            .SetCancelable(false)
                            .SetPositiveButton(Android.Resource.String.Ok, delegate(object o, DialogClickEventArgs eventArgs)
                                {
                                    GotoDonateUrl(ctx);
                                    ((Dialog) o).Dismiss();
                                })
                            .SetMessage(Resource.String.NoDonateOption_question)
                            .Create().Show();

                    }
                };
        }