Пример #1
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (targetType != typeof(Brush))
            {
                return(null);
            }

            BrushCollection brushes = (BrushCollection)parameter;


            return((bool)value ? brushes[1] :
                   brushes[0]);
        }
Пример #2
0
        public static object GetProperty(this BrushCollection brushCollection, BrushCollectionProperty brushCollectionProperty)
        {
            switch (brushCollectionProperty)
            {
            case BrushCollectionProperty.Text: return(brushCollection.Text);

            case BrushCollectionProperty.Foreground: return(brushCollection.Foreground);

            case BrushCollectionProperty.Background: return(brushCollection.Background);

            default: return(null);
            }
        }
Пример #3
0
        public static string ToText(this BrushCollection brushCollection)
        {
            var result = string.Empty;

            foreach (var brush in brushCollection)
            {
                result += brush.ToColor().ToHex();
                if (brush is GradientBrush)
                {
                    result += "^";
                }
                result += " ";
            }
            return(result);
        }
Пример #4
0
    private void SerializeBrushCollection()
    {
        string brushXmlPath = System.IO.Path.Combine(Application.dataPath, "BrushCollectionTest.xml");

        BrushCollection brushes = new BrushCollection();

        brushes.Brushes.Add(strokeSketchObject.GetBrush());
        brushes.Brushes.Add(patchSketchObject.GetBrush());
        brushes.Brushes.Add(ribbonSketchObject.GetBrush());
        Serializer.SerializeToXmlFile <BrushCollection>(brushes, brushXmlPath);

        BrushCollection loadedBrushes;

        Serializer.DeserializeFromXmlFile <BrushCollection>(out loadedBrushes, brushXmlPath);
        Debug.Log(loadedBrushes.Brushes.Count);
    }
Пример #5
0
        public MainViewModel(IInkPageDataprovider inkPageDataProvider, ISettingsDataProvider settingsDataProvider, InkCanvas inkCanvas, Rectangle rectangle)
        {
            _settingsDataProvider = settingsDataProvider;
            _inkPageDataProvider  = inkPageDataProvider;

            //DefaultColors
            Colors_BallpointPen = new BrushCollection()
            {
                new SolidColorBrush(Windows.UI.Colors.Black),
                new SolidColorBrush(Windows.UI.Colors.Gray),
                new SolidColorBrush(Windows.UI.Colors.MediumVioletRed),
                new SolidColorBrush(Windows.UI.Colors.Red),
                new SolidColorBrush(Windows.UI.Colors.Orange),
                new SolidColorBrush(Windows.UI.Colors.Gold),

                new SolidColorBrush(ColorsHelper.GetColorFromHexa("#A2E61B").Color),
                new SolidColorBrush(ColorsHelper.GetColorFromHexa("#008055").Color),
                new SolidColorBrush(ColorsHelper.GetColorFromHexa("#00AACC").Color),
                new SolidColorBrush(ColorsHelper.GetColorFromHexa("#004DE6").Color),
                new SolidColorBrush(ColorsHelper.GetColorFromHexa("#6600CC").Color),
                new SolidColorBrush(ColorsHelper.GetColorFromHexa("#8E562E").Color),
            };
            Colors_Pencil = new BrushCollection()
            {
                new SolidColorBrush(Windows.UI.Colors.Black),
                new SolidColorBrush(Windows.UI.Colors.Gray),
                new SolidColorBrush(Windows.UI.Colors.MediumVioletRed),
                new SolidColorBrush(Windows.UI.Colors.Red),
                new SolidColorBrush(Windows.UI.Colors.Orange),
                new SolidColorBrush(Windows.UI.Colors.Gold),
                new SolidColorBrush(ColorsHelper.GetColorFromHexa("#A2E61B").Color),
                new SolidColorBrush(ColorsHelper.GetColorFromHexa("#008055").Color),
                new SolidColorBrush(ColorsHelper.GetColorFromHexa("#00AACC").Color),
                new SolidColorBrush(ColorsHelper.GetColorFromHexa("#004DE6").Color),
                new SolidColorBrush(ColorsHelper.GetColorFromHexa("#6600CC").Color),
                new SolidColorBrush(ColorsHelper.GetColorFromHexa("#8E562E").Color),
            };
            Colors_Highlighter = new BrushCollection()
            {
                new SolidColorBrush(ColorsHelper.GetColorFromHexa("#FFE600").Color),
                new SolidColorBrush(ColorsHelper.GetColorFromHexa("#26E600").Color),
                new SolidColorBrush(ColorsHelper.GetColorFromHexa("#44C8F5").Color),
                new SolidColorBrush(ColorsHelper.GetColorFromHexa("#EC008C").Color),
                new SolidColorBrush(ColorsHelper.GetColorFromHexa("#FF5500").Color),
                new SolidColorBrush(ColorsHelper.GetColorFromHexa("#6600CC").Color),
            };
        }
