Ejemplo n.º 1
0
        private void child_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (child != null)
            {
                if (delayedclicktimer.Enabled)
                {
                    delayedclicktimer.Stop();

                    if (ClickedCommand.CanExecute(null))
                    {
                        PresentationSource source = PresentationSource.FromVisual(this);

                        System.Drawing.Point p = new System.Drawing.Point();

                        if (source != null)
                        {
                            p = new System.Drawing.Point(
                                (int)(e.GetPosition(child).X *source.CompositionTarget.TransformToDevice.M11),
                                (int)(e.GetPosition(child).Y *source.CompositionTarget.TransformToDevice.M22));

                            ClickedCommand.Execute(p);
                        }
                    }
                }
                child.ReleaseMouseCapture();
                this.Cursor = Cursors.Arrow;
            }
        }
Ejemplo n.º 2
0
        void TouchUp()
        {
            TouchedUp?.Invoke(this, null);
            TouchedUpCommand?.Execute(null);
            Clicked?.Invoke(this, null);
            ClickedCommand?.Execute(null);

            Container.BackgroundColor = BackgroundColor;
            ButtonText.TextColor      = ForegroundColor;
            ColorIcon(ForegroundColor);
        }
Ejemplo n.º 3
0
    public VModel()
    {
        DataTable dt = new DataTable();

        using (MySqlConnection connection = new MySqlConnection("SERVER=localhost;" + "DATABASE=library;" + "UID=root;" + "PASSWORD=;"))
        {
            MySqlDataAdapter adapter = new MySqlDataAdapter();
            adapter.SelectCommand = new MySqlCommand("select * from movie_list", connection);
            adapter.Fill(dt);
        }
        var Library = dt.DefaultView;
        var Clicked = new ClickedCommand(this);
    }
Ejemplo n.º 4
0
        public HeartIconView()
        {
            // add larger touch-area
            Margin  = new Thickness(-10);
            Padding = new Thickness(10);

            _icon = new SvgCachedImage()
            {
                HeightRequest                = 25,
                WidthRequest                 = 25,
                Aspect                       = Aspect.AspectFit,
                Source                       = IsActive ? Images.FavoriteFill : Images.Favorite,
                FadeAnimationEnabled         = true,
                FadeAnimationForCachedImages = true,
                FadeAnimationDuration        = 150,
            };

            Content = new Grid()
            {
                Children =
                {
                    _icon,
                }
            };

            this.AddTouch(async(sender, args) =>
            {
                if (_isAnimating)
                {
                    return;
                }

                _isAnimating = true;

                if (!IsActive)
                {
                    IsActive = true;
                    await _icon.ScaleTo(.7f, 100u, Easing.SinInOut);
                    await _icon.ScaleTo(1f, 150u, Easing.SpringOut);
                }
                else
                {
                    IsActive = false;
                    await _icon.ScaleTo(.7f, 100u, Easing.SinOut);
                    await _icon.ScaleTo(1f, 150u, Easing.SpringOut);
                    _isAnimating = false;
                }
                ClickedCommand?.Execute(null);
            });
        }
Ejemplo n.º 5
0
        void CommandCanExecuteChanged(object sender, EventArgs e)
        {
            // Define IsEnabled state
            var canExecuteClick       = ClickedCommand?.CanExecute(null);
            var canExecuteTouchedDown = TouchedDownCommand?.CanExecute(null);

            if (canExecuteClick != null && canExecuteTouchedDown != null)
            {
                IsEnabled = canExecuteClick == true && canExecuteTouchedDown == true;
            }
            else
            {
                IsEnabled = canExecuteClick == true || canExecuteTouchedDown == true;
            }
        }
Ejemplo n.º 6
0
        private void Initialize()
        {
            ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(1, GridUnitType.Star)
            });
            RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(1, GridUnitType.Star)
            });

            ButtonFrame = new SupportFrame()
            {
                HasShadow         = Shadow,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Padding           = 0,
                CornerRadius      = CornerRadius
            };
            if (Device.RuntimePlatform == Device.iOS)
            {
                ButtonFrame.BackgroundColor = Color.Transparent;
            }
            else if (Device.RuntimePlatform == Device.Android)
            {
                ButtonFrame.BackgroundColor = FrameBackgroundColor;
            }


            ButtonTitleLabel = new Label();
            ButtonImage      = new Image();

            Children.Clear();
            Children.Add(ButtonFrame);

            tapGestureRecognizer         = new TapGestureRecognizer();
            tapGestureRecognizer.Tapped += (sender, e) => {
                ClickedCommand?.Execute(CommandParameter);
            };
            GestureRecognizers.Clear();
            GestureRecognizers.Add(tapGestureRecognizer);
        }