Пример #1
0
 public Circle(double radius, Brush fill, Brush stroke, Brush labelColor, double opacity = 1)
 {
     _circle  = new Ellipse();
     _label   = new CircleLabel(labelColor, null);
     Radius   = radius;
     Fill     = fill;
     Stroke   = stroke;
     Position = new Point(0, 0);
     Opacity  = opacity;
     InitMouseEvents();
 }
Пример #2
0
 public void SelectCircle(CircleLabel target = null)
 {
     foreach (CircleLabel clbl in CircleLabels)
     {
         if (clbl != target)
         {
             clbl.TextColor = Color.Gray;
         }
     }
     if (target != null)
     {
         target.TextColor = Color.FromHex("0076FF");
     }
 }
Пример #3
0
        public void DrawSelector(TableArray tableArray)
        {
            Device.StartTimer(TimeSpan.FromMilliseconds(100), () =>
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    SelectorStack = new StackLayout
                    {
                        HorizontalOptions = LayoutOptions.CenterAndExpand,
                        VerticalOptions   = LayoutOptions.CenterAndExpand,
                        HeightRequest     = 20,
                        Padding           = 0,
                        Spacing           = 4,
                        Orientation       = StackOrientation.Horizontal,
                    };
                    if (TableStack.Children.Count == 2)
                    {
                        CircleLabels = new List <CircleLabel>();
                        for (int r = 0; r < tableArray.TableData.GetUpperBound(0); r++)
                        {
                            var circleLabel = new CircleLabel(r);
                            if (r % 2 == 0)
                            {
                                circleLabel.IsVisible = true;
                            }
                            else
                            {
                                circleLabel.IsVisible = false;
                            }
                            var tapGestureRecognizer     = new TapGestureRecognizer();
                            tapGestureRecognizer.Tapped += async(CircleLabel, e) =>
                            {
                                IsBusy   = true;
                                var cell = pageGrid.tableGrid.Children[(CircleLabel as CircleLabel).Index];

                                SelectCircle((CircleLabel as CircleLabel));
                                await pageGrid.tableScroll.ScrollToAsync(cell.Bounds.Left, 0, true);
                                IsBusy = false;
                            };
                            circleLabel.GestureRecognizers.Add(tapGestureRecognizer);
                            SelectorStack.Children.Add(circleLabel);
                            CircleLabels.Add(circleLabel);
                        }
                    }



                    if (TableStack.Children.Count == 2)
                    {
                        var selectorScroll = new ScrollView
                        {
                            Orientation       = ScrollOrientation.Horizontal,
                            HorizontalOptions = LayoutOptions.FillAndExpand,
                            VerticalOptions   = LayoutOptions.StartAndExpand,
                            Padding           = 0,
                            Content           = SelectorStack,
                        };
                        TableStack.Children.Add(selectorScroll);
                        AI.IsVisible           = false;
                        AI.IsRunning           = false;
                        VerticalScroll.Content = pageGrid;
                        Device.StartTimer(TimeSpan.FromMilliseconds(10), () =>
                        {
                            if (pageGrid.tableScroll.ContentSize.Width > pageGrid.tableScroll.Width)
                            {
                                SelectorStack.IsVisible = true;
                            }
                            else
                            {
                                SelectorStack.IsVisible = false;
                            }
                            return(false);
                        });

                        IsBusy = false;
                    }
                });
                return(false);
            });
        }