Skip to content

Commit

Permalink
Added samples for reference
Browse files Browse the repository at this point in the history
  • Loading branch information
prathameshnarkhede committed Jul 16, 2024
1 parent 7d6cf97 commit 8524f7a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<Border Background="#99ffffff" x:Name="popupPanel" IsVisible="False">
<Border HorizontalOptions="Center" VerticalOptions="Center" Background="{AppThemeBinding Dark=Black, Light=White}" Margin="0,32" Padding="12">
<Grid>
<esriTK:PopupViewer x:Name="popupViewer" Padding="12" MaximumWidthRequest="400" MaximumHeightRequest="400" PopupAttachmentClicked="popupViewer_PopupAttachmentClicked" />
<esriTK:PopupViewer x:Name="popupViewer" Padding="12" MaximumWidthRequest="400" MaximumHeightRequest="400" PopupAttachmentClicked="popupViewer_PopupAttachmentClicked" HyperLinkClicked="popupViewer_HyperLinkClicked" />
<Button BorderWidth="0" Text="X" HorizontalOptions="End" VerticalOptions="Start" Clicked="CloseButton_Click" BackgroundColor="Transparent" TextColor="{AppThemeBinding Dark=White, Light=Black}" Margin="5" />
</Grid>
</Border>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,12 @@ private void popupViewer_PopupAttachmentClicked(object sender, Esri.ArcGISRuntim
_ = Microsoft.Maui.ApplicationModel.Launcher.Default.OpenAsync(
new Microsoft.Maui.ApplicationModel.OpenFileRequest(e.Attachment.Name, new ReadOnlyFile(e.Attachment.Filename!, e.Attachment.ContentType)));
}

private void popupViewer_HyperLinkClicked(object sender, Esri.ArcGISRuntime.Toolkit.Maui.HyperLinkClickedEventArgs e)
{
e.Handled = true; // Prevent default launch action
// Open default browser, this could be custom action
_ = Microsoft.Maui.ApplicationModel.Launcher.Default.OpenAsync(e.Uri);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<Grid Background="#AA333333" Visibility="Collapsed" x:Name="PopupBackground" MouseDown="PopupBackground_MouseDown">
<Border BorderBrush="Black" BorderThickness="1" Background="White" HorizontalAlignment="Center" VerticalAlignment="Center" >
<esri:PopupViewer x:Name="popupViewer" Margin="5" Width="400" MaxHeight="400" PopupAttachmentClicked="popupViewer_PopupAttachmentClicked" />
<esri:PopupViewer x:Name="popupViewer" Margin="5" Width="400" MaxHeight="400" PopupAttachmentClicked="popupViewer_PopupAttachmentClicked" HyperLinkClicked="popupViewer_LinkClicked" />
</Border>
</Grid>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using ABI.System;
using Esri.ArcGISRuntime.Data;
using Esri.ArcGISRuntime.Mapping.Popups;
using Esri.ArcGISRuntime.RealTime;
Expand All @@ -8,6 +9,7 @@
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using Windows.System;

namespace Esri.ArcGISRuntime.Toolkit.Samples.PopupViewer
{
Expand Down Expand Up @@ -148,11 +150,18 @@ private async void popupViewer_PopupAttachmentClicked(object sender, UI.Controls
e.Attachment.CancelLoad();
}
}
catch (Exception ex)
catch (System.Exception ex)
{
MessageBox.Show("Failed to download attachment", ex.Message);
}
}
}

private async void popupViewer_LinkClicked(object sender, UI.Controls.HyperLinkClickedEventArgs e)
{
e.Handled = true;
// Open default browser, this could be custom action
await Launcher.LaunchUriAsync(e.Uri);
}
}
}

0 comments on commit 8524f7a

Please sign in to comment.