예제 #1
0
        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();
        }
예제 #2
0
        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();
        }
예제 #3
0
파일: Program.cs 프로젝트: jz36/bro
        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();
        }
예제 #4
0
파일: SvgExporter.cs 프로젝트: ymnsh/lab6
        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());
        }
예제 #5
0
파일: Program.cs 프로젝트: ymnsh/lab6
        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();
        }
예제 #6
0
        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();
        }