Beispiel #1
0
 /// <summary>
 /// An event that fires when a Category is appended to the current projects display library.
 /// </summary>
 /// <param name="library">[in] The Style Library object the category was appended too.</param>
 /// <param name="category">[in] The Category object Appended to the Style Library.</param>
 public static void DoCategoryAppended(StyleLibrary library, StyleCategory category)
 {
     string message = null;
     message = string.Format("\nCategory {0} was appended to the Style Library which now has {1} Categories.", category.Name, library.CategoryCount);
     Utility.ShowMessage(message);
 }
        public IStyleLibrary CreateStyleLibrary()
        {
            var styleLibrary = new StyleLibrary()
            {
                Items = new ObservableCollection <ShapeStyle>()
            };

            var fontFamily = "Calibri";

            styleLibrary.Items.Add(
                new ShapeStyle(
                    "Default",
                    new ArgbColor(255, 0, 0, 0),
                    new ArgbColor(255, 255, 255, 255),
                    true, false, true, 2.0,
                    new TextStyle(fontFamily, 12.0, HAlign.Center, VAlign.Center, new ArgbColor(255, 0, 0, 0), true)));

            styleLibrary.Items.Add(
                new ShapeStyle(
                    "Red",
                    new ArgbColor(255, 255, 0, 0),
                    new ArgbColor(255, 255, 0, 0),
                    true, false, true, 2.0,
                    new TextStyle(fontFamily, 12.0, HAlign.Center, VAlign.Center, new ArgbColor(255, 255, 0, 0), true)));

            styleLibrary.Items.Add(
                new ShapeStyle(
                    "Green",
                    new ArgbColor(255, 0, 255, 0),
                    new ArgbColor(255, 0, 255, 0),
                    true, false, true, 2.0,
                    new TextStyle(fontFamily, 12.0, HAlign.Center, VAlign.Center, new ArgbColor(255, 0, 255, 0), true)));

            styleLibrary.Items.Add(
                new ShapeStyle(
                    "Blue",
                    new ArgbColor(255, 0, 0, 255),
                    new ArgbColor(255, 0, 0, 255),
                    true, false, true, 2.0,
                    new TextStyle(fontFamily, 12.0, HAlign.Center, VAlign.Center, new ArgbColor(255, 0, 0, 255), true)));

            styleLibrary.Items.Add(
                new ShapeStyle(
                    "Cyan",
                    new ArgbColor(255, 0, 255, 255),
                    new ArgbColor(255, 0, 255, 255),
                    true, false, true, 2.0,
                    new TextStyle(fontFamily, 12.0, HAlign.Center, VAlign.Center, new ArgbColor(255, 0, 255, 255), true)));

            styleLibrary.Items.Add(
                new ShapeStyle(
                    "Magenta",
                    new ArgbColor(255, 255, 0, 255),
                    new ArgbColor(255, 255, 0, 255),
                    true, false, true, 2.0,
                    new TextStyle(fontFamily, 12.0, HAlign.Center, VAlign.Center, new ArgbColor(255, 255, 0, 255), true)));

            styleLibrary.Items.Add(
                new ShapeStyle(
                    "Yellow",
                    new ArgbColor(255, 255, 255, 0),
                    new ArgbColor(255, 255, 255, 0),
                    true, false, true, 2.0,
                    new TextStyle(fontFamily, 12.0, HAlign.Center, VAlign.Center, new ArgbColor(255, 255, 255, 0), true)));

            styleLibrary.Items.Add(
                new ShapeStyle(
                    "Black",
                    new ArgbColor(255, 0, 0, 0),
                    new ArgbColor(255, 0, 0, 0),
                    true, false, true, 2.0,
                    new TextStyle(fontFamily, 12.0, HAlign.Center, VAlign.Center, new ArgbColor(255, 0, 0, 0), true)));

            styleLibrary.Items.Add(
                new ShapeStyle(
                    "Decorator-Stroke",
                    new ArgbColor(255, 0, 255, 255),
                    new ArgbColor(255, 0, 255, 255),
                    true, false, true, 2.0,
                    new TextStyle(fontFamily, 12.0, HAlign.Center, VAlign.Center, new ArgbColor(255, 0, 255, 255), true)));

            styleLibrary.Items.Add(
                new ShapeStyle(
                    "Decorator-Fill",
                    new ArgbColor(255, 0, 255, 255),
                    new ArgbColor(255, 0, 255, 255),
                    false, true, true, 2.0,
                    new TextStyle(fontFamily, 12.0, HAlign.Center, VAlign.Center, new ArgbColor(255, 0, 255, 255), true)));

            styleLibrary.Items.Add(
                new ShapeStyle(
                    "Guide",
                    new ArgbColor(128, 0, 255, 255),
                    new ArgbColor(128, 0, 255, 255),
                    true, true, true, 2.0,
                    new TextStyle(fontFamily, 12.0, HAlign.Center, VAlign.Center, new ArgbColor(128, 0, 255, 255), true)));

            styleLibrary.Items.Add(
                new ShapeStyle(
                    "Selection",
                    new ArgbColor(255, 0, 120, 215),
                    new ArgbColor(60, 170, 204, 238),
                    true, true, true, 2.0,
                    new TextStyle(fontFamily, 12.0, HAlign.Center, VAlign.Center, new ArgbColor(255, 0, 120, 215), true)));

            styleLibrary.Items.Add(
                new ShapeStyle(
                    "PointTemplate",
                    new ArgbColor(255, 255, 0, 255),
                    new ArgbColor(255, 255, 0, 255),
                    false, true, true, 2.0,
                    new TextStyle(fontFamily, 12.0, HAlign.Center, VAlign.Center, new ArgbColor(255, 255, 0, 255), true)));

            styleLibrary.CurrentItem = styleLibrary.Items[0];

            return(styleLibrary);
        }