Пример #6
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            BrushCollection brushes = (BrushCollection)parameter;

            if (brushes == null)
            {
                brushes = new BrushCollection();
                brushes.Add((Brush)App.Current.Resources["ThemeTextForegroundBrush"]);
                brushes.Add(new SolidColorBrush(Colors.Blue));
                brushes.Add(new SolidColorBrush(Colors.Red));
            }

            if (targetType != typeof(Brush))
            {
                return(null);
            }

            if ((int)value == 0)
            {
                return(brushes[1]);
            }

            return((int)value < 0 ? brushes[2] : brushes[0]);
        }
Пример #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MapElementViewModel"/> class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="bedData">The bed data.</param>
        /// <param name="fillBrushes">The fill brushes.</param>
        /// <param name="strokeBrushes">The stroke brushes.</param>
        public MapElementViewModel(string name, BedData bedData, BrushCollection fillBrushes, BrushCollection strokeBrushes)
        {
            Name = name;

            if (bedData != null)
            {
                BedData       = bedData;
                _fill         = fillBrushes[(int)(BedData.BedStatus) + 1];
                _inactiveFill = fillBrushes[0];

                var strokeIndex = BedData.BedStatus != BedStatus.Free ? ((int)(BedData.Patient.Gender) + 1) : 0;

                _stroke          = strokeBrushes[strokeIndex];
                _strokeThickness = strokeIndex == 0 ? new Thickness(0) : new Thickness(3);
                _inactiveStroke  = strokeBrushes[0];
            }
            else
            {
                IsStub           = true;
                _fill            = fillBrushes[0];
                _stroke          = strokeBrushes[0];
                _strokeThickness = new Thickness(1);
            }
        }
