Ejemplo n.º 1
0
        private void UpdateSizeSelectionMyVersion(Xamarin.Forms.Shapes.Rectangle border, Xamarin.Forms.Shapes.Path cup)
        {
            // clear the selections
            SolidColorBrush unselectedBackground = new SolidColorBrush(Color.FromHex("F8F8F8"));
            SolidColorBrush unselectedStroke     = new SolidColorBrush(Color.FromHex("E1E1E1"));
            SolidColorBrush selectedBackground   = new SolidColorBrush(Color.FromHex("E5F0EC"));
            SolidColorBrush selectedStroke       = new SolidColorBrush(Color.FromHex("1B714B"));

            SmallRect.Fill    = unselectedBackground;
            SmallRect.Stroke  = unselectedStroke;
            MediumRect.Fill   = unselectedBackground;
            MediumRect.Stroke = unselectedStroke;
            LargeRect.Fill    = unselectedBackground;
            LargeRect.Stroke  = unselectedStroke;
            SmallCup.Stroke   = unselectedStroke;
            MediumCup.Stroke  = unselectedStroke;
            LargeCup.Stroke   = unselectedStroke;

            // move the selectionRectangle
            SelectionRect.LayoutTo(border.Bounds, 100, Easing.CubicInOut);

            // update the background colors
            border.Fill = selectedBackground;

            // update the stroke on the cup
            cup.Stroke = selectedStroke;
        }
Ejemplo n.º 2
0
        public void RadiusCanBeSetFromStyle()
        {
            var rectangle = new Rect();

            Assert.AreEqual(0.0, rectangle.RadiusX);
            rectangle.SetValue(Rect.RadiusXProperty, 10.0, true);
            Assert.AreEqual(10.0, rectangle.RadiusX);

            Assert.AreEqual(0.0, rectangle.RadiusY);
            rectangle.SetValue(Rect.RadiusYProperty, 10.0, true);
            Assert.AreEqual(10.0, rectangle.RadiusY);
        }
Ejemplo n.º 3
0
        private void UpdateSizeSelection(SelectedSize selectedSize)
        {
            Xamarin.Forms.Shapes.Rectangle selectedRect = SmallRect;
            Xamarin.Forms.Shapes.Path      selectedCup  = SmallCup;
            switch (selectedSize)
            {
            case SelectedSize.small:
                selectedRect = SmallRect;
                selectedCup  = SmallCup;
                break;

            case SelectedSize.medium:
                selectedRect = MediumRect;
                selectedCup  = MediumCup;
                break;

            case SelectedSize.large:
                selectedRect = LargeRect;
                selectedCup  = LargeCup;
                break;
            }

            // clear the selections
            SolidColorBrush unselectedBackground = new SolidColorBrush(Color.FromHex("F8F8F8"));
            SolidColorBrush unselectedStroke     = new SolidColorBrush(Color.FromHex("E1E1E1"));
            SolidColorBrush selectedBackground   = new SolidColorBrush(Color.FromHex("E5F0EC"));
            SolidColorBrush selectedStroke       = new SolidColorBrush(Color.FromHex("1B714B"));

            SmallRect.Fill    = unselectedBackground;
            SmallRect.Stroke  = unselectedStroke;
            MediumRect.Fill   = unselectedBackground;
            MediumRect.Stroke = unselectedStroke;
            LargeRect.Fill    = unselectedBackground;
            LargeRect.Stroke  = unselectedStroke;
            SmallCup.Stroke   = unselectedStroke;
            MediumCup.Stroke  = unselectedStroke;
            LargeCup.Stroke   = unselectedStroke;

            // move the selectionRectangle
            SelectionRect.LayoutTo(selectedRect.Bounds, 100, Easing.CubicInOut);

            // update the background colors
            selectedRect.Fill = selectedBackground;

            // update the stroke on the cup
            selectedCup.Stroke = selectedStroke;
        }
Ejemplo n.º 4
0
        public RectangleDemoPage()
        {
            Label header = new Label
            {
                Text              = "Rectangle",
                FontSize          = 50,
                FontAttributes    = FontAttributes.Bold,
                HorizontalOptions = LayoutOptions.Center
            };

            Rect rectangle = new Rect
            {
                Fill              = Color.Red,
                WidthRequest      = 150,
                HeightRequest     = 50,
                HorizontalOptions = LayoutOptions.Center
            };

            Rect square = new Rect
            {
                Stroke            = Color.Red,
                StrokeThickness   = 4,
                WidthRequest      = 150,
                HeightRequest     = 150,
                HorizontalOptions = LayoutOptions.Center
            };

            // Build the page.
            Title   = "Rectangle Demo";
            Content = new StackLayout
            {
                Children =
                {
                    header,
                    rectangle,
                    square
                }
            };
        }
Ejemplo n.º 5
0
        public static void Main()
        {
            //force XF assembly load
            var _ = new Xamarin.Forms.Shapes.Rectangle();

            var types = (from domainAssembly in AppDomain.CurrentDomain.GetAssemblies()
                         // alternative: from domainAssembly in domainAssembly.GetExportedTypes()
                         from assemblyType in domainAssembly.GetTypes()
                         where typeof(BindableObject).IsAssignableFrom(assemblyType)
                         // alternative: where assemblyType.IsSubclassOf(typeof(B))
                         // alternative: && ! assemblyType.IsAbstract
                         select assemblyType)
                        .ToDictionary(_ => _.FullName, _ => _);

            foreach (var classNameToGenerate in File.ReadAllLines("WidgetList.txt").Where(_ => !string.IsNullOrWhiteSpace(_)))
            {
                var typeToScaffold = types[classNameToGenerate];
                var outputPath     = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "gen");
                Directory.CreateDirectory(outputPath);

                Scaffold(typeToScaffold, outputPath);
            }
        }