Exemplo n.º 1
0
 public MaterialPanel() : base()
 {
     isDisposing          = false;
     stringToColor        = new StringToColorConverter();
     stringToThickness    = new StringToThicknessConverter();
     stringToCornerRadius = new StringToCornerRadiusConverter();
 }
        public void TestInvalidColorReturnsTransparent(string str)
        {
            var converter = new StringToColorConverter();
            var result    = converter.Convert(str, typeof(SolidColorBrush), null, CultureInfo.CurrentCulture) as SolidColorBrush;

            Assert.That(result, Is.Not.Null);
            Assert.That(result.Color.A, Is.EqualTo(0x00));
        }
Exemplo n.º 3
0
 public MaterialStackLayoud() : base()
 {
     isDisposing          = false;
     stringToColor        = new StringToColorConverter();
     stringToThickness    = new StringToThicknessConverter();
     stringToCornerRadius = new StringToCornerRadiusConverter();
     canvas = new SKCanvasView();
     canvas.PaintSurface += OnPaintSurface;
     Children.Add(canvas);
 }
        public void TestColorConversion(string str, byte r, byte g, byte b)
        {
            var converter = new StringToColorConverter();
            var result    = converter.Convert(str, typeof(SolidColorBrush), null, CultureInfo.CurrentCulture) as SolidColorBrush;

            Assert.That(result, Is.Not.Null);
            Assert.That(result.Color.A, Is.EqualTo(0xFF));
            Assert.That(result.Color.R, Is.EqualTo(r));
            Assert.That(result.Color.G, Is.EqualTo(g));
            Assert.That(result.Color.B, Is.EqualTo(b));
        }
Exemplo n.º 5
0
        private List <TimelineItem> CreateTimelineItemsFor(DateTime from, DateTime to)
        {
            var converter = new StringToColorConverter();

            // get executions for today
            var executions = mpdsItems.SelectMany(i => i.Executions).Where(e => e.End <= to && e.Start >= from);
            var groups     = executions.Select(i => i.Task.Group).Distinct().ToList();

            return(executions.Select(e =>
                                     CreateTimelineItem(Factory.GetNonRepeatedImageNameFromName(e.Task.Group, groups), e.Start, e.End, (Color)converter.Convert(e.Task.Group, typeof(Color), null, null), true)).ToList());
        }
Exemplo n.º 6
0
        public CalendarCollectionViewCell(string labelBinding, bool selectionEnabled = false)
        {
            var colorConverter = new StringToColorConverter();

            var grid = new Grid {
                HeightRequest = _baseRowHeight
            };

            var contentLabel = new Label {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                TextColor         = Color.FromHex(Theme.Current.TodayCalendarBaseTextColor),
                Style             = AppStyles.GetLabelStyle(NamedSize.Small)
            };

            if (selectionEnabled)
            {
                contentLabel.SetBinding(Label.TextColorProperty, "TextColor", converter: colorConverter);
            }

            contentLabel.SetBinding(Label.TextProperty, labelBinding);

            if (selectionEnabled)
            {
                var selectedBoxView = new BoxView {
                    VerticalOptions   = LayoutOptions.Center,
                    HorizontalOptions = LayoutOptions.Center,
                    HeightRequest     = _baseRowHeight,
                    WidthRequest      = _baseRowHeight,
                    CornerRadius      = _baseRowHeight / 2
                };

                selectedBoxView.SetBinding(BoxView.ColorProperty, "SelectionColor", converter: colorConverter);
                grid.Children.Add(selectedBoxView);
            }
            else
            {
                contentLabel.FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label));
            }

            grid.Children.Add(contentLabel);
            Content = grid;
        }
Exemplo n.º 7
0
 public StringToColorConverterTests()
 {
     stringToColorConverter = new StringToColorConverter();
 }