Ejemplo n.º 1
0
        private async void StockCellRecognizer_Tapped(object sender, EventArgs e)
        {
            // thingamajig to fade in the overlay
            FadeBackground.Opacity   = 0;
            FadeBackground.IsVisible = true;
            _ = FadeBackground.FadeTo(1, animationSpeed);

            // gets cell that was tapped
            var element = (StockCell)sender;

            FakeCell.BindingContext = element.BindingContext;

            // positions the dropdowns
            PositionDropDown(element, Front);
            PositionDropDown(element, Back);


            // the dropdowns have to start hidden - might refactor this later, this looks ugly...
            Front.IsVisible          = true;
            DeleteDropDown.IsVisible = false;
            EditDropDown.IsVisible   = false;
            InfoDropDown.IsVisible   = false;
            Back.IsVisible           = false;

            await OpenDropDown(InfoDropDown);
            await OpenDropDown(DeleteDropDown);
            await OpenDropDown(EditDropDown);
        }
Ejemplo n.º 2
0
        private async void YesButtonTapGestureRecognizer_Tapped(object sender, EventArgs e)
        {
            // close the overlays
            await Flip(BackSide, FrontSide);

            CloseDropDown(EditDropDown);
            await CloseDropDown(DeleteDropDown);

            await FadeBackground.FadeTo(0, animationSpeed);

            FadeBackground.IsVisible = false;

            // go through all the elements after it and translate them up
            List <Task> animations = new List <Task>();

            for (int i = selectedIndex + 1; i < ViewStack.Children.Count; i++)
            {
                VisualElement elementToMove;
                elementToMove = ViewStack.Children[i];
                // work out the bounds we are going to move them to
                var boundsToMoveTo = elementToMove.Bounds;
                boundsToMoveTo.Top -= selectedElement.Height;
                animations.Add(elementToMove.LayoutTo(boundsToMoveTo, animationSpeed, Easing.BounceOut));
            }
            await Task.WhenAll(animations);

            await selectedElement.FadeTo(0, animationSpeed);

            ViewStack.Children.Remove(selectedElement);
        }
        private async void TimeCellGestureRecognizer_Tapped(object sender, EventArgs e)
        {
            //淡出PopupPage
            FadeBackground.Opacity   = 0;
            FadeBackground.IsVisible = true;
            _ = FadeBackground.FadeTo(1, animationSpeed);

            #region 動態定位點到的元件且待出資料
            //取得點到的是哪一筆
            var element = (TimeCell)sender;
            //帶出選到值
            FakeCell.BindingContext = element.BindingContext;

            PositionDropDown(element, FrontSide);
            PositionDropDown(element, BackSide);
            #endregion

            //先隱藏元件
            FrontSide.IsVisible = true;

            DeleteDropdown.IsVisible = false;
            EditDropdown.IsVisible   = false;
            InfoDropdown.IsVisible   = false;
            BackSide.IsVisible       = false;
            //再打開
            await OpenDropDown(DeleteDropdown);
            await OpenDropDown(EditDropdown);
            await OpenDropDown(InfoDropdown);
        }
Ejemplo n.º 4
0
        private async void StockCellRecognizer_Tapped(object sender, EventArgs e)
        {
            // thingamajig to fade in the overlay
            FadeBackground.Opacity   = 0;
            FadeBackground.IsVisible = true;
            FadeBackground.FadeTo(1, animationSpeed);

            // gets cell that was tapped
            var element = (StockCell)sender;

            // positions the overlay
            FakeCell.BindingContext = element.BindingContext;

            var dropDownContainerRect = new Rectangle(0, element.Bounds.Top, this.Width, FakeCell.Height + InfoDropDown.Height + DeleteDropDown.Height);

            AbsoluteLayout.SetLayoutBounds(DropDownContainer, dropDownContainerRect);

            // the dropdowns have to start hidden - might refactor this later, this looks ugly...
            DeleteDropDown.IsVisible = false;
            EditDropDown.IsVisible   = false;
            InfoDropDown.IsVisible   = false;

            await OpenDropDown(InfoDropDown);
            await OpenDropDown(DeleteDropDown);
            await OpenDropDown(EditDropDown);
        }
Ejemplo n.º 5
0
        private async void BackgroundTapRecognizer_Tapped(object sender, EventArgs e)
        {
            // closes all the dropdowns
            await CloseDropDown(EditDropDown);
            await CloseDropDown(DeleteDropDown);
            await CloseDropDown(InfoDropDown);

            // thingamajig to fade out the overlay -- added async/await because it makes sense to me.
            await FadeBackground.FadeTo(0, animationSpeed);

            FadeBackground.IsVisible = false;
        }
        private async void BackgroundTapGestureRecognizer_Tapped(object sender, EventArgs e)
        {
            //關閉動畫
            await CloseDropDown(InfoDropdown);
            await CloseDropDown(EditDropdown);
            await CloseDropDown(DeleteDropdown);

            //取消跳出
            await FadeBackground.FadeTo(0, 100);

            FadeBackground.IsVisible = false;
        }
Ejemplo n.º 7
0
        private async void CloseGestureRecognizer_Tapped(object sender, EventArgs e)
        {
            AnimateCloseButton(CloseButton, entering: false);

            // close the drop downs
            await CloseDropDown(InfoDropDown);
            await CloseDropDown(EditDropDown);
            await CloseDropDown(DeleteDropDown);

            // fade out the overlay
            await FadeBackground.FadeTo(0, animationSpeed);

            FadeBackground.IsVisible = false;
        }
Ejemplo n.º 8
0
        private async void TimeCellTapRecognizer_Tapped(object sender, EventArgs e)
        {
            // get the cell that was tapped
            selectedElement = (TimeCell)sender;
            selectedIndex   = ViewStack.Children.IndexOf(selectedElement);

            // set the binding context to the panel
            // so that it can be inherited by the FakeCell and
            // any other controls required on the popup.
            FrontSide.BindingContext = selectedElement.BindingContext;

            // position the drop downs
            PositionDropDown(selectedElement, FrontSide);
            PositionDropDown(selectedElement, BackSide);

            // fade in the overlay
            FadeBackground.Opacity   = 0;
            FadeBackground.IsVisible = true;
            _ = FadeBackground.FadeTo(1, animationSpeed);

            // position the close button
            var padding         = 40;
            var xPos            = (this.Width / 2) - (CloseButton.Width / 2);
            var yPos            = selectedElement.Bounds.Y + FrontSide.Bounds.Height + padding;
            var closeButtonRect = new Rectangle(xPos, yPos, CloseButton.Width, CloseButton.Height);

            AbsoluteLayout.SetLayoutBounds(CloseButton, closeButtonRect);

            // hide the dropdowns
            FrontSide.IsVisible      = true;
            DeleteDropDown.IsVisible = false;
            EditDropDown.IsVisible   = false;
            InfoDropDown.IsVisible   = false;
            BackSide.IsVisible       = false;
            CloseButton.Opacity      = 0;

            await OpenDropDown(DeleteDropDown);
            await OpenDropDown(EditDropDown);
            await OpenDropDown(InfoDropDown);

            AnimateCloseButton(CloseButton, entering: true);
        }