public MainViewModel(IPrimitives primitives) { _availiableColors.Add(new SolidColorBrush(Colors.Gold)); _availiableColors.Add(new SolidColorBrush(Colors.Black)); _availiableColors.Add(new SolidColorBrush(Colors.Brown)); _availiableColors.Add(new SolidColorBrush(Colors.Coral)); _availiableColors.Add(new SolidColorBrush(Colors.ForestGreen)); Primitives.AddRange(primitives.GetPrimitives()); //setup callbacks foreach (var graphPrimitive in Primitives) { if (graphPrimitive.PrimitiveType == PrimitiveTypes.Pen) { graphPrimitive.OnDrawPrimitiveInBitmap += drawPenOnBitmap; graphPrimitive.OnDrawPrimitiveInteractiveState += drawPenInteractiveState; } if (graphPrimitive.PrimitiveType == PrimitiveTypes.Line) { graphPrimitive.OnDrawPrimitiveInBitmap += drawLineOnBitmap; graphPrimitive.OnDrawPrimitiveInteractiveState += drawLineInteractiveState; } if (graphPrimitive.PrimitiveType == PrimitiveTypes.Rectangle) { graphPrimitive.OnDrawPrimitiveInBitmap += drawRectangleOnBitmap; graphPrimitive.OnDrawPrimitiveInteractiveState += drawRectangleInteractiveState; } if (graphPrimitive.PrimitiveType == PrimitiveTypes.Ellipse) { graphPrimitive.OnDrawPrimitiveInBitmap += drawEllipseOnBitmap; graphPrimitive.OnDrawPrimitiveInteractiveState += drawEllipseInteractiveState; } } SelectedPrimitive = Primitives[0]; }