Esempio n. 1
0
        internal async void HidePopover()
        {
            //Fade Out(慢慢透明) 元件
            await Task.WhenAll(
                new Task[]
            {
                FakeProduct.FadeTo(0),
                PagePopover.FadeTo(0)
            });

            //確定都透明了再做別的事
            //1.隱藏假的產品
            FakeProduct.IsVisible = false;
            //2.隱藏Popupover
            PagePopover.IsVisible = false;
        }
        internal async Task HidePopover()
        {
            // fade out the elements
            await Task.WhenAll(
                new Task[]
            {
                FakeProductCell.FadeTo(0),
                PagePopover.FadeTo(0)
            });

            // hide our fake product cell
            FakeProductCell.IsVisible = false;

            // hide our Page poper
            PagePopover.IsVisible = false;
        }
Esempio n. 3
0
        /// <summary>
        /// animation activated by pressing on a product panel
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e">never used, do not try</param>
        private async void TapGestureRecognizer_Tapped(object sender, EventArgs e)
        {
            // the user has tapped on an element
            ProductDisplay element = sender as ProductDisplay;

            // set the binding context to the selected cell
            FakeProductCell.BindingContext = element.BindingContext;
            FakeProductCell.ImageOffsetX   = element.ImageOffsetX;
            FakeProductCell.ImageOffsetY   = element.ImageOffsetY;
            FakeProductCell.Opacity        = 1;
            FakeProductCell.IsVisible      = true;

            // set the selected item
            ((MainViewModel)this.BindingContext).SelectedProduct = element.BindingContext as ProductViewModel;

            // set the layout to the same postion
            var       yScroll = ScrollContainer.ScrollY;
            Rectangle rect    = new Rectangle(
                x: ScrollContainer.X + element.X,
                y: ScrollContainer.Y + element.Y - yScroll,
                width: element.Width,
                height: element.Height);

            AbsoluteLayout.SetLayoutBounds(FakeProductCell, rect);

            // hide the cell we clicked on
            element.Opacity = 0.01;
            await FakeProductCell.ExpandToFill(this.Bounds);

            element.Opacity = 1;

            // display the page popover
            PagePopover.Opacity   = 0;
            PagePopover.IsVisible = true;
            await PagePopover.Expand();

            Vibration.Vibrate(20);
        }
Esempio n. 4
0
        private async void TapGestureRecognizer_Tapped(object sender, EventArgs e)
        {
            //點擊了一個區塊
            Controls.ProductDisplay element = sender as Controls.ProductDisplay;

            //設定假的產品資料來源
            FakeProduct.BindingContext = element.BindingContext;
            //再次定位
            FakeProduct.ImageOffsetX = element.ImageOffsetX;
            FakeProduct.ImageOffsetY = element.ImageOffsetY;
            FakeProduct.Opacity      = 1;
            FakeProduct.IsVisible    = true;

            //把點到是哪個頁面資訊(BindingContext)傳到自訂的頁面 [part4 2:37:44]
            ((MainPageViewModel)this.BindingContext).SeletedProduct = element.BindingContext as Product;

            var ySctoll = scrollContainer.ScaleY;

            //找到點擊的區塊是哪一個並從那個方塊展開
            Rectangle rect = new Rectangle(
                x: scrollContainer.X + element.X,
                y: scrollContainer.Y + element.Y - ySctoll,
                width: element.Width,
                height: element.Height);

            //Rectangle rect = pancake.Bounds;
            AbsoluteLayout.SetLayoutBounds(FakeProduct, rect);

            element.Opacity = 0.01;
            await FakeProduct.ExpanToFill(this.Bounds);

            element.Opacity = 1;

            //顯示Popover Page
            PagePopover.Opacity   = 0;
            PagePopover.IsVisible = true;
            await PagePopover.Expand();
        }