Skip to content

Commit a09a166

Browse files
committed
Changed the sample to .NET 10
1 parent 425a2b6 commit a09a166

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

DetectPdfChanges/DetectPdfChanges.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net9.0-android;net9.0-ios;net9.0-maccatalyst</TargetFrameworks>
5-
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0</TargetFrameworks>
4+
<TargetFrameworks>net10.0-android;net10.0-ios;net10.0-maccatalyst</TargetFrameworks>
5+
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net10.0-windows10.0.19041.0</TargetFrameworks>
66
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
77
<!-- <TargetFrameworks>$(TargetFrameworks);net9.0-tizen</TargetFrameworks> -->
88

@@ -69,7 +69,7 @@
6969

7070
<ItemGroup>
7171
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
72-
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0" />
72+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.0" />
7373
<PackageReference Include="Syncfusion.Maui.PdfViewer" Version="*" />
7474
</ItemGroup>
7575

DetectPdfChanges/MainPage.xaml.cs

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,37 @@ public MainPage()
99
InitializeComponent();
1010
}
1111

12-
private void PdfViewer_FormFieldValueChanged(object sender, FormFieldValueChangedEventArgs e)
12+
private async void PdfViewer_FormFieldValueChanged(object sender, FormFieldValueChangedEventArgs e)
1313
{
14-
if (Application.Current != null)
15-
Application.Current.Windows[0].Page?.DisplayAlert("PDF Edited", $"{e.FormField} value is changed.", "OK");
14+
var page = Application.Current?.Windows?.FirstOrDefault()?.Page;
15+
if (page is null)
16+
return;
17+
18+
await page.DisplayAlertAsync("PDF Edited", $"{e.FormField} value is changed.", "OK");
1619
}
1720

18-
private void PdfViewer_AnnotationAdded(object sender, AnnotationEventArgs e)
21+
private async void PdfViewer_AnnotationAdded(object sender, AnnotationEventArgs e)
1922
{
20-
if (Application.Current != null)
21-
Application.Current.Windows[0].Page?.DisplayAlert("PDF Edited", "Annotation is added.", "OK");
23+
var page = Application.Current?.Windows?.FirstOrDefault()?.Page;
24+
if (page is null)
25+
return;
26+
await page.DisplayAlertAsync("PDF Edited", "Annotation is added.", "OK");
2227
}
2328

24-
private void PdfViewer_AnnotationEdited(object sender, AnnotationEventArgs e)
29+
private async void PdfViewer_AnnotationEdited(object sender, AnnotationEventArgs e)
2530
{
26-
if (Application.Current != null)
27-
Application.Current.Windows[0].Page?.DisplayAlert("PDF Edited", $"Annotation is edited.", "OK");
31+
var page = Application.Current?.Windows?.FirstOrDefault()?.Page;
32+
if (page is null)
33+
return;
34+
await page.DisplayAlertAsync("PDF Edited", $"Annotation is edited.", "OK");
2835
}
2936

30-
private void PdfViewer_AnnotationRemoved(object sender, AnnotationEventArgs e)
37+
private async void PdfViewer_AnnotationRemoved(object sender, AnnotationEventArgs e)
3138
{
32-
if(Application.Current != null)
33-
Application.Current.Windows[0].Page?.DisplayAlert("PDF Edited", $"Annotation is removed.", "OK");
39+
var page = Application.Current?.Windows?.FirstOrDefault()?.Page;
40+
if (page is null)
41+
return;
42+
await page.DisplayAlertAsync("PDF Edited", $"Annotation is removed.", "OK");
3443
}
3544
}
3645
}

0 commit comments

Comments
 (0)