Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BookmarksViewSample fixes #543

Merged
merged 7 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public partial class BookmarksViewSample : ContentPage
private const string webMapOneUrl = "https://arcgisruntime.maps.arcgis.com/home/item.html?id=e50fafe008ac4ce4ad2236de7fd149c3";
private const string webMapTwoUrl = "https://arcgisruntime.maps.arcgis.com/home/item.html?id=16f1b8ba37b44dc3884afc8d5f454dd2";
private const string webSceneOne = "https://arcgisruntime.maps.arcgis.com/home/item.html?id=6b6588041965408e84ba319e12d9d7ad";
private const string webSceneTwo = "https://www.arcgis.com/home/webscene/viewer.html?webscene=b9ad8372ff884bc4a4e78d936b170f7d";
private const string webSceneTwo = "https://arcgisruntime.maps.arcgis.com/home/item.html?id=b3e2230e170d4f91aa3d47f88821743d";
private MapView MyMapView;
private SceneView MySceneView;
private Random _randomizer = new Random();
Expand Down Expand Up @@ -48,6 +48,8 @@ private void SetMapViewBinding_Click(object? sender, EventArgs e)
BookmarksView.SetBinding(Esri.ArcGISRuntime.Toolkit.Maui.BookmarksView.GeoViewProperty, geoviewBinding);
}

// Note that the Web Scene specification uses presentation slides in lieu of bookmarks.
// As such, the BookmarksView will initially be empty, so click the "Set list" button to generate bookmarks.
private void SetSceneViewBinding_Click(object? sender, EventArgs e)
{
if (_viewContainer.Children.Contains(MySceneView) == false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public sealed partial class BookmarksViewSample : Page
private const string webMapOneUrl = "https://arcgisruntime.maps.arcgis.com/home/item.html?id=e50fafe008ac4ce4ad2236de7fd149c3";
private const string webMapTwoUrl = "https://arcgisruntime.maps.arcgis.com/home/item.html?id=16f1b8ba37b44dc3884afc8d5f454dd2";
private const string webSceneOne = "https://arcgisruntime.maps.arcgis.com/home/item.html?id=6b6588041965408e84ba319e12d9d7ad";
private const string webSceneTwo = "https://www.arcgis.com/home/webscene/viewer.html?webscene=b9ad8372ff884bc4a4e78d936b170f7d";
private const string webSceneTwo = "https://arcgisruntime.maps.arcgis.com/home/item.html?id=b3e2230e170d4f91aa3d47f88821743d";

private Random _randomizer = new Random();

Expand Down Expand Up @@ -46,6 +46,8 @@ private void SetMapViewBinding_Click(object sender, RoutedEventArgs e)
BookmarksView.SetBinding(UI.Controls.BookmarksView.GeoViewProperty, geoviewBinding);
}

// Note that the Web Scene specification uses presentation slides in lieu of bookmarks.
// As such, the BookmarksView will initially be empty, so click the "Set list" button to generate bookmarks.
private void SetSceneViewBinding_Click(object sender, RoutedEventArgs e)
{
MyMapView.Visibility = Visibility.Collapsed;
Expand Down Expand Up @@ -136,7 +138,13 @@ private void RemoveSelectionListener_Click(object sender, RoutedEventArgs e)

private async void BookmarkSelected(object sender, Bookmark bookmark)
{
#if WINUI
var dialog = new MessageDialog($"{bookmark.Name} Selected!");
WinRT.Interop.InitializeWithWindow.Initialize(dialog, App.CurrentWindowHandle);
await dialog.ShowAsync();
williambohrmann3 marked this conversation as resolved.
Show resolved Hide resolved
#else
await new MessageDialog($"{bookmark.Name} Selected!").ShowAsync();
#endif
}

private void SelectDefaultItemContainer_Click(object sender, RoutedEventArgs e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public partial class BookmarksViewSample : UserControl
private const string webMapOneUrl = "https://arcgisruntime.maps.arcgis.com/home/item.html?id=e50fafe008ac4ce4ad2236de7fd149c3";
private const string webMapTwoUrl = "https://arcgisruntime.maps.arcgis.com/home/item.html?id=16f1b8ba37b44dc3884afc8d5f454dd2";
private const string webSceneOne = "https://arcgisruntime.maps.arcgis.com/home/item.html?id=6b6588041965408e84ba319e12d9d7ad";
private const string webSceneTwo = "https://www.arcgis.com/home/webscene/viewer.html?webscene=b9ad8372ff884bc4a4e78d936b170f7d";
private const string webSceneTwo = "https://arcgisruntime.maps.arcgis.com/home/item.html?id=b3e2230e170d4f91aa3d47f88821743d";

private Random _randomizer = new Random();

Expand Down Expand Up @@ -57,6 +57,8 @@ private void SetMapViewBinding_Click(object sender, RoutedEventArgs e)
BookmarksView.SetBinding(UI.Controls.BookmarksView.GeoViewProperty, geoviewBinding);
}

// Note that the Web Scene specification uses presentation slides in lieu of bookmarks.
// As such, the BookmarksView will initially be empty, so click the "Set list" button to generate bookmarks.
private void SetSceneViewBinding_Click(object sender, RoutedEventArgs e)
{
MyMapView.Visibility = Visibility.Collapsed;
Expand Down
2 changes: 2 additions & 0 deletions src/Samples/Toolkit.SampleApp.WinUI/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,7 @@ protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs ar
}

private Window m_window;

public static IntPtr CurrentWindowHandle => WinRT.Interop.WindowNative.GetWindowHandle(((App)Current).m_window);
}
}
Loading