public InfiniteCanvasCreateTextBoxCommand(List <IDrawable> drawableList, double x, double y, double width, double height, int textFontSize, string text, Color color, bool isBold, bool isItalic) { _drawable = new TextDrawable( x, y, width, height, textFontSize, text, color, isBold, isItalic); _drawableList = drawableList; }
public override IDrawable Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) { throw new JsonException(); } reader.Read(); if (reader.TokenType != JsonTokenType.PropertyName) { throw new JsonException(); } string propertyName = reader.GetString(); if (propertyName != "$type") { throw new JsonException(); } reader.Read(); if (reader.TokenType != JsonTokenType.String) { throw new JsonException(); } var typeDiscriminator = reader.GetString(); IDrawable drawable; if (typeDiscriminator == GetDiscriminator(typeof(InkDrawable)) || typeDiscriminator == OldInkDrawableDiscriminator) { drawable = new InkDrawable(); } else if (typeDiscriminator == GetDiscriminator(typeof(TextDrawable)) || typeDiscriminator == OldTextDrawableDiscriminator) { drawable = new TextDrawable(); } else { throw new JsonException(); } while (reader.Read()) { if (reader.TokenType == JsonTokenType.EndObject) { drawable.OnDeserialized(); return(drawable); } if (reader.TokenType == JsonTokenType.PropertyName) { propertyName = reader.GetString(); reader.Read(); switch (propertyName) { case "IsActive": drawable.IsActive = reader.GetBoolean(); break; case "Bounds": drawable.Bounds = JsonSerializer.Deserialize <Rect>(ref reader); break; default: drawable.ReadProperty(propertyName, ref reader); break; } } } throw new JsonException(); }
public InfiniteCanvasUpdateTextColorCommand(TextDrawable drawable, Color oldText, Color newText) { _oldColor = oldText; _newColor = newText; _drawable = drawable; }
public InfiniteCanvasRemoveTextBoxCommand(List <IDrawable> drawableList, TextDrawable drawable) { _drawable = drawable; _drawableList = drawableList; }