private void DetailedTripList_OnItemClick(object sender, ItemClickEventArgs e)
        {
            ListView list = sender as ListView;

            if (list == null)
            {
                return;
            }

            //Frame clicked point on the map
            TripLeg clickedLeg   = (TripLeg)e.ClickedItem;
            var     boundingBox  = SingleMap.GetBoundingBoxWithIds(clickedLeg.TemporaryId);
            double  bottomMargin = DirectionsFloatingPanel.IsOpen ? DirectionsFloatingPanel.ExpandedHeight + 10 : 10;

            SingleMap.TrySetViewBoundsAsync(boundingBox, new Thickness(10, 10, 10, bottomMargin), MapAnimationKind.Bow).DoNotAwait();

            //Expand intermediate stops of clicked leg
            var element = list.ContainerFromItem(e.ClickedItem);
            var intermediatesControl = element.FindChild <TripDetailListIntermediates>("IntermediateStops");

            if (intermediatesControl != null)
            {
                intermediatesControl.ToggleViewState();
            }
        }
Beispiel #2
0
 private void SingleMap_MapElementsChanged(object sender, EventArgs e)
 {
     if (_favoritePlace != null || (SearchBoxPlace != null && SearchBoxPlace.Type != ModelEnums.PlaceType.NameOnly))
     {
         var boundingBox = SingleMap.GetAllMapElementsBoundingBox();
         SingleMap.TrySetViewAsync(new Geopoint(boundingBox.NorthwestCorner), 13, MapAnimationKind.Default).DoNotAwait();
     }
     if (_favoriteRoute != null)
     {
         var boundingBox = SingleMap.GetAllMapElementsBoundingBox();
         SingleMap.TrySetViewBoundsAsync(boundingBox, null, MapAnimationKind.Default, true).DoNotAwait();
     }
 }
        private void SwitchToDetailedState(MessageTypes.ViewPlanDetails details)
        {
            MapWidth = this.ActualWidth; //Otherwise MapControl sets its own width, which, in rare cases, is too wide.
            if (TripStateGroup.CurrentState == _tripListState)
            {
                VisualStateManager.GoToState(this, _detailedTripState.Name, true);
            }
            else
            {
                VisualStateManager.GoToState(this, _detailedTripState.Name, false);
            }

            GeoboundingBox iconsBoundingBox = SingleMap.GetAllMapElementsBoundingBox();
            var            mapMargin        = new Thickness(10, 10, 10, (this.ActualHeight * .66) + 10);

            SingleMap.TrySetViewBoundsAsync(iconsBoundingBox, mapMargin, MapAnimationKind.None, true).DoNotAwait();
        }
Beispiel #4
0
        private async void AddOrEditFavoriteDialog_Loaded(object sender, RoutedEventArgs e)
        {
            SingleMap.Focus(FocusState.Programmatic); //prevent auto-focusing on the search box

            FontFamily hslFamily   = null;
            FontFamily segoeFamily = null;
            TaskCompletionSource <bool> fontFamiliesFound = new TaskCompletionSource <bool>();

            DispatcherHelper.CheckBeginInvokeOnUI(() =>
            {
                //apparently FontFamilies have to be constructed on the UI thread. Who knew?
                hslFamily   = (FontFamily)App.Current.Resources[Constants.HslPiktoFrameFontFamilyKey];
                segoeFamily = new FontFamily(Constants.SegoeMdl2FontName);
                fontFamiliesFound.SetResult(true);
            });
            await fontFamiliesFound.Task;
            await Task.Delay(10); //give UI time to render before we go hunting for glyphs

            List <FavoriteIcon> iconsList = new List <FavoriteIcon>();

            List <int> fontInts = HslFontGlyphs.PiktoFrame.ToList();

            foreach (int value in fontInts)
            {
                var icon = new FavoriteIcon
                {
                    FontFamily = hslFamily,
                    Glyph      = ((char)(int.Parse(value.ToString("X"), System.Globalization.NumberStyles.HexNumber))).ToString(),
                    FontSize   = Constants.HslFontSize
                };
                iconsList.Add(icon);
            }

            Array enumsValues = Enum.GetValues(typeof(Symbol));

            foreach (var value in enumsValues)
            {
                int currentValue = (int)value;
                var icon         = new FavoriteIcon
                {
                    FontFamily = segoeFamily,
                    Glyph      = ((char)(int.Parse(currentValue.ToString("X"), System.Globalization.NumberStyles.HexNumber))).ToString(),
                    FontSize   = Constants.SymbolFontSize
                };
                iconsList.Add(icon);
            }

            PossibleIconsList = new ObservableCollection <FavoriteIcon>(iconsList);

            // The SelectedIconIndex binding won't update correctly until the GridView has actually
            // realized at least one element, so let's wait here for a moment to make sure that it's
            // ready to go.
            await Task.Delay(100);

            if (!String.IsNullOrWhiteSpace(_editDialogIconFont) &&
                !String.IsNullOrWhiteSpace(_editDialogIconGlyph))
            {
                SelectedIconIndex = PossibleIconsList.IndexOf
                                    (
                    PossibleIconsList.FirstOrDefault(x => x.FontFamily.Source == _editDialogIconFont && x.Glyph == _editDialogIconGlyph)
                                    );
            }

            if (SelectedIconIndex == -1)
            {
                SelectedIconIndex = 0; //In case we didn't find it, default to the first icon.
            }
        }