Exemplo n.º 1
0
 public void MouseDragged(object sender, MouseEventArgs e)
 {
     pointsGathered.Add(e.GetPosition(constructorListener.InputElement));                                                      //
     temporaryObject.define(pointsGathered);                                                                                   //
     constructorListener.hoveringOverConstructionArea(makeHoveringPrototype(e.GetPosition(constructorListener.InputElement))); //1
     constructorListener.constructionContinuing(temporaryObject);
 }
Exemplo n.º 2
0
        public void MousePressed(object sender, MouseButtonEventArgs e)
        {
            this.IsDragging = true;

            pointsGathered = new PointCollection();
            pointsGathered.Add(e.GetPosition(constructorListener.InputElement));

            try
            {
                temporaryObject = Activator.CreateInstance(paintObjectType) as PaintObject;
            }
            catch (Exception exception)
            {
                Console.WriteLine("Error creating paintObjectType: " + exception.Message);
            }

            temporaryObject.setColor(color);
            temporaryObject.setThickness(thickness);
            temporaryObject.define(pointsGathered);

            constructorListener.hoveringOverConstructionArea(makeHoveringPrototype(e.GetPosition(((IPaintObjectConstructorListener)constructorListener).InputElement))); //
            constructorListener.constructionBeginning(temporaryObject);
        }
Exemplo n.º 3
0
        private PaintObject makeHoveringPrototype(Point p)
        {
            PaintObject prototype = null;

            try
            {
                prototype = (PaintObject)Activator.CreateInstance(paintObjectType);
            }
            catch (Exception exception)
            {
                Console.WriteLine("Error creating paintObjectType error: " + exception.Message);
            }

            PointCollection points = new PointCollection(2);

            points.Add(p);
            points.Add(p); //
            prototype.define(points);
            prototype.setThickness(5);
            prototype.setColor(this.color);

            return(prototype);
        }