Exemplo n.º 1
0
        public void TestMethod7()
        {
            Canvas canvas = new Canvas();

            canvas.XOne = 10;
            canvas.YOne = 20;
            canvas.XTwo = 10;
            canvas.YTwo = 10;
            ICanvasService canvasService = FactoryCanvas.GetCanvas();

            string[,] str = canvasService.DrawingCanvas(canvas);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            XmlConfigurator.Configure();
            do
            {
                try
                {
                    Entities.Canvas canvas = new Entities.Canvas();//FactoryRectangleObject.GetRectagle();
                    Console.WriteLine("Enter values for co-ordinates");
                    Console.WriteLine("Enter X co-ordinate for point one");
                    canvas.XOne = Validate.ValidateNumber(Console.ReadLine());
                    Console.WriteLine("Enter Y co-ordinate for point one");
                    canvas.YOne = Validate.ValidateNumber(Console.ReadLine());
                    Console.WriteLine("Enter X co-ordinate for point two");
                    canvas.XTwo = Validate.ValidateNumber(Console.ReadLine());
                    Console.WriteLine("Enter Y co-ordinate for point two");
                    canvas.YTwo = Validate.ValidateNumber(Console.ReadLine());
                    ICanvasService canvasService = FactoryCanvas.GetCanvas();
                    string[,] canvasStorage = canvasService.DrawingCanvas(canvas);



                    Console.WriteLine("enter your choice");
                    Console.WriteLine("1 . line");
                    Console.WriteLine("2 . rectangle");
                    Console.WriteLine("3 . circle");
                    Console.WriteLine("4 . Triangle");
                    Console.WriteLine("5 . Polygon");
                    string choice = Console.ReadLine();
                    switch (choice)
                    {
                    case "1":
                        Line line = new Line();    //FactoryLineObject.GetLine();
                        Console.WriteLine("Enter values for co-ordinates");
                        Console.WriteLine("Enter X co-ordinate for point one");
                        line.PointOneX = Validate.ValidateNumber(Console.ReadLine());
                        Console.WriteLine("Enter Y co-ordinate for point one");
                        line.PointOneY = Validate.ValidateNumber(Console.ReadLine());
                        Console.WriteLine("Enter X co-ordinate for point two");
                        line.PointTwoX = Validate.ValidateNumber(Console.ReadLine());
                        Console.WriteLine("Enter Y co-ordinate for point two");
                        line.PointTwoY = Validate.ValidateNumber(Console.ReadLine());
                        ILineOperation lineOperation = FactoryLineOperationObject.GetLineOperation();
                        lineOperation.DrawingLine(line, canvas);
                        logger.Info("Line with co-ordinate x1 => " + line.PointOneX + " y1 => " + line.PointOneY +
                                    " x2 => " + line.PointTwoX + " y2 => " + line.PointTwoY);

                        break;

                    case "2":
                        Entities.Rectangle rectangle = new Entities.Rectangle();    //FactoryRectangleObject.GetRectagle();
                        Console.WriteLine("Enter values for co-ordinates");
                        Console.WriteLine("Enter X co-ordinate for point one");
                        rectangle.PointOneX = Validate.ValidateNumber(Console.ReadLine());
                        Console.WriteLine("Enter Y co-ordinate for point one");
                        rectangle.PointOneY = Validate.ValidateNumber(Console.ReadLine());
                        Console.WriteLine("Enter X co-ordinate for point two");
                        rectangle.PointTwoX = Validate.ValidateNumber(Console.ReadLine());
                        Console.WriteLine("Enter Y co-ordinate for point two");
                        rectangle.PointTwoY = Validate.ValidateNumber(Console.ReadLine());
                        IRectangleOperation rectangleOperation = FactoryRectangleOerationObject.GetRectagleOperation();
                        rectangleOperation.DrawingRectangle(rectangle, canvas);

                        logger.Info("Rectangle with co-ordinate x1 => " + rectangle.PointOneX + " y1 => " + rectangle.PointOneY +
                                    " x2 => " + rectangle.PointTwoX + " y2 => " + rectangle.PointTwoY);
                        break;

                    case "3":
                        Circle circle = new Circle();    //FactoryCircleObject.GetCircle();
                        Console.WriteLine("Enter values for co-ordinates");
                        Console.WriteLine("Enter X co-ordinate for centre");
                        circle.CentreX = Validate.ValidateNumber(Console.ReadLine());
                        Console.WriteLine("Enter Y co-ordinate for centre");
                        circle.CentreY = Validate.ValidateNumber(Console.ReadLine());
                        Console.WriteLine("Enter radius for circle");
                        circle.Radius = Validate.ValidateNumber(Console.ReadLine());
                        ICircleOperation circleOperation = FactoryCircleOperationObject.GetCircleOperationObject();
                        circleOperation.DrawingCircle(circle);
                        logger.Info("Circle with co-ordinate x1 => " + circle.CentreX + " y1 => " + circle.CentreY +
                                    " radius => " + circle.Radius);
                        break;

                    case "4":

                        Triangle triangle = new Triangle();    //FactoryEntity.GetTriangle();
                        Point    point    = new Point();
                        Console.WriteLine("Enter values for point one");
                        Console.WriteLine("Enter X co-ordinate for centre");
                        point.X = (int)Validate.ValidateNumber(Console.ReadLine());
                        Console.WriteLine("Enter Y co-ordinate point one");
                        point.Y           = (int)Validate.ValidateNumber(Console.ReadLine());
                        triangle.PointOne = point;

                        Console.WriteLine("Enter X co-ordinate point two");
                        point.X = (int)Validate.ValidateNumber(Console.ReadLine());
                        Console.WriteLine("Enter Y co-ordinate point two");
                        point.Y           = (int)Validate.ValidateNumber(Console.ReadLine());
                        triangle.PointTwo = point;


                        Console.WriteLine("Enter X co-ordinate point Three");
                        point.X = (int)Validate.ValidateNumber(Console.ReadLine());
                        Console.WriteLine("Enter Y co-ordinate point Three");
                        point.Y             = (int)Validate.ValidateNumber(Console.ReadLine());
                        triangle.PointThree = point;


                        ITriangleOperation triangleOperation = FactoryService.GetTriangleOperationObject();
                        triangleOperation.DrawingTriangle(triangle);
                        //Polygon polygon = FactoryEntity.GetPolygon();
                        //polygon.PointOne = new Point(10, 10);
                        //polygon.PointTwo = new Point(20, 10);
                        //polygon.PointThree = new Point(30, 20);
                        //polygon.PointFour = new Point(20, 30);
                        //polygon.PointFive = new Point(10, 30);
                        //polygon.PointSix = new Point(5, 20);
                        //IPolygonOperation polygonOperation = FactoryService.GetPolygon();
                        //polygonOperation.DrawingPolygon(polygon);
                        logger.Info("trangle with co-ordinate x1 => " + triangle.PointOne.X + " y1 => " + triangle.PointOne.Y +
                                    " X2 => " + triangle.PointTwo.X + " Y2 => " + triangle.PointTwo.Y +
                                    " x3=>  " + triangle.PointThree.X + " Y3 => " + triangle.PointThree.Y);
                        break;

                    case "5":

                        Circle circlep = new Circle();    //FactoryCircleObject.GetCircle();
                        Console.WriteLine("Enter values for co-ordinates");
                        Console.WriteLine("Enter X co-ordinate for centre");
                        circlep.CentreX = Validate.ValidateNumber(Console.ReadLine());
                        Console.WriteLine("Enter Y co-ordinate for centre");
                        circlep.CentreY = Validate.ValidateNumber(Console.ReadLine());
                        Console.WriteLine("Enter radius for circle");
                        circlep.Radius = Validate.ValidateNumber(Console.ReadLine());
                        IPolygonOperation polygonOperation = FactoryService.GetPolygon();
                        polygonOperation.DrawingPolygon(circlep);
                        logger.Info("polygon with co-ordinate x1 => " + circlep.CentreX + " y1 => " + circlep.CentreY +
                                    " radius => " + circlep.Radius);
                        //Circle circle1 = FactoryCircleObject.GetCircle();
                        //circle1.CentreX = 100.0;
                        //circle1.CentreY = 100.0;
                        //circle1.Radius = 100.0;
                        //IPolygonOperation polygonOperation = FactoryService.GetPolygon();
                        //polygonOperation.DrawingPolygon(circle1);
                        break;
                    //case "6":
                    //    Entities.Canvas canvas = new Entities.Canvas();//FactoryRectangleObject.GetRectagle();
                    //    Console.WriteLine("Enter values for co-ordinates");
                    //    Console.WriteLine("Enter X co-ordinate for point one");
                    //    canvas.XOne = Validate.ValidateNumber(Console.ReadLine());
                    //    Console.WriteLine("Enter Y co-ordinate for point one");
                    //    canvas.YOne = Validate.ValidateNumber(Console.ReadLine());
                    //    Console.WriteLine("Enter X co-ordinate for point two");
                    //    canvas.XTwo = Validate.ValidateNumber(Console.ReadLine());
                    //    Console.WriteLine("Enter Y co-ordinate for point two");
                    //    canvas.YTwo = Validate.ValidateNumber(Console.ReadLine());
                    //    ICanvasService canvasService = FactoryCanvas.GetCanvas();
                    //    canvasService.DrawingCanvas(canvas);

                    //    logger.Info("Rectangle with co-ordinate x1 => " + canvas.XOne + " y1 => " + canvas.YOne +
                    //        " x2 => " + canvas.XTwo + " y2 => " + canvas.YTwo);
                    //    break;
                    default:
                        Console.WriteLine("please check your Input");
                        logger.Error("wrong input Enter by user");
                        break;
                    }
                }
                catch (Exception e)
                {
                    logger.Error(e.Message);
                }
            } while (true);
        }
