public void Action(object sender, object contextObject) { IShapePlugin shapePlugin = (IShapePlugin)contextObject; HandlePluginParameters(shapePlugin); IShape shape = shapePlugin.GetShape(); canvas.AddShape(shape); Console.WriteLine("Shapes on canvas:"); canvas.DrawShapes(); Console.ReadKey(); }
private void HandlePluginParameters(IShapePlugin plugin) { List <string> arguments = (List <string>)plugin.GetRequiredArguments(); if (arguments.Count != 0) { Dictionary <string, string> parameters = new Dictionary <string, string>(); Console.WriteLine("Enter parameters: "); foreach (var arg in arguments) { Console.WriteLine(arg + ": "); parameters[arg] = Console.ReadLine(); } plugin.SetArguments(parameters); } }
public void AddAvailableShape(IShapePlugin shapePlugin) { addShapesSubMenu.SetMenuItem(shapePlugins.Count + 1, shapePlugin.GetName(), () => container.Add(shapePlugin.ReadShape())); shapePlugins.Add(shapePlugin); }