public void updatePieCount(int id, Player player, int pieCount)
        {
            player.Pies += pieCount;

            if ((id == 0) || (id == 2))
                orangeCount.Content = player.Pies;
            else if ((id == 1) || (id == 3))
                greenCount.Content = player.Pies;
        }
        public void updateScore(int id, Player player)
        {
            player.Score += 1;

            if ((id == 0) || (id == 2))
                orangeScore.Content = player.Score;
            else if ((id == 1) || (id == 3))
                greenScore.Content = player.Score;
        }
        public Pie(Canvas canvas, Dictionary<int, Player> players, int id, Player player, Point pt)
        {
            this.InitializeComponent();
            this.canvas = canvas;
            this.player = player;
            this.id = id;
            this.pt = pt;
            this.players = players;

            this.IsRotateEnabled = false;
            this.MinScale = 1;
            this.MaxScale = 2;

            //we want a different pie from for each player
            this.pieRim.Fill = new LinearGradientBrush(getTop(), getBottom(), 90.0);
            this.TouchMove += new libSMARTMultiTouch.Input.TouchContactEventHandler(Pie_TouchMove);
            this.ScaleTransformUpdated += new EventHandler(Pie_ScaleTransformUpdated);
        }
        private void TableApplicationControl_Loaded(object sender, RoutedEventArgs e)
        {
            TableLayoutRoot.Children.Add(canvas);
            canvas.Background = new LinearGradientBrush(Color.FromRgb(79,134,187), Color.FromRgb(35,86,136), 90);

            //we are working with two players
            player1 = new Player();
            player2 = new Player();
            Trainer trainer = Trainer.getInstance();
            trainer.setCanvas(this.canvas);
            Whale whale = Whale.getInstance();
            SpeechBubble speech = SpeechBubble.getInstance();
            Scoreboard scoreboard = Scoreboard.getInstance();
            PieStash pieStash = PieStash.getInstance();

            speech.updateEquation();

            TouchInputManager.AddTouchContactDownHandler(pieStash, new TouchContactEventHandler(Stash_TouchDown));

            trainer.SetValue(Canvas.LeftProperty, 0.0);
            trainer.SetValue(Canvas.TopProperty, 0.0);
            whale.SetValue(Canvas.LeftProperty, 300.0);
            whale.SetValue(Canvas.TopProperty, 200.0);
            speech.SetValue(Canvas.LeftProperty, 250.0);
            speech.SetValue(Canvas.TopProperty, 10.0);
            scoreboard.SetValue(Canvas.RightProperty, 10.0);
            scoreboard.SetValue(Canvas.TopProperty, 10.0);
            pieStash.SetValue(Canvas.LeftProperty, 0.0);
            pieStash.SetValue(Canvas.BottomProperty, -30.0);

            canvas.Children.Add(whale);
            canvas.Children.Add(trainer);
            canvas.Children.Add(speech);
            canvas.Children.Add(scoreboard);
            canvas.Children.Add(pieStash);
        }