Exemple #1
0
        private void UpdateNotification(string text, Color color, double seconds)
        {
            //update
            var Notification = new Label
            {
                Text                    = text,
                BackgroundColor         = color, //IndianRed / LightGreen
                VerticalOptions         = LayoutOptions.Start,
                HorizontalTextAlignment = TextAlignment.Center,
                IsVisible               = true,
            };

            UIContentLayers.Children.Add(Notification);
            UIContentLayers.RaiseChild(Notification);

            Task.Run(() => {
                Device.StartTimer(TimeSpan.FromSeconds(seconds), () => {
                    UIContentLayers.Children.Remove(Notification);
                    return(true);
                });
            });
        }
Exemple #2
0
        public void OnFloatingMenuPan(object sender, PanUpdatedEventArgs e)
        {
            UIContentLayers.RaiseChild(UISlidingPane);

            switch (e.StatusType)
            {
            case GestureStatus.Started:
                StartDragY = UISlidingPane.TranslationY;
                break;

            case GestureStatus.Running:
                UISlidingPane.TranslationY = StartDragY + e.TotalY;
                break;

            case GestureStatus.Completed:
                double final = UISlidingPane.TranslationY;
                double dist  = final - StartDragY;

                if (Math.Abs(dist) < 50) //minimum drag distance
                {
                    return;              //ignore smaller movenents
                }
                switch (dist > 0)        //direction
                {
                case true:
                    UISlidingPane.TranslateTo(0, LowerBounds);        //down
                    UIButtonCollapse.IsVisible = false;
                    break;

                case false:
                    UISlidingPane.TranslateTo(0, 0);        //top
                    break;
                }
                break;    //GestureStatus.Completed:
            }
        }