static void Main(string[] args) { Console.OutputEncoding = Encoding.UTF8; var picture = new Picture(); var ui = new DrawableGUI(picture); var app = new ConsoleUI.Application(); app.AddCommand(new ExitCommand(app)); app.AddCommand(new ExplainCommand(app)); app.AddCommand(new HelpCommand(app)); app.AddCommand(new PointCommand(picture)); app.AddCommand(new LineCommand(picture)); app.AddCommand(new SaveCommand(ui.GetForm())); app.AddCommand(new LoadCommand(picture)); app.AddCommand(new RemoveCommand(picture)); app.AddCommand(new ListCommand(picture)); app.AddCommand(new EllipseCommand(picture)); app.AddCommand(new CircleCommand(picture)); app.AddCommand(new ColorCommand(picture)); app.AddCommand(new WidthCommand(picture)); picture.Changed += ui.Refresh; ui.Start(); app.Run(Console.In); ui.Stop(); }
private static void Main(string[] args) { var picture = new Picture(); var ui = new DrawableGUI(picture); var app = new Application(); app.AddCommand(new ExitCommand(app)); app.AddCommand(new ExplainCommand(app)); app.AddCommand(new HelpCommand(app)); app.AddCommand(new PointCommand(picture)); app.AddCommand(new LineCommand(picture)); app.AddCommand(new EllipseCommand(picture)); app.AddCommand(new CircleCommand(picture)); app.AddCommand(new ListCommand(picture)); app.AddCommand(new RemoveCommand(picture)); app.AddCommand(new ColorCommand(picture)); app.AddCommand(new WidthCommand(picture)); picture.Changed += ui.Refresh; ui.Start(); app.Run(Console.In); ui.Stop(); }
static void Main(string[] args) { var picture = new Picture(); var ui = new DrawableGUI(picture); var app = new Application(); app.AddCommand(new ExitCommand(app)); app.AddCommand(new ExplainCommand(app)); app.AddCommand(new HelpCommand(app)); picture.Changed += ui.Refresh; ui.Start(); app.Run(); ui.Stop(); }
public void Export(List <IShape> shapes, string fileName) { var width = DrawableGUI.GetFormWidth(); var height = DrawableGUI.GetFormHeight(); var actualHeader = string.Format(HEADER, width, height); var stringBuilder = new StringBuilder(); stringBuilder.AppendLine(actualHeader); foreach (var shape in shapes) { stringBuilder.AppendLine(shape.ToSvg()); } stringBuilder.AppendLine(CLOSING_TAG); fileName = fileName.Contains(".svg") ? fileName : fileName + ".svg"; File.WriteAllText($"{fileName}", stringBuilder.ToString()); }
static void Main(string[] args) { var picture = new Picture(); var ui = new DrawableGUI(picture); var app = new Application(); app.AddCommand(new ExitCommand(app)); app.AddCommand(new ExplainCommand(app)); app.AddCommand(new HelpCommand(app)); app.AddCommand(new DrawPointCommand(picture)); app.AddCommand(new DrawLineCommand(picture)); app.AddCommand(new DrawEllipseCommand(picture)); app.AddCommand(new DrawCircleCommand(picture)); app.AddCommand(new ListCommand(picture)); app.AddCommand(new RemoveCommand(picture)); app.AddCommand(new RotateCommand(picture)); app.AddCommand(new ScaleCommand(picture)); app.AddCommand(new TranslateCommand(picture)); app.AddCommand(new GroupCommand(picture)); app.AddCommand(new UngroupCommand(picture)); app.AddCommand(new SelectionListCommand()); app.AddCommand(new SelectCommand(picture)); app.AddCommand(new SelectionAddCommand(picture)); app.AddCommand(new SelectionRemoveCommand(picture)); app.AddCommand(new UndoCommand(picture)); app.AddCommand(new RedoCommand(picture)); app.AddCommand(new SaveCommand(picture)); app.AddCommand(new LoadCommand(app, picture)); app.AddCommand(new ExportCommand(picture, new SvgExporter())); CommandHistoryContainer.Init(picture); picture.Changed += ui.Refresh; ui.Start(); app.Run(Console.In); ui.Stop(); }
public static void Main(string[] args) { var picture = new Picture(); var ui = new DrawableGUI(picture); var app = new Application(); app.AddCommand(new ExitCommand(app)); app.AddCommand(new ExplainCommand(app)); app.AddCommand(new HelpCommand(app)); // Shapes app.AddCommand(new PointCommand(picture)); // Other app.AddCommand(new ListCommand(picture)); app.AddCommand(new RemoveCommand(picture)); app.AddCommand(new GroupCommand(picture)); app.AddCommand(new UngroupCommand(picture)); picture.Changed += ui.Refresh; ui.Start(); app.Run(Console.In); ui.Stop(); }