private int SortRoutes(IndexWrapper <MobileSrc.Commuter.Shared.RouteDefinition> a, IndexWrapper <MobileSrc.Commuter.Shared.RouteDefinition> b)
        {
            TimeSpan durA = (_isReturn) ? a.Data.EstimatedRetDuration : a.Data.EstimatedDuration;
            TimeSpan durB = (_isReturn) ? b.Data.EstimatedRetDuration : b.Data.EstimatedDuration;

            return(durA.CompareTo(durB));
        }
        private void routeList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (routeList.SelectedIndex >= 0)
            {
                IndexWrapper <MobileSrc.Commuter.Shared.RouteDefinition> item = routeList.SelectedItem as IndexWrapper <MobileSrc.Commuter.Shared.RouteDefinition>;
                if (null != item)
                {
                    RouteViewer.SelectedDefinition = item.Data;
                    Uri uri = new Uri("/RouteViewer.xaml", UriKind.Relative);

                    Page             parentPage    = null;
                    FrameworkElement parentControl = this.Parent as FrameworkElement;

                    while (parentControl != null)
                    {
                        parentPage = parentControl as Page;

                        if (null != parentPage)
                        {
                            break;
                        }

                        parentControl = parentControl.Parent as FrameworkElement;
                    }

                    if (null != parentPage)
                    {
                        parentPage.NavigationService.Navigate(uri);
                    }
                }
            }
            routeList.SelectedIndex = -1;
        }
        private void BindData()
        {
            Routes = new List <IndexWrapper <MobileSrc.Commuter.Shared.RouteDefinition> >();

            if (null != DataContextManager.SelectedCommute)
            {
                foreach (MobileSrc.Commuter.Shared.RouteDefinition route in DataContextManager.SelectedCommute.Routes)
                {
                    IndexWrapper <MobileSrc.Commuter.Shared.RouteDefinition> obj = new IndexWrapper <MobileSrc.Commuter.Shared.RouteDefinition>(Routes, route);
                    obj.Message = (_isReturn) ? route.TravelSummaryRet : route.TravelSummary;
                    Routes.Add(obj);
                }
                Routes.Sort(new Comparison <IndexWrapper <MobileSrc.Commuter.Shared.RouteDefinition> >(SortRoutes));
                routeList.ItemsSource = null;
                routeList.ItemsSource = Routes;
            }
        }