Exemplo n.º 3
0
 public CanvasController(
     ICanvasService canvasService)
 {
     _canvasService = canvasService;
 }
Exemplo n.º 4
0
        public static async Task InitializeAsync(
            UserManager <User> userManager,
            RoleManager <IdentityRole> roleManager,
            ICanvasService canvasService,
            IConfiguration config)
        {
            string adminEmail = config.GetSection("InitialAdminParams").GetValue <string>("Email");
            string password   = config.GetSection("InitialAdminParams").GetValue <string>("Password");

            var roles = new string[] { "admin", "user" };

            foreach (var role in roles)
            {
                if (await roleManager.FindByNameAsync(role) == null)
                {
                    await roleManager.CreateAsync(new IdentityRole(role));
                }
            }

            if (await userManager.FindByNameAsync(adminEmail) == null)
            {
                User admin = new User {
                    Email = adminEmail, UserName = adminEmail
                };
                IdentityResult result = await userManager.CreateAsync(admin, password);

                if (result.Succeeded)
                {
                    await userManager.AddToRoleAsync(admin, "admin");
                }
            }

            var canvases = new CreateCanvasDto[]
            {
                new CreateCanvasDto {
                    Price = 121, Size = "20x30"
                },
                new CreateCanvasDto {
                    Price = 188, Size = "35x45"
                },
                new CreateCanvasDto {
                    Price = 255, Size = "40x60"
                },
                new CreateCanvasDto {
                    Price = 350, Size = "50x75"
                },
                new CreateCanvasDto {
                    Price = 418, Size = "60x80"
                },
                new CreateCanvasDto {
                    Price = 514, Size = "70x90"
                },
            };

            var db = await canvasService.GetCanvasesAsync();

            foreach (var canvas in canvases)
            {
                if (!db.Any(i => i.Price == canvas.Price && i.Size == canvas.Size))
                {
                    await canvasService.CreateCanvasAsync(canvas);
                }
            }
        }
Exemplo n.º 5
0
 public ToolbarItemEx()
 {
     _canvasService = DependencyService.Get <ICanvasService>();
 }
Exemplo n.º 6
0
 public TestRibbonItem(ICanvasService canvasService)
 {
     _canvasService = canvasService;
 }
 public KanjiDrawingService(ICanvasService canvas)
 {
     _canvas = canvas;
 }
Exemplo n.º 8
0
 public CanvasController(ICanvasService canvasService)
 {
     _canvasService = canvasService;
 }