Example #1
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 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);
        }
        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);
        }
Example #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);
        }
        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;
        }
Example #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;
        }
Example #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);
        }
Example #9
0
        private void setBackground()
        {
            BackgroundComponent background = new BackgroundComponent("Menus/Small Menu", new Vector2(25, 210), Color.White);

            TransitionWrapper transition;

            transition = new BaseTransition(15, TransitionState.intro);
            transition = new FloatBackground(transition, new Vector2(0, 15));
            transition = new FadeBackground(transition);
            transition.setTransition(background);
            background.Intro = transition;

            transition        = new BaseTransition(15, TransitionState.selected);
            transition        = new FloatBackground(transition, new Vector2(0, -15));
            transition        = new FadeBackground(transition);
            background.Select = transition;

            transition.State = TransitionState.exit;
            background.Exit  = transition;

            addComponent(background);
        }
Example #10
0
 public Level_01()
 {
     Start();
     introduction = new Introduction(AssetManager.Instance.GetCampaignAndSurviveModeAssets().IntroductionChapter_01);
     whiteBackground = new FadeBackground(1);
 }