//every pencil must be displayed in the grid (when window is initialized and user didn't use the pencil so far
        //and in large cavas (Name=Panel, same size as visual table) as well, so the pencil can be moved on the whole screen (not including header!!)
        public PencilProvider(Controller con)
        {
            this.controller = con;
            brush = new SolidColorBrush(Colors.Black);
            //initialize Images

            pencil = new Pencil(controller.Ui.Pencil, Colors.Gray, 2);
            pencil.SetOffset(0.5, -0.5);
            marker = new Pencil(controller.Ui.Marker, controller.Ui.Marker_Open, Color.FromArgb(100, 0, 0, 255), 10);
            marker.SetOffset(0.5, 0);
            eraser = new Pencil(controller.Ui.Eraser, Colors.White, 20);
            eraser.SetOffset(0.5, -0.5);
            hand = new Pencil(controller.Ui.handcursor, Colors.White);
            hand.DrawingEnabled = false;

            pencils = new Pencil[] {pencil, marker, eraser};
            int i = 0;
            foreach (Pencil p in pencils) {
                controller.Ui.Panel.Children.Add(p.CanvasImage);
                Canvas.SetLeft(p.CanvasImage, controller.Ui.Panel.ActualWidth / 9 * 8);
                Canvas.SetTop(p.CanvasImage, controller.Ui.Panel.ActualHeight / 3 * i);
                i++;
            }

            controller.Ui.Panel.Children.Add(hand.CanvasImage);
            Canvas.SetLeft(hand.CanvasImage, controller.Ui.Panel.ActualWidth / 9 * 2);
            Canvas.SetTop(hand.CanvasImage, 50);

            cursor = hand;
        }
 /// <summary>
 /// Starts this handler
 /// </summary>
 /// <param name="c">controller class</param>
 /// <param name="sensor">kinect sensor</param>
 public override void Start(Controller c, KinectSensor sensor)
 {
     controller = c;
     if(sensor!= null)
     {
         //load reader and register frame arrived delegate (listener)
         reader = sensor.ColorFrameSource.OpenReader();
         reader.FrameArrived += Reader_FrameArrived;
     }
 }
        /// <summary>
        /// Default constructor
        /// </summary>
        public MainWindow()
        {
            //create associated objects

            InitializeComponent();
            this.WindowState = WindowState.Maximized;
            Whiteboard whiteBoard = new Whiteboard();
            this.Content = whiteBoard;
            controller = new Controller(whiteBoard);
            whiteBoard.controller = this.controller;
        }
 /// <summary>
 /// Starts the handler
 /// </summary>
 /// <param name="c"></param>
 /// <param name="sensor"></param>
 public abstract void Start(Controller c, KinectSensor sensor);
        /// <summary>
        /// Starts this handler
        /// </summary>
        /// <param name="c">controller class</param>
        /// <param name="sensor">kinect sensor</param>
        public override void Start(Controller c, KinectSensor sensor)
        {
            controller = c;
            provider = new PencilProvider(controller);
            provider.changeCursorToHand();
            if (sensor != null)
            {
                //load reader and register frame arrived delegate (listener)
                reader = sensor.BodyFrameSource.OpenReader();
                reader.FrameArrived += Reader_FrameArrived;

                coordinateMapper = sensor.CoordinateMapper;

                drawer = controller.Ui.CanvasDrawer;
                drawer.controller = this.controller;
                drawer.provider = this.provider;

            }
        }