Ejemplo n.º 1
0
        private void ColorCircle_Click(object sender, EventArgs e)
        {
            if (!diagram.PageSettings.ShowGrid)
            {
                return;
            }
            ColorCircle circle = (ColorCircle)sender;

            diagram.PageSettings.GridColor = circle.m_color;
            circle.Selected = true;
            circle.SetWillNotDraw(true);
            circle.SetWillNotDraw(false);
            for (int i = 0; i < scrollLayout.ChildCount; i++)
            {
                ColorCircle colorCircle = scrollLayout.GetChildAt(i) as ColorCircle;
                if (colorCircle.m_color.ToString().Equals(circle.m_color.ToString()))
                {
                    continue;
                }
                else if (colorCircle.Selected)
                {
                    colorCircle.Selected = false;
                    colorCircle.SetWillNotDraw(true);
                    colorCircle.SetWillNotDraw(false);
                }
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            double length;
            string input;

            do
            {
                Console.WriteLine("Enter a length: ");
                input = Console.ReadLine();
            } while (!double.TryParse(input, out length));

            double width;

            do
            {
                Console.WriteLine("Enter a width: ");
                input = Console.ReadLine();
            } while (!double.TryParse(input, out width));

            /* var r = new Rectangle();
             * r.Length = length;
             * r.Width = width;*/
            // Property initializer
            var r = new Rectangle {
                Length = length,
                Width  = width
            };

            r.PrintRectangle();
            var circle = new ColorCircle(4, "black");

            Console.WriteLine(ShapeDetails(circle));
        }
Ejemplo n.º 3
0
        private void AddColor(Color color)
        {
            ColorCircle colorCircle = new ColorCircle(diagram.Context, color);

            colorCircle.Click           += ColorCircle_Click;
            colorCircle.LayoutParameters = new ViewGroup.LayoutParams((int)(60 * currentDensity), (int)(60 * currentDensity));
            scrollLayout.AddView(colorCircle);
        }
Ejemplo n.º 4
0
        public static string getSection(bool open, string title)
        {
            ColorCircle cc = ColorCircle.circle_green;

            if (!open)
            {
                cc = ColorCircle.circle_red;
            }
            return(getSection(cc, title));
        }
Ejemplo n.º 5
0
    // Use this for initialization
    void Start()
    {
        rt = GetComponent <RectTransform>();

        CRGB = GetComponentInChildren <ColorRGB>();
        CP   = GetComponentInChildren <ColorPanel>();
        CC   = GetComponentInChildren <ColorCircle>();

        sliderCRGB.onValueChanged.AddListener(OnCRGBValueChanged);

        CC.getPos += CC_getPos;
    }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            string input;
            double length;

            do
            {
                Console.WriteLine("Enter a length: ");
                input = Console.ReadLine();
            } while (!double.TryParse(input, out length));

            double width;

            do
            {
                Console.WriteLine("Enter a width: ");
                input = Console.ReadLine();
            } while (!double.TryParse(input, out width));

            var rectangle = new Rectangle()
            {
                Length = length,
                Width  = width
            };

            rectangle.PrintRectangle();

            double radius;

            do
            {
                Console.WriteLine("enter a radius: ");
                input = Console.ReadLine();
            }while(!double.TryParse(input, out radius));

            ColorCircle colorCircle = new ColorCircle
            {
                Radius = radius,
                Color  = "black"
            };

            Console.WriteLine(colorCircle.GetPerimeter());
            Console.WriteLine(ShapeDetails(circle));


            // C# has something called "out" parameters
            // an out parameter cannot have a value before you pass it
        }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            double length;
            string input;

            do
            {
                Console.WriteLine("Enter a length:");
                input = Console.ReadLine();
            } while (!double.TryParse(input, out length));
            double width;

            do
            {
                Console.WriteLine("Enter a width:");
                input = Console.ReadLine();
            } while (!double.TryParse(input, out width));

            // C# has something called "out" parameters
            // an out parameter cannot have a value before you pass it
            // the method gets that exact variable and fills in its value

            // similar to collection initializer, we have property initializer

            var rectangle = new Rectangle
            {
                Length = length,
                Width  = width
            };

            // PrintRectangle(rectangle);
            rectangle.PrintRectangle();

            double radius;

            do
            {
                Console.WriteLine("Enter a radius:");
                input = Console.ReadLine();
            } while (!double.TryParse(input, out radius));

            ColorCircle colorCircle = new ColorCircle(radius: radius, color: "black");

            Console.WriteLine(colorCircle.GetPerimeter());

            Console.WriteLine(ShapeDetails(colorCircle));
        }
