Ejemplo n.º 1
0
        public override void OnClick(object sender, TappedRoutedEventArgs e)
        {
            if (sender is DrawingCanvas)
            {
                DrawingCanvas canvas = sender as DrawingCanvas;

                if (clicked)
                {
                    clicked = false;

                    Point pos = new Point()
                    {
                        X = rect.Margin.Left,
                        Y = rect.Margin.Top
                    };
                    DrawableClassObject clObject = ModelManager.GetInstance()
                                                   .CreateNewClass(new Point(rect.Width, rect.Height), rect.Fill, VisualShape.Rectangle, pos, 1);
                    EditPage.Instance.ClassGallery.FillClasses();
                    EditPage.Instance.DrawClassView(clObject);
                    EditPage.Instance.PropertiesPanel.FillWithClass(clObject);
                    return;
                }

                rect = new Rectangle();
                double x = e.GetPosition(canvas).X;
                double y = e.GetPosition(canvas).Y;
                rect.Fill   = _randomColor.Shuffle();
                thickness   = new Thickness(x, y, 0, 0);
                rect.Margin = thickness;
                off_x       = x;
                off_y       = y;
                canvas.AddUIControl(rect);

                clicked = true;
            }
            else if (sender is GalleryIcon)
            {
                GalleryIcon icon = sender as GalleryIcon;
                EditPage.Instance.DrawClassView(icon.ClassObject);
            }
        }