v20.4.0.38
This commit is contained in:
Родитель
0134d23134
Коммит
c4a442e39b
|
@ -0,0 +1,16 @@
|
|||
<configuration>
|
||||
<packageRestore>
|
||||
<add key="enabled" value="True" />
|
||||
<add key="automatic" value="True" />
|
||||
</packageRestore>
|
||||
<packageSources>
|
||||
|
||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
|
||||
</packageSources>
|
||||
<activePackageSource>
|
||||
|
||||
</activePackageSource>
|
||||
<bindingRedirects>
|
||||
<add key="skip" value="False" />
|
||||
</bindingRedirects>
|
||||
</configuration>
|
|
@ -0,0 +1,31 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.31611.283
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleBrowser.Maui.PdfViewer", "SampleBrowser.Maui.PdfViewer\SampleBrowser.Maui.PdfViewer.csproj", "{3205BB3F-EC29-4031-9A42-D2804E47F7C3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release-Xml|Any CPU = Release-Xml|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{3205BB3F-EC29-4031-9A42-D2804E47F7C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3205BB3F-EC29-4031-9A42-D2804E47F7C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3205BB3F-EC29-4031-9A42-D2804E47F7C3}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{3205BB3F-EC29-4031-9A42-D2804E47F7C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3205BB3F-EC29-4031-9A42-D2804E47F7C3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3205BB3F-EC29-4031-9A42-D2804E47F7C3}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||
{3205BB3F-EC29-4031-9A42-D2804E47F7C3}.Release-Xml|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3205BB3F-EC29-4031-9A42-D2804E47F7C3}.Release-Xml|Any CPU.Build.0 = Release|Any CPU
|
||||
{3205BB3F-EC29-4031-9A42-D2804E47F7C3}.Release-Xml|Any CPU.Deploy.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {61F7FB11-1E47-470C-91E2-47F8143E1572}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,14 @@
|
|||
<?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:SampleBrowser.Maui.PdfViewer"
|
||||
xmlns:base="clr-namespace:SampleBrowser.Maui.Base;assembly=SampleBrowser.Maui.Base"
|
||||
x:Class="SampleBrowser.Maui.PdfViewer.App">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<base:SampleBrowserStyles/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
|
@ -0,0 +1,23 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
using System.Reflection;
|
||||
|
||||
namespace SampleBrowser.Maui.PdfViewer;
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
public App()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
//MainPage = new AppShell();
|
||||
var appInfo = typeof(App).GetTypeInfo().Assembly;
|
||||
SampleBrowser.Maui.Base.BaseConfig.IsIndividualSB = true;
|
||||
MainPage = SampleBrowser.Maui.Base.BaseConfig.MainPageInit(appInfo);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
namespace SampleBrowser.Maui.PdfViewer
|
||||
{
|
||||
// All the code in this file is included in all platforms.
|
||||
public class ControlConfig
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<SampleBrowser>
|
||||
<Assemblies Prefix="SampleBrowser.Maui.PdfViewer" QualifiedInfo="Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<Assembly Name="PdfViewer" />
|
||||
</Assemblies>
|
||||
</SampleBrowser>
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
using SampleBrowser.Maui.Base.Hosting;
|
||||
using Syncfusion.Maui.Core.Hosting;
|
||||
|
||||
namespace SampleBrowser.Maui.PdfViewer;
|
||||
public static class MauiProgram
|
||||
{
|
||||
public static MauiApp CreateMauiApp()
|
||||
{
|
||||
var builder = MauiApp.CreateBuilder();
|
||||
builder
|
||||
.UseMauiApp<App>()
|
||||
.ConfigureSyncfusionCore()
|
||||
.ConfigureFonts(fonts =>
|
||||
{
|
||||
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
|
||||
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
|
||||
fonts.AddFont("Roboto-Medium.ttf", "RobotoMedium");
|
||||
fonts.AddFont("Roboto-Regular.ttf", "Roboto");
|
||||
});
|
||||
builder.ConfigureSampleBrowserBase();
|
||||
return builder.Build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageRestore>
|
||||
<add key="enabled" value="True" />
|
||||
<add key="automatic" value="True" />
|
||||
</packageRestore>
|
||||
<packageSources>
|
||||
<add key="NexusServer" value="https://nexus.syncfusion.com/repository/nuget-hosted" />
|
||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
|
||||
</packageSources>
|
||||
<activePackageSource>
|
||||
<add key="NexusServer" value="https://nexus.syncfusion.com/repository/nuget-hosted" />
|
||||
</activePackageSource>
|
||||
<bindingRedirects>
|
||||
<add key="skip" value="False" />
|
||||
</bindingRedirects>
|
||||
</configuration>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<SyncfusionControls>
|
||||
<ControlCategory Name="Viewer">
|
||||
<Control Title="PDF Viewer" StatusTag="New" IsPreview="True" ControlName="SfPdfViewer" Image="pdfviewer.png" Description="View the PDF documents seamlessly and efficiently">
|
||||
<Sample Title="Getting Started" SampleName="GettingStarted" Description="This sample demonstrates how to load and view a PDF document in the viewer." SearchTags="pdf, view pdf, pdf viewer, viewer, pdf reader" CodeViewerPath="PdfViewer/GettingStarted/View/" />
|
||||
<Sample Title="Custom Toolbar" SampleName="CustomToolbar" Description="This sample demonstrates how to create a custom toolbar and perform functionalities using the APIs." SearchTags="pdf, view pdf, pdf viewer, viewer, pdf reader, toolbar, custom toolbar" CodeViewerPath="PdfViewer/CustomToolbar/View/" />
|
||||
</Control>
|
||||
</ControlCategory>
|
||||
</SyncfusionControls>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"></application>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
</manifest>
|
|
@ -0,0 +1,17 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
using Android.App;
|
||||
using Android.Content.PM;
|
||||
using Android.OS;
|
||||
|
||||
namespace SampleBrowser.Maui.PdfViewer;
|
||||
|
||||
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
|
||||
public class MainActivity : MauiAppCompatActivity
|
||||
{
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
using Android.App;
|
||||
using Android.Runtime;
|
||||
|
||||
namespace SampleBrowser.Maui.PdfViewer;
|
||||
|
||||
[Application]
|
||||
public class MainApplication : MauiApplication
|
||||
{
|
||||
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
|
||||
: base(handle, ownership)
|
||||
{
|
||||
}
|
||||
|
||||
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#512BD4</color>
|
||||
<color name="colorPrimaryDark">#2B0B98</color>
|
||||
<color name="colorAccent">#2B0B98</color>
|
||||
</resources>
|
|
@ -0,0 +1,16 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
using Foundation;
|
||||
|
||||
namespace SampleBrowser.Maui.PdfViewer;
|
||||
|
||||
[Register("AppDelegate")]
|
||||
public class AppDelegate : MauiUIApplicationDelegate
|
||||
{
|
||||
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>XSAppIconAssets</key>
|
||||
<string>Assets.xcassets/appicon.appiconset</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,22 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
using ObjCRuntime;
|
||||
using UIKit;
|
||||
|
||||
namespace SampleBrowser.Maui.PdfViewer;
|
||||
|
||||
public class Program
|
||||
{
|
||||
// This is the main entry point of the application.
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||
// you can specify it here.
|
||||
UIApplication.Main(args, null, typeof(AppDelegate));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
using System;
|
||||
using Microsoft.Maui;
|
||||
using Microsoft.Maui.Hosting;
|
||||
|
||||
namespace SampleBrowser.Maui.PdfViewer;
|
||||
|
||||
class Program : MauiApplication
|
||||
{
|
||||
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var app = new Program();
|
||||
app.Run(args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="maui-application-id-placeholder" version="0.0.0" api-version="7" xmlns="http://tizen.org/ns/packages">
|
||||
<profile name="common" />
|
||||
<ui-application appid="maui-application-id-placeholder" exec="SampleBrowser.Maui.PdfViewer.dll" multiple="false" nodisplay="false" taskmanage="true" type="dotnet" launch_mode="single">
|
||||
<label>maui-application-title-placeholder</label>
|
||||
<icon>maui-appicon-placeholder</icon>
|
||||
<metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
|
||||
</ui-application>
|
||||
<shortcut-list />
|
||||
<privileges>
|
||||
<privilege>http://tizen.org/privilege/internet</privilege>
|
||||
</privileges>
|
||||
<dependencies />
|
||||
<provides-appdefined-privileges />
|
||||
</manifest>
|
|
@ -0,0 +1,8 @@
|
|||
<maui:MauiWinUIApplication
|
||||
x:Class="SampleBrowser.Maui.PdfViewer.WinUI.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:maui="using:Microsoft.Maui"
|
||||
xmlns:local="using:SampleBrowser.Maui.PdfViewer.WinUI">
|
||||
|
||||
</maui:MauiWinUIApplication>
|
|
@ -0,0 +1,46 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
using Microsoft.UI.Xaml;
|
||||
|
||||
// To learn more about WinUI, the WinUI project structure,
|
||||
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
||||
|
||||
namespace SampleBrowser.Maui.PdfViewer.WinUI;
|
||||
|
||||
/// <summary>
|
||||
/// Provides application-specific behavior to supplement the default Application class.
|
||||
/// </summary>
|
||||
public partial class App : MauiWinUIApplication
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes the singleton application object. This is the first line of authored code
|
||||
/// executed, and as such is the logical equivalent of main() or WinMain().
|
||||
/// </summary>
|
||||
public App()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
|
||||
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
|
||||
|
||||
protected override void OnLaunched(LaunchActivatedEventArgs args)
|
||||
{
|
||||
base.OnLaunched(args);
|
||||
foreach (var item in Application.Windows)
|
||||
{
|
||||
var platformWindow = (item?.Handler?.PlatformView as Microsoft.UI.Xaml.Window);
|
||||
|
||||
if (platformWindow != null)
|
||||
{
|
||||
platformWindow.ExtendsContentIntoTitleBar = false;
|
||||
platformWindow.Title = ".NET MAUI Pdf Viewer Demo";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Package
|
||||
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
|
||||
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
|
||||
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
|
||||
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
|
||||
IgnorableNamespaces="uap rescap">
|
||||
|
||||
<Identity Name="maui-package-name-placeholder" Publisher="CN=User Name" Version="0.0.0.0" />
|
||||
|
||||
<mp:PhoneIdentity PhoneProductId="274D33CC-F7ED-4B05-86CF-ADCAE338D3CE" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||
|
||||
<Properties>
|
||||
<DisplayName>$placeholder$</DisplayName>
|
||||
<PublisherDisplayName>User Name</PublisherDisplayName>
|
||||
<Logo>$placeholder$.png</Logo>
|
||||
</Properties>
|
||||
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
|
||||
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
|
||||
</Dependencies>
|
||||
|
||||
<Resources>
|
||||
<Resource Language="x-generate" />
|
||||
</Resources>
|
||||
|
||||
<Applications>
|
||||
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="$targetentrypoint$">
|
||||
<uap:VisualElements
|
||||
DisplayName="$placeholder$"
|
||||
Description="$placeholder$"
|
||||
Square150x150Logo="$placeholder$.png"
|
||||
Square44x44Logo="$placeholder$.png"
|
||||
BackgroundColor="transparent">
|
||||
<uap:DefaultTile Square71x71Logo="$placeholder$.png" Wide310x150Logo="$placeholder$.png" Square310x310Logo="$placeholder$.png" />
|
||||
<uap:SplashScreen Image="$placeholder$.png" />
|
||||
</uap:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
|
||||
<Capabilities>
|
||||
<rescap:Capability Name="runFullTrust" />
|
||||
</Capabilities>
|
||||
|
||||
</Package>
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="SampleBrowser.Maui.PdfViewer.WinUI.app"/>
|
||||
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<!-- The combination of below two tags have the following effect:
|
||||
1) Per-Monitor for >= Windows 10 Anniversary Update
|
||||
2) System < Windows 10 Anniversary Update
|
||||
-->
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
</assembly>
|
|
@ -0,0 +1,16 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
using Foundation;
|
||||
|
||||
namespace SampleBrowser.Maui.PdfViewer;
|
||||
|
||||
[Register("AppDelegate")]
|
||||
public class AppDelegate : MauiUIApplicationDelegate
|
||||
{
|
||||
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>XSAppIconAssets</key>
|
||||
<string>Assets.xcassets/appicon.appiconset</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,22 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
using ObjCRuntime;
|
||||
using UIKit;
|
||||
|
||||
namespace SampleBrowser.Maui.PdfViewer;
|
||||
|
||||
public class Program
|
||||
{
|
||||
// This is the main entry point of the application.
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||
// you can specify it here.
|
||||
UIApplication.Main(args, null, typeof(AppDelegate));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"profiles": {
|
||||
"Windows Machine": {
|
||||
"commandName": "MsixPackage",
|
||||
"nativeDebugging": false
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
<svg width="456" height="456" viewBox="0 0 456 456" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M456 0H0V456H456V0Z" fill="#4822E3"/>
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 155 B |
|
@ -0,0 +1,14 @@
|
|||
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M48 0H0V48H48V0Z" fill="#4822E3"/>
|
||||
<g opacity="0.9">
|
||||
<rect x="15" y="17.3984" width="4.8406" height="4.80195" fill="white"/>
|
||||
<rect x="15" y="22.8086" width="4.8406" height="4.80195" fill="white"/>
|
||||
<rect x="15" y="28.1992" width="4.8406" height="4.80195" fill="white"/>
|
||||
<rect x="20.4473" y="17.3984" width="4.8406" height="4.80195" fill="white"/>
|
||||
<rect x="20.4473" y="22.8086" width="4.8406" height="4.80195" fill="white"/>
|
||||
<rect x="20.4473" y="28.1992" width="4.8406" height="4.80195" fill="white"/>
|
||||
<rect width="4.82131" height="4.82131" transform="matrix(0.709935 0.704267 -0.709935 0.704267 30.5234 15)" fill="white"/>
|
||||
<rect x="25.8906" y="22.8086" width="4.8406" height="4.80195" fill="white"/>
|
||||
<rect x="25.8906" y="28.1992" width="4.8406" height="4.80195" fill="white"/>
|
||||
</g>
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 913 B |
Двоичные данные
MAUI/PdfViewer/SampleBrowser.Maui.PdfViewer/Resources/Fonts/OpenSans-Regular.ttf
Normal file
Двоичные данные
MAUI/PdfViewer/SampleBrowser.Maui.PdfViewer/Resources/Fonts/OpenSans-Regular.ttf
Normal file
Двоичный файл не отображается.
Двоичные данные
MAUI/PdfViewer/SampleBrowser.Maui.PdfViewer/Resources/Fonts/OpenSans-Semibold.ttf
Normal file
Двоичные данные
MAUI/PdfViewer/SampleBrowser.Maui.PdfViewer/Resources/Fonts/OpenSans-Semibold.ttf
Normal file
Двоичный файл не отображается.
Двоичные данные
MAUI/PdfViewer/SampleBrowser.Maui.PdfViewer/Resources/Fonts/PdfViewerIcon.ttf
Normal file
Двоичные данные
MAUI/PdfViewer/SampleBrowser.Maui.PdfViewer/Resources/Fonts/PdfViewerIcon.ttf
Normal file
Двоичный файл не отображается.
Двоичные данные
MAUI/PdfViewer/SampleBrowser.Maui.PdfViewer/Resources/Fonts/Roboto-Medium.ttf
Normal file
Двоичные данные
MAUI/PdfViewer/SampleBrowser.Maui.PdfViewer/Resources/Fonts/Roboto-Medium.ttf
Normal file
Двоичный файл не отображается.
Двоичные данные
MAUI/PdfViewer/SampleBrowser.Maui.PdfViewer/Resources/Fonts/Roboto-Regular.ttf
Normal file
Двоичные данные
MAUI/PdfViewer/SampleBrowser.Maui.PdfViewer/Resources/Fonts/Roboto-Regular.ttf
Normal file
Двоичный файл не отображается.
|
@ -0,0 +1,15 @@
|
|||
Any raw assets you want to be deployed with your application can be placed in
|
||||
this directory (and child directories). Deployment of the asset to your application
|
||||
is automatically handled by the following `MauiAsset` Build Action within your `.csproj`.
|
||||
|
||||
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
|
||||
|
||||
These files will be deployed with you package and will be accessible using Essentials:
|
||||
|
||||
async Task LoadMauiAsset()
|
||||
{
|
||||
using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt");
|
||||
using var reader = new StreamReader(stream);
|
||||
|
||||
var contents = reader.ReadToEnd();
|
||||
}
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
После Ширина: | Высота: | Размер: 18 KiB |
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<?xaml-comp compile="true" ?>
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
||||
|
||||
<Color x:Key="Primary">#512BD4</Color>
|
||||
<Color x:Key="Secondary">#DFD8F7</Color>
|
||||
<Color x:Key="Tertiary">#2B0B98</Color>
|
||||
<Color x:Key="White">White</Color>
|
||||
<Color x:Key="Black">Black</Color>
|
||||
<Color x:Key="Gray100">#E1E1E1</Color>
|
||||
<Color x:Key="Gray200">#C8C8C8</Color>
|
||||
<Color x:Key="Gray300">#ACACAC</Color>
|
||||
<Color x:Key="Gray400">#919191</Color>
|
||||
<Color x:Key="Gray500">#6E6E6E</Color>
|
||||
<Color x:Key="Gray600">#404040</Color>
|
||||
<Color x:Key="Gray900">#212121</Color>
|
||||
<Color x:Key="Gray950">#141414</Color>
|
||||
<SolidColorBrush x:Key="PrimaryBrush" Color="{StaticResource Primary}"/>
|
||||
<SolidColorBrush x:Key="SecondaryBrush" Color="{StaticResource Secondary}"/>
|
||||
<SolidColorBrush x:Key="TertiaryBrush" Color="{StaticResource Tertiary}"/>
|
||||
<SolidColorBrush x:Key="WhiteBrush" Color="{StaticResource White}"/>
|
||||
<SolidColorBrush x:Key="BlackBrush" Color="{StaticResource Black}"/>
|
||||
<SolidColorBrush x:Key="Gray100Brush" Color="{StaticResource Gray100}"/>
|
||||
<SolidColorBrush x:Key="Gray200Brush" Color="{StaticResource Gray200}"/>
|
||||
<SolidColorBrush x:Key="Gray300Brush" Color="{StaticResource Gray300}"/>
|
||||
<SolidColorBrush x:Key="Gray400Brush" Color="{StaticResource Gray400}"/>
|
||||
<SolidColorBrush x:Key="Gray500Brush" Color="{StaticResource Gray500}"/>
|
||||
<SolidColorBrush x:Key="Gray600Brush" Color="{StaticResource Gray600}"/>
|
||||
<SolidColorBrush x:Key="Gray900Brush" Color="{StaticResource Gray900}"/>
|
||||
<SolidColorBrush x:Key="Gray950Brush" Color="{StaticResource Gray950}"/>
|
||||
|
||||
<Color x:Key="Yellow100Accent">#F7B548</Color>
|
||||
<Color x:Key="Yellow200Accent">#FFD590</Color>
|
||||
<Color x:Key="Yellow300Accent">#FFE5B9</Color>
|
||||
<Color x:Key="Cyan100Accent">#28C2D1</Color>
|
||||
<Color x:Key="Cyan200Accent">#7BDDEF</Color>
|
||||
<Color x:Key="Cyan300Accent">#C3F2F4</Color>
|
||||
<Color x:Key="Blue100Accent">#3E8EED</Color>
|
||||
<Color x:Key="Blue200Accent">#72ACF1</Color>
|
||||
<Color x:Key="Blue300Accent">#A7CBF6</Color>
|
||||
|
||||
</ResourceDictionary>
|
|
@ -0,0 +1,384 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<?xaml-comp compile="true" ?>
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
||||
|
||||
<Style TargetType="ActivityIndicator">
|
||||
<Setter Property="Color" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
|
||||
</Style>
|
||||
|
||||
<Style TargetType="IndicatorView">
|
||||
<Setter Property="IndicatorColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray500}}"/>
|
||||
<Setter Property="SelectedIndicatorColor" Value="{AppThemeBinding Light={StaticResource Gray950}, Dark={StaticResource Gray100}}"/>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="Stroke" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray500}}" />
|
||||
<Setter Property="StrokeShape" Value="Rectangle"/>
|
||||
<Setter Property="StrokeThickness" Value="1"/>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="BoxView">
|
||||
<Setter Property="Color" Value="{AppThemeBinding Light={StaticResource Gray950}, Dark={StaticResource Gray200}}" />
|
||||
</Style>
|
||||
|
||||
<Style TargetType="Button">
|
||||
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Primary}}" />
|
||||
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
|
||||
<Setter Property="FontFamily" Value="OpenSansRegular"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
<Setter Property="CornerRadius" Value="8"/>
|
||||
<Setter Property="Padding" Value="14,10"/>
|
||||
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||
<VisualStateGroupList>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
<VisualState x:Name="Disabled">
|
||||
<VisualState.Setters>
|
||||
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray950}, Dark={StaticResource Gray200}}" />
|
||||
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray600}}" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateGroupList>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="CheckBox">
|
||||
<Setter Property="Color" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
|
||||
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||
<VisualStateGroupList>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
<VisualState x:Name="Disabled">
|
||||
<VisualState.Setters>
|
||||
<Setter Property="Color" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateGroupList>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="DatePicker">
|
||||
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" />
|
||||
<Setter Property="BackgroundColor" Value="Transparent" />
|
||||
<Setter Property="FontFamily" Value="OpenSansRegular"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||
<VisualStateGroupList>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
<VisualState x:Name="Disabled">
|
||||
<VisualState.Setters>
|
||||
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray500}}" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateGroupList>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="Editor">
|
||||
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" />
|
||||
<Setter Property="BackgroundColor" Value="Transparent" />
|
||||
<Setter Property="FontFamily" Value="OpenSansRegular"/>
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<Setter Property="PlaceholderColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray500}}" />
|
||||
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||
<VisualStateGroupList>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
<VisualState x:Name="Disabled">
|
||||
<VisualState.Setters>
|
||||
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateGroupList>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="Entry">
|
||||
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" />
|
||||
<Setter Property="BackgroundColor" Value="Transparent" />
|
||||
<Setter Property="FontFamily" Value="OpenSansRegular"/>
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<Setter Property="PlaceholderColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray500}}" />
|
||||
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||
<VisualStateGroupList>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
<VisualState x:Name="Disabled">
|
||||
<VisualState.Setters>
|
||||
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateGroupList>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="Frame">
|
||||
<Setter Property="HasShadow" Value="False" />
|
||||
<Setter Property="BorderColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray950}}" />
|
||||
<Setter Property="CornerRadius" Value="8" />
|
||||
</Style>
|
||||
|
||||
<Style TargetType="ImageButton">
|
||||
<Setter Property="Opacity" Value="1" />
|
||||
<Setter Property="BorderColor" Value="Transparent"/>
|
||||
<Setter Property="BorderWidth" Value="0"/>
|
||||
<Setter Property="CornerRadius" Value="0"/>
|
||||
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||
<VisualStateGroupList>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
<VisualState x:Name="Disabled">
|
||||
<VisualState.Setters>
|
||||
<Setter Property="Opacity" Value="0.5" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateGroupList>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="Label">
|
||||
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" />
|
||||
<Setter Property="FontFamily" Value="OpenSansRegular" />
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||
<VisualStateGroupList>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
<VisualState x:Name="Disabled">
|
||||
<VisualState.Setters>
|
||||
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateGroupList>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="ListView">
|
||||
<Setter Property="SeparatorColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray500}}" />
|
||||
<Setter Property="RefreshControlColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Gray200}}" />
|
||||
</Style>
|
||||
|
||||
<Style TargetType="Picker">
|
||||
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" />
|
||||
<Setter Property="TitleColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Gray200}}" />
|
||||
<Setter Property="BackgroundColor" Value="Transparent" />
|
||||
<Setter Property="FontFamily" Value="OpenSansRegular"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||
<VisualStateGroupList>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
<VisualState x:Name="Disabled">
|
||||
<VisualState.Setters>
|
||||
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||
<Setter Property="TitleColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateGroupList>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="ProgressBar">
|
||||
<Setter Property="ProgressColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
|
||||
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||
<VisualStateGroupList>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
<VisualState x:Name="Disabled">
|
||||
<VisualState.Setters>
|
||||
<Setter Property="ProgressColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateGroupList>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="RadioButton">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" />
|
||||
<Setter Property="FontFamily" Value="OpenSansRegular"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||
<VisualStateGroupList>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
<VisualState x:Name="Disabled">
|
||||
<VisualState.Setters>
|
||||
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateGroupList>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="RefreshView">
|
||||
<Setter Property="RefreshColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Gray200}}" />
|
||||
</Style>
|
||||
|
||||
<Style TargetType="SearchBar">
|
||||
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" />
|
||||
<Setter Property="PlaceholderColor" Value="{StaticResource Gray500}" />
|
||||
<Setter Property="CancelButtonColor" Value="{StaticResource Gray500}" />
|
||||
<Setter Property="BackgroundColor" Value="Transparent" />
|
||||
<Setter Property="FontFamily" Value="OpenSansRegular" />
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||
<VisualStateGroupList>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
<VisualState x:Name="Disabled">
|
||||
<VisualState.Setters>
|
||||
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||
<Setter Property="PlaceholderColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateGroupList>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="SearchHandler">
|
||||
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" />
|
||||
<Setter Property="PlaceholderColor" Value="{StaticResource Gray500}" />
|
||||
<Setter Property="BackgroundColor" Value="Transparent" />
|
||||
<Setter Property="FontFamily" Value="OpenSansRegular" />
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||
<VisualStateGroupList>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
<VisualState x:Name="Disabled">
|
||||
<VisualState.Setters>
|
||||
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||
<Setter Property="PlaceholderColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateGroupList>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="Shadow">
|
||||
<Setter Property="Radius" Value="15" />
|
||||
<Setter Property="Opacity" Value="0.5" />
|
||||
<Setter Property="Brush" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource White}}" />
|
||||
<Setter Property="Offset" Value="10,10" />
|
||||
</Style>
|
||||
|
||||
<Style TargetType="Slider">
|
||||
<Setter Property="MinimumTrackColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
|
||||
<Setter Property="MaximumTrackColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray600}}" />
|
||||
<Setter Property="ThumbColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
|
||||
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||
<VisualStateGroupList>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
<VisualState x:Name="Disabled">
|
||||
<VisualState.Setters>
|
||||
<Setter Property="MinimumTrackColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}"/>
|
||||
<Setter Property="MaximumTrackColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}"/>
|
||||
<Setter Property="ThumbColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateGroupList>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="SwipeItem">
|
||||
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Black}}" />
|
||||
</Style>
|
||||
|
||||
<Style TargetType="Switch">
|
||||
<Setter Property="OnColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
|
||||
<Setter Property="ThumbColor" Value="{StaticResource White}" />
|
||||
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||
<VisualStateGroupList>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
<VisualState x:Name="Disabled">
|
||||
<VisualState.Setters>
|
||||
<Setter Property="OnColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||
<Setter Property="ThumbColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="On">
|
||||
<VisualState.Setters>
|
||||
<Setter Property="OnColor" Value="{AppThemeBinding Light={StaticResource Secondary}, Dark={StaticResource Gray200}}" />
|
||||
<Setter Property="ThumbColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Off">
|
||||
<VisualState.Setters>
|
||||
<Setter Property="ThumbColor" Value="{AppThemeBinding Light={StaticResource Gray400}, Dark={StaticResource Gray500}}" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateGroupList>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="TimePicker">
|
||||
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" />
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="FontFamily" Value="OpenSansRegular"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||
<VisualStateGroupList>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
<VisualState x:Name="Disabled">
|
||||
<VisualState.Setters>
|
||||
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateGroupList>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="Page" ApplyToDerivedTypes="True">
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Black}}" />
|
||||
</Style>
|
||||
|
||||
<Style TargetType="Shell" ApplyToDerivedTypes="True">
|
||||
<Setter Property="Shell.BackgroundColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource Gray950}}" />
|
||||
<Setter Property="Shell.ForegroundColor" Value="{OnPlatform WinUI={StaticResource Primary}, Default={StaticResource White}}" />
|
||||
<Setter Property="Shell.TitleColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource White}}" />
|
||||
<Setter Property="Shell.DisabledColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray950}}" />
|
||||
<Setter Property="Shell.UnselectedColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray200}}" />
|
||||
<Setter Property="Shell.NavBarHasShadow" Value="False" />
|
||||
<Setter Property="Shell.TabBarBackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Black}}" />
|
||||
<Setter Property="Shell.TabBarForegroundColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
|
||||
<Setter Property="Shell.TabBarTitleColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
|
||||
<Setter Property="Shell.TabBarUnselectedColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Gray200}}" />
|
||||
</Style>
|
||||
|
||||
<Style TargetType="NavigationPage">
|
||||
<Setter Property="BarBackgroundColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource Gray950}}" />
|
||||
<Setter Property="BarTextColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource White}}" />
|
||||
<Setter Property="IconColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource White}}" />
|
||||
</Style>
|
||||
|
||||
<Style TargetType="TabbedPage">
|
||||
<Setter Property="BarBackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Gray950}}" />
|
||||
<Setter Property="BarTextColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
|
||||
<Setter Property="UnselectedTabColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray950}}" />
|
||||
<Setter Property="SelectedTabColor" Value="{AppThemeBinding Light={StaticResource Gray950}, Dark={StaticResource Gray200}}" />
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
|
@ -0,0 +1,95 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
|
||||
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net6.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);net6.0-tizen</TargetFrameworks> -->
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>SampleBrowser.Maui.PdfViewer</RootNamespace>
|
||||
<UseMaui>true</UseMaui>
|
||||
<SingleProject>true</SingleProject>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<EnableNETAnalyzers>true</EnableNETAnalyzers>
|
||||
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
|
||||
<AnalysisLevel>latest</AnalysisLevel>
|
||||
<AnalysisLevelSecurity>latest-recommended</AnalysisLevelSecurity>
|
||||
<CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors>
|
||||
<Nullable>enable</Nullable>
|
||||
<NoWarn>$(NoWarn);NU1803</NoWarn>
|
||||
|
||||
<!-- Display name -->
|
||||
<ApplicationTitle>SampleBrowser.Maui.PdfViewer</ApplicationTitle>
|
||||
|
||||
<!-- App Identifier -->
|
||||
<ApplicationId>com.companyname.samplebrowser.maui.pdfviewer</ApplicationId>
|
||||
<ApplicationIdGuid>e1db8031-244e-4909-a6ad-280f55daacfd</ApplicationIdGuid>
|
||||
|
||||
<!-- Versions -->
|
||||
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
|
||||
<ApplicationVersion>1</ApplicationVersion>
|
||||
|
||||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
|
||||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
|
||||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
|
||||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.18362.0</SupportedOSPlatformVersion>
|
||||
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.18362.0</TargetPlatformMinVersion>
|
||||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
|
||||
<Configurations>Debug;Release;Release-Xml</Configurations>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DefineConstants>TRACE;DEBUG;</DefineConstants>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<WarningLevel>5</WarningLevel>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DefineConstants>TRACE;RELEASE;</DefineConstants>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<WarningLevel>5</WarningLevel>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release-Xml|AnyCPU' ">
|
||||
<DefineConstants>TRACE;RELEASE;</DefineConstants>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<WarningLevel>5</WarningLevel>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- App Icon -->
|
||||
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#4822E3" />
|
||||
|
||||
<!-- Splash Screen -->
|
||||
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#4822E3" BaseSize="*,*" />
|
||||
|
||||
<!-- Images -->
|
||||
|
||||
<!-- Custom Fonts -->
|
||||
<MauiFont Include="Resources\Fonts\*" />
|
||||
|
||||
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
|
||||
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="ControlList.xml" />
|
||||
<EmbeddedResource Include="PdfViewerSamplesList.xml" />
|
||||
<EmbeddedResource Include="Samples\Pdf\corrupted_document.pdf" />
|
||||
<EmbeddedResource Include="Samples\Pdf\encrypted_document.pdf" />
|
||||
<EmbeddedResource Include="Samples\Pdf\Invoice.pdf" />
|
||||
<EmbeddedResource Include="Samples\Pdf\PDF_Succinctly.pdf" />
|
||||
<EmbeddedResource Include="Samples\Pdf\rotated_document.pdf" />
|
||||
<EmbeddedResource Include="SyncfusionLicense.txt" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SampleBrowser.Maui.Base" version="20.4.38" />
|
||||
<PackageReference Include="Syncfusion.Compression.NET" version="20.4.0.38" />
|
||||
<PackageReference Include="Syncfusion.Maui.Core" version="20.4.38" />
|
||||
<PackageReference Include="Syncfusion.Maui.PdfToImageConverter" version="20.4.38" />
|
||||
<PackageReference Include="Syncfusion.PDF.NET" version="20.4.0.38" />
|
||||
<PackageReference Include="Syncfusion.Maui.PdfViewer" version="20.4.38" />
|
||||
<PackageReference Include="Syncfusion.Maui.TabView" version="20.4.38" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>SampleBrowser.Maui.PdfViewer</id>
|
||||
<version>20.1.0.1</version>
|
||||
<authors>Syncfusion Inc.</authors>
|
||||
<owners>Syncfusion Inc.</owners>
|
||||
<requireLicenseAcceptance>true</requireLicenseAcceptance>
|
||||
<licenseUrl>http://www.syncfusion.com/nuget/license</licenseUrl>
|
||||
<projectUrl>http://www.syncfusion.com/</projectUrl>
|
||||
<iconUrl>http://www.syncfusion.com/content/images/nuget/sync_logo_icon.png</iconUrl>
|
||||
<description>PdfViewer component for Syncfusion .NET MAUI</description>
|
||||
<copyright>Copyright 2001 - 2019 Syncfusion Inc.</copyright>
|
||||
<dependencies>
|
||||
<group targetFramework="net6.0">
|
||||
<dependency id="Microsoft.Maui.Dependencies" version="*" exclude="Build,Analyzers" />
|
||||
</group>
|
||||
<group targetFramework="net6.0-android30.0">
|
||||
<dependency id="Microsoft.Maui.Dependencies" version="*" exclude="Build,Analyzers" />
|
||||
</group>
|
||||
<group targetFramework="net6.0-ios13.6">
|
||||
<dependency id="Microsoft.Maui.Dependencies" version="*" exclude="Build,Analyzers" />
|
||||
</group>
|
||||
<group targetFramework="net6.0-maccatalyst13.5">
|
||||
<dependency id="Microsoft.Maui.Dependencies" version="*" exclude="Build,Analyzers" />
|
||||
</group>
|
||||
<group targetFramework="net6.0-windows10.0.19041.0">
|
||||
<dependency id="Microsoft.Maui.Dependencies" version="*" exclude="Build,Analyzers" />
|
||||
</group>
|
||||
</dependencies>
|
||||
</metadata>
|
||||
</package>
|
|
@ -0,0 +1,65 @@
|
|||
<Project>
|
||||
<ItemGroup>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)\Samples\PdfViewer\GettingStarted\View\GettingStarted.xaml.cs">
|
||||
<Link>Samples\PdfViewer\GettingStarted\View\GettingStarted.xaml.cs</Link>
|
||||
<DependentUpon>GettingStarted.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)\Samples\PdfViewer\GettingStarted\ViewModel\ViewModel.cs">
|
||||
<Link>Samples\PdfViewer\GettingStarted\ViewModel\ViewModel.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)\Samples\PdfViewer\CustomToolbar\View\CustomToolbar.xaml.cs">
|
||||
<Link>Samples\PdfViewer\CustomToolbar\View\CustomToolbar.xaml.cs</Link>
|
||||
<DependentUpon>CustomToolbar.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)\Samples\PdfViewer\CustomToolbar\Controls\MessageBox\MessageBox.xaml.cs">
|
||||
<Link>Samples\PdfViewer\CustomToolbar\Controls\MessageBox\MessageBox.xaml.cs</Link>
|
||||
<DependentUpon>MessageBox.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)\Samples\PdfViewer\CustomToolbar\Controls\PasswordDialog\PasswordDialogBox.xaml.cs">
|
||||
<Link>Samples\PdfViewer\CustomToolbar\Controls\PasswordDialog\PasswordDialogBox.xaml.cs</Link>
|
||||
<DependentUpon>PasswordDialogBox.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)\Samples\PdfViewer\CustomToolbar\Model\PdfData.cs">
|
||||
<Link>Samples\PdfViewer\CustomToolbar\Model\PdfData.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)\Samples\PdfViewer\CustomToolbar\ViewModel\CustomToolbarViewModel.cs">
|
||||
<Link>Samples\PdfViewer\CustomToolbar\ViewModel\CustomToolbarViewModel.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\PdfViewerSamplesList.xml" >
|
||||
<Link>PdfViewerSamplesList.xml</Link>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\Samples\Pdf\corrupted_document.pdf">
|
||||
<Link>Resources\Pdf\corrupted_document.pdf</Link>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\Samples\Pdf\encrypted_document.pdf">
|
||||
<Link>Resources\Pdf\encrypted_document.pdf</Link>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\Samples\Pdf\rotated_document.pdf">
|
||||
<Link>Resources\Pdf\rotated_document.pdf</Link>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\Samples\Pdf\PDF_Succinctly.pdf">
|
||||
<Link>Resources\Pdf\PDF_Succinctly.pdf</Link>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<MauiXaml Include="$(MSBuildThisFileDirectory)\Samples\PdfViewer\GettingStarted\View\GettingStarted.xaml">
|
||||
<Link>Samples\PdfViewer\GettingStarted\View\GettingStarted.xaml</Link>
|
||||
</MauiXaml>
|
||||
<MauiXaml Include="$(MSBuildThisFileDirectory)\Samples\PdfViewer\CustomToolbar\View\CustomToolbar.xaml">
|
||||
<Link>Samples\PdfViewer\CustomToolbar\View\CustomToolbar.xaml</Link>
|
||||
</MauiXaml>
|
||||
<MauiXaml Include="$(MSBuildThisFileDirectory)\Samples\PdfViewer\CustomToolbar\Controls\PasswordDialog\PasswordDialogBox.xaml">
|
||||
<Link>Samples\PdfViewer\CustomToolbar\Controls\PasswordDialog\PasswordDialogBox.xaml</Link>
|
||||
</MauiXaml>
|
||||
<MauiXaml Include="$(MSBuildThisFileDirectory)\Samples\PdfViewer\CustomToolbar\Controls\MessageBox\MessageBox.xaml">
|
||||
<Link>Samples\PdfViewer\CustomToolbar\Controls\MessageBox\MessageBox.xaml</Link>
|
||||
</MauiXaml>
|
||||
</ItemGroup>
|
||||
</Project>
|
Двоичный файл не отображается.
Двоичные данные
MAUI/PdfViewer/SampleBrowser.Maui.PdfViewer/Samples/Pdf/PDF_Succinctly.pdf
Normal file
Двоичные данные
MAUI/PdfViewer/SampleBrowser.Maui.PdfViewer/Samples/Pdf/PDF_Succinctly.pdf
Normal file
Двоичный файл не отображается.
Двоичные данные
MAUI/PdfViewer/SampleBrowser.Maui.PdfViewer/Samples/Pdf/corrupted_document.pdf
Normal file
Двоичные данные
MAUI/PdfViewer/SampleBrowser.Maui.PdfViewer/Samples/Pdf/corrupted_document.pdf
Normal file
Двоичный файл не отображается.
Двоичные данные
MAUI/PdfViewer/SampleBrowser.Maui.PdfViewer/Samples/Pdf/encrypted_document.pdf
Normal file
Двоичные данные
MAUI/PdfViewer/SampleBrowser.Maui.PdfViewer/Samples/Pdf/encrypted_document.pdf
Normal file
Двоичный файл не отображается.
Двоичные данные
MAUI/PdfViewer/SampleBrowser.Maui.PdfViewer/Samples/Pdf/rotated_document.pdf
Normal file
Двоичные данные
MAUI/PdfViewer/SampleBrowser.Maui.PdfViewer/Samples/Pdf/rotated_document.pdf
Normal file
Двоичный файл не отображается.
|
@ -0,0 +1,59 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="SampleBrowser.Maui.PdfViewer.SfPdfViewer.MessageBox"
|
||||
HeightRequest="160" WidthRequest="320">
|
||||
<ContentView.Resources>
|
||||
<Style x:Key="buttonIconStyle" TargetType="Button">
|
||||
<Setter Property="BackgroundColor" Value="Transparent" />
|
||||
<Setter Property="Opacity" Value="0.6"/>
|
||||
<Setter Property="Padding" Value="4" />
|
||||
<Setter Property="BorderWidth" Value="0" />
|
||||
<Setter Property="FontFamily" Value="{OnPlatform iOS=PdfViewerIcon, MacCatalyst=PdfViewerIcon, Android=PdfViewerIcon.ttf#, WinUI=PdfViewerIcon.ttf#PdfViewerIcon}"/>
|
||||
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||
<VisualStateGroupList>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal">
|
||||
<VisualState.Setters>
|
||||
<Setter Property="TextColor" Value="#99000000" />
|
||||
<Setter Property="BackgroundColor" Value="Transparent" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Disabled">
|
||||
<VisualState.Setters>
|
||||
<Setter Property="TextColor" Value="#44000000" />
|
||||
<Setter Property="BackgroundColor" Value="Transparent" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Pressed">
|
||||
<VisualState.Setters>
|
||||
<Setter Property="TextColor" Value="#99000000" />
|
||||
<Setter Property="BackgroundColor" Value="#0F000000" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateGroupList>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ContentView.Resources>
|
||||
<Border
|
||||
BackgroundColor="White"
|
||||
Stroke="#33000000"
|
||||
StrokeShape="RoundRectangle 4" StrokeThickness="1">
|
||||
<Grid Padding="20">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="2*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Label
|
||||
x:Name="Title" Grid.Row="0" FontAttributes="Bold" FontSize="20" FontFamily="Roboto-Medium"
|
||||
VerticalOptions="Start" VerticalTextAlignment="Start"/>
|
||||
<Label x:Name="Message" FontFamily="Roboto-Regular" Grid.Row="1" TextColor="#DE000000" VerticalTextAlignment="Center" LineBreakMode="WordWrap"/>
|
||||
<Button x:Name="OkButton" Grid.Row="2" Style="{StaticResource buttonIconStyle}" Text="CLOSE"
|
||||
Padding="4" TextColor="#6200EE" Clicked="Ok_Clicked"
|
||||
FontFamily="Roboto-Medium"
|
||||
HorizontalOptions="End" Opacity="1" VerticalOptions="End" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</ContentView>
|
|
@ -0,0 +1,46 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
namespace SampleBrowser.Maui.PdfViewer.SfPdfViewer;
|
||||
|
||||
public partial class MessageBox : ContentView
|
||||
{
|
||||
public event EventHandler<CloseClickedEventArgs?>? CloseClicked;
|
||||
public MessageBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Ok_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
Hide();
|
||||
CloseClickedEventArgs closeClickedEventArgs = new CloseClickedEventArgs(Title.Text);
|
||||
CloseClicked?.Invoke(this, closeClickedEventArgs);
|
||||
}
|
||||
|
||||
internal void Show(string title, string message, string closeText = "CLOSE")
|
||||
{
|
||||
this.IsVisible = true;
|
||||
Title.Text = title;
|
||||
Message.Text = message;
|
||||
OkButton.Text = closeText;
|
||||
}
|
||||
|
||||
internal void Hide()
|
||||
{
|
||||
this.IsVisible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public class CloseClickedEventArgs : EventArgs
|
||||
{
|
||||
public string? Title { get; set; }
|
||||
public CloseClickedEventArgs(string title)
|
||||
{
|
||||
this.Title = title;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,134 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentView
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="SampleBrowser.Maui.PdfViewer.SfPdfViewer.PasswordDialogBox"
|
||||
HeightRequest="240" WidthRequest="360">
|
||||
<ContentView.Resources>
|
||||
<Style x:Key="buttonIconStyle" TargetType="Button">
|
||||
<Setter Property="BackgroundColor" Value="Transparent" />
|
||||
<Setter Property="TextColor" Value="#FF000000"/>
|
||||
<Setter Property="Opacity" Value="0.6"/>
|
||||
<Setter Property="Padding" Value="4" />
|
||||
<Setter Property="BorderWidth" Value="0" />
|
||||
<Setter Property="FontFamily" Value="{OnPlatform iOS=PdfViewerIcon, MacCatalyst=PdfViewerIcon, Android=PdfViewerIcon.ttf#, WinUI=PdfViewerIcon.ttf#PdfViewerIcon}"/>
|
||||
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||
<VisualStateGroupList>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal">
|
||||
<VisualState.Setters>
|
||||
<Setter Property="BackgroundColor" Value="Transparent" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Pressed">
|
||||
<VisualState.Setters>
|
||||
<Setter Property="BackgroundColor" Value="#0F000000" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateGroupList>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ContentView.Resources>
|
||||
<Border
|
||||
BackgroundColor="White"
|
||||
Stroke="#33000000"
|
||||
StrokeShape="RoundRectangle 4" StrokeThickness="1"
|
||||
x:Name="passwordGrid"
|
||||
Grid.Row="1">
|
||||
<Grid Padding="16" BackgroundColor="White">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1.5*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="{OnPlatform Default=1*, Android=0.75*}"/>
|
||||
<RowDefinition Height="{OnPlatform Default=0.75*, Android=1*}"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0" VerticalOptions="Start">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label
|
||||
x:Name="headerView"
|
||||
Text="Enter a Password"
|
||||
FontFamily="Roboto-Medium"
|
||||
Grid.Column="0" Opacity="0.87"
|
||||
FontAttributes="Bold"
|
||||
FontSize="20" />
|
||||
<Button
|
||||
Grid.Column="1"
|
||||
Text=""
|
||||
VerticalOptions="Start"
|
||||
FontSize="13.65"
|
||||
Style="{StaticResource buttonIconStyle}" Clicked="CancelButton_Clicked" />
|
||||
</Grid>
|
||||
<Label
|
||||
Grid.Row="1"
|
||||
Text="The file is protected. Please enter a password to open the PDF file."
|
||||
FontFamily="Roboto-Regular"
|
||||
VerticalOptions="Center" VerticalTextAlignment="End"
|
||||
LineBreakMode="WordWrap"
|
||||
TextColor="#99000000" Margin="2"/>
|
||||
<VerticalStackLayout Grid.Row="2" Spacing="2" Margin="0,4,0,4">
|
||||
<Border BackgroundColor="#FFFFFFFF" Stroke="#66000000" StrokeShape="{OnPlatform Default=RoundRectangle 4, iOS=Rectangle, MacCatalyst=Rectangle}" x:Name="passwordBorder"
|
||||
Padding="{OnPlatform Default=0,Android=5}" StrokeThickness="1">
|
||||
<Entry
|
||||
TextColor="#DE000000"
|
||||
FontFamily="Roboto-Regular"
|
||||
HandlerChanged="PasswordEntry_HandlerChanged"
|
||||
HorizontalOptions="Fill"
|
||||
PlaceholderColor="#66000000"
|
||||
Placeholder="Password: syncfusion"
|
||||
x:Name="passwordBlock"
|
||||
IsPassword="True"
|
||||
TextChanged="passwordBlock_TextChanged">
|
||||
</Entry>
|
||||
</Border>
|
||||
<Label
|
||||
Text="Enter password"
|
||||
x:Name="helperText"
|
||||
VerticalOptions="Center" VerticalTextAlignment="Center"
|
||||
FontFamily="Roboto-Regular"
|
||||
LineBreakMode="WordWrap"
|
||||
FontSize="12" Opacity="0.6"
|
||||
Padding="0,2,0,2"
|
||||
Margin="2"/>
|
||||
</VerticalStackLayout>
|
||||
<HorizontalStackLayout
|
||||
x:Name="showPassword"
|
||||
Spacing="8" Grid.Row="3"
|
||||
VerticalOptions="Start" Margin="2">
|
||||
<CheckBox Margin="{OnPlatform Android='-8,0', WinUI=0, iOS='-14,0', MacCatalyst='-14,0'}" Scale="0.8" CheckedChanged="CheckBox_CheckedChanged"/>
|
||||
<Label
|
||||
HorizontalTextAlignment="Center"
|
||||
Text="Show Password"
|
||||
FontFamily="Roboto-Regular"
|
||||
VerticalTextAlignment="Center"
|
||||
TextColor="#99000000"/>
|
||||
</HorizontalStackLayout>
|
||||
<Grid Grid.Row="4">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition Width="20"/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button
|
||||
Grid.Column="1" Padding="{OnPlatform Android=0,Default=4}"
|
||||
TextColor="#6200EE" x:Name="cancelButton" Text="CANCEL" Opacity="1"
|
||||
FontFamily="Roboto-Medium"
|
||||
Style="{StaticResource buttonIconStyle}"
|
||||
Clicked="CancelButton_Clicked"
|
||||
VerticalOptions="End"/>
|
||||
<Button
|
||||
Grid.Column="3" Padding="{OnPlatform Android=0,Default=4}"
|
||||
TextColor="#6200EE" x:Name="okButton" Text="OK" Opacity="1"
|
||||
FontFamily="Roboto-Medium"
|
||||
Style="{StaticResource buttonIconStyle}"
|
||||
Clicked="OkButton_Clicked"
|
||||
VerticalOptions="End"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ContentView>
|
|
@ -0,0 +1,199 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace SampleBrowser.Maui.PdfViewer.SfPdfViewer;
|
||||
|
||||
public partial class PasswordDialogBox : ContentView
|
||||
{
|
||||
public string? Password { get; set; }
|
||||
|
||||
public PasswordDialogBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
#if WINDOWS
|
||||
okButton.HandlerChanged += OkButton_HandlerChanged;
|
||||
cancelButton.HandlerChanged += CancelButton_HandlerChanged;
|
||||
#endif
|
||||
}
|
||||
#if ANDROID
|
||||
protected override async void OnPropertyChanged([CallerMemberName] string? propertyName = null)
|
||||
{
|
||||
#else
|
||||
protected override void OnPropertyChanged([CallerMemberName] string? propertyName = null)
|
||||
{
|
||||
#endif
|
||||
|
||||
if (propertyName == "IsVisible")
|
||||
{
|
||||
if (this.IsVisible == true)
|
||||
{
|
||||
passwordBlock.Focus();
|
||||
#if ANDROID
|
||||
if (passwordBlock?.Handler!.PlatformView is Android.Widget.TextView textView)
|
||||
{
|
||||
await Task.Delay(10);
|
||||
ShowKeyboard(textView);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
ResetHelperTextAppearance();
|
||||
passwordBorder.Stroke = Color.FromArgb("66000000");
|
||||
helperText.Text = "Enter password";
|
||||
#if ANDROID
|
||||
if (passwordBlock?.Handler != null)
|
||||
{
|
||||
if (passwordBlock?.Handler.PlatformView is Android.Widget.TextView textView)
|
||||
HideKeyboard(textView);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
base.OnPropertyChanged(propertyName);
|
||||
}
|
||||
#if ANDROID
|
||||
private void ShowKeyboard(Android.Views.View inputView)
|
||||
{
|
||||
if (inputView.Context == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
using (var inputMethodManager = (Android.Views.InputMethods.InputMethodManager?)inputView.Context.GetSystemService(Android.Content.Context.InputMethodService))
|
||||
{
|
||||
inputMethodManager?.ShowSoftInput(inputView, Android.Views.InputMethods.ShowFlags.Forced);
|
||||
}
|
||||
}
|
||||
private void HideKeyboard(Android.Views.View inputView)
|
||||
{
|
||||
using (var inputMethodManager = (Android.Views.InputMethods.InputMethodManager?)inputView.Context?.GetSystemService(Android.Content.Context.InputMethodService))
|
||||
{
|
||||
if (inputMethodManager != null)
|
||||
{
|
||||
var token = Platform.CurrentActivity?.CurrentFocus?.WindowToken;
|
||||
inputMethodManager.HideSoftInputFromWindow(token, Android.Views.InputMethods.HideSoftInputFlags.None);
|
||||
Platform.CurrentActivity?.Window?.DecorView.ClearFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
private void CancelButton_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
Password = null;
|
||||
passwordBlock.Text = "";
|
||||
this.IsVisible = false;
|
||||
}
|
||||
|
||||
private void OkButton_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(passwordBlock.Text) == false)
|
||||
{
|
||||
Password = passwordBlock.Text;
|
||||
passwordBlock.Text = "";
|
||||
this.IsVisible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
helperText.TextColor = Color.FromArgb("#F40606");
|
||||
helperText.Opacity = 1;
|
||||
passwordBorder.Stroke = Color.FromArgb("#F40606");
|
||||
helperText.Text = "Password cannot be empty";
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckBox_CheckedChanged(object sender, CheckedChangedEventArgs e)
|
||||
{
|
||||
if (sender is CheckBox checkBox)
|
||||
{
|
||||
if (checkBox.IsChecked)
|
||||
passwordBlock.IsPassword = false;
|
||||
else
|
||||
passwordBlock.IsPassword = true;
|
||||
}
|
||||
}
|
||||
|
||||
void ResetHelperTextAppearance()
|
||||
{
|
||||
helperText.TextColor = Color.FromArgb("FF000000");
|
||||
helperText.Opacity = 0.6;
|
||||
}
|
||||
|
||||
private void passwordBlock_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
ResetHelperTextAppearance();
|
||||
helperText.TextColor = Color.FromArgb("FF000000");
|
||||
helperText.Opacity = 0.6;
|
||||
passwordBorder.Stroke = Color.FromArgb("66000000");
|
||||
if (string.IsNullOrEmpty(e.NewTextValue) == false)
|
||||
{
|
||||
helperText.Text = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
helperText.Text = "Enter password";
|
||||
}
|
||||
}
|
||||
|
||||
private void PasswordEntry_HandlerChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (passwordBlock.Handler != null)
|
||||
{
|
||||
var handler = passwordBlock.Handler as Microsoft.Maui.Handlers.EntryHandler;
|
||||
if (handler != null)
|
||||
{
|
||||
#if WINDOWS
|
||||
handler.PlatformView.BorderThickness = new Microsoft.UI.Xaml.Thickness(0);
|
||||
#elif IOS || MACCATALYST
|
||||
handler.PlatformView.BorderStyle = UIKit.UITextBorderStyle.None;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if WINDOWS
|
||||
private void OkButton_HandlerChanged(object? sender, EventArgs e)
|
||||
{
|
||||
var handler = okButton.Handler as Microsoft.Maui.Handlers.ButtonHandler;
|
||||
if (handler != null)
|
||||
{
|
||||
handler.PlatformView.PointerEntered += PlatformView_OkButtonPointerEntered;
|
||||
handler.PlatformView.PointerExited += PlatformView_OkButtonPointerExited;
|
||||
}
|
||||
}
|
||||
private void CancelButton_HandlerChanged(object? sender, EventArgs e)
|
||||
{
|
||||
var handler = cancelButton.Handler as Microsoft.Maui.Handlers.ButtonHandler;
|
||||
if (handler != null)
|
||||
{
|
||||
handler.PlatformView.PointerEntered += PlatformView_CancelButtonPointerEntered;
|
||||
handler.PlatformView.PointerExited += PlatformView_CancelButtonPointerExited;
|
||||
}
|
||||
}
|
||||
private void PlatformView_CancelButtonPointerExited(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e)
|
||||
{
|
||||
if (cancelButton.Handler != null)
|
||||
cancelButton.BackgroundColor = Color.FromArgb("#00000000");
|
||||
}
|
||||
private void PlatformView_CancelButtonPointerEntered(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e)
|
||||
{
|
||||
if (cancelButton.Handler != null)
|
||||
cancelButton.BackgroundColor = Color.FromArgb("#0F000000");
|
||||
}
|
||||
private void PlatformView_OkButtonPointerExited(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e)
|
||||
{
|
||||
if (okButton.Handler != null)
|
||||
okButton.BackgroundColor = Color.FromArgb("#00000000");
|
||||
}
|
||||
private void PlatformView_OkButtonPointerEntered(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e)
|
||||
{
|
||||
if (okButton.Handler != null)
|
||||
okButton.BackgroundColor = Color.FromArgb("#0F000000");
|
||||
}
|
||||
#endif
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
using SampleBrowser.Maui.Base;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace SampleBrowser.Maui.PdfViewer.SfPdfViewer
|
||||
{
|
||||
public class PdfData : INotifyPropertyChanged
|
||||
{
|
||||
private Stream? _documentStream;
|
||||
private int? _pageCount;
|
||||
private string? _fileName;
|
||||
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
public Stream? DocumentStream
|
||||
{
|
||||
get => _documentStream;
|
||||
set
|
||||
{
|
||||
_documentStream = value;
|
||||
OnPropertyChanged("DocumentStream");
|
||||
}
|
||||
}
|
||||
|
||||
public int? PageCount
|
||||
{
|
||||
get => _pageCount;
|
||||
set
|
||||
{
|
||||
_pageCount = value;
|
||||
OnPropertyChanged("PageCount");
|
||||
}
|
||||
}
|
||||
|
||||
public string? FileName
|
||||
{
|
||||
get
|
||||
{
|
||||
return _fileName;
|
||||
}
|
||||
set
|
||||
{
|
||||
_fileName = value;
|
||||
string basePath = "SampleBrowser.Maui.Resources.Pdf.";
|
||||
if (BaseConfig.IsIndividualSB)
|
||||
basePath = "SampleBrowser.Maui.PdfViewer.Samples.Pdf.";
|
||||
if (string.IsNullOrEmpty(value) == false)
|
||||
DocumentStream = this.GetType().Assembly.GetManifestResourceStream(basePath + value);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPropertyChanged(string name)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,183 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<localCore:SampleView
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:localCore="clr-namespace:SampleBrowser.Maui.Base;assembly=SampleBrowser.Maui.Base"
|
||||
xmlns:local="clr-namespace:SampleBrowser.Maui.PdfViewer.SfPdfViewer"
|
||||
xmlns:syncfusion="clr-namespace:Syncfusion.Maui.PdfViewer;assembly=Syncfusion.Maui.PdfViewer"
|
||||
x:Class="SampleBrowser.Maui.PdfViewer.SfPdfViewer.CustomToolbar">
|
||||
<localCore:SampleView.BindingContext>
|
||||
<local:CustomToolbarViewModel/>
|
||||
</localCore:SampleView.BindingContext>
|
||||
<localCore:SampleView.Resources>
|
||||
<Style x:Key="buttonIconStyle" TargetType="Button">
|
||||
<Setter Property="BorderWidth" Value="0" />
|
||||
<Setter Property="FontSize" Value="18" />
|
||||
<Setter Property="Padding" Value="4" />
|
||||
<Setter Property="VerticalOptions" Value="Center" />
|
||||
<Setter Property="FontFamily" Value="{OnPlatform iOS=PdfViewerIcon, MacCatalyst=PdfViewerIcon, Android=PdfViewerIcon.ttf#, WinUI=PdfViewerIcon.ttf#PdfViewerIcon}" />
|
||||
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||
<VisualStateGroupList>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal">
|
||||
<VisualState.Setters>
|
||||
<Setter Property="TextColor" Value="#99000000" />
|
||||
<Setter Property="BackgroundColor" Value="Transparent" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Disabled">
|
||||
<VisualState.Setters>
|
||||
<Setter Property="TextColor" Value="#44000000" />
|
||||
<Setter Property="BackgroundColor" Value="Transparent" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Pressed">
|
||||
<VisualState.Setters>
|
||||
<Setter Property="TextColor" Value="#99000000" />
|
||||
<Setter Property="BackgroundColor" Value="#0F000000" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateGroupList>
|
||||
</Setter>
|
||||
</Style>
|
||||
</localCore:SampleView.Resources>
|
||||
<localCore:SampleView.Content>
|
||||
<Border Stroke="#D2D2D2" StrokeThickness="{OnPlatform Default=1, Android=0, iOS=0}"
|
||||
StrokeShape="Rectangle" Padding="0">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0" HeightRequest="40" BackgroundColor="#FFF6F6F6">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{OnPlatform Default=Auto, Android=1*, iOS=1*}"/>
|
||||
<ColumnDefinition Width="{OnPlatform Default=*, Android=3*, iOS=3*}"/>
|
||||
<ColumnDefinition Width="{OnPlatform MacCatalyst=*, Android=1*, iOS=1*, WinUI=*}"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Text=""
|
||||
Margin="8,0,0,0"
|
||||
Grid.Column="0"
|
||||
HorizontalOptions="Start"
|
||||
Style="{StaticResource buttonIconStyle}"
|
||||
Command="{Binding OpenCloseFilePickerCommand}"/>
|
||||
<HorizontalStackLayout HorizontalOptions="{OnPlatform Default=End, Android=CenterAndExpand, iOS=CenterAndExpand}"
|
||||
Spacing="8" Grid.Column="1">
|
||||
<Border BackgroundColor="#FFFFFFFF" Stroke="#66000000" StrokeShape="{OnPlatform Android=RoundRectangle 4, WinUI=RoundRectangle 4, MacCatalyst=RoundRectangle 5, iOS=RoundRectangle 5}" HeightRequest="{OnPlatform Android=30,WinUI=34, MacCatalyst=26, iOS=26}"
|
||||
Padding="{OnPlatform Android=5}" StrokeThickness="1">
|
||||
<Entry
|
||||
x:Name="pageNumberEntry"
|
||||
HandlerChanged="pageNumberEntry_HandlerChanged"
|
||||
Text="{Binding PageNumber}"
|
||||
MaxLength="4"
|
||||
Keyboard="Numeric"
|
||||
TextChanged="pageNumberEntry_TextChanged"
|
||||
Focused="pageNumberEntry_Focused"
|
||||
Unfocused="pageNumberEntry_Unfocused"
|
||||
Completed="GoToEntry_Completed"
|
||||
VerticalTextAlignment="Center"
|
||||
WidthRequest="40"
|
||||
HeightRequest="{OnPlatform Default=24, Android=40}"
|
||||
VerticalOptions="Center"
|
||||
HorizontalTextAlignment="Center"/>
|
||||
</Border>
|
||||
<Label
|
||||
Text=" / "
|
||||
VerticalTextAlignment="Center"
|
||||
HorizontalTextAlignment="Center"
|
||||
VerticalOptions="Center"/>
|
||||
<Label
|
||||
Text="{Binding DocumentData.PageCount}"
|
||||
VerticalTextAlignment="Center"
|
||||
HorizontalTextAlignment="Center"
|
||||
VerticalOptions="Center"
|
||||
Margin="0,0,4,0"/>
|
||||
<Button
|
||||
Text="" FontSize="16"
|
||||
Margin="4,0,0,0" IsEnabled="{Binding CanGoToPreviousPage}"
|
||||
Style="{StaticResource buttonIconStyle}"
|
||||
Command="{Binding Source={x:Reference PdfViewer},Path=GoToPreviousPageCommand}"/>
|
||||
<Button
|
||||
Text="" FontSize="16"
|
||||
x:Name="goToNext"
|
||||
Margin="4,0,0,0" IsEnabled="{Binding CanGoToNextPage}"
|
||||
Style="{StaticResource buttonIconStyle}"
|
||||
Command="{Binding Source={x:Reference PdfViewer},Path=GoToNextPageCommand}"/>
|
||||
<Rectangle
|
||||
Fill="{OnPlatform WinUI=#FF979797, MacCatalyst=#FF979797}" HeightRequest="{OnPlatform Default=24, Android=0}" WidthRequest="{OnPlatform Default=2, Android=0}"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout
|
||||
Grid.Column="2" Margin="8,0,12,0"
|
||||
HorizontalOptions="{OnPlatform MacCatalyst=Start, iOS=End, Android=End, WinUI=Start}">
|
||||
<Button
|
||||
Text="" Margin="4,0,0,0"
|
||||
x:Name="zoomOut"
|
||||
Style="{StaticResource buttonIconStyle}"
|
||||
Command="{Binding ZoomOutCommand}" IsEnabled="{Binding CanZoomOut}"/>
|
||||
<Button
|
||||
Text="" Margin="4,0,0,0"
|
||||
x:Name="zoomIn"
|
||||
Style="{StaticResource buttonIconStyle}"
|
||||
Command="{Binding ZoomInCommand}" IsEnabled="{Binding CanZoomIn}"/>
|
||||
</HorizontalStackLayout>
|
||||
</Grid>
|
||||
<Line Grid.Row="1" StrokeThickness="1">
|
||||
<Line.Background>
|
||||
<LinearGradientBrush EndPoint="0,1">
|
||||
<GradientStop Color="#33000000" Offset="0.1"/>
|
||||
<GradientStop Color="#24000000" Offset="0.4"/>
|
||||
<GradientStop Color="#1F000000" Offset="0.7"/>
|
||||
</LinearGradientBrush>
|
||||
</Line.Background>
|
||||
</Line>
|
||||
<syncfusion:SfPdfViewer
|
||||
x:Name="PdfViewer"
|
||||
Grid.Row="2"
|
||||
PageCount="{Binding DocumentData.PageCount, Mode=OneWayToSource}"
|
||||
PageNumber="{Binding PageNumber, Mode=OneWayToSource}"
|
||||
MinZoomFactor="{Binding MinZoom, Mode=OneWayToSource}"
|
||||
MaxZoomFactor="{Binding MaxZoom, Mode=OneWayToSource}"
|
||||
DocumentSource="{Binding DocumentData.DocumentStream}"
|
||||
ZoomFactor="{Binding CurrentZoom,Mode=TwoWay}"
|
||||
PasswordRequested="PdfViewer_PasswordRequested"
|
||||
DocumentLoadFailed="PdfViewer_DocumentLoadFailed"
|
||||
DocumentLoaded="PdfViewer_DocumentLoaded"
|
||||
DocumentUnloaded="PdfViewer_DocumentUnloaded">
|
||||
<syncfusion:SfPdfViewer.GestureRecognizers>
|
||||
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped" />
|
||||
</syncfusion:SfPdfViewer.GestureRecognizers>
|
||||
</syncfusion:SfPdfViewer>
|
||||
<Border
|
||||
Grid.Row="2" WidthRequest="200" HeightRequest="180" Padding="8"
|
||||
HorizontalOptions="Start" VerticalOptions="Start"
|
||||
BackgroundColor="#FFFFFFFF"
|
||||
Stroke="#33000000"
|
||||
StrokeShape="Rectangle" StrokeThickness="1"
|
||||
IsVisible="{Binding IsFilePickerVisible}">
|
||||
<ListView BackgroundColor="#FFFFFFFF"
|
||||
ItemsSource="{Binding Files}"
|
||||
RowHeight="32"
|
||||
SelectionMode="None"
|
||||
ItemTapped="ListView_ItemTapped">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ViewCell Tapped="ViewCell_Tapped">
|
||||
<Label Text="{Binding .}" VerticalTextAlignment="Center"/>
|
||||
</ViewCell>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
</Border>
|
||||
<local:PasswordDialogBox
|
||||
x:Name="passwordDialog" Grid.Row="2"
|
||||
IsVisible="{Binding ShowPasswordDialog, Mode=TwoWay}"/>
|
||||
<local:MessageBox
|
||||
CloseClicked="MessageBox_CloseClicked"
|
||||
x:Name="messageBox" Grid.Row="2"
|
||||
IsVisible="False"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</localCore:SampleView.Content>
|
||||
</localCore:SampleView>
|
|
@ -0,0 +1,272 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
using Microsoft.Maui.Platform;
|
||||
using SampleBrowser.Maui.Base;
|
||||
using Syncfusion.Maui.PdfViewer;
|
||||
|
||||
namespace SampleBrowser.Maui.PdfViewer.SfPdfViewer;
|
||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||
public partial class CustomToolbar : SampleView
|
||||
{
|
||||
private int goToPageNumber = 0;
|
||||
private bool isTextChanged = false;
|
||||
#if WINDOWS
|
||||
private bool isZoomOutEnabled = true;
|
||||
private bool isZoomInEnabled = true;
|
||||
#endif
|
||||
private string? previousDocument = string.Empty;
|
||||
#if ANDROID || IOS
|
||||
private ViewCell? lastCell;
|
||||
#endif
|
||||
public CustomToolbar()
|
||||
{
|
||||
InitializeComponent();
|
||||
#if WINDOWS
|
||||
zoomIn.PropertyChanged += ZoomIn_PropertyChanged;
|
||||
zoomOut.PropertyChanged += ZoomOut_PropertyChanged;
|
||||
goToNext.PropertyChanged += GoToNext_PropertyChanged;
|
||||
#endif
|
||||
}
|
||||
private void MessageBox_CloseClicked(object? sender, CloseClickedEventArgs? e)
|
||||
{
|
||||
if (this.BindingContext is CustomToolbarViewModel bindingContext && e?.Title == "Incorrect Password")
|
||||
bindingContext.UpdateFileName("Encrypted PDF");
|
||||
}
|
||||
public override void OnDisappearing()
|
||||
{
|
||||
base.OnDisappearing();
|
||||
PdfViewer.Handler?.DisconnectHandler();
|
||||
}
|
||||
|
||||
private void pageNumberEntry_HandlerChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (pageNumberEntry.Handler != null)
|
||||
{
|
||||
var handler = pageNumberEntry.Handler as Microsoft.Maui.Handlers.EntryHandler;
|
||||
if (handler != null)
|
||||
{
|
||||
#if ANDROID
|
||||
handler.PlatformView.SetSelectAllOnFocus(true);
|
||||
#elif IOS || MACCATALYST
|
||||
handler.PlatformView.EditingDidBegin += (s, e) =>
|
||||
{
|
||||
handler.PlatformView.PerformSelector(new ObjCRuntime.Selector("selectAll"), null, 0.0f);
|
||||
};
|
||||
#elif WINDOWS
|
||||
handler.PlatformView.Padding= new Microsoft.UI.Xaml.Thickness(0);
|
||||
handler.PlatformView.GotFocus += (s, e) =>
|
||||
{
|
||||
handler.PlatformView.SelectAll();
|
||||
};
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void pageNumberEntry_TextChanged(System.Object sender, Microsoft.Maui.Controls.TextChangedEventArgs e)
|
||||
{
|
||||
var entry = (Entry)sender;
|
||||
if (entry != null && entry.IsFocused && !string.IsNullOrEmpty(entry.Text))
|
||||
{
|
||||
bool isNumber = int.TryParse(entry.Text, out goToPageNumber);
|
||||
if (isNumber)
|
||||
{
|
||||
isTextChanged = true;
|
||||
entry.Text = goToPageNumber.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
entry.Text = e.OldTextValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void pageNumberEntry_Unfocused(System.Object sender, Microsoft.Maui.Controls.FocusEventArgs e)
|
||||
{
|
||||
var entry = (Entry)sender;
|
||||
if (PdfViewer != null && PdfViewer.PageCount != 0)
|
||||
entry.Text = PdfViewer.PageNumber.ToString();
|
||||
}
|
||||
|
||||
private void GoToEntry_Completed(object sender, EventArgs e)
|
||||
{
|
||||
#if ANDROID
|
||||
if (Platform.CurrentActivity?.CurrentFocus != null)
|
||||
Platform.CurrentActivity.HideKeyboard(Platform.CurrentActivity.CurrentFocus);
|
||||
#endif
|
||||
if (sender is Entry entry && isTextChanged && goToPageNumber != PdfViewer.PageNumber)
|
||||
{
|
||||
if (goToPageNumber > 0 && goToPageNumber <= PdfViewer.PageCount)
|
||||
{
|
||||
PdfViewer.GoToPage(goToPageNumber);
|
||||
isTextChanged = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
MainThread.BeginInvokeOnMainThread(() => messageBox.Show("Error", "Invalid Page Number"));
|
||||
entry.Text = PdfViewer.PageNumber.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void TapGestureRecognizer_Tapped(object sender, EventArgs e)
|
||||
{
|
||||
#if ANDROID
|
||||
if (Platform.CurrentActivity?.CurrentFocus != null)
|
||||
Platform.CurrentActivity.HideKeyboard(Platform.CurrentActivity.CurrentFocus);
|
||||
#endif
|
||||
if (this.BindingContext is CustomToolbarViewModel bindingContext && bindingContext.IsFilePickerVisible)
|
||||
{
|
||||
bindingContext.IsFilePickerVisible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void pageNumberEntry_Focused(object sender, FocusEventArgs e)
|
||||
{
|
||||
if (this.BindingContext is CustomToolbarViewModel bindingContext && bindingContext.IsFilePickerVisible)
|
||||
bindingContext.IsFilePickerVisible = false;
|
||||
}
|
||||
|
||||
private void ListView_ItemTapped(object sender, ItemTappedEventArgs e)
|
||||
{
|
||||
if (this.BindingContext is CustomToolbarViewModel bindingContext)
|
||||
{
|
||||
if (bindingContext.IsFilePickerVisible)
|
||||
{
|
||||
if (!passwordDialog.IsVisible || previousDocument != e.Item.ToString())
|
||||
bindingContext.UpdateFileName(e.Item.ToString());
|
||||
bindingContext.IsFilePickerVisible = false;
|
||||
previousDocument = e.Item.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void PdfViewer_PasswordRequested(object sender, PasswordRequestedEventArgs e)
|
||||
{
|
||||
MainThread.BeginInvokeOnMainThread(() =>
|
||||
{
|
||||
if (messageBox.IsVisible == true)
|
||||
{
|
||||
messageBox.IsVisible = false;
|
||||
}
|
||||
});
|
||||
WaitForPasswordCompletion();
|
||||
e.Password = passwordDialog.Password;
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
void WaitForPasswordCompletion()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
if (passwordDialog.IsVisible)
|
||||
Task.Delay(1000);
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void PdfViewer_DocumentLoadFailed(object sender, DocumentLoadFailedEventArgs e)
|
||||
{
|
||||
if (e.Message == "Invalid cross reference table.")
|
||||
MainThread.BeginInvokeOnMainThread(() => messageBox.Show("Error", "Failed to load the PDF document."));
|
||||
else if (e.Message == "Can't open an encrypted document. The password is invalid." && !passwordDialog.IsVisible)
|
||||
MainThread.BeginInvokeOnMainThread(() => messageBox.Show("Incorrect Password", "The password you entered is incorrect. Please try again.", "OK"));
|
||||
}
|
||||
|
||||
private void ViewCell_Tapped(object sender, EventArgs e)
|
||||
{
|
||||
#if ANDROID || IOS
|
||||
if (lastCell != null)
|
||||
lastCell.View.BackgroundColor = Colors.Transparent;
|
||||
var viewCell = (ViewCell)sender;
|
||||
if (viewCell.View != null)
|
||||
{
|
||||
viewCell.View.BackgroundColor = Color.FromArgb("#0A000000");
|
||||
lastCell = viewCell;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
private void PdfViewer_DocumentLoaded(object sender, EventArgs e)
|
||||
{
|
||||
if (messageBox.IsVisible == true)
|
||||
messageBox.IsVisible = false;
|
||||
if (this.BindingContext is CustomToolbarViewModel bindingContext)
|
||||
{
|
||||
bindingContext.CanZoomIn = bindingContext.CanZoomOut = true;
|
||||
bindingContext.ValidateZoomChange();
|
||||
}
|
||||
}
|
||||
|
||||
#if WINDOWS
|
||||
private void GoToNext_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||
{
|
||||
|
||||
if (e.PropertyName == "IsEnabled")
|
||||
{
|
||||
if (!goToNext.IsEnabled)
|
||||
goToNext.Unfocus();
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
private void ZoomOut_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||
{
|
||||
#if WINDOWS
|
||||
if (e.PropertyName == "IsEnabled")
|
||||
{
|
||||
if (sender is Button button)
|
||||
{
|
||||
if (isZoomOutEnabled != button.IsEnabled)
|
||||
{
|
||||
if (button.IsEnabled)
|
||||
Dispatcher.DispatchDelayed(TimeSpan.FromMilliseconds(1), () =>
|
||||
{
|
||||
VisualStateManager.GoToState(button, "Normal");
|
||||
});
|
||||
if (zoomIn.IsPressed && !zoomOut.IsEnabled)
|
||||
zoomOut.Unfocus();
|
||||
}
|
||||
isZoomOutEnabled = button.IsEnabled;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
private void ZoomIn_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||
{
|
||||
#if WINDOWS
|
||||
if (e.PropertyName == "IsEnabled")
|
||||
{
|
||||
if (sender is Button button)
|
||||
{
|
||||
if (isZoomInEnabled != button.IsEnabled)
|
||||
{
|
||||
if (button.IsEnabled)
|
||||
Dispatcher.DispatchDelayed(TimeSpan.FromMilliseconds(1), () =>
|
||||
{
|
||||
VisualStateManager.GoToState(button, "Normal");
|
||||
});
|
||||
}
|
||||
isZoomInEnabled = button.IsEnabled;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
private void PdfViewer_DocumentUnloaded(object sender, EventArgs e)
|
||||
{
|
||||
if (this.BindingContext is CustomToolbarViewModel bindingContext)
|
||||
{
|
||||
bindingContext.CanZoomIn = false;
|
||||
bindingContext.CanZoomOut = false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,366 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace SampleBrowser.Maui.PdfViewer.SfPdfViewer
|
||||
{
|
||||
public class CustomToolbarViewModel : INotifyPropertyChanged
|
||||
{
|
||||
private PdfData _documentData;
|
||||
private int _pageNumber;
|
||||
private bool _isFilePickerVisible;
|
||||
private ICommand? _openCloseFilePickerCommand;
|
||||
private ICommand? _zoomInCommand;
|
||||
private ICommand? _zoomOutCommand;
|
||||
private object? _selectedFile;
|
||||
private double _currentZoom = 1;
|
||||
private double? _minZoom = null;
|
||||
private double? _maxZoom = null;
|
||||
private bool _canZoomIn = true;
|
||||
private bool _canZoomOut = true;
|
||||
private bool _canGoToPreviousPage = true;
|
||||
private bool _canGoToNextPage = true;
|
||||
private bool _showPasswordDialog = false;
|
||||
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
|
||||
public PdfData DocumentData
|
||||
{
|
||||
get
|
||||
{
|
||||
return _documentData;
|
||||
}
|
||||
}
|
||||
|
||||
public object? SelectedFile
|
||||
{
|
||||
get
|
||||
{
|
||||
return _selectedFile;
|
||||
}
|
||||
set
|
||||
{
|
||||
_selectedFile = value;
|
||||
if (value != null)
|
||||
{
|
||||
IsFilePickerVisible = false;
|
||||
UpdateFileName(value.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IList<string> Files
|
||||
{
|
||||
get
|
||||
{
|
||||
return new List<string>
|
||||
{
|
||||
"Rotated PDF",
|
||||
"Encrypted PDF",
|
||||
"Corrupted PDF",
|
||||
"Single page PDF",
|
||||
#if !MACCATALYST
|
||||
"Browse files on this device"
|
||||
#endif
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsFilePickerVisible
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isFilePickerVisible;
|
||||
}
|
||||
set
|
||||
{
|
||||
_isFilePickerVisible = value;
|
||||
OnPropertyChanged("IsFilePickerVisible");
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanZoomIn
|
||||
{
|
||||
get
|
||||
{
|
||||
return _canZoomIn;
|
||||
}
|
||||
set
|
||||
{
|
||||
_canZoomIn = value;
|
||||
OnPropertyChanged("CanZoomIn");
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShowPasswordDialog
|
||||
{
|
||||
get
|
||||
{
|
||||
return _showPasswordDialog;
|
||||
}
|
||||
set
|
||||
{
|
||||
_showPasswordDialog = value;
|
||||
OnPropertyChanged("ShowPasswordDialog");
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanZoomOut
|
||||
{
|
||||
get
|
||||
{
|
||||
return _canZoomOut;
|
||||
}
|
||||
set
|
||||
{
|
||||
_canZoomOut = value;
|
||||
OnPropertyChanged("CanZoomOut");
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanGoToPreviousPage
|
||||
{
|
||||
get
|
||||
{
|
||||
return _canGoToPreviousPage;
|
||||
}
|
||||
set
|
||||
{
|
||||
_canGoToPreviousPage = value;
|
||||
OnPropertyChanged("CanGoToPreviousPage");
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanGoToNextPage
|
||||
{
|
||||
get
|
||||
{
|
||||
return _canGoToNextPage;
|
||||
}
|
||||
set
|
||||
{
|
||||
_canGoToNextPage = value;
|
||||
OnPropertyChanged("CanGoToNextPage");
|
||||
}
|
||||
}
|
||||
public double CurrentZoom
|
||||
{
|
||||
get
|
||||
{
|
||||
return _currentZoom;
|
||||
}
|
||||
set
|
||||
{
|
||||
_currentZoom = value;
|
||||
OnPropertyChanged("CurrentZoom");
|
||||
ValidateZoomChange();
|
||||
}
|
||||
}
|
||||
|
||||
public int PageNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return _pageNumber;
|
||||
}
|
||||
set
|
||||
{
|
||||
_pageNumber = value;
|
||||
OnPropertyChanged("PageNumber");
|
||||
ValidatePageNumber();
|
||||
}
|
||||
}
|
||||
|
||||
public double? MinZoom
|
||||
{
|
||||
get
|
||||
{
|
||||
return _minZoom;
|
||||
}
|
||||
set
|
||||
{
|
||||
_minZoom = value;
|
||||
ValidateZoomChange();
|
||||
}
|
||||
}
|
||||
|
||||
public double? MaxZoom
|
||||
{
|
||||
get
|
||||
{
|
||||
return _maxZoom;
|
||||
}
|
||||
set
|
||||
{
|
||||
_maxZoom = value;
|
||||
ValidateZoomChange();
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand OpenCloseFilePickerCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_openCloseFilePickerCommand == null)
|
||||
_openCloseFilePickerCommand = new Command<object>(OpenCloseFilePicker);
|
||||
return _openCloseFilePickerCommand;
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand ZoomInCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_zoomInCommand == null)
|
||||
_zoomInCommand = new Command<object>(ZoomIn);
|
||||
return _zoomInCommand;
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand ZoomOutCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_zoomOutCommand == null)
|
||||
_zoomOutCommand = new Command<object>(ZoomOut);
|
||||
return _zoomOutCommand;
|
||||
}
|
||||
}
|
||||
|
||||
public CustomToolbarViewModel()
|
||||
{
|
||||
_documentData = new PdfData();
|
||||
_documentData.FileName = "PDF_Succinctly.pdf";
|
||||
}
|
||||
|
||||
public void ValidateZoomChange()
|
||||
{
|
||||
if (IsFilePickerVisible)
|
||||
IsFilePickerVisible = false;
|
||||
|
||||
if (_minZoom == null || _maxZoom == null)
|
||||
return;
|
||||
if (_currentZoom > _minZoom && _currentZoom < _maxZoom)
|
||||
{
|
||||
CanZoomIn = true;
|
||||
CanZoomOut = true;
|
||||
}
|
||||
else if (_currentZoom <= _minZoom && _currentZoom >= _maxZoom)
|
||||
{
|
||||
CanZoomIn = false;
|
||||
CanZoomOut = false;
|
||||
}
|
||||
else if (_currentZoom <= _minZoom)
|
||||
CanZoomOut = false;
|
||||
else if (_currentZoom >= _maxZoom)
|
||||
CanZoomIn = false;
|
||||
}
|
||||
|
||||
public void ValidatePageNumber()
|
||||
{
|
||||
if (IsFilePickerVisible)
|
||||
IsFilePickerVisible = false;
|
||||
|
||||
if (_documentData.PageCount<=1)
|
||||
{
|
||||
CanGoToPreviousPage = false;
|
||||
CanGoToNextPage = false;
|
||||
}
|
||||
if (_pageNumber <= 1)
|
||||
CanGoToPreviousPage = false;
|
||||
else
|
||||
CanGoToPreviousPage = true;
|
||||
if (_pageNumber >= _documentData.PageCount)
|
||||
CanGoToNextPage = false;
|
||||
else
|
||||
CanGoToNextPage = true;
|
||||
}
|
||||
|
||||
public void OnPropertyChanged(string name)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
|
||||
}
|
||||
|
||||
void OpenCloseFilePicker(object commandParameter)
|
||||
{
|
||||
if (IsFilePickerVisible == true)
|
||||
IsFilePickerVisible = false;
|
||||
else
|
||||
IsFilePickerVisible = true;
|
||||
}
|
||||
|
||||
void ZoomIn(object commandParameter)
|
||||
{
|
||||
CurrentZoom += 0.25;
|
||||
}
|
||||
|
||||
void ZoomOut(object commandParameter)
|
||||
{
|
||||
CurrentZoom -= 0.25;
|
||||
}
|
||||
|
||||
async internal void UpdateFileName(string? file)
|
||||
{
|
||||
ShowPasswordDialog = false;
|
||||
switch (file)
|
||||
{
|
||||
case "Rotated PDF":
|
||||
_documentData.FileName = "rotated_document.pdf";
|
||||
break;
|
||||
case "Encrypted PDF":
|
||||
ShowPasswordDialog = true;
|
||||
_documentData.FileName = "encrypted_document.pdf";
|
||||
break;
|
||||
case "Corrupted PDF":
|
||||
_documentData.FileName = "corrupted_document.pdf";
|
||||
break;
|
||||
case "Single page PDF":
|
||||
_documentData.FileName = "Invoice.pdf";
|
||||
break;
|
||||
case "Browse files on this device":
|
||||
FilePickerFileType pdfFileType = new FilePickerFileType(new Dictionary<DevicePlatform, IEnumerable<string>>{
|
||||
{ DevicePlatform.iOS, new[] { "public.pdf" } },
|
||||
{ DevicePlatform.Android, new[] { "application/pdf" } },
|
||||
{ DevicePlatform.WinUI, new[] { "pdf" } },
|
||||
{ DevicePlatform.MacCatalyst, new[] { "pdf" } },
|
||||
});
|
||||
PickOptions options = new()
|
||||
{
|
||||
PickerTitle = "Please select a PDF file",
|
||||
FileTypes = pdfFileType,
|
||||
};
|
||||
await PickAndShow(options);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<FileResult?> PickAndShow(PickOptions options)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = await FilePicker.Default.PickAsync(options);
|
||||
if (result != null)
|
||||
{
|
||||
_documentData.DocumentStream = await result.OpenReadAsync();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string message;
|
||||
if (ex != null && string.IsNullOrEmpty(ex.Message) == false)
|
||||
message = ex.Message;
|
||||
else
|
||||
message = "File open failed.";
|
||||
Application.Current?.MainPage?.DisplayAlert("Error", message, "OK");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<localCore:SampleView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:localCore="clr-namespace:SampleBrowser.Maui.Base;assembly=SampleBrowser.Maui.Base"
|
||||
xmlns:local="clr-namespace:SampleBrowser.Maui.PdfViewer.SfPdfViewer"
|
||||
xmlns:syncfusion="clr-namespace:Syncfusion.Maui.PdfViewer;assembly=Syncfusion.Maui.PdfViewer"
|
||||
x:Class="SampleBrowser.Maui.PdfViewer.SfPdfViewer.GettingStarted">
|
||||
<localCore:SampleView.BindingContext>
|
||||
<local:ViewModel/>
|
||||
</localCore:SampleView.BindingContext>
|
||||
<localCore:SampleView.Content>
|
||||
<Border
|
||||
Stroke="#D2D2D2" StrokeThickness="{OnPlatform Default=1, Android=0, iOS=0}"
|
||||
StrokeShape="Rectangle" Padding="0">
|
||||
<syncfusion:SfPdfViewer
|
||||
x:Name="PdfViewer"
|
||||
DocumentSource="{Binding DocumentStream}"/>
|
||||
</Border>
|
||||
</localCore:SampleView.Content>
|
||||
</localCore:SampleView>
|
|
@ -0,0 +1,24 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
using SampleBrowser.Maui.Base;
|
||||
|
||||
namespace SampleBrowser.Maui.PdfViewer.SfPdfViewer;
|
||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||
public partial class GettingStarted : SampleView
|
||||
{
|
||||
public GettingStarted()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public override void OnDisappearing()
|
||||
{
|
||||
base.OnDisappearing();
|
||||
PdfViewer.Handler?.DisconnectHandler();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
using SampleBrowser.Maui.Base;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace SampleBrowser.Maui.PdfViewer.SfPdfViewer
|
||||
{
|
||||
internal class ViewModel : INotifyPropertyChanged
|
||||
{
|
||||
private Stream? _documentStream;
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
public Stream? DocumentStream
|
||||
{
|
||||
get => _documentStream;
|
||||
set
|
||||
{
|
||||
_documentStream = value;
|
||||
OnPropertyChanged("DocumentStream");
|
||||
}
|
||||
}
|
||||
|
||||
public ViewModel()
|
||||
{
|
||||
string fileName = "PDF_Succinctly.pdf";
|
||||
string basePath = "SampleBrowser.Maui.Resources.Pdf.";
|
||||
if (BaseConfig.IsIndividualSB)
|
||||
basePath = "SampleBrowser.Maui.PdfViewer.Samples.Pdf.";
|
||||
DocumentStream = this.GetType().Assembly.GetManifestResourceStream(basePath + fileName);
|
||||
}
|
||||
|
||||
public void OnPropertyChanged(string name)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче