Exemple #1
0
        static void Main(string[] args)
        {
            MyCanvas myCanvas = new MyCanvas();

            //created buttons
            MyCanvas.CreateNewButton(0, 0, 100, 100);
            MyCanvas.CreateNewButton(100, 100, 200, 200);
            MyCanvas.CreateNewButton(200, 200, 300, 300);


            //moved button
            MyCanvas.MoveButton(0, 250, 250, 300, 400);

            //print
            Console.WriteLine(myCanvas.ToString());


            //fetch data
            Console.WriteLine($"Current Number Of Buttons: {MyCanvas.GetCurrentNumberOfButtons()}");
            Console.WriteLine($"Max Number Of Buttons: {MyCanvas.GetMaxNumberOfButtons()}");
            Console.WriteLine($"Max Width Of A Button: {MyCanvas.GetTheMaxWidthOfAButton()}");
            Console.WriteLine($"Max Height Of A Button: {MyCanvas.GetTheMaxHeightOfAButton()}");

            //check if
            Console.WriteLine($"Is Point Inside A Button: {MyCanvas.IsPointInsideAButton(120,120)}");
            Console.WriteLine($"If any buttons is overlapping: {MyCanvas.CheckIfAnyButtonIsOverlapping()}");

            //delete last button
            MyCanvas.DeleteLastButton();
            Console.WriteLine(myCanvas.ToString());

            //clear all buttons
            MyCanvas.ClearAllButtons();
            Console.WriteLine(myCanvas.ToString());
        }
Exemple #2
0
        static void Main(string[] args)
        {
            MyCanvas.CreateNewButton(1, 8, 10, 12);
            MyCanvas.CreateNewButton(1, 6, 20, 10);
            MyCanvas.CreateNewButton(1, 11, 30, 12);

            MyCanvas.Print();

            Console.WriteLine("\nMoveButton(0, 0, 7)");
            MyCanvas.MoveButton(0, 0, 7);
            MyCanvas.Print();

            Console.WriteLine("\nThe Max Width Of A Button is " + MyCanvas.GetTheMaxWidthOfAButton());
            Console.WriteLine("\nThe Max Height Of A Button is " + MyCanvas.GetTheMaxHeightOfAButton());
            Console.WriteLine("\nCurrent Number Of Buttons " + MyCanvas.GetCurrentNumberOfButtons());
            Console.WriteLine("\nIs Point Inside A Button? " + MyCanvas.IsPointInsideAButton(200, 200));
            Console.WriteLine("\nIs Point Inside A Button? " + MyCanvas.IsPointInsideAButton(1, 7));

            Console.WriteLine("\nDeleteLastButton()");
            MyCanvas.DeleteLastButton();
            MyCanvas.Print();

            Console.WriteLine("\nClearAllButtons()");
            MyCanvas.ClearAllButtons();
            Console.WriteLine("Current Number Of Buttons: " + MyCanvas.GetCurrentNumberOfButtons());
        }
Exemple #3
0
        public static void Main(string[] args)
        {
            MyCanvas.CreateNewButton(7, 7, 10, 10);
            MyCanvas.CreateNewButton(5, 5, 15, 15);
            MyCanvas.CreateNewButton(8, 8, 20, 20);

            MyCanvas.MoveButton(0, 5, 100);

            if (MyCanvas.CheckIfAnyButtonIsOvefLapping() == true)
            {
                Console.WriteLine("There is Button over Lapping");
            }

            MyCanvas.GetCurrentNumberOfButtons();
            MyCanvas.Print();
        }
Exemple #4
0
 static void Main(string[] args)
 {
     MyCanvas.CreateNewButton(0, 600, 800, 0);
     MyCanvas.CreateNewButton(500, 500, 700, 300);
     MyCanvas.CreateNewButton(300, 200, 400, 100);
     MyCanvas.MoveButton(1, 50, 50);
     MyCanvas.Print();
     Console.WriteLine(MyCanvas.GetCurrentNumberOfButton());
     Console.WriteLine(MyCanvas.GetMaxNumberOfButtons());
     Console.WriteLine(MyCanvas.GetTheMaxHeightOfAButton());
     Console.WriteLine(MyCanvas.GetTheMaxWidthOfAButton());
     Console.WriteLine(MyCanvas.IsPointInsideAButton(400, 400));
     Console.WriteLine(MyCanvas.CheckIfAnyButtonIsOverlapping());
     //Console.WriteLine(MyCanvas.DeleteLastButton());
     //פתרתי את זה בדרך הפשוטה, לכן אני לא רוצה להשתמש הפונקצייה הזאת, כי היא נחותה :)
     //Console.WriteLine(MyCanvas.GetCurrentNumberOfButton());
     //כנ"ל זאתי
     Console.ReadLine();
 }
Exemple #5
0
        static void Main(string[] args)
        {
            Console.WriteLine($"1. Button 1 created: {MyCanvas.CreateNewButton(3, 3, 6, 6)}");
            Console.WriteLine($"2. Button 2 created: {MyCanvas.CreateNewButton(8, 8, 15, 15)}");
            Console.WriteLine($"3. Button 3 created: {MyCanvas.CreateNewButton(30, 30, 60, 60)}");
            Console.ReadKey();

            MyCanvas.MoveButton(2, 6, 6);
            Console.WriteLine($"Current Number Of existing Buttons: {MyCanvas.GetCurrentNumberOfButtons()}");
            bool deleteLast = MyCanvas.DeleteLastButton();

            Console.WriteLine($"Last delete Succeed {deleteLast}");
            Console.WriteLine($"Current Number Of existing Buttons: {MyCanvas.GetCurrentNumberOfButtons()}");
            Console.WriteLine($"MaxNumberOfButtons: {MyCanvas.GetMaxNumberOfButtons()}");
            Console.WriteLine($"MaxWidthOfAButton: {MyCanvas.GetTheMaxWidthOfAButton()}");
            Console.WriteLine($"MaxHeightOfAButton: {MyCanvas.GetTheMaxHeightOfAButton()}");
            Console.WriteLine($"Checking if the Point x= 10, y = 15 inside a button: {MyCanvas.IsPointInsideAButton(10, 15)}");
            Console.WriteLine($"AnyButtonIsOverlapping: { MyCanvas.CheckIfAnyButtonIsOverlapping()}");
            Console.ReadKey();
        }
        public static void Main(string[] args)
        {
            MyCanvas.CreateNewButton(8, 8, 12, 12);
            MyCanvas.CreateNewButton(7, 7, 16, 16);
            MyCanvas.CreateNewButton(9, 9, 21, 21);

            MyCanvas.MoveButton(0, 7, 99);

            if (MyCanvas.CheckIfAnyButtonIsOverLapping() == true)
            {
                Console.WriteLine("This button is over lapping");
            }

            MyCanvas.GetMaxNumberOfNumberOfButtons();

            MyCanvas.GetCurrentNumberOfButtons();



            MyCanvas.Print();
        }
Exemple #7
0
        static void Main(string[] args)
        {
            if (MyCanvas.CreateNewButton(2, 5, 4, 3) == true)
            {
                Console.WriteLine("Button has been created");
            }
            else
            {
                Console.WriteLine("try again");
            }
            if (MyCanvas.CreateNewButton(3, 40, 8, 3) == true)
            {
                Console.WriteLine("Button has been created");
            }
            else
            {
                Console.WriteLine("try again");
            }
            MyCanvas.Print();
            Console.WriteLine("AFTER THE MOVMENT:");
            if (MyCanvas.GetCurrentNumOfButtons() > 0)
            {
                MyCanvas.MoveButton(0, 70, 45);
            }
            MyCanvas.Print();
            int maxHeight = MyCanvas.GetTheMaxHeighthOfAButton();

            Console.WriteLine($"The maximum height is: {maxHeight}");
            Console.WriteLine("");
            if (MyCanvas.GetCurrentNumOfButtons() > 0)
            {
                MyCanvas.DeleteLastButton();
            }
            Console.WriteLine("After deleting the last btn:");
            MyCanvas.Print();
            Console.WriteLine("After clearing all buttons:");
            MyCanvas.ClearAllButtons();
            MyCanvas.Print();
        }