-
Notifications
You must be signed in to change notification settings - Fork 1
865752 - Create a blog sample for how to load and save files from AWS cloud storage #72
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8588a0f
865752 - Create a blog sample for how to load and save files from AWS…
Nandhakumar-SF4686 af3cbcb
Adding changes
Nandhakumar-SF4686 5c6925e
Adding changes
Nandhakumar-SF4686 87851d6
Adding changes
Nandhakumar-SF4686 e87eb10
Adding changes without open button
Nandhakumar-SF4686 1711d5c
Feedback addressed
Nandhakumar-SF4686 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version = "1.0" encoding = "UTF-8" ?> | ||
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:local="clr-namespace:AutoSavePDFinAWS" | ||
xmlns:converters="clr-namespace:AutoSavePDFinAWS" | ||
x:Class="AutoSavePDFinAWS.App"> | ||
<Application.Resources> | ||
<ResourceDictionary> | ||
<ResourceDictionary.MergedDictionaries> | ||
<ResourceDictionary Source="Resources/Styles/Colors.xaml" /> | ||
<ResourceDictionary Source="Resources/Styles/Styles.xaml" /> | ||
</ResourceDictionary.MergedDictionaries> | ||
<converters:InverseBooleanConverter x:Key="InverseBooleanConverter" /> | ||
</ResourceDictionary> | ||
</Application.Resources> | ||
</Application> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace AutoSavePDFinAWS | ||
{ | ||
public partial class App : Application | ||
{ | ||
public App() | ||
{ | ||
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("Add valid license key"); | ||
InitializeComponent(); | ||
} | ||
|
||
protected override Window CreateWindow(IActivationState? activationState) | ||
{ | ||
return new Window(new AppShell()); | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<Shell | ||
x:Class="AutoSavePDFinAWS.AppShell" | ||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:local="clr-namespace:AutoSavePDFinAWS" | ||
Title="AutoSavePDFinAWS"> | ||
|
||
<ShellContent | ||
Title="Home" | ||
ContentTemplate="{DataTemplate local:MainPage}" | ||
Route="MainPage" /> | ||
|
||
</Shell> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace AutoSavePDFinAWS | ||
{ | ||
public partial class AppShell : Shell | ||
{ | ||
public AppShell() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>net9.0-android;net9.0-ios;net9.0-maccatalyst</TargetFrameworks> | ||
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0</TargetFrameworks> | ||
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET --> | ||
<!-- <TargetFrameworks>$(TargetFrameworks);net9.0-tizen</TargetFrameworks> --> | ||
|
||
<!-- Note for MacCatalyst: | ||
The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64. | ||
When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>. | ||
The Mac App Store will NOT accept apps with ONLY maccatalyst-arm64 indicated; | ||
either BOTH runtimes must be indicated or ONLY macatalyst-x64. --> | ||
<!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> --> | ||
|
||
<OutputType>Exe</OutputType> | ||
<RootNamespace>AutoSavePDFinAWS</RootNamespace> | ||
<UseMaui>true</UseMaui> | ||
<SingleProject>true</SingleProject> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<!-- Display name --> | ||
<ApplicationTitle>AutoSavePDFinAWS</ApplicationTitle> | ||
|
||
<!-- App Identifier --> | ||
<ApplicationId>com.companyname.autosavepdfinaws</ApplicationId> | ||
|
||
<!-- Versions --> | ||
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion> | ||
<ApplicationVersion>1</ApplicationVersion> | ||
|
||
<!-- To develop, package, and publish an app to the Microsoft Store, see: https://aka.ms/MauiTemplateUnpackaged --> | ||
<WindowsPackageType>None</WindowsPackageType> | ||
|
||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">15.0</SupportedOSPlatformVersion> | ||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">15.0</SupportedOSPlatformVersion> | ||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion> | ||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion> | ||
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion> | ||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<!-- App Icon --> | ||
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" /> | ||
|
||
<!-- Splash Screen --> | ||
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" /> | ||
|
||
<!-- Images --> | ||
<MauiImage Include="Resources\Images\*" /> | ||
<MauiImage Update="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185" /> | ||
|
||
<!-- Custom Fonts --> | ||
<MauiFont Include="Resources\Fonts\*" /> | ||
|
||
<!-- Raw Assets (also remove the "Resources\Raw" prefix) --> | ||
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="AWSSDK.S3" Version="*" /> | ||
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0" /> | ||
<PackageReference Include="Syncfusion.Maui.PdfViewer" Version="*" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
| ||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.14.36203.30 d17.14 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoSavePDFinAWS", "AutoSavePDFinAWS.csproj", "{626306A7-D53A-409E-A65E-2D1D3714EC3F}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{626306A7-D53A-409E-A65E-2D1D3714EC3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{626306A7-D53A-409E-A65E-2D1D3714EC3F}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{626306A7-D53A-409E-A65E-2D1D3714EC3F}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{626306A7-D53A-409E-A65E-2D1D3714EC3F}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {BADD224A-DD7D-497F-A2D1-4D59A4DC92AA} | ||
EndGlobalSection | ||
EndGlobal |
51 changes: 51 additions & 0 deletions
51
Save/AutoSavePDFinAWS/Converter/InverseBooleanConverter.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace AutoSavePDFinAWS | ||
{ | ||
/// <summary> | ||
/// Value converter that inverts boolean values for data binding scenarios. | ||
/// Used in XAML to bind UI elements that need the opposite of a boolean property. | ||
/// For example, enabling a Save button when Auto-Save is disabled. | ||
/// </summary> | ||
public class InverseBooleanConverter : IValueConverter | ||
{ | ||
/// <summary> | ||
/// Converts a boolean value to its inverse. | ||
/// </summary> | ||
/// <param name="value">The boolean value to convert</param> | ||
/// <param name="targetType">The type of the binding target property (must be bool)</param> | ||
/// <param name="parameter">Optional parameter for the converter (not used)</param> | ||
/// <param name="culture">Culture information for the conversion (not used)</param> | ||
/// <returns>The inverted boolean value</returns> | ||
/// <exception cref="InvalidOperationException">Thrown when target type is not boolean</exception> | ||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
// Validate that the target type is boolean | ||
if (targetType != typeof(bool)) | ||
throw new InvalidOperationException("The target must be a boolean"); | ||
|
||
// Return the inverse of the input boolean value | ||
return value is bool boolValue ? !boolValue : false; | ||
} | ||
|
||
/// <summary> | ||
/// Converts back from the inverted value to the original (not supported). | ||
/// This converter is designed for one-way binding only. | ||
/// </summary> | ||
/// <param name="value">The value to convert back</param> | ||
/// <param name="targetType">The type to convert to</param> | ||
/// <param name="parameter">Optional parameter for the converter</param> | ||
/// <param name="culture">Culture information for the conversion</param> | ||
/// <returns>Not supported</returns> | ||
/// <exception cref="NotSupportedException">Always thrown as this operation is not supported</exception> | ||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
throw new NotSupportedException("InverseBooleanConverter does not support ConvertBack operation"); | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:pdfViewer="clr-namespace:Syncfusion.Maui.PdfViewer;assembly=Syncfusion.Maui.PdfViewer" | ||
x:Class="AutoSavePDFinAWS.MainPage"> | ||
|
||
<!-- UI resource definitions --> | ||
<ContentPage.Resources> | ||
<ResourceDictionary> | ||
|
||
<!-- Toolbar button style --> | ||
<Style x:Key="ToolbarButtonStyle" | ||
TargetType="Button"> | ||
<Setter Property="CornerRadius" | ||
Value="6" /> | ||
<Setter Property="Padding" | ||
Value="10,6" /> | ||
<Setter Property="Margin" | ||
Value="5,0" /> | ||
<Setter Property="BackgroundColor" | ||
Value="#3B82F6" /> | ||
<Setter Property="TextColor" | ||
Value="White" /> | ||
<Setter Property="FontAttributes" | ||
Value="Bold" /> | ||
|
||
<!-- Visual states for button --> | ||
<Setter Property="VisualStateManager.VisualStateGroups"> | ||
<VisualStateGroupList> | ||
<VisualStateGroup Name="CommonStates"> | ||
<!-- Normal state - default blue appearance --> | ||
<VisualState Name="Normal" /> | ||
|
||
<!-- Disabled state - muted gray appearance --> | ||
<VisualState Name="Disabled"> | ||
<VisualState.Setters> | ||
<Setter Property="BackgroundColor" | ||
Value="#E5E7EB" /> | ||
<Setter Property="TextColor" | ||
Value="#1F2937" /> | ||
</VisualState.Setters> | ||
</VisualState> | ||
</VisualStateGroup> | ||
</VisualStateGroupList> | ||
</Setter> | ||
</Style> | ||
</ResourceDictionary> | ||
</ContentPage.Resources> | ||
|
||
<!-- Main layout grid --> | ||
<Grid RowSpacing="0"> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto" /> | ||
<!-- Toolbar row - auto-sized --> | ||
<RowDefinition Height="*" /> | ||
<!-- PDF viewer row - fills remaining space --> | ||
</Grid.RowDefinitions> | ||
|
||
<!-- Toolbar --> | ||
<Border Grid.Row="0" | ||
BackgroundColor="#F3F4F6" | ||
Padding="12" | ||
StrokeThickness="0"> | ||
<Grid ColumnSpacing="12"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="*" /> | ||
<!-- Notification area - takes remaining space --> | ||
<ColumnDefinition Width="Auto" /> | ||
<!-- Button area - auto-sized --> | ||
</Grid.ColumnDefinitions> | ||
|
||
<!-- Status notification label --> | ||
<Label Grid.Column="0" | ||
x:Name="NotificationLabel" | ||
Text="{Binding NotificationText}" | ||
HorizontalOptions="Start" | ||
VerticalOptions="Center" /> | ||
|
||
<!-- Toolbar controls --> | ||
<HorizontalStackLayout Grid.Column="1"> | ||
|
||
<!-- Save button (manual) --> | ||
<Button x:Name="SaveButton" | ||
FontSize="20" | ||
Text="" | ||
VerticalOptions="Center" | ||
FontFamily="MauiMaterialAssets" | ||
ToolTipProperties.Text="Save PDF file manually" | ||
Style="{StaticResource ToolbarButtonStyle}" | ||
Command="{Binding SavePdfCommand}" | ||
IsEnabled="{Binding IsAutoSaveEnabled, Converter={StaticResource InverseBooleanConverter}}"/> | ||
|
||
<!-- Auto-save toggle --> | ||
<Border StrokeThickness="1" | ||
Padding="0,0,12,0" | ||
Margin="4,0" | ||
Stroke="LightGray" | ||
VerticalOptions="Center"> | ||
<StackLayout Orientation="Horizontal" VerticalOptions="Center"> | ||
<CheckBox IsChecked="{Binding IsAutoSaveEnabled}" VerticalOptions="Center" /> | ||
<Label Text="Auto Save" VerticalOptions="Center" /> | ||
</StackLayout> | ||
</Border> | ||
|
||
</HorizontalStackLayout> | ||
</Grid> | ||
</Border> | ||
|
||
<!-- PDF Viewer with event handlers --> | ||
<pdfViewer:SfPdfViewer Grid.Row="1" | ||
x:Name="PdfViewer" | ||
DocumentLoaded="PdfViewer_DocumentLoaded" | ||
DocumentUnloaded="PdfViewer_DocumentUnloaded" | ||
AnnotationAdded="PdfViewer_AnnotationAdded" | ||
AnnotationRemoved="PdfViewer_AnnotationRemoved" | ||
AnnotationEdited="PdfViewer_AnnotationEdited" | ||
FormFieldValueChanged="PdfViewer_FormFieldValueChanged" /> | ||
</Grid> | ||
|
||
</ContentPage> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shorten the following XML comments
...
...
...
...
...
...
...
...
...
...
...
...
Shortened format
...
...
...
...
...
...
...
...
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed the xml comments