예제 #1
0
        private void SetUp(Color color)
        {
            var inflater = (LayoutInflater)Context.GetSystemService(Context.LayoutInflaterService);

            var layout = inflater.Inflate(Resource.Layout.dialog_color_picker, null);

            SetContentView(layout);

            SetTitle(Resource.String.dialog_color_picker);

            _colorPicker = layout.FindViewById <ColorPickerView>(Resource.Id.color_picker_view);
            _oldColor    = layout.FindViewById <ColorPickerPanelView>(Resource.Id.old_color_panel);
            _newColor    = layout.FindViewById <ColorPickerPanelView>(Resource.Id.new_color_panel);

            ((LinearLayout)_oldColor.Parent).SetPadding(
                (int)Math.Round(_colorPicker.DrawingOffset),
                0,
                (int)Math.Round(_colorPicker.DrawingOffset),
                0
                );

            _oldColor.SetOnClickListener(this);
            _newColor.SetOnClickListener(this);
            _colorPicker.ColorChanged += (sender, args) =>
            {
                _newColor.Color = args.Color;
                if (ColorChanged != null)
                {
                    ColorChanged(this, new ColorChangedEventArgs {
                        Color = _newColor.Color
                    });
                }
            };
            _oldColor.Color    = color;
            _colorPicker.Color = color;
        }
        private void SetUp(Color color)
        {
            var inflater = (LayoutInflater) Context.GetSystemService(Context.LayoutInflaterService);

		    var layout = inflater.Inflate(Resource.Layout.dialog_color_picker, null);

		    SetContentView(layout);

		    SetTitle(Resource.String.dialog_color_picker);

            _colorPicker = layout.FindViewById<ColorPickerView>(Resource.Id.color_picker_view);
            _oldColor = layout.FindViewById<ColorPickerPanelView>(Resource.Id.old_color_panel);
            _newColor = layout.FindViewById<ColorPickerPanelView>(Resource.Id.new_color_panel);

            ((LinearLayout)_oldColor.Parent).SetPadding(
                (int) Math.Round(_colorPicker.DrawingOffset), 
			    0,
                (int) Math.Round(_colorPicker.DrawingOffset), 
			    0
		    );

            _oldColor.SetOnClickListener(this);
            _newColor.SetOnClickListener(this);
            _colorPicker.ColorChanged += (sender, args) =>
                                             {
                                                 _newColor.Color = args.Color;
                                                 if (ColorChanged != null)
                                                     ColorChanged(this, new ColorChangedEventArgs { Color = _newColor.Color });
                                             };
            _oldColor.Color = color;
            _colorPicker.Color = color;
        }