private void UpdateSentData(TestData data)
 {
     componentsSentData[data.Name] = new SentData
     {
         PassRate = data.PassRate.ToString(),
         ImageType = data.ImageName,
         TestProgress = data.TestProgress.ToString(),
         TestCoverage = data.TestCoverage.ToString(),
         CodeCoverage = data.CodeCoverage.ToString()
     };
 }
        private void sendToast(TestData data)
        {
            UpdateSentData(data);
            //TODO - Add TOAST notifications sending logic here
            string msg = "Test completed";
            List<Uri> subscribers = RegistrationService.GetSubscribers();

            toastPushNotificationMessage.Title = String.Format("Test ALERT({0})", data.Name);
            toastPushNotificationMessage.SubTitle = msg;
            toastPushNotificationMessage.TargetPage = MakeTileUri(data.Name).ToString();

            subscribers.ForEach(uri =>
                toastPushNotificationMessage.SendAsync(uri,
                (result) => OnMessageSent(NotificationType.Toast, result),
                (result) => { }));
        }
        private void sendHttp(TestData data)
        {
            UpdateSentData(data);

            //Get the list of subscribed WP7 clients
            List<Uri> subscribers = RegistrationService.GetSubscribers();
            //Prepare payload
            byte[] payload = prepareRAWPayload(
                data.Name,
                data.PassRate.ToString(),
                data.ImageName,
                data.TestProgress.ToString(),
                data.TestCoverage.ToString(),
                data.CodeCoverage.ToString());

            rawPushNotificationMessage.RawData = payload;
            subscribers.ForEach(uri => rawPushNotificationMessage.SendAsync(uri,
                (result) => OnMessageSent(NotificationType.Raw, result),
                (result) => { }));
        }
        private void sendTile(TestData data)
        {
            UpdateSentData(data);

            //TODO - Add TILE notifications sending logic here
            string picType = data.ImageName;
            int passRate = data.PassRate;
            string project = data.Name;
            List<Uri> subscribers = RegistrationService.GetSubscribers();

            tilePushNotificationMessage.BackgroundImageUri = new Uri("Images/" + picType + ".png", UriKind.Relative);
            if (passRate <= 99)
                tilePushNotificationMessage.Count = passRate;
            else
            {
                tilePushNotificationMessage.Count = 0;
            }
            tilePushNotificationMessage.Title = project;
            tilePushNotificationMessage.SecondaryTile = MakeTileUri(project).ToString();

            subscribers.ForEach(uri => tilePushNotificationMessage.SendAsync(uri,
                (result) => OnMessageSent(NotificationType.Token, result),
                (result) => { }));
        }
        private void PlayDemo(TestData data, int passRate, int testProgress, int testCoverage)
        {
            data.PassRate = passRate;
            data.TestProgress = testProgress;
            data.TestCoverage = testCoverage;
            if (testProgress == 100)
            {
                if (passRate == 100)
                {
                    data.ImageName = "Passed";
                }
                else
                {
                    data.ImageName = "Failed";
                }
                sendToast(data);
            }

            sendTile(data);
            sendHttp(data);
            LogMessage(String.Format("{0}: Run Test Suite '{1}', {2}% Completed, {3}% Passed. \n",
                            DateTime.Now.ToString(),
                            data.Name,
                            data.TestProgress,
                            data.PassRate
                            ));
        }