/// <summary>
        /// 
        /// </summary>
        /// <param name="rf"></param>
        /// <param name="pf"></param>
        private async void ShowQueue(IReadOnlyList<StorageFile> rf, IReadOnlyList<StorageFile> pf)
        {
            ObservableCollection<ReportObject> QueuedReportsList = new ObservableCollection<ReportObject>();
            QueuedListView.Items.Clear();
            queuedListIndex.Clear();
            int queued_count = 0;
            foreach (StorageFile report_file in rf)
            {
                queued_count++;
                string reportString = await FileIO.ReadTextAsync(report_file);
                string[] report_split = reportString.Split(new char[] { '|' }, StringSplitOptions.None);

                ReportObject qro = new ReportObject(-queued_count,
                                                    report_split[0], report_split[1],
                                                    report_split[2], report_split[3],
                                                    ConvertToDateTime(report_split[4]), report_split[5],
                                                    report_split[6], report_split[7], report_split[8]);
                QueuedReportsList.Add(qro);
            }
            PopulateQueue(QueuedReportsList, pf);
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="reportObject"></param>
 private void AddToMap(ReportObject reportObject)
 {
     Pushpin pushpin = new Pushpin();
     pushpin.Name = reportObject.ReportId.ToString();
     pushpin.Background = new SolidColorBrush(Color.FromArgb(255, 255, 165, 0));
     MapLayer.SetPosition(pushpin, new Location(Convert.ToDouble(reportObject.ReportLatitude), Convert.ToDouble(reportObject.ReportLongitude)));
     Canvas.SetZIndex(pushpin, 1);
     pushpin.Tapped += pushpinTapped;
     Map.Children.Add(pushpin);
 }
        /// <summary>
        /// Populates list from response of web service
        /// </summary>
        /// <param name="ReportsList"></param>
        private async void PopulateQueue(ObservableCollection<ReportObject> QueuedList, IReadOnlyList<StorageFile> pf)
        {
            //if (refreshMap)
            //{
            //    ClearMap();
            //}

            queuedObjectList.Clear();

            int count = 0;
            foreach (var Que in QueuedList)
            {
                Image image = new Image();
                count++;
                var file = await pictureFolder.GetFileAsync(count + "_" + Que.ReportType.ToString() + ".png");

                var fileStream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read);
                var img = new BitmapImage();
                img.SetSource(fileStream);

                image.Source = img;

                GridViewItem ReportView = new GridViewItem();
                GridViewItem ImageView = new GridViewItem();

                StackPanel listSP = new StackPanel();

                LinearGradientBrush lgb = new LinearGradientBrush();

                lgb.StartPoint = new Point(.5, 0);
                lgb.EndPoint = new Point(.5, 1);

                GradientStop lggs = new GradientStop();
                lggs.Color = Color.FromArgb(255, 217, 214, 203);
                lggs.Offset = 0.0;
                lgb.GradientStops.Add(lggs);

                GradientStop ggs = new GradientStop();
                ggs.Color = Color.FromArgb(255, 108, 108, 108);
                ggs.Offset = 1.25;
                lgb.GradientStops.Add(ggs);

                listSP.Background = lgb;

                listSP.Orientation = Orientation.Horizontal;

                StackPanel reportSP = new StackPanel();

                queuedListIndex.Add(Que.ReportId);

                TextBlock ridTB = new TextBlock() { Text = Que.ReportId.ToString() };
                ridTB.Foreground = new SolidColorBrush(Colors.Black);
                reportSP.Children.Add(ridTB);

                TextBlock rtypeTB = new TextBlock() { Text = Que.ReportType };
                rtypeTB.Foreground = new SolidColorBrush(Colors.Black);
                reportSP.Children.Add(rtypeTB);

                TextBlock rtimeTB = new TextBlock() { Text = Que.ReportTime.ToString() };
                rtimeTB.Foreground = new SolidColorBrush(Colors.Black);
                reportSP.Children.Add(rtimeTB);

                ReportObject queuedReportObject = new ReportObject(Que.ReportId,
                                                                   Que.ReportType,
                                                                   Que.ReportAuthor,
                                                                   Que.ReportDescription,
                                                                   Que.ReportLocation,
                                                                   Que.ReportTime,
                                                                   Que.ReportLatitude,
                                                                   Que.ReportLongitude,
                                                                   Que.ReportAccuracy,
                                                                   Que.ReportDirection);

                queuedObjectList.Add(queuedReportObject);

                if (!(queuedReportObject.ReportLatitude == "NA" || queuedReportObject.ReportLongitude == "NA"))
                {
                    try
                    {
                        AddToMap(queuedReportObject);
                    }
                    catch (Exception) { }
                }

                image.Height = 110;
                image.Width = 175;

                ImageView.Content = image;
                ReportView.Content = reportSP;
                ImageView.AddHandler(UIElement.TappedEvent, new TappedEventHandler(QImageSelected), true);
                ReportView.AddHandler(UIElement.TappedEvent, new TappedEventHandler(QReportSelected), true);

                listSP.Children.Add(ReportView);
                listSP.Children.Add(ImageView);
                QueuedListView.Items.Add(listSP);
            }
            if (count > 0)
            {
                if (SIUC311.SettingsView.GetAutoSubmitSetting())
                {
                    await WaitablePromptMessage("You have " + count + " reports queued\n\nQueued reports will be automatically submitted.");
                }
                else
                {
                    await WaitablePromptMessage("You have " + count + " reports queued.");
                }
                if (haveInternetAccess)
                {
                    //NotifyUser("Processing queue . . . ", NotifyType.ReportMessage);
                    try
                    {
                        inSession = await SIU311Service.IsSessionAliveAsync(sessionId); // SLOW TAKES TIME 
                    }
                    catch (Exception)
                    {
                        inSession = false;
                    }
                    //NotifyUser("Session checked at " + string.Format("{0:M/d/yyyy H:mm:ss tt}", DateTime.Now), NotifyType.ReportMessage);
                    if (inSession)
                    {
                        if (SIUC311.SettingsView.GetAutoSubmitSetting())
                        {
                            await SubmitQueue();
                        }
                    }
                }
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="qro"></param>
        /// <returns></returns>
        private async Task<bool> SubmitQueuedReport(ReportObject qro)
        {
            bool success = true;
            if (await SIU311Service.InsertReportAsync(sessionId, new SIUC311ServiceRef.ReportObject
            {
                ReportType = qro.ReportType,
                ReportAuthor = qro.ReportAuthor,
                ReportDescription = qro.ReportDescription,
                ReportLocation = qro.ReportLocation,
                ReportTime = qro.ReportTime,
                ReportLatitude = qro.ReportLatitude,
                ReportLongitude = qro.ReportLongitude,
                ReportAccuracy = qro.ReportAccuracy,
                ReportDirection = qro.ReportDirection
            }))
            {
                //NotifyUser("Report Accepted at " + string.Format("{0:M/d/yyyy H:mm:ss tt}", DateTime.Now), NotifyType.QueueMessage);

                //NotifyUser("Attempting to submit photo", NotifyType.StatusMessage);

                var file = await pictureFolder.GetFileAsync((-qro.ReportId) + "_" + qro.ReportType + ".png");

                byte[] photo = await ConvertImagetoByte(file);

                if (await SIU311Service.InsertPhotoAsync(sessionId, new SIUC311ServiceRef.PhotoObject
                {
                    ReportPhoto = photo
                }))
                {   
                    if (await RemoveQueuedReport(qro.ReportId))
                    {
                        await WaitablePromptMessage("Queued report " + qro.ReportId + " has been submitted and removed from local device.");
                    }
                    else
                    {
                        PromptMessage("Could not remove report " + qro.ReportId);
                        success = false;
                    }
                }
                else
                {
                    //NotifyUser("Unable to upload photo", NotifyType.ReportMessage);
                    success = false;
                }
            }
            else
            {
                //NotifyUser("Report Rejected. Try Again.", NotifyType.ReportMessage);
                success = false;
            }
            RefreshQueue();
            ResetSession();
            return success;
        }
        /// <summary>
        /// Populates list from response of web service
        /// </summary>
        /// <param name="ReportsList"></param>
        private async void PopulateList(ObservableCollection<SIUC311ServiceRef.ReportObject> ReportsList, bool byOwner)
        {
            // add condition from checkbox
            if (refreshMap)
            {
                ClearMap();
                reportObjectList.Clear();
            }            

            foreach (var Rep in ReportsList)
            {
                Image image = new Image();

                var photoObject = await SIU311Service.GetPhotoAsync(Rep.ReportId);

                BitmapImage bimage;

                if (photoObject != null && photoObject.ReportPhoto != null)
                {
                    bimage = await ByteToImage(photoObject.ReportPhoto);
                }
                else
                {
                    bimage = new BitmapImage(new Uri("ms-appx:///Assets/ImagePlaceHolder.png"));
                }

                string status = await SIU311Service.GetStatusAsync(Rep.ReportId);

                image.Source = bimage;

                GridViewItem ReportView = new GridViewItem();
                GridViewItem ImageView = new GridViewItem();

                StackPanel listSP = new StackPanel();

                LinearGradientBrush lgb = new LinearGradientBrush();

                lgb.StartPoint = new Point(.5, 0);
                lgb.EndPoint = new Point(.5, 1);

                GradientStop lggs = new GradientStop();
                lggs.Color = Color.FromArgb(255, 217, 214, 203);
                lggs.Offset = 0.0;
                lgb.GradientStops.Add(lggs);

                GradientStop ggs = new GradientStop();
                ggs.Color = Color.FromArgb(255, 108, 108, 108);
                ggs.Offset = 1.25;
                lgb.GradientStops.Add(ggs);

                listSP.Background = lgb;

                listSP.Orientation = Orientation.Horizontal;

                StackPanel reportSP = new StackPanel();

                reportListIndex.Add(Rep.ReportId);

                StackPanel idStatusSP = new StackPanel();
                idStatusSP.Orientation = Orientation.Horizontal;

                TextBlock ridTB = new TextBlock() { Text = Rep.ReportId.ToString() };
                ridTB.Foreground = new SolidColorBrush(Colors.Black);

                TextBlock statusTB = new TextBlock() { Text = " : " + status };
                statusTB.Foreground = new SolidColorBrush(Colors.Black);

                idStatusSP.Children.Add(ridTB);
                idStatusSP.Children.Add(statusTB);

                reportSP.Children.Add(idStatusSP);

                TextBlock rtypeTB = new TextBlock() { Text = Rep.ReportType };
                rtypeTB.Foreground = new SolidColorBrush(Colors.Black);
                reportSP.Children.Add(rtypeTB);

                if (!byOwner)
                {
                    TextBlock rownTB = new TextBlock() { Text = Rep.ReportAuthor };
                    rownTB.Foreground = new SolidColorBrush(Colors.Black);
                    reportSP.Children.Add(rownTB);
                }

                TextBlock rtimeTB = new TextBlock() { Text = Rep.ReportTime.ToString() };
                rtimeTB.Foreground = new SolidColorBrush(Colors.Black);
                reportSP.Children.Add(rtimeTB);

                ReportObject reportObject = new ReportObject(Rep.ReportId,
                                                             Rep.ReportType,
                                                             Rep.ReportAuthor,
                                                             Rep.ReportDescription,
                                                             Rep.ReportLocation,
                                                             Rep.ReportTime,
                                                             Rep.ReportLatitude,
                                                             Rep.ReportLongitude,
                                                             Rep.ReportAccuracy,
                                                             Rep.ReportDirection);

                reportObjectList.Add(reportObject);

                if (!(reportObject.ReportLatitude == "NA" || reportObject.ReportLatitude == "NA"))
                {
                    try
                    {
                        AddToMap(reportObject);
                    }
                    catch (Exception) { }
                }

                image.Height = 110;
                image.Width = 175;
                ImageView.Content = image;

                ReportView.Content = reportSP;

                ImageView.AddHandler(UIElement.TappedEvent, new TappedEventHandler(ImageSelected), true);
                ReportView.AddHandler(UIElement.TappedEvent, new TappedEventHandler(ReportSelected), true);

                listSP.Children.Add(ReportView);
                listSP.Children.Add(ImageView);

                ReportsListView.Items.Add(listSP);
            }
            UnLockControls();
        }