Skip to content

Commit 269e103

Browse files
Feedback addressed
1 parent 53135b5 commit 269e103

File tree

6 files changed

+30
-37
lines changed

6 files changed

+30
-37
lines changed
-63.8 KB
Binary file not shown.
207 KB
Binary file not shown.

MultiTabbedPDFViewer/MainPage.xaml.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,30 @@ public MainPage()
1919
pdfViewer2.ZoomMode = ZoomMode.FitToWidth;
2020
}
2121

22-
async void SfTabView_Loaded(System.Object sender, System.EventArgs e)
22+
private void SfTabView_Loaded(System.Object sender, System.EventArgs e)
2323
{
2424
// Ensure the viewModel is not null before proceeding
2525
if (viewModel?.PDFDocuments != null)
2626
{
2727
// Check if the first tab's header matches "doc 1"
2828
if (tab1.Header.Equals("doc 1"))
2929
{
30-
await Task.Delay(80); // Slight delay to ensure UI is ready
3130
pdfViewer.DocumentSource = viewModel.PDFDocuments[0]; // Assign the stream to the "DocumentSource" property of the PdfViewer control
3231
tab1.Content = pdfViewer; // Set the content of tab1 to the pdfViewer.
3332
}
3433

3534
// Check if the second tab's header matches "doc 2"
3635
if (tab2.Header.Equals("doc 2"))
3736
{
38-
await Task.Delay(80); // Slight delay to ensure UI is ready
3937
pdfViewer1.DocumentSource = viewModel.PDFDocuments[1]; // Assign the stream to the "DocumentSource" property of the PdfViewer control
40-
tab2.Content = pdfViewer1; // Set the content of tab1 to the pdfViewer1.
38+
tab2.Content = pdfViewer1; // Set the content of tab2 to the pdfViewer1.
4139
}
4240

4341
// Check if the third tab's header matches "doc 3"
4442
if (tab3.Header.Equals("doc 3"))
4543
{
46-
await Task.Delay(80); // Slight delay to ensure UI is ready
4744
pdfViewer2.DocumentSource = viewModel.PDFDocuments[2]; // Assign the stream to the "DocumentSource" property of the PdfViewer control
48-
tab3.Content = pdfViewer2; // Set the content of tab1 to the pdfViewer1.
45+
tab3.Content = pdfViewer2; // Set the content of tab3 to the pdfViewer1.
4946
}
5047
}
5148
}

MultiTabbedPDFViewer/MultiTabbedPDFViewer.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@
6161

6262
<ItemGroup>
6363
<None Remove="Assets\Annotations.pdf" />
64-
<None Remove="Assets\form_document.pdf" />
6564
<None Remove="Assets\PDF_Succinctly.pdf" />
65+
<None Remove="Assets\rotated_document.pdf" />
6666
</ItemGroup>
6767

6868
<ItemGroup>
6969
<EmbeddedResource Include="Assets\Annotations.pdf" />
70-
<EmbeddedResource Include="Assets\form_document.pdf" />
7170
<EmbeddedResource Include="Assets\PDF_Succinctly.pdf" />
71+
<EmbeddedResource Include="Assets\rotated_document.pdf" />
7272
</ItemGroup>
7373

7474
<ItemGroup>