Ejemplo n.º 8
0
    // Use this for initialization
    void Start()
    {
        rt = GetComponent <RectTransform>();

        CRGB = GetComponentInChildren <ColorRGB>();
        CP   = GetComponentInChildren <ColorPanel>();
        CC   = GetComponentInChildren <ColorCircle>();

        sliderCRGB.onValueChanged.AddListener(OnCRGBValueChanged);

        CC.getPos += CC_getPos;

        _closeButton.onClick.AddListener(() =>
        {
            Destroy(this.gameObject);
        });
    }
Ejemplo n.º 9
0
 private void ShowGridSwitch_CheckedChange(object sender, CompoundButton.CheckedChangeEventArgs e)
 {
     diagram.PageSettings.ShowGrid = e.IsChecked;
     snapToGridSwitch.Enabled      = e.IsChecked;
     if (!e.IsChecked)
     {
         for (int i = 0; i < scrollLayout.ChildCount; i++)
         {
             ColorCircle circle = scrollLayout.GetChildAt(i) as ColorCircle;
             if (circle.Selected)
             {
                 circle.Selected = false;
                 circle.SetWillNotDraw(true);
                 circle.SetWillNotDraw(false);
             }
         }
         diagram.PageSettings.SnapToGrid = false;
         snapToGridSwitch.Checked        = false;
     }
 }
Ejemplo n.º 10
0
        static void Main(string[] args)
        {
            double length;
            string input;

            do
            {
                Console.WriteLine("Enter a Length: ");
                input = Console.ReadLine();
            } while (!double.TryParse(input, out length));

            double width;

            do
            {
                Console.WriteLine("Enter a Width: ");
                input = Console.ReadLine();
            } while (!double.TryParse(input, out width));

            var rectangle = new Rectangle
            {
                Length = length,
                Width  = width
            };

            rectangle.PrintRectangle();

            double radius;

            do
            {
                Console.WriteLine("Enter a radius: ");
                input = Console.ReadLine();
            } while (!double.TryParse(input, out radius));

            ColorCircle colorCircle = new ColorCircle(radius: radius, colorCircle: "black");

            Console.WriteLine(colorCircle.GetPerimeter());

            Console.WriteLine(ShapeDetails(colorCircle));
        }
Ejemplo n.º 11
0
        static void Main(string[] args)
        {
            double length;
            string input;

            do
            {
                Console.WriteLine("Enter a length:");
                input = Console.ReadLine();
            } while (!double.TryParse(input, out length));

            double width;

            do
            {
                Console.WriteLine("Enter a width:");
                input = Console.ReadLine();
            } while (!double.TryParse(input, out width));

            var rectangle = new Rectangle()
            {
                Length = length,
                Width  = width
            };

            rectangle.PrintRectangle();
            double radius;

            do
            {
                Console.WriteLine("Enter a radius:");
                input = Console.ReadLine();
            } while (!double.TryParse(input, out radius));
            ColorCircle circle = new ColorCircle {
            };
        }
Ejemplo n.º 12
0
        public static string getSection(ColorCircle cc, string title)
        {
            string str = string.Format("<tr><td><div class='{0}'/></td><td>{1}</td></tr>", cc.ToString(), title);

            return(str);
        }