Exemplo n.º 1
0
        public PictureDraft CreateDraft(TextReader inputData)
        {
            PictureDraft draft = new PictureDraft();

            while (true)
            {
                try
                {
                    var command = inputData.ReadLine().ToLower();
                    if (command == null || command == CommandExit)
                    {
                        break;
                    }

                    draft.AddShape(_factory.CreateShape(command));
                    Console.WriteLine("Successfuly added!");
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"Sth went wrong... {ex.Message}");
                }
            }

            return(draft);
        }
Exemplo n.º 2
0
 public void DrawPicture(PictureDraft pictureDraft, ICanvas canvas)
 {
     for (var i = 0; i < pictureDraft.ShapeCount; ++i)
     {
         var shape = pictureDraft.GetShapeByIndex(i);
         Console.WriteLine($"type: {shape.GetType().Name}");
         shape.Draw(canvas);
         Console.WriteLine("----------------------");
     }
 }
Exemplo n.º 3
0
 public void CreatePictureDraft(IDesigner designer, TextReader inStrm)
 {
     ShowHelpInfo();
     _draft = designer.CreateDraft(inStrm);
 }