MultiTabbedPDFViewer/README.md

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ In the MainPage constructor, set the [ZoomMode](https://help.syncfusion.com/cr/m
108108

109109
//Accessing the PDF document that is added as embedded resource as stream.
110110
Stream? documentSource = typeof(App).GetTypeInfo().Assembly.GetManifestResourceStream("MultiTabbedPDFViewer.Assets.PDF_Succinctly.pdf");
111-
Stream? documentSource1 = typeof(App).GetTypeInfo().Assembly.GetManifestResourceStream("MultiTabbedPDFViewer.Assets.form_document.pdf");
111+
Stream? documentSource1 = typeof(App).GetTypeInfo().Assembly.GetManifestResourceStream("MultiTabbedPDFViewer.Assets.rotated_document.pdf");
112112
Stream? documentSource2 = typeof(App).GetTypeInfo().Assembly.GetManifestResourceStream("MultiTabbedPDFViewer.Assets.Annotations.pdf");
113113
// Add the PDF streams to the collection if they are successfully retrieved
114114
if (documentSource != null)
@@ -150,36 +150,33 @@ In the SfTabView `Loaded` event handler, evaluate the header text of each SfTabI
150150
**C#:**
151151

152152
```csharp
153-
async void SfTabView_Loaded(System.Object sender, System.EventArgs e)
153+
private void SfTabView_Loaded(System.Object sender, System.EventArgs e)
154+
{
155+
// Ensure the viewModel is not null before proceeding
156+
if (viewModel?.PDFDocuments != null)
154157
{
155-
// Ensure the viewModel is not null before proceeding
156-
if (viewModel?.PDFDocuments != null)
158+
// Check if the first tab's header matches "doc 1"
159+
if (tab1.Header.Equals("doc 1"))
160+
{
161+
pdfViewer.DocumentSource = viewModel.PDFDocuments[0]; // Assign the stream to the "DocumentSource" property of the PdfViewer control
162+
tab1.Content = pdfViewer; // Set the content of tab1 to the pdfViewer.
163+
}
164+
165+
// Check if the second tab's header matches "doc 2"
166+
if (tab2.Header.Equals("doc 2"))
157167
{
158-
// Check if the first tab's header matches "doc 1"
159-
if (tab1.Header.Equals("doc 1"))
160-
{
161-
await Task.Delay(80); // Slight delay to ensure UI is ready
162-
pdfViewer.DocumentSource = viewModel.PDFDocuments[0]; // Assign the stream to the "DocumentSource" property of the PdfViewer control
163-
tab1.Content = pdfViewer; // Set the content of tab1 to the pdfViewer.
164-
}
165-
166-
// Check if the second tab's header matches "doc 2"
167-
if (tab2.Header.Equals("doc 2"))
168-
{
169-
await Task.Delay(80); // Slight delay to ensure UI is ready
170-
pdfViewer1.DocumentSource = viewModel.PDFDocuments[1]; // Assign the stream to the "DocumentSource" property of the PdfViewer control
171-
tab2.Content = pdfViewer1; // Set the content of tab1 to the pdfViewer1.
172-
}
173-
174-
// Check if the third tab's header matches "doc 3"
175-
if (tab3.Header.Equals("doc 3"))
176-
{
177-
await Task.Delay(80); // Slight delay to ensure UI is ready
178-
pdfViewer2.DocumentSource = viewModel.PDFDocuments[2]; // Assign the stream to the "DocumentSource" property of the PdfViewer control
179-
tab3.Content = pdfViewer2; // Set the content of tab1 to the pdfViewer1.
180-
}
168+
pdfViewer1.DocumentSource = viewModel.PDFDocuments[1]; // Assign the stream to the "DocumentSource" property of the PdfViewer control
169+
tab2.Content = pdfViewer1; // Set the content of tab2 to the pdfViewer1.
170+
}
171+
172+
// Check if the third tab's header matches "doc 3"
173+
if (tab3.Header.Equals("doc 3"))
174+
{
175+
pdfViewer2.DocumentSource = viewModel.PDFDocuments[2]; // Assign the stream to the "DocumentSource" property of the PdfViewer control
176+
tab3.Content = pdfViewer2; // Set the content of tab3 to the pdfViewer1.
181177
}
182178
}
179+
}
183180
```
184181

185182
### 6. Subscription of TabView Loaded event.

MultiTabbedPDFViewer/ViewModel/PdfViewerViewModel.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System.Collections.ObjectModel;
22
using System.ComponentModel;
33
using System.Reflection;
4-
using static Android.Hardware.Camera;
54

65
namespace MultiTabbedPDFViewer
76
{
@@ -19,7 +18,7 @@ public PdfViewerViewModel()
1918

2019
//Accessing the PDF document that is added as embedded resource as stream.
2120
Stream? documentSource = typeof(App).GetTypeInfo().Assembly.GetManifestResourceStream("MultiTabbedPDFViewer.Assets.PDF_Succinctly.pdf");
22-
Stream? documentSource1 = typeof(App).GetTypeInfo().Assembly.GetManifestResourceStream("MultiTabbedPDFViewer.Assets.form_document.pdf");
21+
Stream? documentSource1 = typeof(App).GetTypeInfo().Assembly.GetManifestResourceStream("MultiTabbedPDFViewer.Assets.rotated_document.pdf");
2322
Stream? documentSource2 = typeof(App).GetTypeInfo().Assembly.GetManifestResourceStream("MultiTabbedPDFViewer.Assets.Annotations.pdf");
2423
// Add the PDF streams to the collection if they are successfully retrieved
2524
if (documentSource != null)

0 commit comments

Comments
 (0)