Ejemplo n.º 1
0
        public void onClickColorPickerDialog(IMenuItem item)
        {
            //The color picker menu item as been clicked. Show
            //a dialog using the custom ColorPickerDialog class.

            var prefs = PreferenceManager.GetDefaultSharedPreferences(this);
            //TODO: check with the value for color
            int initialValue = prefs.GetInt("color_2", Int32.Parse("FF000000", System.Globalization.NumberStyles.HexNumber));

            Console.WriteLine("mColorPicker", "initial value:" + initialValue);

            ColorPickerDialog colorDialog = new ColorPickerDialog(this, initialValue);

            colorDialog.setAlphaSliderVisible(true);
            colorDialog.SetTitle("Pick a Color!");

//			colorDialog.setButton(DialogInterface.BUTTON_POSITIVE, getString(Resource.String.dialog_ok), new DialogInterface.OnClickListener() {
//
//				public void onClick(DialogInterface dialog, int which) {
//					Toast.MakeText(this, "Selected Color: " + colorToHexString(colorDialog.getColor()), ToastLength.Long).Show();
//
//					//Save the value in our preferences.
//					ISharedPreferencesEditor editor = prefs.Edit();
//					editor.PutInt("color_2", colorDialog.getColor());
//					editor.Commit();
//				}
//			});
//
//			colorDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getString(android.R.string.cancel), new DialogInterface.OnClickListener() {
//
//				public void onClick(DialogInterface dialog, int which) {
//					//Nothing to do here.
//				}
//			});

            colorDialog.Show();
        }