Пример #8
0
        private static void Overlay_OnGraphicsSetup(object sender, SetupGraphicsEventArgs e)
        {
            //textbox = new DxTextBox("2", "qwertyuiop[]asdfghjkl;'zxcvbnm,./1234567890") { Margin = new Thickness(650, 10, 0, 0), Width = 550 };
            //textbox1 = new DxTextBox("2", "qwertyuiop[]asdfghjkl;'zxcvbnm,./1234567890".ToUpperInvariant()) { Margin = new Thickness(650, 35, 0, 0), Width = 550 };
            //Controls.Add(textbox);
            //Controls.Add(textbox1);

            //l1 = new DxLabel("1", $"{g.Graphics.MeasureText(textbox.Text.Substring(0, textbox.CaretPos + 1), FontCollection.Get("Control.Font").Font).Width}") { Margin = new Thickness(10, 35, 0, 0), Width = 200 };
            //Controls.Add(l1);

            //tb = new DxTrackBar("3", "DxTrackBar")
            //{
            //    Margin = new Thickness(200,500,0,0),
            //    Min = 0,
            //    Max = 255,
            //    TickRate = 1,
            //    Value = 0,
            //    IsSnapToTick = true
            //};
            //Controls.Add(tb);
            ////l = new DxLabel("1", $"")
            ////{
            ////    Margin = new Thickness(10, 10, 0, 0), Width = 800, Height = 500
            ////};
            ////Controls.Add(l);

            //bmp = new Image(g.Graphics.GetRenderTarget(), "q.png");
            //var q = new DxImage("", bmp){Margin = new Thickness(10,10,0,0), Width = 200, Height = 200};
            //Controls.Add(q);

            var button = new DxButton("button", "Test")
            {
                Margin = new Thickness(10, 10, 0, 0)
            };

            button.Click += btn =>
            {
                //MsgBox();
            };

            Controls.Add(button);

            var image = new DxImage("image", new Image(g.Graphics.GetRenderTarget(), "q.png"))
            {
                Width = 50, Height = 75, Margin = new Thickness(100, 10, 0, 0)
            };

            Controls.Add(image);

            var panel = new DxPanel("panel")
            {
                Width       = 50,
                Height      = 75,
                Margin      = new Thickness(100, 10, 0, 0),
                StrokeBrush = BrushCollection.Get("Control.Stroke").Brush
            };

            Controls.Add(panel);

            var imagebutton = new DxImageButton("imagebutton", new Image(g.Graphics.GetRenderTarget(), "q.png"))
            {
                Width = 50, Height = 75, Margin = new Thickness(200, 10, 0, 0)
            };

            imagebutton.Click += btn =>
            {
                //MsgBox();
            };
            Controls.Add(imagebutton);

            var label = new DxLabel("label", "text")
            {
                Margin = new Thickness(300, 10, 0, 0)
            };

            Controls.Add(label);

            var textbox = new DxTextBox("textbox", "test")
            {
                Width  = 100,
                Margin = new Thickness(100, 150, 0, 0)
            };

            Controls.Add(textbox);

            var toggle = new DxToggle("toggle", "test toggle")
            {
                Width    = 200,
                Margin   = new Thickness(100, 200, 0, 0),
                IsActive = true
            };

            Controls.Add(toggle);

            var trackbar = new DxTrackBar("trackbar", "trackbar test")
            {
                Width        = 200,
                Max          = 250,
                Min          = 0,
                IsSnapToTick = true,
                TickRate     = 1,
                Margin       = new Thickness(100, 250, 0, 0)
            };

            Controls.Add(trackbar);
        }
Пример #9
0
        /// <summary>Converts brushes in BrushCollection to LinearGradientBrush </summary>
        public static LinearGradientBrush ToGradientBrush(this BrushCollection brushCollection)
        {
            var brushes = brushCollection.ToList();

            return(brushes.ToGradientBrush());
        }
Пример #10
0
 /// <summary>Creates BrushCollection from a list of Brushes </summary>
 public static BrushCollection FromColors(this BrushCollection brushCollection, List <NamedColor> colors)
 {
     return(brushCollection.AddRange(colors));
 }
Пример #11
0
 /// <summary>Creates BrushCollection from a list of LinearGradientBrush </summary>
 public static BrushCollection FromBrushes(this BrushCollection brushCollection, List <LinearGradientBrush> brushes)
 {
     return(brushCollection.AddRange(brushes));
 }
Пример #12
0
 /// <summary>Creates BrushCollection from a list of SolidColorBrush </summary>
 public static BrushCollection FromBrushes(this BrushCollection brushCollection, List <SolidColorBrush> brushes)
 {
     return(brushCollection.AddRange(brushes));
 }
Пример #13
0
        /// <summary>Blends brushes in BrushCollection to SolidColorBrush </summary>
        public static SolidColorBrush Blend(this BrushCollection brushCollection)
        {
            var brushes = brushCollection.ToList();

            return(brushes.Blend());
        }
Пример #14
0
 public GeoMarkerBrushScale()
 {
     Brushes = new BrushCollection();
     Brushes.CollectionChanged += Brushes_CollectionChanged;
 }