diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..8e39950
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,21 @@
+version: 2
+updates:
+- package-ecosystem: nuget
+ directory: "/"
+ schedule:
+ interval: daily
+ time: "03:00"
+ open-pull-requests-limit: 10
+ ignore:
+ - dependency-name: Microsoft.NETCore.UniversalWindowsPlatform
+ versions:
+ - 6.2.11
+ - dependency-name: Xamarin.Forms
+ versions:
+ - 4.3.0.991211
+ - dependency-name: Win2D.uwp
+ versions:
+ - 1.25.0
+ - dependency-name: MSBuild.Sdk.Extras
+ versions:
+ - 3.0.22
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 0000000..61118dd
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,34 @@
+name: XamarinSignaturePad
+
+# Controls when the action will run. Triggers the workflow on push or pull request
+# events but only for the WPF branch
+on:
+ push:
+ branches: [ WPF ]
+ pull_request:
+ branches: [ WPF ]
+
+jobs:
+ buildOnWindows:
+ runs-on: windows-latest
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Install tools
+ shell: cmd
+ run: choco install mono -x86
+
+ - name: Run build
+ shell: pwsh
+ run: ./build.ps1
+
+ buildOnMac:
+ runs-on: macos-latest
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Run build
+ shell: bash
+ run: ./build.sh
diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md
index 4938791..d93b495 100644
--- a/ISSUE_TEMPLATE.md
+++ b/ISSUE_TEMPLATE.md
@@ -20,10 +20,10 @@
- Last known good version:
- IDE:
- Platform Target Frameworks:
- - Android:
+ - Android:
- iOS:
- UWP:
- - Xamarin.Forms:
+ - Xamarin.Forms:
- Target Devices:
-
diff --git a/README.md b/README.md
index 469a24e..f8aff23 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,13 @@
-# Signature Pad
+# Important
+
+The packages which are published in nuget support Android, iOS and UWP. If you develop for another platforms (macOS, WPF, GTK), follow the [link](https://ci.appveyor.com/project/VladislavAntonyuk/signaturepad/build/artifacts) and download artifacts.
+
+## If you find any defects, feel free to create a pull request.
+
+# Signature Pad
-[](https://jenkins.mono-project.com/view/Components/job/Components-SignaturePad-Windows/) [](https://jenkins.mono-project.com/view/Components/job/Components-SignaturePad/)
+[](https://ci.appveyor.com/project/VladislavAntonyuk/signaturepad) 
[](https://www.nuget.org/packages/Xamarin.Controls.SignaturePad) [](https://www.nuget.org/packages/Xamarin.Controls.SignaturePad.Forms)
diff --git a/appveyor.yml b/appveyor.yml
new file mode 100644
index 0000000..ab33b32
--- /dev/null
+++ b/appveyor.yml
@@ -0,0 +1,33 @@
+version: 1.0.{build}
+
+pull_requests:
+ do_not_increment_build_number: true
+
+image:
+ - Visual Studio 2019 Preview
+
+environment:
+ DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
+ DOTNET_CLI_TELEMETRY_OPTOUT: 1
+
+nuget:
+ disable_publish_on_pr: true
+
+install:
+ - ps: >-
+ echo "Install software";
+ choco install mono -x86;
+
+build_script:
+ - pwsh: >-
+ echo "Run build";
+ ./build.ps1;
+ $host.SetShouldExit($LastExitCode);
+
+artifacts:
+ - path: output
+ name: output
+
+test: off
+
+deploy: off
\ No newline at end of file
diff --git a/build.cake b/build.cake
index c1ce253..ecdd2da 100644
--- a/build.cake
+++ b/build.cake
@@ -1,18 +1,56 @@
+#tool nuget:?package=vswhere
+
///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////
-var CURRENT_PACKAGE_VERSION = "3.0.0";
+var CURRENT_PACKAGE_VERSION = "3.2.0";
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var packageVersion = Argument("packageVersion", CURRENT_PACKAGE_VERSION);
var majorVersion = $"{packageVersion.Substring(0, packageVersion.IndexOf("."))}.0.0.0";
-var buildVersion = Argument("buildVersion", EnvironmentVariable("BUILD_NUMBER") ?? "");
+var buildVersion = Argument("buildVersion", EnvironmentVariable("APPVEYOR_BUILD_NUMBER") ?? "");
if (!string.IsNullOrEmpty(buildVersion)) {
buildVersion = $"-{buildVersion}";
}
+MSBuildSettings CreateSettings()
+{
+ var settings = new MSBuildSettings
+ {
+ Configuration = configuration,
+ MSBuildPlatform = MSBuildPlatform.x86,
+ Properties = {
+ { "AssemblyVersion", new [] { majorVersion } },
+ { "Version", new [] { packageVersion } },
+ },
+ ArgumentCustomization = args => {
+ return args.Append("/restore");
+ }
+ };
+
+ if (IsRunningOnWindows())
+ {
+ DirectoryPath vsLatest = VSWhereLatest(new VSWhereLatestSettings{IncludePrerelease = true});
+ FilePath msBuildPath = vsLatest?.CombineWithFilePath("./MSBuild/Current/Bin/MSBuild.exe");
+
+ if (!FileExists(msBuildPath))
+ {
+ throw new Exception($"Failed to find MSBuild: {msBuildPath}");
+ }
+
+ Information("Building using MSBuild at " + msBuildPath);
+ settings.ToolPath = msBuildPath;
+ }
+ else
+ {
+ settings.ToolPath = Context.Tools.Resolve("msbuild");
+ }
+
+ return settings;
+}
+
///////////////////////////////////////////////////////////////////////////////
// TASKS
///////////////////////////////////////////////////////////////////////////////
@@ -21,34 +59,33 @@ Task("libs")
.Does(() =>
{
var sln = IsRunningOnWindows() ? "./src/SignaturePad.sln" : "./src/SignaturePad.Mac.sln";
-
- MSBuild(sln, new MSBuildSettings {
- Verbosity = Verbosity.Minimal,
- Configuration = configuration,
- PlatformTarget = PlatformTarget.MSIL,
- MSBuildPlatform = MSBuildPlatform.x86,
- ArgumentCustomization = args => args.Append("/restore"),
- Properties = {
- { "AssemblyVersion", new [] { majorVersion } },
- { "Version", new [] { packageVersion } },
- },
- });
+ MSBuild(sln, CreateSettings());
EnsureDirectoryExists("./output/android/");
+ EnsureDirectoryExists("./output/wpf/");
+ EnsureDirectoryExists("./output/gtk/");
+ EnsureDirectoryExists("./output/mac/");
EnsureDirectoryExists("./output/ios/");
- EnsureDirectoryExists("./output/uwp/");
- EnsureDirectoryExists("./output/uwp/Themes");
+ EnsureDirectoryExists("./output/uwp/SignaturePad/Themes");
EnsureDirectoryExists("./output/netstandard/");
CopyFiles($"./src/SignaturePad.Android/bin/{configuration}/SignaturePad.*", "./output/android/");
CopyFiles($"./src/SignaturePad.iOS/bin/{configuration}/SignaturePad.*", "./output/ios/");
+ CopyFiles($"./src/SignaturePad.MacOS/bin/{configuration}/SignaturePad.*", "./output/mac/");
+ CopyFiles($"./src/SignaturePad.WPF/bin/{configuration}/SignaturePad.*", "./output/wpf/");
+ CopyFiles($"./src/SignaturePad.GTK/bin/{configuration}/SignaturePad.*", "./output/gtk/");
CopyFiles($"./src/SignaturePad.UWP/bin/{configuration}/SignaturePad.*", "./output/uwp/");
- CopyFiles($"./src/SignaturePad.UWP/bin/{configuration}/Themes/*", "./output/uwp/Themes");
+ CopyFiles($"./src/SignaturePad.UWP/bin/{configuration}/SignaturePad/*", "./output/uwp/SignaturePad");
+ CopyFiles($"./src/SignaturePad.UWP/bin/{configuration}/SignaturePad/Themes/*", "./output/uwp/SignaturePad/Themes");
CopyFiles($"./src/SignaturePad.Forms.Droid/bin/{configuration}/SignaturePad.Forms.*", "./output/android/");
CopyFiles($"./src/SignaturePad.Forms.iOS/bin/{configuration}/SignaturePad.Forms.*", "./output/ios/");
+ CopyFiles($"./src/SignaturePad.Forms.MacOS/bin/{configuration}/SignaturePad.Forms.*", "./output/mac/");
+ CopyFiles($"./src/SignaturePad.Forms.WPF/bin/{configuration}/SignaturePad.Forms.*", "./output/wpf/");
+ CopyFiles($"./src/SignaturePad.Forms.GTK/bin/{configuration}/SignaturePad.Forms.*", "./output/gtk/");
CopyFiles($"./src/SignaturePad.Forms.UWP/bin/{configuration}/SignaturePad.Forms.*", "./output/uwp/");
- CopyFiles($"./src/SignaturePad.Forms.UWP/bin/{configuration}/Themes/*", "./output/uwp/Themes");
+ CopyFiles($"./src/SignaturePad.Forms.UWP/bin/{configuration}/SignaturePad/*", "./output/uwp/SignaturePad/");
+ CopyFiles($"./src/SignaturePad.Forms.UWP/bin/{configuration}/SignaturePad/Themes/*", "./output/uwp/SignaturePad/Themes");
CopyFiles($"./src/SignaturePad.Forms/bin/{configuration}/SignaturePad.Forms.*", "./output/netstandard/");
});
@@ -57,7 +94,6 @@ Task("nuget")
.WithCriteria(IsRunningOnWindows())
.Does(() =>
{
- var nuget = Context.Tools.Resolve("nuget.exe");
var nuspecs = GetFiles("./nuget/*.nuspec");
var settings = new NuGetPackSettings {
BasePath = ".",
@@ -80,23 +116,33 @@ Task("samples")
.IsDependentOn("libs")
.Does(() =>
{
- var settings = new MSBuildSettings {
- Verbosity = Verbosity.Minimal,
- Configuration = configuration,
- PlatformTarget = PlatformTarget.MSIL,
- MSBuildPlatform = MSBuildPlatform.x86,
- ArgumentCustomization = args => args.Append("/restore"),
+ var settings = CreateSettings();
+ var settingsIos = CreateSettings();
+ settingsIos.ArgumentCustomization = args => {
+ return args.Append($"/p:Platform=\"iPhoneSimulator\"");
};
if (IsRunningOnWindows()) {
+ NuGetRestore("./samples/Sample.Android/Sample.Android.sln");
MSBuild("./samples/Sample.Android/Sample.Android.sln", settings);
- MSBuild("./samples/Sample.iOS/Sample.iOS.sln", settings);
+
+ NuGetRestore("./samples/Sample.iOS/Sample.iOS.sln");
+ MSBuild("./samples/Sample.iOS/Sample.iOS.sln", settingsIos);
+
+ NuGetRestore("./samples/Sample.UWP/Sample.UWP.sln");
MSBuild("./samples/Sample.UWP/Sample.UWP.sln", settings);
- MSBuild("./samples/Sample.Forms/Sample.Forms.sln", settings);
+
+ NuGetRestore("./samples/Sample.Forms/Sample.Forms.sln");
+ MSBuild("./samples/Sample.Forms/Sample.Forms.sln", settingsIos);
} else {
+ NuGetRestore("./samples/Sample.Android/Sample.Android.sln");
MSBuild("./samples/Sample.Android/Sample.Android.sln", settings);
- MSBuild("./samples/Sample.iOS/Sample.iOS.sln", settings);
- MSBuild("./samples/Sample.Forms/Sample.Forms.Mac.sln", settings);
+
+ NuGetRestore("./samples/Sample.iOS/Sample.iOS.sln");
+ MSBuild("./samples/Sample.iOS/Sample.iOS.sln", settingsIos);
+
+ NuGetRestore("./samples/Sample.Forms/Sample.Forms.Mac.sln");
+ MSBuild("./samples/Sample.Forms/Sample.Forms.Mac.sln", settingsIos);
}
});
@@ -106,7 +152,4 @@ Task("Default")
.IsDependentOn("nuget")
.IsDependentOn("samples");
-Task("CI")
- .IsDependentOn("Default");
-
RunTarget(target);
diff --git a/nuget/Xamarin.Controls.SignaturePad.Forms.nuspec b/nuget/Xamarin.Controls.SignaturePad.Forms.nuspec
index d7176d5..f0535ff 100644
--- a/nuget/Xamarin.Controls.SignaturePad.Forms.nuspec
+++ b/nuget/Xamarin.Controls.SignaturePad.Forms.nuspec
@@ -20,18 +20,32 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
@@ -39,6 +53,15 @@
+
+
+
+
+
+
+
+
+
@@ -46,9 +69,11 @@
-
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/nuget/Xamarin.Controls.SignaturePad.nuspec b/nuget/Xamarin.Controls.SignaturePad.nuspec
index c86265a..7f4bffd 100644
--- a/nuget/Xamarin.Controls.SignaturePad.nuspec
+++ b/nuget/Xamarin.Controls.SignaturePad.nuspec
@@ -1,4 +1,4 @@
-
+
@@ -19,7 +19,10 @@
+
+
+
@@ -31,14 +34,23 @@
+
+
+
+
+
+
+
+
+
-
-
+
+
diff --git a/samples/Sample.Android/Properties/AndroidManifest.xml b/samples/Sample.Android/Properties/AndroidManifest.xml
index 45b47e9..dcb4e6d 100644
--- a/samples/Sample.Android/Properties/AndroidManifest.xml
+++ b/samples/Sample.Android/Properties/AndroidManifest.xml
@@ -1,7 +1,7 @@
-
+
-
\ No newline at end of file
+
diff --git a/samples/Sample.Android/Sample.Android.csproj b/samples/Sample.Android/Sample.Android.csproj
index 5950baf..0b71fcc 100644
--- a/samples/Sample.Android/Sample.Android.csproj
+++ b/samples/Sample.Android/Sample.Android.csproj
@@ -16,8 +16,8 @@
Resources\Resource.designer.cs
Sample.Android
Properties\AndroidManifest.xml
- v7.1
- False
+ v10.0
+ True
True
@@ -41,7 +41,6 @@
4
False
False
- armeabi,armeabi-v7a,x86,x86_64,arm64-v8a
Full
True
Xamarin
@@ -54,10 +53,10 @@
-
-
-
-
+
+
+
+
diff --git a/samples/Sample.Forms/Sample.Forms.Mac.sln b/samples/Sample.Forms/Sample.Forms.Mac.sln
index c160445..030d86c 100644
--- a/samples/Sample.Forms/Sample.Forms.Mac.sln
+++ b/samples/Sample.Forms/Sample.Forms.Mac.sln
@@ -19,6 +19,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.Android", "Samples.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.iOS", "Samples.iOS\Samples.iOS.csproj", "{2142B859-21E9-484D-880A-26AD708569DB}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SignaturePad.MacOS", "..\..\src\SignaturePad.MacOS\SignaturePad.MacOS.csproj", "{EB7F9F29-7348-4DAE-B7E0-198FF0E14474}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SignaturePad.Forms.MacOS", "..\..\src\SignaturePad.Forms.MacOS\SignaturePad.Forms.MacOS.csproj", "{C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.MacOS", "Samples.MacOS\Samples.MacOS.csproj", "{5131B6A0-D5EA-4EB0-A44A-7538192EC275}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -131,6 +137,68 @@ Global
{2142B859-21E9-484D-880A-26AD708569DB}.Release|iPhone.Build.0 = Release|iPhone
{2142B859-21E9-484D-880A-26AD708569DB}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{2142B859-21E9-484D-880A-26AD708569DB}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Debug|ARM.Build.0 = Debug|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Debug|x64.Build.0 = Debug|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Debug|x86.Build.0 = Debug|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Release|Any CPU.Build.0 = Release|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Release|ARM.ActiveCfg = Release|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Release|ARM.Build.0 = Release|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Release|iPhone.Build.0 = Release|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Release|x64.ActiveCfg = Release|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Release|x64.Build.0 = Release|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Release|x86.ActiveCfg = Release|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Release|x86.Build.0 = Release|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Debug|ARM.Build.0 = Debug|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Debug|x64.Build.0 = Debug|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Debug|x86.Build.0 = Debug|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Release|ARM.ActiveCfg = Release|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Release|ARM.Build.0 = Release|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Release|iPhone.Build.0 = Release|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Release|x64.ActiveCfg = Release|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Release|x64.Build.0 = Release|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Release|x86.ActiveCfg = Release|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Release|x86.Build.0 = Release|Any CPU
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}.Debug|ARM.ActiveCfg = Debug|iPhoneSimulator
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}.Debug|iPhone.ActiveCfg = Debug|iPhoneSimulator
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}.Debug|x64.ActiveCfg = Debug|iPhoneSimulator
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}.Debug|x86.ActiveCfg = Debug|iPhoneSimulator
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}.Release|ARM.ActiveCfg = Release|iPhoneSimulator
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}.Release|iPhone.ActiveCfg = Release|iPhoneSimulator
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}.Release|x64.ActiveCfg = Release|iPhoneSimulator
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}.Release|x86.ActiveCfg = Release|iPhoneSimulator
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/samples/Sample.Forms/Sample.Forms.sln b/samples/Sample.Forms/Sample.Forms.sln
index d3a14a7..8849765 100644
--- a/samples/Sample.Forms/Sample.Forms.sln
+++ b/samples/Sample.Forms/Sample.Forms.sln
@@ -25,6 +25,18 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SignaturePad.UWP", "..\..\s
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SignaturePad.Forms.UWP", "..\..\src\SignaturePad.Forms.UWP\SignaturePad.Forms.UWP.csproj", "{6FC62387-6717-4577-A48B-D15848741F08}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SignaturePad.WPF", "..\..\src\SignaturePad.WPF\SignaturePad.WPF.csproj", "{89547259-5482-43FC-B100-EEA0BB2C91A3}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SignaturePad.Forms.WPF", "..\..\src\SignaturePad.Forms.WPF\SignaturePad.Forms.WPF.csproj", "{713B7BF4-24CB-4CE7-87D2-44E347CFED19}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.WPF", "Samples.WPF\Samples.WPF.csproj", "{497C984A-6F4A-4522-A043-E3AB050670A8}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SignaturePad.MacOS", "..\..\src\SignaturePad.MacOS\SignaturePad.MacOS.csproj", "{EB7F9F29-7348-4DAE-B7E0-198FF0E14474}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SignaturePad.Forms.MacOS", "..\..\src\SignaturePad.Forms.MacOS\SignaturePad.Forms.MacOS.csproj", "{C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.MacOS", "Samples.MacOS\Samples.MacOS.csproj", "{5131B6A0-D5EA-4EB0-A44A-7538192EC275}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -329,6 +341,140 @@ Global
{6FC62387-6717-4577-A48B-D15848741F08}.Release|x64.Build.0 = Release|Any CPU
{6FC62387-6717-4577-A48B-D15848741F08}.Release|x86.ActiveCfg = Release|Any CPU
{6FC62387-6717-4577-A48B-D15848741F08}.Release|x86.Build.0 = Release|Any CPU
+ {89547259-5482-43FC-B100-EEA0BB2C91A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {89547259-5482-43FC-B100-EEA0BB2C91A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {89547259-5482-43FC-B100-EEA0BB2C91A3}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {89547259-5482-43FC-B100-EEA0BB2C91A3}.Debug|ARM.Build.0 = Debug|Any CPU
+ {89547259-5482-43FC-B100-EEA0BB2C91A3}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {89547259-5482-43FC-B100-EEA0BB2C91A3}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {89547259-5482-43FC-B100-EEA0BB2C91A3}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {89547259-5482-43FC-B100-EEA0BB2C91A3}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {89547259-5482-43FC-B100-EEA0BB2C91A3}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {89547259-5482-43FC-B100-EEA0BB2C91A3}.Debug|x64.Build.0 = Debug|Any CPU
+ {89547259-5482-43FC-B100-EEA0BB2C91A3}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {89547259-5482-43FC-B100-EEA0BB2C91A3}.Debug|x86.Build.0 = Debug|Any CPU
+ {89547259-5482-43FC-B100-EEA0BB2C91A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {89547259-5482-43FC-B100-EEA0BB2C91A3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {89547259-5482-43FC-B100-EEA0BB2C91A3}.Release|ARM.ActiveCfg = Release|Any CPU
+ {89547259-5482-43FC-B100-EEA0BB2C91A3}.Release|ARM.Build.0 = Release|Any CPU
+ {89547259-5482-43FC-B100-EEA0BB2C91A3}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {89547259-5482-43FC-B100-EEA0BB2C91A3}.Release|iPhone.Build.0 = Release|Any CPU
+ {89547259-5482-43FC-B100-EEA0BB2C91A3}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {89547259-5482-43FC-B100-EEA0BB2C91A3}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {89547259-5482-43FC-B100-EEA0BB2C91A3}.Release|x64.ActiveCfg = Release|Any CPU
+ {89547259-5482-43FC-B100-EEA0BB2C91A3}.Release|x64.Build.0 = Release|Any CPU
+ {89547259-5482-43FC-B100-EEA0BB2C91A3}.Release|x86.ActiveCfg = Release|Any CPU
+ {89547259-5482-43FC-B100-EEA0BB2C91A3}.Release|x86.Build.0 = Release|Any CPU
+ {713B7BF4-24CB-4CE7-87D2-44E347CFED19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {713B7BF4-24CB-4CE7-87D2-44E347CFED19}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {713B7BF4-24CB-4CE7-87D2-44E347CFED19}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {713B7BF4-24CB-4CE7-87D2-44E347CFED19}.Debug|ARM.Build.0 = Debug|Any CPU
+ {713B7BF4-24CB-4CE7-87D2-44E347CFED19}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {713B7BF4-24CB-4CE7-87D2-44E347CFED19}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {713B7BF4-24CB-4CE7-87D2-44E347CFED19}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {713B7BF4-24CB-4CE7-87D2-44E347CFED19}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {713B7BF4-24CB-4CE7-87D2-44E347CFED19}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {713B7BF4-24CB-4CE7-87D2-44E347CFED19}.Debug|x64.Build.0 = Debug|Any CPU
+ {713B7BF4-24CB-4CE7-87D2-44E347CFED19}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {713B7BF4-24CB-4CE7-87D2-44E347CFED19}.Debug|x86.Build.0 = Debug|Any CPU
+ {713B7BF4-24CB-4CE7-87D2-44E347CFED19}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {713B7BF4-24CB-4CE7-87D2-44E347CFED19}.Release|Any CPU.Build.0 = Release|Any CPU
+ {713B7BF4-24CB-4CE7-87D2-44E347CFED19}.Release|ARM.ActiveCfg = Release|Any CPU
+ {713B7BF4-24CB-4CE7-87D2-44E347CFED19}.Release|ARM.Build.0 = Release|Any CPU
+ {713B7BF4-24CB-4CE7-87D2-44E347CFED19}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {713B7BF4-24CB-4CE7-87D2-44E347CFED19}.Release|iPhone.Build.0 = Release|Any CPU
+ {713B7BF4-24CB-4CE7-87D2-44E347CFED19}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {713B7BF4-24CB-4CE7-87D2-44E347CFED19}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {713B7BF4-24CB-4CE7-87D2-44E347CFED19}.Release|x64.ActiveCfg = Release|Any CPU
+ {713B7BF4-24CB-4CE7-87D2-44E347CFED19}.Release|x64.Build.0 = Release|Any CPU
+ {713B7BF4-24CB-4CE7-87D2-44E347CFED19}.Release|x86.ActiveCfg = Release|Any CPU
+ {713B7BF4-24CB-4CE7-87D2-44E347CFED19}.Release|x86.Build.0 = Release|Any CPU
+ {497C984A-6F4A-4522-A043-E3AB050670A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {497C984A-6F4A-4522-A043-E3AB050670A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {497C984A-6F4A-4522-A043-E3AB050670A8}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {497C984A-6F4A-4522-A043-E3AB050670A8}.Debug|ARM.Build.0 = Debug|Any CPU
+ {497C984A-6F4A-4522-A043-E3AB050670A8}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {497C984A-6F4A-4522-A043-E3AB050670A8}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {497C984A-6F4A-4522-A043-E3AB050670A8}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {497C984A-6F4A-4522-A043-E3AB050670A8}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {497C984A-6F4A-4522-A043-E3AB050670A8}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {497C984A-6F4A-4522-A043-E3AB050670A8}.Debug|x64.Build.0 = Debug|Any CPU
+ {497C984A-6F4A-4522-A043-E3AB050670A8}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {497C984A-6F4A-4522-A043-E3AB050670A8}.Debug|x86.Build.0 = Debug|Any CPU
+ {497C984A-6F4A-4522-A043-E3AB050670A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {497C984A-6F4A-4522-A043-E3AB050670A8}.Release|Any CPU.Build.0 = Release|Any CPU
+ {497C984A-6F4A-4522-A043-E3AB050670A8}.Release|ARM.ActiveCfg = Release|Any CPU
+ {497C984A-6F4A-4522-A043-E3AB050670A8}.Release|ARM.Build.0 = Release|Any CPU
+ {497C984A-6F4A-4522-A043-E3AB050670A8}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {497C984A-6F4A-4522-A043-E3AB050670A8}.Release|iPhone.Build.0 = Release|Any CPU
+ {497C984A-6F4A-4522-A043-E3AB050670A8}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {497C984A-6F4A-4522-A043-E3AB050670A8}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {497C984A-6F4A-4522-A043-E3AB050670A8}.Release|x64.ActiveCfg = Release|Any CPU
+ {497C984A-6F4A-4522-A043-E3AB050670A8}.Release|x64.Build.0 = Release|Any CPU
+ {497C984A-6F4A-4522-A043-E3AB050670A8}.Release|x86.ActiveCfg = Release|Any CPU
+ {497C984A-6F4A-4522-A043-E3AB050670A8}.Release|x86.Build.0 = Release|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Debug|ARM.Build.0 = Debug|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Debug|x64.Build.0 = Debug|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Debug|x86.Build.0 = Debug|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Release|Any CPU.Build.0 = Release|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Release|ARM.ActiveCfg = Release|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Release|ARM.Build.0 = Release|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Release|iPhone.Build.0 = Release|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Release|x64.ActiveCfg = Release|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Release|x64.Build.0 = Release|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Release|x86.ActiveCfg = Release|Any CPU
+ {EB7F9F29-7348-4DAE-B7E0-198FF0E14474}.Release|x86.Build.0 = Release|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Debug|ARM.Build.0 = Debug|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Debug|x64.Build.0 = Debug|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Debug|x86.Build.0 = Debug|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Release|ARM.ActiveCfg = Release|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Release|ARM.Build.0 = Release|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Release|iPhone.Build.0 = Release|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Release|x64.ActiveCfg = Release|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Release|x64.Build.0 = Release|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Release|x86.ActiveCfg = Release|Any CPU
+ {C6FA17D7-0F22-49B6-8C17-C6AE0AC39489}.Release|x86.Build.0 = Release|Any CPU
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}.Debug|ARM.ActiveCfg = Debug|iPhoneSimulator
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}.Debug|iPhone.ActiveCfg = Debug|iPhoneSimulator
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}.Debug|x64.ActiveCfg = Debug|iPhoneSimulator
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}.Debug|x86.ActiveCfg = Debug|iPhoneSimulator
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}.Release|ARM.ActiveCfg = Release|iPhoneSimulator
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}.Release|iPhone.ActiveCfg = Release|iPhoneSimulator
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}.Release|x64.ActiveCfg = Release|iPhoneSimulator
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}.Release|x86.ActiveCfg = Release|iPhoneSimulator
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/samples/Sample.Forms/Samples.Android/Properties/AndroidManifest.xml b/samples/Sample.Forms/Samples.Android/Properties/AndroidManifest.xml
index 38ad0de..446c389 100644
--- a/samples/Sample.Forms/Samples.Android/Properties/AndroidManifest.xml
+++ b/samples/Sample.Forms/Samples.Android/Properties/AndroidManifest.xml
@@ -1,7 +1,7 @@
-
+
-
\ No newline at end of file
+
diff --git a/samples/Sample.Forms/Samples.Android/Samples.Android.csproj b/samples/Sample.Forms/Samples.Android/Samples.Android.csproj
index 086b919..92093a6 100644
--- a/samples/Sample.Forms/Samples.Android/Samples.Android.csproj
+++ b/samples/Sample.Forms/Samples.Android/Samples.Android.csproj
@@ -14,8 +14,7 @@
Resources\Resource.Designer.cs
Off
Properties\AndroidManifest.xml
- v7.1
- false
+ v10.0
true
@@ -27,7 +26,6 @@
4
None
True
- armeabi-v7a;x86
pdbonly
@@ -37,7 +35,6 @@
prompt
4
False
- armeabi-v7a,x86
@@ -47,7 +44,7 @@
-
+
diff --git a/samples/Sample.Forms/Samples.MacOS/AppDelegate.cs b/samples/Sample.Forms/Samples.MacOS/AppDelegate.cs
new file mode 100644
index 0000000..546191e
--- /dev/null
+++ b/samples/Sample.Forms/Samples.MacOS/AppDelegate.cs
@@ -0,0 +1,57 @@
+//
+// Vladislav Antonyuk. All rights reserved.
+//
+// Vladislav Antonyuk
+
+namespace Samples.MacOS
+{
+ using System.IO;
+ using System.Threading.Tasks;
+ using AppKit;
+ using Foundation;
+ using Photos;
+ using Xamarin.Forms;
+ using Xamarin.Forms.Platform.MacOS;
+
+ [Register(nameof(AppDelegate))]
+ public class AppDelegate : FormsApplicationDelegate
+ {
+ public AppDelegate()
+ {
+ MainWindow = UiService.MainWindow;
+ }
+
+ public override NSWindow MainWindow { get; }
+
+ public override void DidFinishLaunching(NSNotification notification)
+ {
+ Forms.Init();
+ LoadApplication(new App (OnSaveSignature));
+ base.DidFinishLaunching(notification);
+ }
+ private async Task OnSaveSignature (Stream bitmap, string filename)
+ {
+ var tcs = new TaskCompletionSource ();
+
+ NSImage image = bitmap == null ? null : NSImage.FromStream(bitmap);
+
+ var status = await PHPhotoLibrary.RequestAuthorizationAsync ();
+ if (status == PHAuthorizationStatus.Authorized)
+ {
+ //image.SaveToPhotosAlbum ((i, error) =>
+ //{
+ // image.Dispose ();
+
+ // tcs.TrySetResult (error == null);
+ //});
+ tcs.TrySetResult (true);
+ }
+ else
+ {
+ tcs.TrySetResult (false);
+ }
+
+ return await tcs.Task;
+ }
+ }
+}
diff --git a/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-128.png b/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-128.png
new file mode 100644
index 0000000..d114e15
Binary files /dev/null and b/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-128.png differ
diff --git a/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-128@2x.png b/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-128@2x.png
new file mode 100644
index 0000000..3b98e88
Binary files /dev/null and b/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-128@2x.png differ
diff --git a/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-16.png b/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-16.png
new file mode 100644
index 0000000..02bd0f4
Binary files /dev/null and b/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-16.png differ
diff --git a/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-16@2x.png b/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-16@2x.png
new file mode 100644
index 0000000..f5ffabc
Binary files /dev/null and b/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-16@2x.png differ
diff --git a/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-256.png b/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-256.png
new file mode 100644
index 0000000..3b98e88
Binary files /dev/null and b/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-256.png differ
diff --git a/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-256@2x.png b/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-256@2x.png
new file mode 100644
index 0000000..b9e2163
Binary files /dev/null and b/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-256@2x.png differ
diff --git a/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-32.png b/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-32.png
new file mode 100644
index 0000000..f5ffabc
Binary files /dev/null and b/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-32.png differ
diff --git a/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-32@2x.png b/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-32@2x.png
new file mode 100644
index 0000000..c324492
Binary files /dev/null and b/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-32@2x.png differ
diff --git a/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-512.png b/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-512.png
new file mode 100644
index 0000000..b9e2163
Binary files /dev/null and b/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-512.png differ
diff --git a/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png b/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png
new file mode 100644
index 0000000..52cd731
Binary files /dev/null and b/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png differ
diff --git a/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/Contents.json b/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/Contents.json
new file mode 100644
index 0000000..6b28545
--- /dev/null
+++ b/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/AppIcon.appiconset/Contents.json
@@ -0,0 +1,68 @@
+{
+ "images": [
+ {
+ "filename": "AppIcon-16.png",
+ "size": "16x16",
+ "scale": "1x",
+ "idiom": "mac"
+ },
+ {
+ "filename": "AppIcon-16@2x.png",
+ "size": "16x16",
+ "scale": "2x",
+ "idiom": "mac"
+ },
+ {
+ "filename": "AppIcon-32.png",
+ "size": "32x32",
+ "scale": "1x",
+ "idiom": "mac"
+ },
+ {
+ "filename": "AppIcon-32@2x.png",
+ "size": "32x32",
+ "scale": "2x",
+ "idiom": "mac"
+ },
+ {
+ "filename": "AppIcon-128.png",
+ "size": "128x128",
+ "scale": "1x",
+ "idiom": "mac"
+ },
+ {
+ "filename": "AppIcon-128@2x.png",
+ "size": "128x128",
+ "scale": "2x",
+ "idiom": "mac"
+ },
+ {
+ "filename": "AppIcon-256.png",
+ "size": "256x256",
+ "scale": "1x",
+ "idiom": "mac"
+ },
+ {
+ "filename": "AppIcon-256@2x.png",
+ "size": "256x256",
+ "scale": "2x",
+ "idiom": "mac"
+ },
+ {
+ "filename": "AppIcon-512.png",
+ "size": "512x512",
+ "scale": "1x",
+ "idiom": "mac"
+ },
+ {
+ "filename": "AppIcon-512@2x.png",
+ "size": "512x512",
+ "scale": "2x",
+ "idiom": "mac"
+ }
+ ],
+ "info": {
+ "version": 1,
+ "author": "xcode"
+ }
+}
\ No newline at end of file
diff --git a/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/Contents.json b/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/Contents.json
new file mode 100644
index 0000000..033a618
--- /dev/null
+++ b/samples/Sample.Forms/Samples.MacOS/Assets.xcassets/Contents.json
@@ -0,0 +1,6 @@
+{
+ "info": {
+ "version": 1,
+ "author": "xcode"
+ }
+}
\ No newline at end of file
diff --git a/samples/Sample.Forms/Samples.MacOS/Entitlements.plist b/samples/Sample.Forms/Samples.MacOS/Entitlements.plist
new file mode 100644
index 0000000..9ae5993
--- /dev/null
+++ b/samples/Sample.Forms/Samples.MacOS/Entitlements.plist
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/samples/Sample.Forms/Samples.MacOS/Info.plist b/samples/Sample.Forms/Samples.MacOS/Info.plist
new file mode 100644
index 0000000..a1d10f4
--- /dev/null
+++ b/samples/Sample.Forms/Samples.MacOS/Info.plist
@@ -0,0 +1,28 @@
+
+
+
+
+ CFBundleName
+ Draw & GO
+ CFBundleIdentifier
+ com.vladislavantonyuk.drawgo
+ CFBundleShortVersionString
+ 1.0
+ CFBundleVersion
+ 1
+ LSMinimumSystemVersion
+ 10.13
+ CFBundleDevelopmentRegion
+ en
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundlePackageType
+ APPL
+ NSPrincipalClass
+ NSApplication
+ XSAppIconAssets
+ Assets.xcassets/AppIcon.appiconset
+ LSApplicationCategoryType
+ public.app-category.utilities
+
+
diff --git a/samples/Sample.Forms/Samples.MacOS/Main.cs b/samples/Sample.Forms/Samples.MacOS/Main.cs
new file mode 100644
index 0000000..cf4876c
--- /dev/null
+++ b/samples/Sample.Forms/Samples.MacOS/Main.cs
@@ -0,0 +1,20 @@
+//
+// Vladislav Antonyuk. All rights reserved.
+//
+// Vladislav Antonyuk
+
+namespace Samples.MacOS
+{
+ using AppKit;
+
+ public class Application
+ {
+ // This is the main entry point of the application.
+ private static void Main(string[] args)
+ {
+ NSApplication.Init();
+ NSApplication.SharedApplication.Delegate = new AppDelegate();
+ NSApplication.Main(args);
+ }
+ }
+}
diff --git a/samples/Sample.Forms/Samples.MacOS/Properties/AssemblyInfo.cs b/samples/Sample.Forms/Samples.MacOS/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..e08f99a
--- /dev/null
+++ b/samples/Sample.Forms/Samples.MacOS/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("DrawGo.Mac.iOS")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("DrawGo.Mac.iOS")]
+[assembly: AssemblyCopyright("Copyright © 2014")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("72bdc44f-c588-44f3-b6df-9aace7daafdd")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/samples/Sample.Forms/Samples.MacOS/Samples.MacOS.csproj b/samples/Sample.Forms/Samples.MacOS/Samples.MacOS.csproj
new file mode 100644
index 0000000..86e269d
--- /dev/null
+++ b/samples/Sample.Forms/Samples.MacOS/Samples.MacOS.csproj
@@ -0,0 +1,106 @@
+
+
+
+ Debug
+ iPhoneSimulator
+ {5131B6A0-D5EA-4EB0-A44A-7538192EC275}
+ {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ Exe
+ Samples.MacOS
+ Samples MacOS
+ Resources
+ v2.0
+ Xamarin.Mac
+
+
+ true
+ full
+ false
+ bin\Debug
+ DEBUG;
+ prompt
+ 4
+ false
+ Mac Developer
+ false
+ false
+ false
+ true
+ true
+ true
+ HttpClientHandler
+ None
+ x86_64
+ 3rd Party Mac Developer Installer
+ None
+
+
+ pdbonly
+ true
+ bin\Release
+
+
+ prompt
+ 4
+ false
+ true
+ false
+ true
+ true
+ true
+ SdkOnly
+ HttpClientHandler
+
+
+ None
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {c6fa17d7-0f22-49b6-8c17-c6ae0ac39489}
+ SignaturePad.Forms.MacOS
+
+
+ {eb7f9f29-7348-4dae-b7e0-198ff0e14474}
+ SignaturePad.MacOS
+
+
+ {cc18e151-5792-4da5-ade6-7cfba16a593e}
+ Samples
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 4.5.0.495
+
+
+
+
\ No newline at end of file
diff --git a/samples/Sample.Forms/Samples.MacOS/UiService.cs b/samples/Sample.Forms/Samples.MacOS/UiService.cs
new file mode 100644
index 0000000..b4b8b79
--- /dev/null
+++ b/samples/Sample.Forms/Samples.MacOS/UiService.cs
@@ -0,0 +1,31 @@
+//
+// Vladislav Antonyuk. All rights reserved.
+//
+// Vladislav Antonyuk
+
+namespace Samples.MacOS
+{
+ using AppKit;
+ using CoreGraphics;
+
+ internal static class UiService
+ {
+ static UiService()
+ {
+ var mainWindowStyle = NSWindowStyle.Closable | NSWindowStyle.Miniaturizable | NSWindowStyle.Resizable |
+ NSWindowStyle.Titled;
+ var mainWindowSize = new CGSize(550, 330);
+ var mainWindowRect = new CGRect(
+ NSScreen.MainScreen.Frame.Width / 2 - mainWindowSize.Width / 2,
+ NSScreen.MainScreen.Frame.Height / 2 - mainWindowSize.Height / 2,
+ mainWindowSize.Width,
+ mainWindowSize.Height);
+ MainWindow = new NSWindow(mainWindowRect, mainWindowStyle, NSBackingStore.Buffered, false)
+ {
+ TitleVisibility = NSWindowTitleVisibility.Visible
+ };
+ }
+
+ internal static NSWindow MainWindow { get; }
+ }
+}
diff --git a/samples/Sample.Forms/Samples.UWP/Samples.UWP.csproj b/samples/Sample.Forms/Samples.UWP/Samples.UWP.csproj
index b62fe0f..3363bf6 100644
--- a/samples/Sample.Forms/Samples.UWP/Samples.UWP.csproj
+++ b/samples/Sample.Forms/Samples.UWP/Samples.UWP.csproj
@@ -11,14 +11,15 @@
Samples.UWP
en-US
UAP
- 10.0.14393.0
- 10.0.10586.0
+ 10.0.18362.0
+ 10.0.18362.0
14
true
512
{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
Samples.UWP_TemporaryKey.pfx
- 5D80C6709564B0BBADBD1B115AFCADCB0B9307AB
+ 5D960AE791CAC02D3474DF1DC282595DB26746BB
+ True
true
@@ -90,9 +91,9 @@
true
-
-
-
+
+
+
diff --git a/samples/Sample.Forms/Samples.UWP/Samples.UWP_TemporaryKey.pfx b/samples/Sample.Forms/Samples.UWP/Samples.UWP_TemporaryKey.pfx
index f25d3f3..bfff14a 100644
Binary files a/samples/Sample.Forms/Samples.UWP/Samples.UWP_TemporaryKey.pfx and b/samples/Sample.Forms/Samples.UWP/Samples.UWP_TemporaryKey.pfx differ
diff --git a/samples/Sample.Forms/Samples.WPF/App.config b/samples/Sample.Forms/Samples.WPF/App.config
new file mode 100644
index 0000000..7c47a67
--- /dev/null
+++ b/samples/Sample.Forms/Samples.WPF/App.config
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/samples/Sample.Forms/Samples.WPF/App.xaml b/samples/Sample.Forms/Samples.WPF/App.xaml
new file mode 100644
index 0000000..ec34f60
--- /dev/null
+++ b/samples/Sample.Forms/Samples.WPF/App.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/samples/Sample.Forms/Samples.WPF/App.xaml.cs b/samples/Sample.Forms/Samples.WPF/App.xaml.cs
new file mode 100644
index 0000000..e47fdc2
--- /dev/null
+++ b/samples/Sample.Forms/Samples.WPF/App.xaml.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace Samples.WPF
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application
+ {
+ }
+}
diff --git a/samples/Sample.Forms/Samples.WPF/MainWindow.xaml b/samples/Sample.Forms/Samples.WPF/MainWindow.xaml
new file mode 100644
index 0000000..077a9c6
--- /dev/null
+++ b/samples/Sample.Forms/Samples.WPF/MainWindow.xaml
@@ -0,0 +1,8 @@
+
+
\ No newline at end of file
diff --git a/samples/Sample.Forms/Samples.WPF/MainWindow.xaml.cs b/samples/Sample.Forms/Samples.WPF/MainWindow.xaml.cs
new file mode 100644
index 0000000..9e3e3fe
--- /dev/null
+++ b/samples/Sample.Forms/Samples.WPF/MainWindow.xaml.cs
@@ -0,0 +1,36 @@
+//
+// Vladislav Antonyuk. All rights reserved.
+//
+// Vladislav Antonyuk
+
+namespace Samples.WPF
+{
+ using System;
+ using System.IO;
+ using System.Threading.Tasks;
+ using SignaturePad.Forms;
+ using Xamarin.Forms;
+ using Xamarin.Forms.Platform.WPF;
+
+ ///
+ /// Interaction logic for MainWindow.xaml
+ ///
+ public partial class MainWindow : FormsApplicationPage
+ {
+ public MainWindow ()
+ {
+ InitializeComponent ();
+ Forms.Init ();
+ LoadApplication (new Samples.App (OnSaveSignature));
+ }
+
+ private async Task OnSaveSignature (Stream bitmap, string filename)
+ {
+ var file = File.Create (filename);
+ if (bitmap != null)
+ await bitmap.CopyToAsync (file);
+
+ return true;
+ }
+ }
+}
diff --git a/samples/Sample.Forms/Samples.WPF/Properties/AssemblyInfo.cs b/samples/Sample.Forms/Samples.WPF/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..d54437b
--- /dev/null
+++ b/samples/Sample.Forms/Samples.WPF/Properties/AssemblyInfo.cs
@@ -0,0 +1,55 @@
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle ("Samples.WPF")]
+[assembly: AssemblyDescription ("")]
+[assembly: AssemblyConfiguration ("")]
+[assembly: AssemblyCompany ("")]
+[assembly: AssemblyProduct ("Samples.WPF")]
+[assembly: AssemblyCopyright ("Copyright © 2018")]
+[assembly: AssemblyTrademark ("")]
+[assembly: AssemblyCulture ("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible (false)]
+
+//In order to begin building localizable applications, set
+//CultureYouAreCodingWith in your .csproj file
+//inside a . For example, if you are using US english
+//in your source files, set the to en-US. Then uncomment
+//the NeutralResourceLanguage attribute below. Update the "en-US" in
+//the line below to match the UICulture setting in the project file.
+
+//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+
+[assembly: ThemeInfo (
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
+
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion ("1.0.0.0")]
+[assembly: AssemblyFileVersion ("1.0.0.0")]
diff --git a/samples/Sample.Forms/Samples.WPF/Properties/Resources.Designer.cs b/samples/Sample.Forms/Samples.WPF/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..77c1860
--- /dev/null
+++ b/samples/Sample.Forms/Samples.WPF/Properties/Resources.Designer.cs
@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace Samples.WPF.Properties
+{
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute ("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute ()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute ()]
+ internal class Resources
+ {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute ("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources ()
+ {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute (global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager
+ {
+ get
+ {
+ if ((resourceMan == null))
+ {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager ("Samples.WPF.Properties.Resources", typeof (Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute (global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture
+ {
+ get
+ {
+ return resourceCulture;
+ }
+ set
+ {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/samples/Sample.Forms/Samples.WPF/Properties/Resources.resx b/samples/Sample.Forms/Samples.WPF/Properties/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/samples/Sample.Forms/Samples.WPF/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/samples/Sample.Forms/Samples.WPF/Properties/Settings.Designer.cs b/samples/Sample.Forms/Samples.WPF/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..c5501bb
--- /dev/null
+++ b/samples/Sample.Forms/Samples.WPF/Properties/Settings.Designer.cs
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace Samples.WPF.Properties
+{
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute ()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute ("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized (new Settings ())));
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/samples/Sample.Forms/Samples.WPF/Properties/Settings.settings b/samples/Sample.Forms/Samples.WPF/Properties/Settings.settings
new file mode 100644
index 0000000..033d7a5
--- /dev/null
+++ b/samples/Sample.Forms/Samples.WPF/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/samples/Sample.Forms/Samples.WPF/Samples.WPF.csproj b/samples/Sample.Forms/Samples.WPF/Samples.WPF.csproj
new file mode 100644
index 0000000..6d5f02b
--- /dev/null
+++ b/samples/Sample.Forms/Samples.WPF/Samples.WPF.csproj
@@ -0,0 +1,130 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {497C984A-6F4A-4522-A043-E3AB050670A8}
+ WinExe
+ Samples.WPF
+ Samples.WPF
+ v4.7.2
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ true
+
+
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+ 4.0
+
+
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ App.xaml
+ Code
+
+
+ MainWindow.xaml
+ Code
+
+
+
+
+ Code
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+
+
+ {713B7BF4-24CB-4CE7-87D2-44E347CFED19}
+ SignaturePad.Forms.WPF
+
+
+ {89547259-5482-43fc-b100-eea0bb2c91a3}
+ SignaturePad.WPF
+
+
+ {cc18e151-5792-4da5-ade6-7cfba16a593e}
+ Samples
+
+
+
+
+ 3.1.0
+
+
+ 3.1.0
+
+
+ 1.0.3
+
+
+ 4.5.0.495
+
+
+ 4.5.0.495
+
+
+
+
\ No newline at end of file
diff --git a/samples/Sample.Forms/Samples.iOS/Samples.iOS.csproj b/samples/Sample.Forms/Samples.iOS/Samples.iOS.csproj
index a44a4b4..aa20cb1 100644
--- a/samples/Sample.Forms/Samples.iOS/Samples.iOS.csproj
+++ b/samples/Sample.Forms/Samples.iOS/Samples.iOS.csproj
@@ -68,7 +68,7 @@
-
+
diff --git a/samples/Sample.Forms/Samples/EventsPage.xaml b/samples/Sample.Forms/Samples/EventsPage.xaml
index 1958eeb..7a47100 100644
--- a/samples/Sample.Forms/Samples/EventsPage.xaml
+++ b/samples/Sample.Forms/Samples/EventsPage.xaml
@@ -1,4 +1,4 @@
-
+ SignatureLineColor="#B8860B" BackgroundColor="#FAFAD2"
+ IsSingleLine="true"/>
-
+
\ No newline at end of file
diff --git a/samples/Sample.UWP/Sample.UWP.csproj b/samples/Sample.UWP/Sample.UWP.csproj
index ec0b4a1..2559c11 100644
--- a/samples/Sample.UWP/Sample.UWP.csproj
+++ b/samples/Sample.UWP/Sample.UWP.csproj
@@ -11,14 +11,15 @@
Sample.UWP
en-US
UAP
- 10.0.14393.0
- 10.0.10240.0
+ 10.0.18362.0
+ 10.0.18362.0
14
512
{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
true
Sample.UWP_TemporaryKey.pfx
- 032355C46F475E4156F2A934E153675DFA6A111E
+ 4C18499CCA09DEE791DFEF7D199B068D9C349F77
+ True
true
@@ -90,8 +91,8 @@
true
-
-
+
+
@@ -119,7 +120,9 @@
-
+
+ Designer
+
diff --git a/samples/Sample.UWP/Sample.UWP_TemporaryKey.pfx b/samples/Sample.UWP/Sample.UWP_TemporaryKey.pfx
index e6d99a4..383eb9e 100644
Binary files a/samples/Sample.UWP/Sample.UWP_TemporaryKey.pfx and b/samples/Sample.UWP/Sample.UWP_TemporaryKey.pfx differ
diff --git a/src/SignaturePad.Android/InkPresenter.cs b/src/SignaturePad.Android/InkPresenter.cs
index d0960f0..2532343 100644
--- a/src/SignaturePad.Android/InkPresenter.cs
+++ b/src/SignaturePad.Android/InkPresenter.cs
@@ -1,12 +1,12 @@
using System.Collections.Generic;
using System.Drawing;
-using System.Linq;
using Android.App;
using Android.Content;
using Android.Graphics;
using Android.Runtime;
using Android.Util;
using Android.Views;
+using Bitmap = Android.Graphics.Bitmap;
namespace Xamarin.Controls
{
@@ -56,6 +56,11 @@ public override bool OnTouchEvent (MotionEvent e)
private void TouchesBegan (MotionEvent e)
{
+ if (IsSingleLine)
+ {
+ Clear();
+ }
+
// don't allow the event to propagate because we're handling it here
Parent?.RequestDisallowInterceptTouchEvent (true);
@@ -211,7 +216,7 @@ private Bitmap CreateBufferImage ()
return null;
}
- var size = new SizeF (Width, Height);
+ var size = new System.Drawing.SizeF (Width, Height);
var image = Bitmap.CreateBitmap ((int)size.Width, (int)size.Height, Bitmap.Config.Argb8888);
using (var canvas = new Canvas (image))
diff --git a/src/SignaturePad.Android/SignaturePad.Android.csproj b/src/SignaturePad.Android/SignaturePad.Android.csproj
index 52b8d8a..7cd52e2 100644
--- a/src/SignaturePad.Android/SignaturePad.Android.csproj
+++ b/src/SignaturePad.Android/SignaturePad.Android.csproj
@@ -1,7 +1,7 @@
-
+
- monoandroid4.0.3
+ monoandroid10.0
Xamarin.Controls
SignaturePad
False
@@ -31,10 +31,6 @@
xamarin,signature,handwriting,windows,ios,android,uwp
-
-
-
-
@@ -43,6 +39,4 @@
-
-
\ No newline at end of file
diff --git a/src/SignaturePad.Forms.Droid/SignaturePad.Forms.Droid.csproj b/src/SignaturePad.Forms.Droid/SignaturePad.Forms.Droid.csproj
index 12fe85d..562a91c 100644
--- a/src/SignaturePad.Forms.Droid/SignaturePad.Forms.Droid.csproj
+++ b/src/SignaturePad.Forms.Droid/SignaturePad.Forms.Droid.csproj
@@ -1,7 +1,7 @@
-
+
- monoandroid7.1
+ monoandroid10.0
SignaturePad.Forms
SignaturePad.Forms
False
@@ -31,8 +31,7 @@
-
-
+
@@ -42,6 +41,4 @@
-
-
\ No newline at end of file
diff --git a/src/SignaturePad.Forms.Droid/SignaturePadViewRenderer.cs b/src/SignaturePad.Forms.Droid/SignaturePadViewRenderer.cs
deleted file mode 100644
index 1202c17..0000000
--- a/src/SignaturePad.Forms.Droid/SignaturePadViewRenderer.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using System;
-using Xamarin.Forms;
-using Xamarin.Forms.Platform.Android;
-
-[assembly: ExportRenderer (typeof (SignaturePad.Forms.SignaturePadView), typeof (SignaturePad.Forms.SignaturePadViewRenderer))]
-
-namespace SignaturePad.Forms
-{
- // TODO: Remove this whole logic once Xamarin.Forms v2.4 is released.
- // This is a fix for issue #94
- // https://github.com/xamarin/SignaturePad/issues/94
-
- [RenderWith (typeof (SignaturePadViewRenderer))]
- partial class SignaturePadView
- {
- }
-
- internal class SignaturePadViewRenderer : VisualElementRenderer
- {
- [Obsolete ("This constructor is obsolete as of version 2.5. Please use 'SignaturePadCanvasRenderer (Context)' instead.")]
- public SignaturePadViewRenderer ()
- {
- }
-
- public SignaturePadViewRenderer (Android.Content.Context context)
- : base (context)
- {
- }
-
- public override bool OnInterceptTouchEvent (Android.Views.MotionEvent ev)
- {
- if (!Enabled || Element?.IsEnabled == false)
- return true;
-
- return base.OnInterceptTouchEvent (ev);
- }
- }
-}
diff --git a/src/SignaturePad.Forms.GTK/SignaturePad.Forms.GTK.csproj b/src/SignaturePad.Forms.GTK/SignaturePad.Forms.GTK.csproj
new file mode 100644
index 0000000..12a630d
--- /dev/null
+++ b/src/SignaturePad.Forms.GTK/SignaturePad.Forms.GTK.csproj
@@ -0,0 +1,91 @@
+
+
+
+ net471
+ SignaturePad.Forms
+ SignaturePad.Forms
+ False
+ bin\$(Configuration)\$(AssemblyName).xml
+ 1.0.0
+
+
+
+ 1.0.0
+ Xamarin.Controls.SignaturePad.Forms
+ SignaturePad for Xamarin.Forms
+ $(AssemblyName) ($(TargetFramework))
+ Microsoft
+ Microsoft
+ true
+ Makes capturing, saving, and displaying signatures extremely simple.
+ Makes capturing, saving, and displaying signatures extremely simple.
+ © Microsoft Corporation. All rights reserved.
+ en
+ https://go.microsoft.com/fwlink/?linkid=874510
+ https://go.microsoft.com/fwlink/?linkid=874507
+ https://go.microsoft.com/fwlink/?linkid=874507
+ https://go.microsoft.com/fwlink/?linkid=874508
+ https://go.microsoft.com/fwlink/?linkid=874509
+ xamarin,signature,handwriting,windows,ios,android,uwp
+
+
+
+ TRACE;GTK
+
+
+
+ TRACE;GTK
+
+
+
+
+
+
+
+
+
+
+ False
+ $(ProgramFiles)\Mono\lib\gtk-sharp-2.0\atk-sharp.dll
+ gtk-sharp-2.0
+
+
+ False
+ $(ProgramFiles)\Mono\lib\gtk-sharp-2.0\gdk-sharp.dll
+ gtk-sharp-2.0
+
+
+ False
+ $(ProgramFiles)\Mono\lib\gtk-sharp-2.0\glade-sharp.dll
+
+
+ False
+ $(ProgramFiles)\Mono\lib\gtk-sharp-2.0\glib-sharp.dll
+ glib-sharp-2.0
+
+
+ False
+ $(ProgramFiles)\Mono\lib\gtk-sharp-2.0\gtk-dotnet.dll
+ gtk-dotnet-2.0
+
+
+ False
+ $(ProgramFiles)\Mono\lib\gtk-sharp-2.0\gtk-sharp.dll
+ gtk-sharp-2.0
+
+
+ False
+ $(ProgramFiles)\Mono\lib\gtk-sharp-2.0\pango-sharp.dll
+ gtk-sharp-2.0
+
+
+ $(ProgramFiles)\Mono\lib\mono\4.7.1-api\Mono.Cairo.dll
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/SignaturePad.Forms.MacOS/SignaturePad.Forms.MacOS.csproj b/src/SignaturePad.Forms.MacOS/SignaturePad.Forms.MacOS.csproj
new file mode 100644
index 0000000..8a9d0d9
--- /dev/null
+++ b/src/SignaturePad.Forms.MacOS/SignaturePad.Forms.MacOS.csproj
@@ -0,0 +1,44 @@
+
+
+
+ xamarin.mac2.0
+ SignaturePad.Forms
+ SignaturePad.Forms
+ False
+ $(MSBuildWarningsAsMessages);VSX1000
+ bin\$(Configuration)\$(AssemblyName).xml
+ 1.0.0
+
+
+
+ 1.0.0
+ Xamarin.Controls.SignaturePad.Forms
+ SignaturePad for Xamarin.Forms
+ $(AssemblyName) ($(TargetFramework))
+ Microsoft
+ Microsoft
+ true
+ Makes capturing, saving, and displaying signatures extremely simple.
+ Makes capturing, saving, and displaying signatures extremely simple.
+ © Microsoft Corporation. All rights reserved.
+ en
+ https://go.microsoft.com/fwlink/?linkid=874510
+ https://go.microsoft.com/fwlink/?linkid=874507
+ https://go.microsoft.com/fwlink/?linkid=874507
+ https://go.microsoft.com/fwlink/?linkid=874508
+ https://go.microsoft.com/fwlink/?linkid=874509
+ xamarin,signature,handwriting,windows,ios,android,uwp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/SignaturePad.Forms.Platform.Shared/ColorExtensions.cs b/src/SignaturePad.Forms.Platform.Shared/ColorExtensions.cs
index 591dcd4..a0f96c6 100644
--- a/src/SignaturePad.Forms.Platform.Shared/ColorExtensions.cs
+++ b/src/SignaturePad.Forms.Platform.Shared/ColorExtensions.cs
@@ -1,4 +1,4 @@
-using Color = Xamarin.Forms.Color;
+using Color = Xamarin.Forms.Color;
#if WINDOWS_PHONE
using System.Windows.Controls;
using System.Windows.Media;
@@ -11,17 +11,30 @@
using UIKit;
using Xamarin.Forms.Platform.iOS;
using NativeColor = UIKit.UIColor;
+#elif __MACOS__
+using AppKit;
+using Xamarin.Forms.Platform.MacOS;
+using NativeColor = AppKit.NSColor;
#elif __ANDROID__
using Android.Widget;
using Xamarin.Forms.Platform.Android;
using NativeColor = Android.Graphics.Color;
+#elif GTK
+using NativeColor = Gdk.Color;
+using TextBlock = Gtk.TextView;
+using SolidColorBrush = System.Windows.Media.SolidColorBrush;
+using Xamarin.Forms.Platform.GTK.Extensions;
+#elif WPF
+using NativeColor = System.Windows.Media.Color;
+using TextBlock = System.Windows.Controls.TextBlock;
+using SolidColorBrush = System.Windows.Media.SolidColorBrush;
#endif
namespace SignaturePad.Forms
{
public static class ColorExtensions
{
-#if WINDOWS_PHONE || WINDOWS_UWP || WINDOWS_PHONE_APP || WINDOWS_APP
+#if WINDOWS_PHONE || WINDOWS_UWP || WINDOWS_PHONE_APP || WINDOWS_APP || WPF
public static NativeColor ToWindows (this Color color)
{
return NativeColor.FromArgb (
@@ -34,16 +47,20 @@ public static NativeColor ToWindows (this Color color)
public static NativeColor ToNative (this Color color)
{
-#if WINDOWS_PHONE || WINDOWS_UWP || WINDOWS_PHONE_APP || WINDOWS_APP
+#if WINDOWS_PHONE || WINDOWS_UWP || WINDOWS_PHONE_APP || WINDOWS_APP || WPF
return color.ToWindows ();
#elif __IOS__
return color.ToUIColor ();
+#elif __MACOS__
+ return color.ToNSColor ();
#elif __ANDROID__
return color.ToAndroid ();
+#elif GTK
+ return color.ToGtkColor();
#endif
}
-#if WINDOWS_PHONE || WINDOWS_UWP || WINDOWS_PHONE_APP || WINDOWS_APP
+#if WINDOWS_PHONE || WINDOWS_UWP || WINDOWS_PHONE_APP || WINDOWS_APP || WPF
public static void SetTextColor (this TextBlock textBlock, Color color)
{
textBlock.Foreground = new SolidColorBrush (color.ToNative ());
@@ -57,11 +74,25 @@ public static void SetTextColor (this UIButton button, Color color)
{
button.SetTitleColor (color.ToNative (), UIControlState.Normal);
}
+#elif __MACOS__
+ public static void SetTextColor (this NSTextField label, Color color)
+ {
+ label.TextColor = color.ToNative ();
+ }
+ public static void SetTextColor (this NSButton button, Color color)
+ {
+ button.BezelColor= color.ToNative ();
+ }
#elif __ANDROID__
public static void SetTextColor (this TextView label, Color color)
{
label.SetTextColor (color.ToNative ());
}
+#elif GTK
+ public static void SetTextColor (this TextBlock label, Color color)
+ {
+ // todo implement
+ }
#endif
}
}
diff --git a/src/SignaturePad.Forms.Platform.Shared/SignaturePadCanvasRenderer.cs b/src/SignaturePad.Forms.Platform.Shared/SignaturePadCanvasRenderer.cs
index 7476e14..3d7f1e1 100644
--- a/src/SignaturePad.Forms.Platform.Shared/SignaturePadCanvasRenderer.cs
+++ b/src/SignaturePad.Forms.Platform.Shared/SignaturePadCanvasRenderer.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.ComponentModel;
using System.Linq;
using Xamarin.Forms;
@@ -21,10 +21,22 @@
using Xamarin.Forms.Platform.iOS;
using NativeSignaturePadCanvasView = Xamarin.Controls.SignaturePadCanvasView;
using NativePoint = CoreGraphics.CGPoint;
+#elif __MACOS__
+using Xamarin.Forms.Platform.MacOS;
+using NativeSignaturePadCanvasView = Xamarin.Controls.SignaturePadCanvasView;
+using NativePoint = CoreGraphics.CGPoint;
#elif __ANDROID__
using Xamarin.Forms.Platform.Android;
using NativeSignaturePadCanvasView = Xamarin.Controls.SignaturePadCanvasView;
using NativePoint = System.Drawing.PointF;
+#elif GTK
+using Xamarin.Forms.Platform.GTK;
+using NativeSignaturePadCanvasView = Xamarin.Controls.SignaturePadCanvasView;
+using NativePoint = Gdk.Point;
+#elif WPF
+using Xamarin.Forms.Platform.WPF;
+using NativeSignaturePadCanvasView = Xamarin.Controls.SignaturePadCanvasView;
+using NativePoint = System.Windows.Input.StylusPoint;
#endif
[assembly: ExportRenderer (typeof (SignaturePadCanvasView), typeof (SignaturePadCanvasRenderer))]
@@ -60,6 +72,7 @@ protected override void OnElementChanged (ElementChangedEventArgs new NativePoint ((float)p.X, (float)p.Y)).ToArray ());
- }
+#if GTK
+ ctrl?.LoadPoints (e.Points.Select (p => new NativePoint ((int)p.X, (int)p.Y)).ToArray ());
+#else
+ ctrl?.LoadPoints (e.Points.Select (p => new NativePoint ((float)p.X, (float)p.Y)).ToArray ());
+#endif
}
private void OnStrokesRequested (object sender, SignaturePadCanvasView.StrokesEventArgs e)
@@ -171,26 +185,28 @@ private void OnStrokesRequested (object sender, SignaturePadCanvasView.StrokesEv
var ctrl = Control;
if (ctrl != null)
{
+#if WPF
+ e.Strokes = ctrl.Strokes.Select (s => s.StylusPoints.Select (p => new Point (p.X, p.Y)));
+#else
e.Strokes = ctrl.Strokes.Select (s => s.Select (p => new Point (p.X, p.Y)));
+#endif
}
}
private void OnStrokesSpecified (object sender, SignaturePadCanvasView.StrokesEventArgs e)
{
var ctrl = Control;
- if (ctrl != null)
- {
- ctrl.LoadStrokes (e.Strokes.Select (s => s.Select (p => new NativePoint ((float)p.X, (float)p.Y)).ToArray ()).ToArray ());
- }
+#if GTK
+ ctrl?.LoadStrokes (e.Strokes.Select (s => s.Select (p => new NativePoint ((int)p.X, (int)p.Y)).ToArray ()).ToArray ());
+#else
+ ctrl?.LoadStrokes (e.Strokes.Select (s => s.Select (p => new NativePoint ((float)p.X, (float)p.Y)).ToArray ()).ToArray ());
+#endif
}
private void OnClearRequested (object sender, EventArgs e)
{
var ctrl = Control;
- if (ctrl != null)
- {
- ctrl.Clear ();
- }
+ ctrl?.Clear ();
}
///
diff --git a/src/SignaturePad.Forms.Shared/SignaturePadCanvasView.cs b/src/SignaturePad.Forms.Shared/SignaturePadCanvasView.cs
index e48f01a..31a4dad 100644
--- a/src/SignaturePad.Forms.Shared/SignaturePadCanvasView.cs
+++ b/src/SignaturePad.Forms.Shared/SignaturePadCanvasView.cs
@@ -7,7 +7,7 @@
namespace SignaturePad.Forms
{
- [RenderWith (typeof (SignaturePadCanvasRenderer))]
+ [RenderWith (typeof (SignaturePadCanvasRenderer))]
public class SignaturePadCanvasView : View
{
public static readonly BindableProperty StrokeColorProperty = BindableProperty.Create (
@@ -16,6 +16,12 @@ public class SignaturePadCanvasView : View
typeof (SignaturePadView),
ImageConstructionSettings.DefaultStrokeColor);
+ public static readonly BindableProperty IsSingleLineProperty = BindableProperty.Create(
+ nameof(IsSingleLine),
+ typeof(bool),
+ typeof(SignaturePadView),
+ false);
+
public static readonly BindableProperty StrokeWidthProperty = BindableProperty.Create (
nameof (StrokeWidth),
typeof (float),
@@ -58,6 +64,12 @@ public Color StrokeColor
set { SetValue (StrokeColorProperty, value); }
}
+ public bool IsSingleLine
+ {
+ get { return (bool)GetValue(IsSingleLineProperty); }
+ set { SetValue(IsSingleLineProperty, value); }
+ }
+
public IEnumerable Points
{
get { return GetSignaturePoints (); }
diff --git a/src/SignaturePad.Forms.Shared/SignaturePadView.cs b/src/SignaturePad.Forms.Shared/SignaturePadView.cs
index 0310e8a..d65e65c 100644
--- a/src/SignaturePad.Forms.Shared/SignaturePadView.cs
+++ b/src/SignaturePad.Forms.Shared/SignaturePadView.cs
@@ -44,11 +44,19 @@ public partial class SignaturePadView : Grid
public static readonly BindableProperty StrokeCompletedCommandProperty;
internal static readonly BindablePropertyKey IsBlankPropertyKey;
public static readonly BindableProperty IsBlankProperty;
+ public static readonly BindableProperty IsSingleLineProperty;
private readonly TapGestureRecognizer clearLabelTap;
static SignaturePadView ()
{
+ IsSingleLineProperty = BindableProperty.Create(
+ nameof(IsSingleLine),
+ typeof(bool),
+ typeof(SignaturePadView),
+ false,
+ propertyChanged: (bindable, oldValue, newValue) => ((SignaturePadView)bindable).SignaturePadCanvas.IsSingleLine = (bool)newValue);
+
StrokeColorProperty = BindableProperty.Create (
nameof (StrokeColor),
typeof (Color),
@@ -378,6 +386,12 @@ public Color StrokeColor
set => SetValue (StrokeColorProperty, value);
}
+ public bool IsSingleLine
+ {
+ get => (bool)GetValue(IsSingleLineProperty);
+ set => SetValue(IsSingleLineProperty, value);
+ }
+
///
/// Gets or sets the width of the signature strokes.
///
diff --git a/src/SignaturePad.Forms.UWP/SignaturePad.Forms.UWP.csproj b/src/SignaturePad.Forms.UWP/SignaturePad.Forms.UWP.csproj
index 6e52976..0429bd2 100644
--- a/src/SignaturePad.Forms.UWP/SignaturePad.Forms.UWP.csproj
+++ b/src/SignaturePad.Forms.UWP/SignaturePad.Forms.UWP.csproj
@@ -1,7 +1,7 @@
-
+
- uap10.0.10240
+ uap10.0.18362
SignaturePad.Forms
SignaturePad.Forms
False
@@ -30,9 +30,8 @@
-
-
-
+
+
@@ -41,6 +40,4 @@
-
-
\ No newline at end of file
diff --git a/src/SignaturePad.Forms.WPF/SignaturePad.Forms.WPF.csproj b/src/SignaturePad.Forms.WPF/SignaturePad.Forms.WPF.csproj
new file mode 100644
index 0000000..0f5e0b5
--- /dev/null
+++ b/src/SignaturePad.Forms.WPF/SignaturePad.Forms.WPF.csproj
@@ -0,0 +1,54 @@
+
+
+
+ net472
+ SignaturePad.Forms
+ SignaturePad.Forms
+ False
+ bin\$(Configuration)\$(AssemblyName).xml
+ 1.0.0
+
+
+
+ 1.0.0
+ Xamarin.Controls.SignaturePad.Forms
+ SignaturePad for Xamarin.Forms
+ $(AssemblyName) ($(TargetFramework))
+ Microsoft
+ Microsoft
+ true
+ Makes capturing, saving, and displaying signatures extremely simple.
+ Makes capturing, saving, and displaying signatures extremely simple.
+ © Microsoft Corporation. All rights reserved.
+ en
+ https://go.microsoft.com/fwlink/?linkid=874510
+ https://go.microsoft.com/fwlink/?linkid=874507
+ https://go.microsoft.com/fwlink/?linkid=874507
+ https://go.microsoft.com/fwlink/?linkid=874508
+ https://go.microsoft.com/fwlink/?linkid=874509
+ xamarin,signature,handwriting,windows,ios,android,uwp
+
+
+
+ TRACE;WPF
+
+
+
+ TRACE;WPF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/SignaturePad.Forms.iOS/SignaturePad.Forms.iOS.csproj b/src/SignaturePad.Forms.iOS/SignaturePad.Forms.iOS.csproj
index 75735f0..f91e2a7 100644
--- a/src/SignaturePad.Forms.iOS/SignaturePad.Forms.iOS.csproj
+++ b/src/SignaturePad.Forms.iOS/SignaturePad.Forms.iOS.csproj
@@ -1,4 +1,4 @@
-
+
xamarin.ios1.0
@@ -31,8 +31,7 @@
-
-
+
@@ -41,6 +40,4 @@
-
-
\ No newline at end of file
diff --git a/src/SignaturePad.Forms/SignaturePad.Forms.csproj b/src/SignaturePad.Forms/SignaturePad.Forms.csproj
index 3b8bd84..040ce88 100644
--- a/src/SignaturePad.Forms/SignaturePad.Forms.csproj
+++ b/src/SignaturePad.Forms/SignaturePad.Forms.csproj
@@ -1,7 +1,7 @@
- netstandard1.0
+ netstandard2.0
SignaturePad.Forms
SignaturePad.Forms
False
@@ -30,14 +30,11 @@
-
-
+
-
-
diff --git a/src/SignaturePad.GTK/SignaturePad.GTK.csproj b/src/SignaturePad.GTK/SignaturePad.GTK.csproj
new file mode 100644
index 0000000..8909554
--- /dev/null
+++ b/src/SignaturePad.GTK/SignaturePad.GTK.csproj
@@ -0,0 +1,111 @@
+
+
+
+ net471
+ Xamarin.Controls
+ SignaturePad
+
+ False
+
+ False
+ bin\$(Configuration)\$(AssemblyName).xml
+ 1.0.0
+
+
+
+ 1.0.0
+ Xamarin.Controls.SignaturePad
+ SignaturePad for Xamarin and Windows
+ $(AssemblyName) ($(TargetFramework))
+ Microsoft
+ Microsoft
+ true
+ Makes capturing, saving, and displaying signatures extremely simple.
+ Makes capturing, saving, and displaying signatures extremely simple.
+ © Microsoft Corporation. All rights reserved.
+ en
+ https://go.microsoft.com/fwlink/?linkid=874510
+ https://go.microsoft.com/fwlink/?linkid=874507
+ https://go.microsoft.com/fwlink/?linkid=874507
+ https://go.microsoft.com/fwlink/?linkid=874508
+ https://go.microsoft.com/fwlink/?linkid=874509
+ xamarin,signature,handwriting,windows,ios,android,uwp
+
+
+
+
+ False
+ $(ProgramFiles)\Mono\lib\gtk-sharp-2.0\atk-sharp.dll
+ gtk-sharp-2.0
+
+
+ False
+ $(ProgramFiles)\Mono\lib\gtk-sharp-2.0\gdk-sharp.dll
+ gtk-sharp-2.0
+
+
+ False
+ $(ProgramFiles)\Mono\lib\gtk-sharp-2.0\glade-sharp.dll
+
+
+ False
+ $(ProgramFiles)\Mono\lib\gtk-sharp-2.0\glib-sharp.dll
+ glib-sharp-2.0
+
+
+ False
+ $(ProgramFiles)\Mono\lib\gtk-sharp-2.0\gtk-dotnet.dll
+ gtk-dotnet-2.0
+
+
+ False
+ $(ProgramFiles)\Mono\lib\gtk-sharp-2.0\gtk-sharp.dll
+ gtk-sharp-2.0
+
+
+ False
+ $(ProgramFiles)\Mono\lib\gtk-sharp-2.0\pango-sharp.dll
+ gtk-sharp-2.0
+
+
+ $(ProgramFiles)\Mono\lib\mono\4.7.1-api\Mono.Cairo.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(MSBuildToolsPath)\Microsoft.CSharp.targets
+ bin/$(Configuration)/$(TargetFramework)
+
+
+ TRACE;GTK
+
+
+ TRACE;GTK
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
\ No newline at end of file
diff --git a/src/SignaturePad.GTK/SignaturePad.cs b/src/SignaturePad.GTK/SignaturePad.cs
new file mode 100644
index 0000000..91fd39a
--- /dev/null
+++ b/src/SignaturePad.GTK/SignaturePad.cs
@@ -0,0 +1,370 @@
+using System;
+using System.ComponentModel;
+
+namespace Xamarin.Controls
+{
+ using System.Windows;
+ using System.Windows.Controls;
+ using System.Windows.Media;
+ using Gtk;
+ using Brush = System.Drawing.Brush;
+ using Color = Gdk.Color;
+ using Image = System.Windows.Controls.Image;
+ using Stretch = Pango.Stretch;
+
+ [TemplatePart (Name = PartBackgroundImageView, Type = typeof (Image))]
+ [TemplatePart (Name = PartSignaturePadCanvas, Type = typeof (SignaturePadCanvasView))]
+ [TemplatePart (Name = PartCaption, Type = typeof (TextView))]
+ [TemplatePart (Name = PartSignatureLine, Type = typeof (Border))]
+ [TemplatePart (Name = PartSignaturePrompt, Type = typeof (TextView))]
+ [TemplatePart (Name = PartClearLabel, Type = typeof (TextView))]
+ public partial class SignaturePad : Widget
+ {
+ private const string PartBackgroundImageView = "BackgroundImageView";
+ private const string PartSignaturePadCanvas = "SignaturePadCanvas";
+ private const string PartCaption = "Caption";
+ private const string PartSignatureLine = "SignatureLine";
+ private const string PartSignaturePrompt = "SignaturePrompt";
+ private const string PartClearLabel = "ClearLabel";
+
+ public static readonly DependencyProperty StrokeColorProperty;
+ public static readonly DependencyProperty StrokeWidthProperty;
+ public static readonly DependencyProperty SignatureLineBrushProperty;
+ public static readonly DependencyProperty SignatureLineThicknessProperty;
+ public static readonly DependencyProperty SignatureLineSpacingProperty;
+ public static readonly DependencyProperty CaptionTextProperty;
+ public static readonly DependencyProperty CaptionFontSizeProperty;
+ public static readonly DependencyProperty CaptionForegroundProperty;
+ public static readonly DependencyProperty SignaturePromptTextProperty;
+ public static readonly DependencyProperty SignaturePromptFontSizeProperty;
+ public static readonly DependencyProperty SignaturePromptForegroundProperty;
+ public static readonly DependencyProperty ClearLabelTextProperty;
+ public static readonly DependencyProperty ClearLabelFontSizeProperty;
+ public static readonly DependencyProperty ClearLabelForegroundProperty;
+ public static readonly DependencyProperty BackgroundImageProperty;
+ public static readonly DependencyProperty BackgroundImageStretchProperty;
+ public static readonly DependencyProperty BackgroundImageOpacityProperty;
+
+ static SignaturePad ()
+ {
+ //DefaultStyleKeyProperty.OverrideMetadata (
+ // typeof (SignaturePad),
+ // new FrameworkPropertyMetadata (typeof (SignaturePad)));
+
+
+ StrokeColorProperty = DependencyProperty.Register (
+ nameof (StrokeColor),
+ typeof (Color),
+ typeof (SignaturePad),
+ new PropertyMetadata (ImageConstructionSettings.DefaultStrokeColor));
+
+ StrokeWidthProperty = DependencyProperty.Register (
+ nameof (StrokeWidth),
+ typeof (double),
+ typeof (SignaturePad),
+ new PropertyMetadata ((double)ImageConstructionSettings.DefaultStrokeWidth));
+
+ SignatureLineBrushProperty = DependencyProperty.Register (
+ nameof (SignatureLineBrush),
+ typeof (Brush),
+ typeof (SignaturePad),
+ new PropertyMetadata (new SolidColorBrush (Colors.Black)));
+
+ SignatureLineThicknessProperty = DependencyProperty.Register (
+ nameof (SignatureLineThickness),
+ typeof (double),
+ typeof (SignaturePad),
+ new PropertyMetadata ((double)DefaultLineThickness));
+
+ SignatureLineSpacingProperty = DependencyProperty.Register (
+ nameof (SignatureLineSpacing),
+ typeof (double),
+ typeof (SignaturePad),
+ new PropertyMetadata ((double)DefaultNarrowSpacing, OnPaddingChanged));
+
+ CaptionTextProperty = DependencyProperty.Register (
+ nameof (CaptionText),
+ typeof (string),
+ typeof (SignaturePad),
+ new PropertyMetadata (DefaultCaptionText));
+
+ CaptionFontSizeProperty = DependencyProperty.Register (
+ nameof (CaptionFontSize),
+ typeof (double),
+ typeof (SignaturePad),
+ new PropertyMetadata ((double)DefaultFontSize));
+
+ CaptionForegroundProperty = DependencyProperty.Register (
+ nameof (CaptionForeground),
+ typeof (Brush),
+ typeof (SignaturePad),
+ new PropertyMetadata (new SolidColorBrush (Colors.Black)));
+
+ SignaturePromptTextProperty = DependencyProperty.Register (
+ nameof (SignaturePromptText),
+ typeof (string),
+ typeof (SignaturePad),
+ new PropertyMetadata (DefaultPromptText));
+
+ SignaturePromptFontSizeProperty = DependencyProperty.Register (
+ nameof (SignaturePromptFontSize),
+ typeof (double),
+ typeof (SignaturePad),
+ new PropertyMetadata ((double)DefaultFontSize));
+
+ SignaturePromptForegroundProperty = DependencyProperty.Register (
+ nameof (SignaturePromptForeground),
+ typeof (Brush),
+ typeof (SignaturePad),
+ new PropertyMetadata (new SolidColorBrush (Colors.Black)));
+
+ ClearLabelTextProperty = DependencyProperty.Register (
+ nameof (ClearLabelText),
+ typeof (string),
+ typeof (SignaturePad),
+ new PropertyMetadata (DefaultClearLabelText));
+
+ ClearLabelFontSizeProperty = DependencyProperty.Register (
+ nameof (ClearLabelFontSize),
+ typeof (double),
+ typeof (SignaturePad),
+ new PropertyMetadata ((double)DefaultFontSize));
+
+ ClearLabelForegroundProperty = DependencyProperty.Register (
+ nameof (ClearLabelForeground),
+ typeof (Brush),
+ typeof (SignaturePad),
+ new PropertyMetadata (new SolidColorBrush (Colors.Black)));
+
+ BackgroundImageProperty = DependencyProperty.Register (
+ nameof (BackgroundImage),
+ typeof (ImageSource),
+ typeof (SignaturePad),
+ new PropertyMetadata (null));
+
+ BackgroundImageStretchProperty = DependencyProperty.Register (
+ nameof (BackgroundImageStretch),
+ typeof (Stretch),
+ typeof (SignaturePad), new PropertyMetadata (Stretch.Normal));
+
+ BackgroundImageOpacityProperty = DependencyProperty.Register (
+ nameof (BackgroundImageOpacity),
+ typeof (double),
+ typeof (SignaturePad),
+ new PropertyMetadata (1.0));
+ }
+
+ public SignaturePad ()
+ {
+ //DefaultStyleKey = typeof (SignaturePad);
+
+ //RegisterPropertyChangedCallback (PaddingProperty, OnPaddingChanged);
+
+ //Padding = new Thickness (DefaultWideSpacing, DefaultWideSpacing, DefaultWideSpacing, DefaultNarrowSpacing);
+ //OnApplyTemplate();
+ }
+
+ ///
+ //public override void OnApplyTemplate()
+ //{
+ // base.OnApplyTemplate();
+
+ // SignaturePadCanvas.StrokeCompleted += delegate
+ // {
+ // OnSignatureStrokeCompleted ();
+ // };
+ // SignaturePadCanvas.Cleared += delegate
+ // {
+ // OnSignatureCleared ();
+ // };
+ // ClearLabel.MouseDown += delegate
+ // {
+ // OnClearTapped ();
+ // };
+
+ // OnPaddingChanged (this, PaddingProperty);
+ // UpdateUi ();
+ //}
+
+ ///
+ /// The real signature canvas view
+ ///
+ public SignaturePadCanvasView SignaturePadCanvas => new SignaturePadCanvasView();
+
+ ///
+ /// The prompt displayed at the beginning of the signature line.
+ ///
+ public TextView SignaturePrompt => new TextView();
+
+ ///
+ /// The caption displayed under the signature line.
+ ///
+ public TextView Caption => new TextView ();
+
+ ///
+ /// An image view that may be used as a watermark or as a texture for the signature pad.
+ ///
+ public Image BackgroundImageView =>new Image();
+
+ ///
+ /// Gets the label that clears the pad when clicked.
+ ///
+ public TextView ClearLabel => new TextView ();
+
+ ///
+ /// Gets the horizontal line that goes in the lower part of the pad.
+ ///
+ public Border SignatureLine => new Border();
+
+ public Color StrokeColor
+ {
+ get;
+ set;
+ }
+
+ public double StrokeWidth
+ {
+ get;
+ set;
+ }
+
+ public Brush SignatureLineBrush
+ {
+ get;
+ set;
+ }
+
+ public Thickness SignatureLineThickness
+ {
+ get;
+ set;
+ }
+
+ public double SignatureLineSpacing
+ {
+ get;
+ set;
+ }
+
+ public string CaptionText
+ {
+ get;
+ set;
+ }
+
+ public double CaptionFontSize
+ {
+ get;
+ set;
+ }
+
+ public Brush CaptionForeground
+ {
+ get;
+ set;
+ }
+
+ public string SignaturePromptText
+ {
+ get;
+ set;
+ }
+
+ public double SignaturePromptFontSize
+ {
+ get;
+ set;
+ }
+
+ public Brush SignaturePromptForeground
+ {
+ get;
+ set;
+ }
+
+ public string ClearLabelText
+ {
+ get;
+ set;
+ }
+
+ public double ClearLabelFontSize
+ {
+ get;
+ set;
+ }
+
+ public Brush ClearLabelForeground
+ {
+ get;
+ set;
+ }
+
+ public ImageSource BackgroundImage
+ {
+ get;
+ set;
+ }
+
+ public Stretch BackgroundImageStretch
+ {
+ get;
+ set;
+ }
+
+ public double BackgroundImageOpacity
+ {
+ get;
+ set;
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ [Obsolete ("Use Background instead.")]
+ public Color BackgroundColor
+ {
+ get;
+ set;
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ [Obsolete ("Use SignatureLineBrush instead.")]
+ public Color SignatureLineColor
+ {
+ get;
+ set;
+ }
+
+ private void UpdateUi ()
+ {
+ //ClearLabel.Visibility = IsBlank ? Visibility.Collapsed : Visibility.Visible;
+ }
+
+ //private void OnPaddingChanged (DependencyObject sender, DependencyProperty dp)
+ //{
+ // var padding = Padding;
+ // var spacing = SignatureLineSpacing;
+
+ // if (SignatureLine != null)
+ // {
+ // SignatureLine.Margin = new Thickness (padding.Left, 0, padding.Right, 0);
+ // }
+ // if (Caption != null)
+ // {
+ // Caption.Margin = new Thickness (0, spacing, 0, padding.Bottom);
+ // }
+ // if (ClearLabel != null)
+ // {
+ // ClearLabel.Margin = new Thickness (0, padding.Top, padding.Right, 0);
+ // }
+ // if (SignaturePrompt != null)
+ // {
+ // SignaturePrompt.Margin = new Thickness (padding.Left, 0, 0, spacing);
+ // }
+ //}
+
+ private static void OnPaddingChanged (DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ //((SignaturePad)d).OnPaddingChanged (d, e.Property);
+ }
+ }
+}
diff --git a/src/SignaturePad.GTK/SignaturePadCanvasView.cs b/src/SignaturePad.GTK/SignaturePadCanvasView.cs
new file mode 100644
index 0000000..67d2e70
--- /dev/null
+++ b/src/SignaturePad.GTK/SignaturePadCanvasView.cs
@@ -0,0 +1,201 @@
+using System.IO;
+using System.Threading.Tasks;
+
+namespace Xamarin.Controls
+{
+ using System;
+ using System.Drawing;
+ using System.Windows;
+ using Cairo;
+ using Gtk;
+
+ public partial class SignaturePadCanvasView : DrawingArea
+ {
+ delegate void DrawShape (Cairo.Context ctx, PointD start, PointD end);
+
+ public static readonly DependencyProperty StrokeColorProperty;
+ public static readonly DependencyProperty StrokeWidthProperty;
+ ImageSurface surface;
+ DrawShape Painter;
+ PointD Start, End;
+
+ bool isDrawing;
+ bool isDrawingPoint;
+
+ static SignaturePadCanvasView ()
+ {
+ StrokeColorProperty = DependencyProperty.Register (
+ nameof (StrokeColor),
+ typeof (Gdk.Color),
+ typeof (SignaturePadCanvasView),
+ new PropertyMetadata (ImageConstructionSettings.DefaultStrokeColor, OnStrokePropertiesChanged));
+
+ StrokeWidthProperty = DependencyProperty.Register (
+ nameof (StrokeWidth),
+ typeof (double),
+ typeof (SignaturePadCanvasView),
+ new PropertyMetadata ((double)ImageConstructionSettings.DefaultStrokeWidth, OnStrokePropertiesChanged));
+
+ }
+
+ public SignaturePadCanvasView ()
+ {
+ //DefaultStyleKey = typeof (SignaturePadCanvasView);
+ surface = new ImageSurface (Format.Argb32, 500, 500);
+
+ OnStrokePropertiesChanged (dependencyObject, new DependencyPropertyChangedEventArgs (StrokeColorProperty, "", ""));
+ inkPresenter.AddEvents (
+ (int)Gdk.EventMask.PointerMotionMask
+ | (int)Gdk.EventMask.ButtonPressMask
+ | (int)Gdk.EventMask.ButtonReleaseMask);
+
+ inkPresenter.ExposeEvent += OnDrawingAreaExposed;
+ inkPresenter.ButtonPressEvent += OnMousePress;
+ inkPresenter.ButtonReleaseEvent += OnMouseRelease;
+ inkPresenter.MotionNotifyEvent += OnMouseMotion;
+ }
+
+ public Gdk.Color StrokeColor
+ {
+ get { return (Gdk.Color)dependencyObject.GetValue (StrokeColorProperty); }
+ set { dependencyObject.SetValue (StrokeColorProperty, value); }
+ }
+
+ public double StrokeWidth
+ {
+ get { return (double)dependencyObject.GetValue (StrokeWidthProperty); }
+ set { dependencyObject.SetValue (StrokeWidthProperty, value); }
+ }
+
+ public DrawingArea inkPresenter { get ; set ; }
+ public DependencyObject dependencyObject { get ; set ; }
+
+ public void Clear ()
+ {
+ if (Strokes != null)
+ {
+ //inkPresenter.Strokes.Clear();
+ OnCleared ();
+ }
+ }
+
+ private Task GetImageStreamInternal (SignatureImageFormat format, System.Drawing.SizeF scale, RectangleF signatureBounds, System.Drawing.SizeF imageSize, float strokeWidth, Gdk.Color strokeColor, Gdk.Color backgroundColor)
+ {
+
+ return Task.FromResult(null);
+
+ }
+
+ private Bitmap GetImageInternal (System.Drawing.SizeF scale, System.Drawing.RectangleF signatureBounds,
+ System.Drawing.SizeF imageSize, float strokeWidth, Gdk.Color strokeColor, Gdk.Color backgroundColor)
+ {
+ return new Bitmap ("");
+ }
+
+ private static void OnStrokePropertiesChanged (DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ //var signaturePad = d as SignaturePadCanvasView;
+
+ //var inkPresenter = signaturePad?.Strokes;
+ //if (inkPresenter != null)
+ //{
+ // foreach (var stroke in inkPresenter)
+ // {
+ // stroke.DrawingAttributes.Color = signaturePad.StrokeColor;
+ // stroke.DrawingAttributes.Width = signaturePad.StrokeWidth;
+ // }
+ //}
+ }
+
+ void OnDrawingAreaExposed (object source, ExposeEventArgs args)
+ {
+ Cairo.Context ctx;
+
+ using (ctx = Gdk.CairoHelper.Create (inkPresenter.GdkWindow))
+ {
+ ctx.SetSource(new SurfacePattern (surface));
+ ctx.Paint ();
+ }
+
+ if (isDrawing)
+ {
+ using (ctx = Gdk.CairoHelper.Create (inkPresenter.GdkWindow))
+ {
+ Painter (ctx, Start, End);
+ }
+ }
+ }
+
+ void OnMousePress (object source, ButtonPressEventArgs args)
+ {
+ Start.X = args.Event.X;
+ Start.Y = args.Event.Y;
+
+ End.X = args.Event.X;
+ End.Y = args.Event.Y;
+
+ isDrawing = true;
+ inkPresenter.QueueDraw ();
+ }
+
+ void OnMouseRelease (object source, ButtonReleaseEventArgs args)
+ {
+ End.X = args.Event.X;
+ End.Y = args.Event.Y;
+
+ isDrawing = false;
+
+ using (Context ctx = new Context (surface))
+ {
+ Painter (ctx, Start, End);
+ }
+
+ inkPresenter.QueueDraw ();
+ OnStrokeCompleted ();
+ }
+
+ void OnMouseMotion (object source, MotionNotifyEventArgs args)
+ {
+ if (isDrawing)
+ {
+ End.X = args.Event.X;
+ End.Y = args.Event.Y;
+
+ if (isDrawingPoint)
+ {
+ using (Context ctx = new Context (surface))
+ {
+ Painter (ctx, Start, End);
+ }
+ }
+
+ inkPresenter.QueueDraw ();
+ }
+ }
+
+ void LineClicked (object sender, EventArgs args)
+ {
+ isDrawingPoint = false;
+ Painter = new DrawShape (DrawLine);
+ }
+
+ void PenClicked (object sender, EventArgs args)
+ {
+ isDrawingPoint = true;
+ Painter = new DrawShape (DrawPoint);
+ }
+
+ void DrawLine (Cairo.Context ctx, PointD start, PointD end)
+ {
+ ctx.MoveTo (start);
+ ctx.LineTo (end);
+ ctx.Stroke ();
+ }
+
+ void DrawPoint (Cairo.Context ctx, PointD start, PointD end)
+ {
+ ctx.Rectangle (end, 1, 1);
+ ctx.Stroke ();
+ }
+ }
+}
diff --git a/src/SignaturePad.InkPresenter.Shared/InkPresenter.cs b/src/SignaturePad.InkPresenter.Shared/InkPresenter.cs
index 6e5e907..b5784ba 100644
--- a/src/SignaturePad.InkPresenter.Shared/InkPresenter.cs
+++ b/src/SignaturePad.InkPresenter.Shared/InkPresenter.cs
@@ -9,6 +9,19 @@
using NativeColor = Android.Graphics.Color;
using NativeImage = Android.Graphics.Bitmap;
using NativePath = Android.Graphics.Path;
+#elif GTK
+using NativePath = Cairo.Path;
+using NativeRect = System.Drawing.RectangleF;
+using NativePoint = Gdk.Point;
+using NativeColor = Gdk.Color;
+using NativeImage = System.Drawing.Bitmap;
+#elif WPF
+using System.Windows.Input;
+using NativePath = System.Windows.Ink.Stroke;
+using NativeRect = System.Drawing.RectangleF;
+using NativePoint = System.Windows.Input.StylusPoint;
+using NativeColor = System.Windows.Media.Color;
+using NativeImage = System.Drawing.Bitmap;
#elif __IOS__
using NativeRect = CoreGraphics.CGRect;
using NativeSize = CoreGraphics.CGSize;
@@ -16,6 +29,13 @@
using NativeColor = UIKit.UIColor;
using NativeImage = UIKit.UIImage;
using NativePath = UIKit.UIBezierPath;
+#elif __MACOS__
+using NativeRect = CoreGraphics.CGRect;
+using NativeSize = CoreGraphics.CGSize;
+using NativePoint = CoreGraphics.CGPoint;
+using NativeColor = AppKit.NSColor;
+using NativeImage = AppKit.NSImage;
+using NativePath = CoreGraphics.CGPath;
#elif WINDOWS_PHONE_APP
using NativeRect = Windows.Foundation.Rect;
using NativeSize = Windows.Foundation.Size;
@@ -31,7 +51,7 @@ internal partial class InkPresenter
{
private const float MinimumPointDistance = 2.0f;
- public static float ScreenDensity;
+ public static float ScreenDensity = 0;
private readonly List paths = new List ();
private InkStroke currentPath;
@@ -42,7 +62,7 @@ internal partial class InkPresenter
private float dirtyRectRight;
private float dirtyRectBottom;
- private NativeImage bitmapBuffer;
+ private NativeImage bitmapBuffer = null;
// public properties
@@ -50,9 +70,10 @@ internal partial class InkPresenter
public float StrokeWidth { get; set; } = 1f;
+ public bool IsSingleLine { get; set; }
// private properties
-#if __IOS__
+#if __IOS__ || __MACOS__
private float Width => (float)Bounds.Width;
private float Height => (float)Bounds.Height;
@@ -65,8 +86,13 @@ private bool ShouldRedrawBufferImage
var sizeChanged = false;
if (bitmapBuffer != null)
{
+#if WPF || GTK
+ var s = bitmapBuffer.Size;
+ sizeChanged = s.Width != this.StrokeWidth || s.Height != this.StrokeWidth;
+#else
var s = bitmapBuffer.GetSize ();
sizeChanged = s.Width != Width || s.Height != Height;
+#endif
}
return sizeChanged ||
@@ -103,7 +129,6 @@ public void Clear ()
{
paths.Clear ();
currentPath = null;
-
this.Invalidate ();
}
@@ -142,7 +167,15 @@ private bool AddStrokeInternal (IEnumerable points, NativeColor col
return false;
}
- var newpath = new NativePath ();
+#if WPF
+ var newpath = new NativePath(new StylusPointCollection (strokePoints));
+#elif GTK
+ NativePath newpath = null;
+ return false;
+#else
+ var newpath = new NativePath();
+#endif
+
newpath.MoveTo (strokePoints[0].X, strokePoints[0].Y);
foreach (var point in strokePoints.Skip (1))
{
diff --git a/src/SignaturePad.InkPresenter.Shared/InkStroke.cs b/src/SignaturePad.InkPresenter.Shared/InkStroke.cs
index 6f95e93..de1ba29 100644
--- a/src/SignaturePad.InkPresenter.Shared/InkStroke.cs
+++ b/src/SignaturePad.InkPresenter.Shared/InkStroke.cs
@@ -4,10 +4,22 @@
using NativePoint = System.Drawing.PointF;
using NativeColor = Android.Graphics.Color;
using NativePath = Android.Graphics.Path;
+#elif GTK
+using NativePoint = Gdk.Point;
+using NativeColor = Gdk.Color;
+using NativePath = Cairo.Path;
+#elif WPF
+using NativePoint = System.Windows.Input.StylusPoint;
+using NativeColor = System.Windows.Media.Color;
+using NativePath = System.Windows.Ink.Stroke;
#elif __IOS__
using NativePoint = CoreGraphics.CGPoint;
using NativeColor = UIKit.UIColor;
using NativePath = UIKit.UIBezierPath;
+#elif __MACOS__
+using NativePoint = CoreGraphics.CGPoint;
+using NativeColor = AppKit.NSColor;
+using NativePath = CoreGraphics.CGPath;
#elif WINDOWS_PHONE_APP
using NativePoint = Windows.Foundation.Point;
using NativeColor = Windows.UI.Color;
diff --git a/src/SignaturePad.Mac.sln b/src/SignaturePad.Mac.sln
index a5d7bca..7ccdcca 100644
--- a/src/SignaturePad.Mac.sln
+++ b/src/SignaturePad.Mac.sln
@@ -13,6 +13,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SignaturePad.Forms.Droid",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SignaturePad.Forms.iOS", "SignaturePad.Forms.iOS\SignaturePad.Forms.iOS.csproj", "{B12D20AA-0EDF-4903-B385-BB8090848532}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SignaturePad.MacOS", "SignaturePad.MacOS\SignaturePad.MacOS.csproj", "{F38B60EA-24D9-4046-84A3-A9CE27D380D5}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SignaturePad.Forms.MacOS", "SignaturePad.Forms.MacOS\SignaturePad.Forms.MacOS.csproj", "{36299905-539E-4B5E-B2F8-669C37BA5EEC}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -39,6 +43,14 @@ Global
{B12D20AA-0EDF-4903-B385-BB8090848532}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B12D20AA-0EDF-4903-B385-BB8090848532}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B12D20AA-0EDF-4903-B385-BB8090848532}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F38B60EA-24D9-4046-84A3-A9CE27D380D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F38B60EA-24D9-4046-84A3-A9CE27D380D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F38B60EA-24D9-4046-84A3-A9CE27D380D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F38B60EA-24D9-4046-84A3-A9CE27D380D5}.Release|Any CPU.Build.0 = Release|Any CPU
+ {36299905-539E-4B5E-B2F8-669C37BA5EEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {36299905-539E-4B5E-B2F8-669C37BA5EEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {36299905-539E-4B5E-B2F8-669C37BA5EEC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {36299905-539E-4B5E-B2F8-669C37BA5EEC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/src/SignaturePad.MacOS/InkPresenter.cs b/src/SignaturePad.MacOS/InkPresenter.cs
new file mode 100644
index 0000000..eb6b1ea
--- /dev/null
+++ b/src/SignaturePad.MacOS/InkPresenter.cs
@@ -0,0 +1,184 @@
+using System.Collections.Generic;
+using CoreGraphics;
+using AppKit;
+
+namespace Xamarin.Controls
+{
+
+ partial class InkPresenter : NSView
+ {
+ static InkPresenter ()
+ {
+ ScreenDensity = (float)NSScreen.MainScreen.BackingScaleFactor;
+ }
+
+ public InkPresenter ()
+ : base ()
+ {
+ Initialize ();
+ }
+
+ public InkPresenter (CGRect frame)
+ : base (frame)
+ {
+ Initialize ();
+ }
+
+ private void Initialize ()
+ {
+ //Opaque = false;
+ }
+
+ // If you put SignaturePad inside a ScrollView, this line of code prevent that the gesture inside
+ // an InkPresenter are dispatched to the ScrollView below
+ //public override bool GestureRecognizerShouldBegin (NSGestureRecognizer gestureRecognizer) => false;
+
+ public override void MouseDown (NSEvent evt)
+ {
+ if (IsSingleLine)
+ {
+ Clear();
+ }
+
+ // create a new path and set the options
+ currentPath = new InkStroke (new CGPath(), new List (), StrokeColor, StrokeWidth);
+
+ // obtain the location of the touch
+ var touchLocation = evt.LocationInWindow;
+
+ // move the path to that position
+ currentPath.Path.MoveTo (touchLocation.X, touchLocation.Y);
+ currentPath.GetPoints ().Add (touchLocation);
+
+ // update the dirty rectangle
+ ResetBounds (touchLocation);
+ }
+
+ public override void MouseDragged (NSEvent evt)
+ {
+ // something may have happened (clear) so start the stroke again
+ if (currentPath == null)
+ {
+ TouchesBeganWithEvent(evt);
+ }
+
+ // obtain the location of the touch
+
+ var touchLocation = evt.LocationInWindow;
+ if (HasMovedFarEnough (currentPath, touchLocation.X, touchLocation.Y))
+ {
+ // add it to the current path
+ currentPath.Path.LineTo (touchLocation.X, touchLocation.Y);
+ currentPath.GetPoints ().Add (touchLocation);
+
+ // update the dirty rectangle
+ UpdateBounds (touchLocation);
+ SetNeedsDisplayInRect (DirtyRect);
+ }
+ }
+
+ public override void MouseUp (NSEvent evt)
+ {
+ // obtain the location of the touch
+ var touchLocation = evt.LocationInWindow;
+
+ // something may have happened (clear) during the stroke
+ if (currentPath != null)
+ {
+ if (HasMovedFarEnough (currentPath, touchLocation.X, touchLocation.Y))
+ {
+ // add it to the current path
+ currentPath.Path.LineTo (touchLocation.X, touchLocation.Y);
+ currentPath.GetPoints ().Add (touchLocation);
+ }
+
+ // obtain the smoothed path, and add it to the old paths
+ var smoothed = PathSmoothing.SmoothedPathWithGranularity (currentPath, 4);
+ paths.Add (smoothed);
+ }
+
+ // clear the current path
+ currentPath = null;
+
+ // update the dirty rectangle
+ UpdateBounds (touchLocation);
+
+ // we are done with drawing
+ OnStrokeCompleted ();
+ }
+
+
+ public override void DrawRect (CGRect rect)
+ {
+ base.DrawRect (rect);
+
+ // destroy an old bitmap
+ if (bitmapBuffer != null && ShouldRedrawBufferImage)
+ {
+ var temp = bitmapBuffer;
+ bitmapBuffer = null;
+
+ temp.Dispose ();
+ temp = null;
+ }
+
+ // re-create
+ if (bitmapBuffer == null)
+ {
+ bitmapBuffer = CreateBufferImage ();
+ }
+
+ // draw the current path over the old paths
+ if (currentPath != null)
+ {
+ var context = NSGraphicsContext.CurrentContext.CGContext;
+ context.SetLineCap (CGLineCap.Round);
+ context.SetLineJoin (CGLineJoin.Round);
+ context.SetStrokeColor (currentPath.Color.CGColor);
+ context.SetLineWidth (currentPath.Width);
+
+ context.AddPath (currentPath.Path);
+ context.StrokePath ();
+ }
+ }
+
+ private NSImage CreateBufferImage ()
+ {
+ if (paths == null || paths.Count == 0)
+ {
+ return null;
+ }
+
+ var context = NSGraphicsContext.CurrentContext.CGContext;
+
+ context.SetLineCap(CGLineCap.Round);
+ context.SetLineJoin(CGLineJoin.Round);
+
+ foreach (var path in paths)
+ {
+ context.SetStrokeColor(path.Color.CGColor);
+ context.SetLineWidth(path.Width);
+
+ context.AddPath(path.Path);
+ context.StrokePath();
+
+ path.IsDirty = false;
+ }
+
+ var size = Bounds.Size;
+ var image = new NSImage(size);
+ image.LockFocus();
+ image.Draw(new CGRect(CGPoint.Empty, size), CGRect.Empty, NSCompositingOperation.SourceOver, 1.0f);
+ image.UnlockFocus();
+
+ return image;
+ }
+
+ public override void Layout ()
+ {
+ base.Layout ();
+
+ NeedsDisplay = true;
+ }
+ }
+}
diff --git a/src/SignaturePad.MacOS/SignaturePad.MacOS.csproj b/src/SignaturePad.MacOS/SignaturePad.MacOS.csproj
new file mode 100644
index 0000000..c2de481
--- /dev/null
+++ b/src/SignaturePad.MacOS/SignaturePad.MacOS.csproj
@@ -0,0 +1,38 @@
+
+
+
+ xamarin.mac2.0
+ Xamarin.Controls
+ SignaturePad
+ False
+ $(MSBuildWarningsAsMessages);VSX1000
+ bin\$(Configuration)\$(AssemblyName).xml
+ 1.0.0
+
+
+
+ 1.0.0
+ Xamarin.Controls.SignaturePad
+ SignaturePad for Xamarin and Windows
+ $(AssemblyName) ($(TargetFramework))
+ Microsoft
+ Microsoft
+ true
+ Makes capturing, saving, and displaying signatures extremely simple.
+ Makes capturing, saving, and displaying signatures extremely simple.
+ © Microsoft Corporation. All rights reserved.
+ en
+ https://go.microsoft.com/fwlink/?linkid=874510
+ https://go.microsoft.com/fwlink/?linkid=874507
+ https://go.microsoft.com/fwlink/?linkid=874507
+ https://go.microsoft.com/fwlink/?linkid=874508
+ https://go.microsoft.com/fwlink/?linkid=874509
+ xamarin,signature,handwriting,windows,ios,android,uwp
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/SignaturePad.MacOS/SignaturePadCanvasView.cs b/src/SignaturePad.MacOS/SignaturePadCanvasView.cs
new file mode 100644
index 0000000..7fbe6fb
--- /dev/null
+++ b/src/SignaturePad.MacOS/SignaturePadCanvasView.cs
@@ -0,0 +1,113 @@
+using System;
+using System.ComponentModel;
+using System.IO;
+using System.Threading.Tasks;
+using CoreGraphics;
+using Foundation;
+using AppKit;
+
+namespace Xamarin.Controls
+{
+ [Register ("SignaturePadCanvasView")]
+ [DesignTimeVisible (true)]
+ public partial class SignaturePadCanvasView : NSView
+ {
+ private InkPresenter inkPresenter;
+
+ public SignaturePadCanvasView ()
+ {
+ Initialize ();
+ }
+
+ public SignaturePadCanvasView (NSCoder coder)
+ : base (coder)
+ {
+ Initialize (/* ? baseProperties: false ? */);
+ }
+
+ protected SignaturePadCanvasView (IntPtr ptr)
+ : base (ptr)
+ {
+ Initialize (false);
+ }
+
+ public SignaturePadCanvasView (CGRect frame)
+ : base (frame)
+ {
+ Initialize ();
+ }
+
+ private void Initialize (bool baseProperties = true)
+ {
+ inkPresenter = new InkPresenter (Bounds)
+ {
+ AutoresizingMask = NSViewResizingMask.WidthSizable | NSViewResizingMask.HeightSizable,
+ };
+ inkPresenter.StrokeCompleted += OnStrokeCompleted;
+ AddSubview (inkPresenter);
+
+ StrokeWidth = ImageConstructionSettings.DefaultStrokeWidth;
+ StrokeColor = ImageConstructionSettings.DefaultStrokeColor;
+ }
+
+ [Export ("StrokeColor"), Browsable (true)]
+ public NSColor StrokeColor
+ {
+ get { return inkPresenter.StrokeColor; }
+ set
+ {
+ inkPresenter.StrokeColor = value;
+ foreach (var stroke in inkPresenter.GetStrokes ())
+ {
+ stroke.Color = value;
+ }
+
+ inkPresenter.NeedsDisplay = true;
+ }
+ }
+
+ [Export ("StrokeWidth"), Browsable (true)]
+ public float StrokeWidth
+ {
+ get { return inkPresenter.StrokeWidth; }
+ set
+ {
+ inkPresenter.StrokeWidth = value;
+ foreach (var stroke in inkPresenter.GetStrokes ())
+ {
+ stroke.Width = value;
+ }
+
+ inkPresenter.NeedsDisplay = true;
+ }
+ }
+
+ public void Clear ()
+ {
+ inkPresenter.Clear ();
+
+ OnCleared ();
+ }
+
+ private NSImage GetImageInternal (CGSize scale, CGRect signatureBounds, CGSize imageSize, float strokeWidth, NSColor strokeColor, NSColor backgroundColor)
+ {
+ return new NSImage(imageSize);
+ }
+
+ private Task GetImageStreamInternal (SignatureImageFormat format, CGSize scale, CGRect signatureBounds, CGSize imageSize, float strokeWidth, NSColor strokeColor, NSColor backgroundColor)
+ {
+ var image = GetImageInternal (scale, signatureBounds, imageSize, strokeWidth, strokeColor, backgroundColor);
+ if (image != null)
+ {
+ switch (format)
+ {
+ case SignatureImageFormat.Jpeg:
+ return Task.Run (() => image.AsTiff ()?.AsStream ());
+ case SignatureImageFormat.Png:
+ return Task.Run (() => image.AsTiff ()?.AsStream ());
+ }
+ }
+ return Task.FromResult (null);
+ }
+ }
+}
diff --git a/src/SignaturePad.MacOS/SignaturePadView.cs b/src/SignaturePad.MacOS/SignaturePadView.cs
new file mode 100644
index 0000000..fd73151
--- /dev/null
+++ b/src/SignaturePad.MacOS/SignaturePadView.cs
@@ -0,0 +1,381 @@
+using System;
+using System.ComponentModel;
+using CoreGraphics;
+using Foundation;
+using AppKit;
+
+namespace Xamarin.Controls
+{
+ [Register ("SignaturePadView")]
+ [DesignTimeVisible (true)]
+ public partial class SignaturePadView : NSView
+ {
+ private NSEdgeInsets padding;
+
+ public SignaturePadView ()
+ {
+ Initialize ();
+ }
+
+ public SignaturePadView (NSCoder coder)
+ : base (coder)
+ {
+ Initialize (/* ? baseProperties: false ? */);
+ }
+
+ public SignaturePadView (IntPtr ptr)
+ : base (ptr)
+ {
+ Initialize (false);
+ }
+
+ public SignaturePadView (CGRect frame)
+ : base (frame)
+ {
+ Initialize ();
+ }
+
+ private void Initialize (bool baseProperties = true)
+ {
+ // add the background view
+ {
+ BackgroundImageView = new NSImageView ();
+ AddSubview (BackgroundImageView);
+ }
+
+ // add the main signature view
+ {
+ SignaturePadCanvas = new SignaturePadCanvasView ();
+ SignaturePadCanvas.StrokeCompleted += delegate
+ {
+ OnSignatureStrokeCompleted ();
+ };
+ SignaturePadCanvas.Cleared += delegate
+ {
+ OnSignatureCleared ();
+ };
+ AddSubview (SignaturePadCanvas);
+ }
+
+ // add the caption
+ {
+ Caption = new NSTextField
+ {
+ BackgroundColor = NSColor.Clear,
+ Alignment = NSTextAlignment.Center,
+ Font = NSFont.SystemFontOfSize (DefaultFontSize),
+ StringValue = DefaultCaptionText,
+ TextColor = SignaturePadDarkColor,
+ };
+ AddSubview (Caption);
+ }
+
+ // add the signature line
+ {
+ SignatureLine = new NSView
+ {
+ //BackgroundColor = SignaturePadDarkColor,
+ };
+ SignatureLineWidth = DefaultLineThickness;
+ SignatureLineSpacing = DefaultNarrowSpacing;
+ AddSubview (SignatureLine);
+ }
+
+ // add the prompt
+ {
+ SignaturePrompt = new NSTextField ()
+ {
+ BackgroundColor = NSColor.Clear,
+ Font = NSFont.BoldSystemFontOfSize (DefaultFontSize),
+ StringValue = DefaultPromptText,
+ TextColor = SignaturePadDarkColor,
+ };
+ AddSubview (SignaturePrompt);
+ }
+
+ // add the clear label
+ {
+ ClearLabel = NSButton.CreateButton(DefaultClearLabelText,OnClearTapped);
+ //ClearLabel.Layer.BackgroundColor = CGColor.Clear;
+ ClearLabel.Font = NSFont.BoldSystemFontOfSize (DefaultFontSize);
+ ClearLabel.BezelColor=SignaturePadDarkColor;
+ AddSubview (ClearLabel);
+
+ // attach the "clear" command
+ //ClearLabel.Activated += delegate
+ //{
+ // OnClearTapped ();
+ //};
+ }
+
+ Padding = new NSEdgeInsets (DefaultWideSpacing, DefaultWideSpacing, DefaultNarrowSpacing, DefaultWideSpacing);
+
+ // clear / initialize the view
+ UpdateUi ();
+ }
+
+ public SignaturePadCanvasView SignaturePadCanvas { get; private set; }
+
+ ///
+ /// Gets the horizontal line that goes in the lower part of the pad.
+ ///
+ public NSView SignatureLine { get; private set; }
+
+ ///
+ /// The caption displayed under the signature line.
+ ///
+ public NSTextField Caption { get; private set; }
+
+ ///
+ /// The prompt displayed at the beginning of the signature line.
+ ///
+ public NSTextField SignaturePrompt { get; private set; }
+
+ ///
+ /// Gets the label that clears the pad when clicked.
+ ///
+ public NSButton ClearLabel { get; private set; }
+
+ ///
+ /// Gets the image view that may be used as a watermark or as a texture
+ /// for the signature pad.
+ ///
+ public NSImageView BackgroundImageView { get; private set; }
+
+ [Export ("StrokeColor"), Browsable (true)]
+ public NSColor StrokeColor
+ {
+ get => SignaturePadCanvas.StrokeColor;
+ set => SignaturePadCanvas.StrokeColor = value;
+ }
+
+ [Export ("StrokeWidth"), Browsable (true)]
+ public float StrokeWidth
+ {
+ get => SignaturePadCanvas.StrokeWidth;
+ set => SignaturePadCanvas.StrokeWidth = value;
+ }
+
+ ///
+ /// Gets or sets the color of the signature line.
+ ///
+ [Export ("SignatureLineColor"), Browsable (true)]
+ public CGColor SignatureLineColor
+ {
+ get => SignatureLine.Layer.BackgroundColor;
+ set => SignatureLine.Layer.BackgroundColor = value;
+ }
+
+ ///
+ /// Gets or sets the width of the signature line.
+ ///
+ [Export ("SignatureLineWidth"), Browsable (true)]
+ public nfloat SignatureLineWidth
+ {
+ get => SignatureLine.Bounds.Height;
+ set
+ {
+ var bounds = SignatureLine.Bounds;
+ bounds.Height = value;
+ SignatureLine.Bounds = bounds;
+ NeedsLayout = true;
+ }
+ }
+
+ ///
+ /// Gets or sets the spacing between the signature line and the caption and prompt.
+ ///
+ [Export ("SignatureLineSpacing"), Browsable (true)]
+ public nfloat SignatureLineSpacing
+ {
+ get => SignatureLine.Bounds.Bottom;
+ set
+ {
+ var margins = SignatureLine.Bounds;
+ //margins.Top = value;
+ //margins.Bottom = value;
+ SignatureLine.Bounds = margins;
+ NeedsLayout = true;
+ }
+ }
+
+ ///
+ /// Gets or sets the text for the caption displayed under the signature line.
+ ///
+ [Export ("CaptionText"), Browsable (true)]
+ public string CaptionText
+ {
+ get => Caption.StringValue;
+ set
+ {
+ Caption.StringValue = value;
+ NeedsLayout = true;
+ }
+ }
+
+ ///
+ /// Gets or sets the font size text for the caption displayed under the signature line.
+ ///
+ [Export ("CaptionFontSize"), Browsable (true)]
+ public nfloat CaptionFontSize
+ {
+ get => Caption.Font.PointSize;
+ set
+ {
+ Caption.Font = NSFont.FromFontName (Caption.Font.FontName, value);
+ NeedsLayout = true;
+ }
+ }
+
+ ///
+ /// Gets or sets the text color for the caption displayed under the signature line.
+ ///
+ [Export ("CaptionTextColor"), Browsable (true)]
+ public NSColor CaptionTextColor
+ {
+ get => Caption.TextColor;
+ set => Caption.TextColor = value;
+ }
+
+ ///
+ /// Gets or sets the text for the prompt displayed at the beginning of the signature line.
+ ///
+ [Export ("SignaturePromptText"), Browsable (true)]
+ public string SignaturePromptText
+ {
+ get => SignaturePrompt.StringValue;
+ set
+ {
+ SignaturePrompt.StringValue = value;
+ NeedsLayout = true;
+ }
+ }
+
+ ///
+ /// Gets or sets the font size the prompt displayed at the beginning of the signature line.
+ ///
+ [Export ("SignaturePromptFontSize"), Browsable (true)]
+ public nfloat SignaturePromptFontSize
+ {
+ get => SignaturePrompt.Font.PointSize;
+ set
+ {
+ SignaturePrompt.Font = NSFont.FromFontName(SignaturePrompt.Font.FontName, value);
+ NeedsLayout = true;
+ }
+ }
+
+ ///
+ /// Gets or sets the text color for the prompt displayed at the beginning of the signature line.
+ ///
+ [Export ("SignaturePromptTextColor"), Browsable (true)]
+ public NSColor SignaturePromptTextColor
+ {
+ get => SignaturePrompt.TextColor;
+ set => SignaturePrompt.TextColor = value;
+ }
+
+ ///
+ /// Gets or sets the text for the label that clears the pad when clicked.
+ ///
+ [Export ("ClearLabelText"), Browsable (true)]
+ public string ClearLabelText
+ {
+ get => ClearLabel.Title;
+ set
+ {
+ ClearLabel.Title= value;
+ NeedsLayout = true;
+ }
+ }
+
+ ///
+ /// Gets or sets the font size the label that clears the pad when clicked.
+ ///
+ [Export ("ClearLabelFontSize"), Browsable (true)]
+ public nfloat ClearLabelFontSize
+ {
+ get => ClearLabel.Font.PointSize;
+ set
+ {
+ ClearLabel.Font = NSFont.FromFontName (ClearLabel.Font.FontName, value);
+ NeedsLayout = true;
+ }
+ }
+
+ ///
+ /// Gets or sets the text color for the label that clears the pad when clicked.
+ ///
+ [Export ("ClearLabelTextColor"), Browsable (true)]
+ public NSColor ClearLabelTextColor
+ {
+ get => ClearLabel.BezelColor;
+ set => ClearLabel.BezelColor = value;
+ }
+
+ [Export ("BackgroundImage"), Browsable (true)]
+ public NSImage BackgroundImage
+ {
+ get => BackgroundImageView.Image;
+ set => BackgroundImageView.Image = value;
+ }
+
+ [Export ("BackgroundImageContentMode"), Browsable (true)]
+ public NSImageView BackgroundImageContentMode
+ {
+ get => BackgroundImageView;
+ set => BackgroundImageView = value;
+ }
+
+ [Export ("BackgroundImageAlpha"), Browsable (true)]
+ public nfloat BackgroundImageAlpha
+ {
+ get => BackgroundImageView.AlphaValue;
+ set => BackgroundImageView.AlphaValue = value;
+ }
+
+ [Export ("Padding"), Browsable (true)]
+ public NSEdgeInsets Padding
+ {
+ get => padding;
+ set
+ {
+ padding = value;
+ NeedsLayout = true;
+ }
+ }
+
+ private void UpdateUi ()
+ {
+ ClearLabel.Hidden = IsBlank;
+ }
+
+ public override void Layout ()
+ {
+ var w = Frame.Width;
+ var h = Frame.Height;
+ var currentY = h;
+
+ SignaturePrompt.SizeToFit ();
+ ClearLabel.SizeToFit ();
+
+ var captionHeight = Caption.SizeThatFits (Caption.Frame.Size).Height;
+ var clearButtonHeight = (int)ClearLabel.Font.CapHeight + 1;
+
+ var rect = new CGRect (0, 0, w, h);
+ SignaturePadCanvas.Frame = rect;
+ BackgroundImageView.Frame = rect;
+
+ currentY = currentY - Padding.Bottom - captionHeight;
+ Caption.Frame = new CGRect (Padding.Left, currentY, w - Padding.Left - Padding.Right, captionHeight);
+
+ currentY = currentY - SignatureLine.Bounds.Bottom - SignatureLine.Frame.Height;
+ SignatureLine.Frame = new CGRect (Padding.Left, currentY, w - Padding.Left - Padding.Right, SignatureLine.Frame.Height);
+
+ currentY = currentY - SignatureLine.Bounds.Top - SignaturePrompt.Frame.Height;
+ SignaturePrompt.Frame = new CGRect (Padding.Left, currentY, SignaturePrompt.Frame.Width, SignaturePrompt.Frame.Height);
+
+ ClearLabel.Frame = new CGRect (w - Padding.Right - ClearLabel.Frame.Width, Padding.Top, ClearLabel.Frame.Width, clearButtonHeight);
+ }
+ }
+}
diff --git a/src/SignaturePad.Shared/Extensions.cs b/src/SignaturePad.Shared/Extensions.cs
index faf4822..addda9e 100644
--- a/src/SignaturePad.Shared/Extensions.cs
+++ b/src/SignaturePad.Shared/Extensions.cs
@@ -8,12 +8,29 @@
#elif __IOS__
using CoreGraphics;
using UIKit;
+#elif __MACOS__
+using CoreGraphics;
+using AppKit;
+#elif GTK
+using Gtk;
+using Gdk;
+using Cairo;
+using Color = Gdk.Color;
+using Point = Gdk.Point;
+#elif WPF
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Ink;
+using System.Windows.Input;
+using System.Windows.Media;
+using InkPresenter = System.Windows.Ink.StrokeCollection;
#elif WINDOWS_PHONE
using System.Windows;
using System.Windows.Controls;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
+using System.Drawing.Drawing2D;
#elif WINDOWS_UWP || WINDOWS_APP
using Windows.Foundation;
using System.Numerics;
@@ -72,6 +89,139 @@ public static CGSize GetSize (this UIView view)
return view.Bounds.Size;
}
+#elif __MACOS__
+
+ public static CGSize GetSize (this NSImage image)
+ {
+ return image.Size;
+ }
+
+ public static void Invalidate (this NSView view)
+ {
+ view.NeedsDisplay = true;
+ }
+
+ public static void MoveTo (this CGPath path, nfloat x, nfloat y)
+ {
+ path.MoveToPoint (new CGPoint (x, y));
+ }
+
+ public static void LineTo (this CGPath path, nfloat x, nfloat y)
+ {
+ path.AddLineToPoint(new CGPoint (x, y));
+ }
+
+ public static CGSize GetSize (this NSView view)
+ {
+ return view.Bounds.Size;
+ }
+
+#elif GTK
+
+ public static void MoveTo (this Cairo.Path stroke, double x, double y)
+ {
+ //stroke.StylusPoints.Add (new Point ((int)x, (int)y));
+ }
+
+ public static void LineTo (this Cairo.Path stroke, double x, double y)
+ {
+ //stroke.StylusPoints.Add (new Point ((int)x, (int)y));
+ }
+
+ public static void AddStrokes (this DrawingArea inkPresenter, IList strokes, Color color, float width)
+ {
+ foreach (var stroke in strokes.Where (s => s.Length > 0))
+ {
+ var pointCollection = new List ();
+ foreach (var point in stroke)
+ {
+ pointCollection.Add (new Point (point.X, point.Y));
+ }
+
+ var newStroke = new List (pointCollection);
+ //strokeCollection.Add (newStroke);
+ }
+
+ //inkPresenter.Strokes = strokeCollection;
+ }
+
+ public static void Invalidate (this InkPresenter control)
+ {
+
+ }
+
+ public static IList GetStrokes (this DrawingArea canvas)
+ {
+ return new List ();
+ //return canvas.Strokes;
+ }
+
+ public static IEnumerable GetPoints (this Cairo.Path stroke)
+ {
+ return new List ();
+ //return stroke.Select (p => new Point (p.X, p.Y));
+ }
+
+ public static Size GetSize (this SignaturePadCanvasView element)
+ {
+ return new Size (element.inkPresenter.WidthRequest, element.inkPresenter.HeightRequest);
+ }
+#elif WPF
+
+ public static void MoveTo (this Stroke stroke, double x, double y)
+ {
+ stroke.StylusPoints.Add (new StylusPoint (x, y));
+ }
+
+ public static void LineTo (this Stroke stroke, double x, double y)
+ {
+ stroke.StylusPoints.Add (new StylusPoint (x, y));
+ }
+
+ public static void AddStrokes (this InkCanvas inkPresenter, IList strokes, Color color, float width)
+ {
+ var strokeCollection = new StrokeCollection ();
+ foreach (var stroke in strokes.Where (s => s.Length > 0))
+ {
+ var pointCollection = new StylusPointCollection ();
+ foreach (var point in stroke)
+ {
+ pointCollection.Add (new StylusPoint (point.X, point.Y));
+ }
+
+ var newStroke = new Stroke (pointCollection);
+ strokeCollection.Add (newStroke);
+
+ newStroke.DrawingAttributes = new DrawingAttributes
+ {
+ Color = color,
+ Width = width,
+ Height = width
+ };
+ }
+
+ inkPresenter.Strokes = strokeCollection;
+ }
+
+ public static void Invalidate (this InkPresenter control)
+ {
+
+ }
+
+ public static IList GetStrokes (this InkCanvas canvas)
+ {
+ return canvas.Strokes;
+ }
+
+ public static IEnumerable GetPoints (this Stroke stroke)
+ {
+ return stroke.StylusPoints.Select (p => new StylusPoint (p.X, p.Y));
+ }
+
+ public static Size GetSize (this FrameworkElement element)
+ {
+ return new Size (element.Width, element.Height);
+ }
#elif WINDOWS_PHONE
public static void MoveTo (this Stroke stroke, double x, double y)
diff --git a/src/SignaturePad.Shared/ImageConstructionSettings.cs b/src/SignaturePad.Shared/ImageConstructionSettings.cs
index 03adbb0..329e35a 100644
--- a/src/SignaturePad.Shared/ImageConstructionSettings.cs
+++ b/src/SignaturePad.Shared/ImageConstructionSettings.cs
@@ -8,6 +8,10 @@
using NativeSize = CoreGraphics.CGSize;
using NativeColor = UIKit.UIColor;
using NativeNullableColor = UIKit.UIColor;
+#elif __MACOS__
+using NativeSize = CoreGraphics.CGSize;
+using NativeColor = AppKit.NSColor;
+using NativeNullableColor = AppKit.NSColor;
#elif WINDOWS_PHONE
using NativeSize = System.Windows.Size;
using NativeColor = System.Windows.Media.Color;
@@ -20,6 +24,14 @@
using NativeSize = Windows.Foundation.Size;
using NativeColor = Windows.UI.Color;
using NativeNullableColor = System.Nullable;
+#elif GTK
+using NativeSize = System.Drawing.SizeF;
+using NativeColor = Gdk.Color;
+using NativeNullableColor = System.Nullable;
+#elif WPF
+using NativeSize = System.Drawing.SizeF;
+using NativeColor = System.Windows.Media.Color;
+using NativeNullableColor = System.Nullable;
#endif
namespace Xamarin.Controls
@@ -92,6 +104,7 @@ public SizeOrScale (float x, float y, SizeOrScaleType type, bool keepAspectRatio
public NativeSize GetScale (float width, float height)
{
+
if (Type == SizeOrScaleType.Scale)
{
return new NativeSize (X, Y);
@@ -130,9 +143,15 @@ public struct ImageConstructionSettings
#if __IOS__ || __ANDROID__
internal static readonly NativeColor Black = NativeColor.Black;
internal static readonly NativeColor Transparent = new NativeColor (0, 0, 0, 0);
-#elif WINDOWS_PHONE || WINDOWS_UWP || WINDOWS_PHONE_APP || WINDOWS_APP
+#elif __MACOS__
+ internal static readonly NativeColor Black = NativeColor.Black;
+ internal static readonly NativeColor Transparent = NativeColor.FromRgba(0, 0, 0, 0);
+#elif WINDOWS_PHONE || WINDOWS_UWP || WINDOWS_PHONE_APP || WINDOWS_APP || WPF
internal static readonly NativeColor Black = NativeColor.FromArgb (255, 0, 0, 0);
internal static readonly NativeColor Transparent = NativeColor.FromArgb (0, 0, 0, 0);
+#elif GTK
+ internal static readonly NativeColor Black = new NativeColor(0, 0, 0);
+ internal static readonly NativeColor Transparent = new NativeColor(0, 0, 0);
#endif
public static readonly bool DefaultShouldCrop = true;
diff --git a/src/SignaturePad.Shared/PathSmoothing.cs b/src/SignaturePad.Shared/PathSmoothing.cs
index 7c02673..7143208 100644
--- a/src/SignaturePad.Shared/PathSmoothing.cs
+++ b/src/SignaturePad.Shared/PathSmoothing.cs
@@ -7,6 +7,9 @@
#elif __IOS__
using NativePoint = CoreGraphics.CGPoint;
using NativePath = UIKit.UIBezierPath;
+#elif __MACOS__
+using NativePoint = CoreGraphics.CGPoint;
+using NativePath = CoreGraphics.CGPath;
#elif WINDOWS_PHONE
using System.Windows.Ink;
using NativePoint = System.Windows.Point;
@@ -17,6 +20,18 @@
using NativePoint = Windows.Foundation.Point;
using NativePath = System.Collections.Generic.List;
using InkStroke = Windows.UI.Input.Inking.InkStroke;
+#elif GTK
+using NativePath = Cairo.Path;
+using NativePoint = Gdk.Point;
+using NativeSize = System.Drawing.Size;
+using NativeColor = Gdk.Color;
+using NativeImage = System.Drawing.Bitmap;
+#elif WPF
+using NativePath= System.Windows.Ink.Stroke;
+using NativePoint = System.Windows.Input.StylusPoint;
+using NativeSize = System.Drawing.Size;
+using NativeColor = System.Drawing.Color;
+using NativeImage = System.Drawing.Bitmap;
#elif WINDOWS_PHONE_APP
using NativePoint = Windows.Foundation.Point;
using NativePath = Windows.UI.Xaml.Media.PathGeometry;
@@ -24,6 +39,9 @@
namespace Xamarin.Controls
{
+ using System;
+ using System.Windows.Input;
+
internal static class PathSmoothing
{
///
@@ -47,7 +65,7 @@ public static InkStroke SmoothedPathWithGranularity (InkStroke currentPath, int
}
// create the new path with the old attributes
-#if __ANDROID__ || __IOS__ || WINDOWS_PHONE_APP
+#if __ANDROID__ || __IOS__ || WINDOWS_PHONE_APP || WPF || __MACOS__ || GTK
return new InkStroke (smoothedPath, smoothedPoints.ToList (), currentPath.Color, currentPath.Width);
#elif WINDOWS_PHONE
var da = currentPath.DrawingAttributes;
@@ -82,8 +100,16 @@ public static void SmoothedPathWithGranularity (List currentPoints,
}
// create a new bezier path to hold the smoothed path.
- smoothedPath = new NativePath ();
smoothedPoints = new List ();
+#if WPF
+ smoothedPath = new NativePath (new StylusPointCollection(smoothedPoints));
+#elif GTK
+ smoothedPath = null;
+ smoothedPoints = null;
+ return;
+#else
+ smoothedPath = new NativePath ();
+#endif
// duplicate the first and last points as control points.
currentPoints.Insert (0, currentPoints[0]);
@@ -108,6 +134,18 @@ public static void SmoothedPathWithGranularity (List currentPoints,
var ttt = tt * t;
// intermediate point
+#if GTK
+ var mid = new NativePoint
+ {
+ X = Convert.ToInt32(0.5f * (2f * p1.X + (p2.X - p0.X) * t +
+ (2f * p0.X - 5f * p1.X + 4f * p2.X - p3.X) * tt +
+ (3f * p1.X - p0.X - 3f * p2.X + p3.X) * ttt)),
+
+ Y = Convert.ToInt32(0.5f * (2 * p1.Y + (p2.Y - p0.Y) * t +
+ (2 * p0.Y - 5 * p1.Y + 4 * p2.Y - p3.Y) * tt +
+ (3 * p1.Y - p0.Y - 3 * p2.Y + p3.Y) * ttt))
+ };
+#else
var mid = new NativePoint
{
X = 0.5f * (2f * p1.X + (p2.X - p0.X) * t +
@@ -118,6 +156,8 @@ public static void SmoothedPathWithGranularity (List currentPoints,
(2 * p0.Y - 5 * p1.Y + 4 * p2.Y - p3.Y) * tt +
(3 * p1.Y - p0.Y - 3 * p2.Y + p3.Y) * ttt)
};
+#endif
+
smoothedPath.LineTo (mid.X, mid.Y);
smoothedPoints.Add (mid);
}
diff --git a/src/SignaturePad.Shared/SignaturePadCanvasView.cs b/src/SignaturePad.Shared/SignaturePadCanvasView.cs
index 51eae7a..c6822b6 100644
--- a/src/SignaturePad.Shared/SignaturePadCanvasView.cs
+++ b/src/SignaturePad.Shared/SignaturePadCanvasView.cs
@@ -16,6 +16,12 @@
using NativeSize = CoreGraphics.CGSize;
using NativeColor = UIKit.UIColor;
using NativeImage = UIKit.UIImage;
+#elif __MACOS__
+using NativeRect = CoreGraphics.CGRect;
+using NativePoint = CoreGraphics.CGPoint;
+using NativeSize = CoreGraphics.CGSize;
+using NativeColor = AppKit.NSColor;
+using NativeImage = AppKit.NSImage;
#elif WINDOWS_PHONE
using NativeRect = System.Windows.Rect;
using NativePoint = System.Windows.Point;
@@ -34,6 +40,22 @@
using NativePoint = Windows.Foundation.Point;
using NativeColor = Windows.UI.Color;
using NativeImage = Windows.UI.Xaml.Media.Imaging.WriteableBitmap;
+#elif GTK
+using NativeRect = System.Drawing.RectangleF;
+using NativePoint = Gdk.Point;
+using NativeSize = System.Drawing.SizeF;
+using NativeColor = Gdk.Color;
+using NativeImage = System.Drawing.Bitmap;
+using System.Windows.Ink;
+using System.Windows.Input;
+#elif WPF
+using NativeRect = System.Drawing.RectangleF;
+using NativePoint = System.Windows.Input.StylusPoint;
+using NativeSize = System.Drawing.SizeF;
+using NativeColor = System.Windows.Media.Color;
+using NativeImage = System.Drawing.Bitmap;
+using System.Windows.Ink;
+using System.Windows.Input;
#endif
namespace Xamarin.Controls
@@ -44,7 +66,43 @@ partial class SignaturePadCanvasView
public event EventHandler Cleared;
- public bool IsBlank => inkPresenter == null ? true : inkPresenter.GetStrokes ().Count == 0;
+ public bool IsBlank => inkPresenter == null || inkPresenter.GetStrokes ().Count == 0;
+
+#if WPF
+ private bool isSingleLine;
+
+ public bool IsSingleLine
+ {
+ get => isSingleLine;
+ set
+ {
+ if (value && isSingleLine != true)
+ {
+ inkPresenter.PreviewMouseDown += InkPresenter_MouseDown;
+ }
+ else
+ {
+ inkPresenter.PreviewMouseDown -= InkPresenter_MouseDown;
+ }
+
+ isSingleLine = value;
+ }
+ }
+
+ private void InkPresenter_MouseDown (object sender, MouseButtonEventArgs e)
+ {
+ Clear();
+ }
+#elif WINDOWS_UWP || GTK
+ public bool IsSingleLine { get; set; }
+#else
+ public bool IsSingleLine
+ {
+ get => inkPresenter.IsSingleLine;
+ set => inkPresenter.IsSingleLine = value;
+ }
+#endif
+
public NativePoint[] Points
{
@@ -63,6 +121,25 @@ public NativePoint[] Points
}
}
+#if WPF
+ public new StrokeCollection Strokes
+ {
+ get
+ {
+ if (IsBlank)
+ {
+ return new StrokeCollection (new List ());
+ }
+
+ // make a deep copy
+ var points = inkPresenter.GetStrokes ().Select (s => s.GetPoints ());
+ var strokes = points.Select (point => new Stroke (new StylusPointCollection (point))).ToList ();
+ var col = new StrokeCollection (strokes);
+ return col;
+ }
+ }
+
+#else
public NativePoint[][] Strokes
{
get
@@ -76,6 +153,7 @@ public NativePoint[][] Strokes
return inkPresenter.GetStrokes ().Select (s => s.GetPoints ().ToArray ()).ToArray ();
}
}
+#endif
public NativeRect GetSignatureBounds (float padding = 5f)
{
@@ -398,6 +476,7 @@ private bool GetImageConstructionArguments (ImageConstructionSettings settings,
}
var sizeOrScale = settings.DesiredSizeOrScale.Value;
+
var viewSize = this.GetSize ();
imageSize = sizeOrScale.GetSize ((float)viewSize.Width, (float)viewSize.Height);
@@ -416,6 +495,20 @@ private bool GetImageConstructionArguments (ImageConstructionSettings settings,
{
scaleX = scaleY = Math.Min ((float)scaleX, (float)scaleY);
}
+#if WPF || GTK
+ scale = new NativeSize ((int)scaleX, (int)scaleY);
+ }
+ else if (sizeOrScale.Type == SizeOrScaleType.Scale)
+ {
+ imageSize.Width = (int)(signatureBounds.Width * scale.Width);
+ imageSize.Height = (int)(signatureBounds.Height * scale.Height);
+ }
+ }
+ else
+ {
+ signatureBounds = new NativeRect (0, 0, (float)viewSize.Width, (float)viewSize.Height);
+ }
+#else
scale = new NativeSize ((float)scaleX, (float)scaleY);
}
else if (sizeOrScale.Type == SizeOrScaleType.Scale)
@@ -428,6 +521,7 @@ private bool GetImageConstructionArguments (ImageConstructionSettings settings,
{
signatureBounds = new NativeRect (0, 0, viewSize.Width, viewSize.Height);
}
+#endif
strokeWidth = settings.StrokeWidth.Value;
strokeColor = (NativeColor)settings.StrokeColor;
diff --git a/src/SignaturePad.Shared/SignaturePadView.cs b/src/SignaturePad.Shared/SignaturePadView.cs
index 57e78c9..decae27 100644
--- a/src/SignaturePad.Shared/SignaturePadView.cs
+++ b/src/SignaturePad.Shared/SignaturePadView.cs
@@ -14,17 +14,37 @@
using NativeSize = CoreGraphics.CGSize;
using NativeColor = UIKit.UIColor;
using NativeImage = UIKit.UIImage;
+#elif __MACOS__
+using NativeRect = CoreGraphics.CGRect;
+using NativePoint = CoreGraphics.CGPoint;
+using NativeSize = CoreGraphics.CGSize;
+using NativeColor = AppKit.NSColor;
+using NativeImage = AppKit.NSImage;
#elif WINDOWS_UWP
using NativeRect = Windows.Foundation.Rect;
using NativePoint = Windows.Foundation.Point;
using NativeSize = Windows.Foundation.Size;
using NativeColor = Windows.UI.Color;
using NativeImage = Windows.UI.Xaml.Media.Imaging.WriteableBitmap;
+#elif GTK
+using NativeRect = System.Drawing.Rectangle;
+using NativePoint = Gdk.Point;
+using NativeSize = System.Drawing.Size;
+using NativeColor = Gdk.Color;
+using NativeImage = System.Drawing.Bitmap;
+#elif WPF
+using NativeRect = System.Drawing.Rectangle;
+using NativePoint = System.Windows.Input.StylusPoint;
+using NativeSize = System.Drawing.Size;
+using NativeColor = System.Windows.Media.Color;
+using NativeImage = System.Drawing.Bitmap;
#endif
namespace Xamarin.Controls
{
-#if WINDOWS_UWP
+ using System.Drawing;
+
+#if WINDOWS_UWP || WPF || GTK
partial class SignaturePad
#else
partial class SignaturePadView
@@ -40,18 +60,25 @@ partial class SignaturePadView
private const string DefaultPromptText = "▶";
private const string DefaultCaptionText = "sign above the line";
-#if __IOS__
- private static readonly NativeColor SignaturePadDarkColor = NativeColor.Black;
- private static readonly NativeColor SignaturePadLightColor = NativeColor.White;
-#elif __ANDROID__
+#if __IOS__ || __MACOS__ || __ANDROID__
private static readonly NativeColor SignaturePadDarkColor = NativeColor.Black;
private static readonly NativeColor SignaturePadLightColor = NativeColor.White;
#elif WINDOWS_UWP
private static readonly NativeColor SignaturePadDarkColor = Windows.UI.Colors.Black;
private static readonly NativeColor SignaturePadLightColor = Windows.UI.Colors.White;
+#elif WPF
+ private static readonly NativeColor SignaturePadDarkColor = System.Windows.Media.Colors.Black;
+ private static readonly NativeColor SignaturePadLightColor = System.Windows.Media.Colors.White;
+#elif GTK
+ private static readonly NativeColor SignaturePadDarkColor = Gdk.Color.Zero;
+ private static readonly NativeColor SignaturePadLightColor = Gdk.Color.Zero;
#endif
+#if WPF
+ public System.Windows.Ink.StrokeCollection Strokes => SignaturePadCanvas.Strokes;
+#else
public NativePoint[][] Strokes => SignaturePadCanvas.Strokes;
+#endif
public NativePoint[] Points => SignaturePadCanvas.Points;
diff --git a/src/SignaturePad.UWP/SignaturePad.UWP.csproj b/src/SignaturePad.UWP/SignaturePad.UWP.csproj
index e6396e7..2544b0c 100644
--- a/src/SignaturePad.UWP/SignaturePad.UWP.csproj
+++ b/src/SignaturePad.UWP/SignaturePad.UWP.csproj
@@ -1,7 +1,7 @@
-
+
- uap10.0.10240
+ uap10.0.18362
Xamarin.Controls
SignaturePad
False
@@ -30,9 +30,8 @@
-
-
-
+
+
@@ -40,6 +39,4 @@
-
-
\ No newline at end of file
diff --git a/src/SignaturePad.WPF/SignaturePad.WPF.csproj b/src/SignaturePad.WPF/SignaturePad.WPF.csproj
new file mode 100644
index 0000000..6a7a5a2
--- /dev/null
+++ b/src/SignaturePad.WPF/SignaturePad.WPF.csproj
@@ -0,0 +1,75 @@
+
+
+
+ net472
+ Xamarin.Controls
+ SignaturePad
+
+ False
+
+ False
+ bin\$(Configuration)\$(AssemblyName).xml
+ 1.0.0
+
+
+
+ 1.0.0
+ Xamarin.Controls.SignaturePad
+ SignaturePad for Xamarin and Windows
+ $(AssemblyName) ($(TargetFramework))
+ Microsoft
+ Microsoft
+ true
+ Makes capturing, saving, and displaying signatures extremely simple.
+ Makes capturing, saving, and displaying signatures extremely simple.
+ © Microsoft Corporation. All rights reserved.
+ en
+ https://go.microsoft.com/fwlink/?linkid=874510
+ https://go.microsoft.com/fwlink/?linkid=874507
+ https://go.microsoft.com/fwlink/?linkid=874507
+ https://go.microsoft.com/fwlink/?linkid=874508
+ https://go.microsoft.com/fwlink/?linkid=874509
+ xamarin,signature,handwriting,windows,ios,android,uwp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(MSBuildToolsPath)\Microsoft.CSharp.targets
+ bin/$(Configuration)/$(TargetFramework)
+
+
+ TRACE;WPF
+
+
+ TRACE;WPF
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
\ No newline at end of file
diff --git a/src/SignaturePad.WPF/SignaturePad.cs b/src/SignaturePad.WPF/SignaturePad.cs
new file mode 100644
index 0000000..efdbbcb
--- /dev/null
+++ b/src/SignaturePad.WPF/SignaturePad.cs
@@ -0,0 +1,373 @@
+using System;
+using System.ComponentModel;
+
+namespace Xamarin.Controls
+{
+ using System.Windows;
+ using System.Windows.Controls;
+ using System.Windows.Media;
+
+ [TemplatePart (Name = PartBackgroundImageView, Type = typeof (Image))]
+ [TemplatePart (Name = PartSignaturePadCanvas, Type = typeof (SignaturePadCanvasView))]
+ [TemplatePart (Name = PartCaption, Type = typeof (TextBlock))]
+ [TemplatePart (Name = PartSignatureLine, Type = typeof (Border))]
+ [TemplatePart (Name = PartSignaturePrompt, Type = typeof (TextBlock))]
+ [TemplatePart (Name = PartClearLabel, Type = typeof (TextBlock))]
+ public partial class SignaturePad : Control
+ {
+ private const string PartBackgroundImageView = "BackgroundImageView";
+ private const string PartSignaturePadCanvas = "SignaturePadCanvas";
+ private const string PartCaption = "Caption";
+ private const string PartSignatureLine = "SignatureLine";
+ private const string PartSignaturePrompt = "SignaturePrompt";
+ private const string PartClearLabel = "ClearLabel";
+
+ public static readonly DependencyProperty StrokeColorProperty;
+ public static readonly DependencyProperty StrokeWidthProperty;
+ public static readonly DependencyProperty SignatureLineBrushProperty;
+ public static readonly DependencyProperty SignatureLineThicknessProperty;
+ public static readonly DependencyProperty SignatureLineSpacingProperty;
+ public static readonly DependencyProperty CaptionTextProperty;
+ public static readonly DependencyProperty CaptionFontSizeProperty;
+ public static readonly DependencyProperty CaptionForegroundProperty;
+ public static readonly DependencyProperty SignaturePromptTextProperty;
+ public static readonly DependencyProperty SignaturePromptFontSizeProperty;
+ public static readonly DependencyProperty SignaturePromptForegroundProperty;
+ public static readonly DependencyProperty ClearLabelTextProperty;
+ public static readonly DependencyProperty ClearLabelFontSizeProperty;
+ public static readonly DependencyProperty ClearLabelForegroundProperty;
+ public static readonly DependencyProperty BackgroundImageProperty;
+ public static readonly DependencyProperty BackgroundImageStretchProperty;
+ public static readonly DependencyProperty BackgroundImageOpacityProperty;
+
+ static SignaturePad ()
+ {
+ DefaultStyleKeyProperty.OverrideMetadata (
+ typeof (SignaturePad),
+ new FrameworkPropertyMetadata (typeof (SignaturePad)));
+
+
+ StrokeColorProperty = DependencyProperty.Register (
+ nameof (StrokeColor),
+ typeof (Color),
+ typeof (SignaturePad),
+ new PropertyMetadata (ImageConstructionSettings.DefaultStrokeColor));
+
+ StrokeWidthProperty = DependencyProperty.Register (
+ nameof (StrokeWidth),
+ typeof (double),
+ typeof (SignaturePad),
+ new PropertyMetadata ((double)ImageConstructionSettings.DefaultStrokeWidth));
+
+ SignatureLineBrushProperty = DependencyProperty.Register (
+ nameof (SignatureLineBrush),
+ typeof (Brush),
+ typeof (SignaturePad),
+ new PropertyMetadata (new SolidColorBrush (SignaturePadDarkColor)));
+
+ SignatureLineThicknessProperty = DependencyProperty.Register (
+ nameof (SignatureLineThickness),
+ typeof (double),
+ typeof (SignaturePad),
+ new PropertyMetadata ((double)DefaultLineThickness));
+
+ SignatureLineSpacingProperty = DependencyProperty.Register (
+ nameof (SignatureLineSpacing),
+ typeof (double),
+ typeof (SignaturePad),
+ new PropertyMetadata ((double)DefaultNarrowSpacing, OnPaddingChanged));
+
+ CaptionTextProperty = DependencyProperty.Register (
+ nameof (CaptionText),
+ typeof (string),
+ typeof (SignaturePad),
+ new PropertyMetadata (DefaultCaptionText));
+
+ CaptionFontSizeProperty = DependencyProperty.Register (
+ nameof (CaptionFontSize),
+ typeof (double),
+ typeof (SignaturePad),
+ new PropertyMetadata ((double)DefaultFontSize));
+
+ CaptionForegroundProperty = DependencyProperty.Register (
+ nameof (CaptionForeground),
+ typeof (Brush),
+ typeof (SignaturePad),
+ new PropertyMetadata (new SolidColorBrush (SignaturePadDarkColor)));
+
+ SignaturePromptTextProperty = DependencyProperty.Register (
+ nameof (SignaturePromptText),
+ typeof (string),
+ typeof (SignaturePad),
+ new PropertyMetadata (DefaultPromptText));
+
+ SignaturePromptFontSizeProperty = DependencyProperty.Register (
+ nameof (SignaturePromptFontSize),
+ typeof (double),
+ typeof (SignaturePad),
+ new PropertyMetadata ((double)DefaultFontSize));
+
+ SignaturePromptForegroundProperty = DependencyProperty.Register (
+ nameof (SignaturePromptForeground),
+ typeof (Brush),
+ typeof (SignaturePad),
+ new PropertyMetadata (new SolidColorBrush (SignaturePadDarkColor)));
+
+ ClearLabelTextProperty = DependencyProperty.Register (
+ nameof (ClearLabelText),
+ typeof (string),
+ typeof (SignaturePad),
+ new PropertyMetadata (DefaultClearLabelText));
+
+ ClearLabelFontSizeProperty = DependencyProperty.Register (
+ nameof (ClearLabelFontSize),
+ typeof (double),
+ typeof (SignaturePad),
+ new PropertyMetadata ((double)DefaultFontSize));
+
+ ClearLabelForegroundProperty = DependencyProperty.Register (
+ nameof (ClearLabelForeground),
+ typeof (Brush),
+ typeof (SignaturePad),
+ new PropertyMetadata (new SolidColorBrush (SignaturePadDarkColor)));
+
+ BackgroundImageProperty = DependencyProperty.Register (
+ nameof (BackgroundImage),
+ typeof (ImageSource),
+ typeof (SignaturePad),
+ new PropertyMetadata (null));
+
+ BackgroundImageStretchProperty = DependencyProperty.Register (
+ nameof (BackgroundImageStretch),
+ typeof (Stretch),
+ typeof (SignaturePad), new PropertyMetadata (Stretch.None));
+
+ BackgroundImageOpacityProperty = DependencyProperty.Register (
+ nameof (BackgroundImageOpacity),
+ typeof (double),
+ typeof (SignaturePad),
+ new PropertyMetadata (1.0));
+ }
+
+ public SignaturePad ()
+ {
+ DefaultStyleKey = typeof (SignaturePad);
+
+ //RegisterPropertyChangedCallback (PaddingProperty, OnPaddingChanged);
+
+ Padding = new Thickness (DefaultWideSpacing, DefaultWideSpacing, DefaultWideSpacing, DefaultNarrowSpacing);
+ OnApplyTemplate();
+ }
+
+ ///
+ public override void OnApplyTemplate()
+ {
+ base.OnApplyTemplate();
+
+ SignaturePadCanvas.StrokeCompleted += delegate
+ {
+ OnSignatureStrokeCompleted ();
+ };
+ SignaturePadCanvas.Cleared += delegate
+ {
+ OnSignatureCleared ();
+ };
+ ClearLabel.MouseDown += delegate
+ {
+ OnClearTapped ();
+ };
+
+ OnPaddingChanged (this, PaddingProperty);
+ UpdateUi ();
+ }
+
+ ///
+ /// The real signature canvas view
+ ///
+ public SignaturePadCanvasView SignaturePadCanvas => GetTemplateChild (PartSignaturePadCanvas) as SignaturePadCanvasView;
+
+ ///
+ /// The prompt displayed at the beginning of the signature line.
+ ///
+ public TextBlock SignaturePrompt => GetTemplateChild (PartSignaturePrompt) as TextBlock;
+
+ ///
+ /// The caption displayed under the signature line.
+ ///
+ public TextBlock Caption => GetTemplateChild (PartCaption) as TextBlock;
+
+ ///
+ /// An image view that may be used as a watermark or as a texture for the signature pad.
+ ///
+ public Image BackgroundImageView => GetTemplateChild (PartBackgroundImageView) as Image;
+
+ ///
+ /// Gets the label that clears the pad when clicked.
+ ///
+ public TextBlock ClearLabel => GetTemplateChild (PartClearLabel) as TextBlock;
+
+ ///
+ /// Gets the horizontal line that goes in the lower part of the pad.
+ ///
+ public Border SignatureLine => GetTemplateChild (PartSignatureLine) as Border;
+
+ public Color StrokeColor
+ {
+ get { return (Color)GetValue (StrokeColorProperty); }
+ set { SetValue (StrokeColorProperty, value); }
+ }
+
+ public double StrokeWidth
+ {
+ get { return (double)GetValue (StrokeWidthProperty); }
+ set { SetValue (StrokeWidthProperty, value); }
+ }
+
+ public Brush SignatureLineBrush
+ {
+ get { return (Brush)GetValue (SignatureLineBrushProperty); }
+ set { SetValue (SignatureLineBrushProperty, value); }
+ }
+
+ public Thickness SignatureLineThickness
+ {
+ get { return (Thickness)GetValue (SignatureLineThicknessProperty); }
+ set { SetValue (SignatureLineThicknessProperty, value); }
+ }
+
+ public double SignatureLineSpacing
+ {
+ get { return (double)GetValue (SignatureLineSpacingProperty); }
+ set { SetValue (SignatureLineSpacingProperty, value); }
+ }
+
+ public string CaptionText
+ {
+ get { return (string)GetValue (CaptionTextProperty); }
+ set { SetValue (CaptionTextProperty, value); }
+ }
+
+ public double CaptionFontSize
+ {
+ get { return (double)GetValue (CaptionFontSizeProperty); }
+ set { SetValue (CaptionFontSizeProperty, value); }
+ }
+
+ public Brush CaptionForeground
+ {
+ get { return (Brush)GetValue (CaptionForegroundProperty); }
+ set { SetValue (CaptionForegroundProperty, value); }
+ }
+
+ public string SignaturePromptText
+ {
+ get { return (string)GetValue (SignaturePromptTextProperty); }
+ set { SetValue (SignaturePromptTextProperty, value); }
+ }
+
+ public double SignaturePromptFontSize
+ {
+ get { return (double)GetValue (SignaturePromptFontSizeProperty); }
+ set { SetValue (SignaturePromptFontSizeProperty, value); }
+ }
+
+ public Brush SignaturePromptForeground
+ {
+ get { return (Brush)GetValue (SignaturePromptForegroundProperty); }
+ set { SetValue (SignaturePromptForegroundProperty, value); }
+ }
+
+ public string ClearLabelText
+ {
+ get { return (string)GetValue (ClearLabelTextProperty); }
+ set { SetValue (ClearLabelTextProperty, value); }
+ }
+
+ public double ClearLabelFontSize
+ {
+ get { return (double)GetValue (ClearLabelFontSizeProperty); }
+ set { SetValue (ClearLabelFontSizeProperty, value); }
+ }
+
+ public Brush ClearLabelForeground
+ {
+ get { return (Brush)GetValue (ClearLabelForegroundProperty); }
+ set { SetValue (ClearLabelForegroundProperty, value); }
+ }
+
+ public ImageSource BackgroundImage
+ {
+ get { return (ImageSource)GetValue (BackgroundImageProperty); }
+ set { SetValue (BackgroundImageProperty, value); }
+ }
+
+ public Stretch BackgroundImageStretch
+ {
+ get { return (Stretch)GetValue (BackgroundImageStretchProperty); }
+ set { SetValue (BackgroundImageStretchProperty, value); }
+ }
+
+ public double BackgroundImageOpacity
+ {
+ get { return (double)GetValue (BackgroundImageOpacityProperty); }
+ set { SetValue (BackgroundImageOpacityProperty, value); }
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ [Obsolete ("Use Background instead.")]
+ public Color BackgroundColor
+ {
+ get
+ {
+ var scb = Background as SolidColorBrush;
+ return scb == null ? Colors.Transparent : scb.Color;
+ }
+ set { Background = new SolidColorBrush (value); }
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ [Obsolete ("Use SignatureLineBrush instead.")]
+ public Color SignatureLineColor
+ {
+ get
+ {
+ var scb = SignatureLineBrush as SolidColorBrush;
+ return scb == null ? Colors.Transparent : scb.Color;
+ }
+ set { SignatureLineBrush = new SolidColorBrush (value); }
+ }
+
+ private void UpdateUi ()
+ {
+ ClearLabel.Visibility = IsBlank ? Visibility.Collapsed : Visibility.Visible;
+ }
+
+ private void OnPaddingChanged (DependencyObject sender, DependencyProperty dp)
+ {
+ var padding = Padding;
+ var spacing = SignatureLineSpacing;
+
+ if (SignatureLine != null)
+ {
+ SignatureLine.Margin = new Thickness (padding.Left, 0, padding.Right, 0);
+ }
+ if (Caption != null)
+ {
+ Caption.Margin = new Thickness (0, spacing, 0, padding.Bottom);
+ }
+ if (ClearLabel != null)
+ {
+ ClearLabel.Margin = new Thickness (0, padding.Top, padding.Right, 0);
+ }
+ if (SignaturePrompt != null)
+ {
+ SignaturePrompt.Margin = new Thickness (padding.Left, 0, 0, spacing);
+ }
+ }
+
+ private static void OnPaddingChanged (DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ((SignaturePad)d).OnPaddingChanged (d, e.Property);
+ }
+ }
+}
diff --git a/src/SignaturePad.WPF/SignaturePadCanvasView.cs b/src/SignaturePad.WPF/SignaturePadCanvasView.cs
new file mode 100644
index 0000000..6de7068
--- /dev/null
+++ b/src/SignaturePad.WPF/SignaturePadCanvasView.cs
@@ -0,0 +1,95 @@
+using System;
+using System.IO;
+using System.Linq;
+using System.Numerics;
+using System.Runtime.InteropServices.WindowsRuntime;
+using System.Threading.Tasks;
+
+namespace Xamarin.Controls
+{
+ using System.Drawing;
+ using System.Windows;
+ using System.Windows.Controls;
+ using System.Windows.Ink;
+ using System.Windows.Media;
+ using System.Windows.Media.Imaging;
+ using System.Windows.Threading;
+
+ public partial class SignaturePadCanvasView : InkCanvas
+ {
+ public static readonly DependencyProperty StrokeColorProperty;
+ public static readonly DependencyProperty StrokeWidthProperty;
+
+ InkCanvas inkPresenter => this;
+ static SignaturePadCanvasView ()
+ {
+ StrokeColorProperty = DependencyProperty.Register (
+ nameof (StrokeColor),
+ typeof (System.Windows.Media.Color),
+ typeof (SignaturePadCanvasView),
+ new PropertyMetadata (ImageConstructionSettings.DefaultStrokeColor, OnStrokePropertiesChanged));
+
+ StrokeWidthProperty = DependencyProperty.Register (
+ nameof (StrokeWidth),
+ typeof (double),
+ typeof (SignaturePadCanvasView),
+ new PropertyMetadata ((double)ImageConstructionSettings.DefaultStrokeWidth, OnStrokePropertiesChanged));
+ }
+
+ public SignaturePadCanvasView ()
+ {
+ DefaultStyleKey = typeof (SignaturePadCanvasView);
+ inkPresenter.Strokes.StrokesChanged += (sender, e) => OnStrokeCompleted ();
+ OnStrokePropertiesChanged (this, new DependencyPropertyChangedEventArgs (StrokeColorProperty, "", ""));
+ }
+
+ public System.Windows.Media.Color StrokeColor
+ {
+ get { return (System.Windows.Media.Color)GetValue (StrokeColorProperty); }
+ set { SetValue (StrokeColorProperty, value); }
+ }
+
+ public double StrokeWidth
+ {
+ get { return (double)GetValue (StrokeWidthProperty); }
+ set { SetValue (StrokeWidthProperty, value); }
+ }
+
+ public void Clear ()
+ {
+ if (Strokes != null)
+ {
+ inkPresenter.Strokes.Clear();
+ OnCleared ();
+ }
+ }
+
+ private Task GetImageStreamInternal (SignatureImageFormat format, System.Drawing.SizeF scale, RectangleF signatureBounds, System.Drawing.SizeF imageSize, float strokeWidth, System.Windows.Media.Color strokeColor, System.Windows.Media.Color backgroundColor)
+ {
+
+ return Task.FromResult(null);
+
+ }
+
+ private Bitmap GetImageInternal (System.Drawing.SizeF scale, System.Drawing.RectangleF signatureBounds,
+ System.Drawing.SizeF imageSize, float strokeWidth, System.Windows.Media.Color strokeColor, System.Windows.Media.Color backgroundColor)
+ {
+ return new Bitmap ("");
+ }
+
+ private static void OnStrokePropertiesChanged (DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ var signaturePad = d as SignaturePadCanvasView;
+
+ var inkPresenter = signaturePad?.Strokes;
+ if (inkPresenter != null)
+ {
+ foreach (var stroke in inkPresenter)
+ {
+ stroke.DrawingAttributes.Color = signaturePad.StrokeColor;
+ stroke.DrawingAttributes.Width = signaturePad.StrokeWidth;
+ }
+ }
+ }
+ }
+}
diff --git a/src/SignaturePad.WPF/Themes/Generic.xaml b/src/SignaturePad.WPF/Themes/Generic.xaml
new file mode 100644
index 0000000..e2b70bd
--- /dev/null
+++ b/src/SignaturePad.WPF/Themes/Generic.xaml
@@ -0,0 +1,97 @@
+
+
+
+
+
+
+
diff --git a/src/SignaturePad.iOS/InkPresenter.cs b/src/SignaturePad.iOS/InkPresenter.cs
index 9f70199..a56ce86 100644
--- a/src/SignaturePad.iOS/InkPresenter.cs
+++ b/src/SignaturePad.iOS/InkPresenter.cs
@@ -35,6 +35,11 @@ private void Initialize ()
public override void TouchesBegan (NSSet touches, UIEvent evt)
{
+ if (IsSingleLine)
+ {
+ Clear ();
+ }
+
// create a new path and set the options
currentPath = new InkStroke (UIBezierPath.Create (), new List (), StrokeColor, StrokeWidth);
diff --git a/src/SignaturePad.iOS/SignaturePad.iOS.csproj b/src/SignaturePad.iOS/SignaturePad.iOS.csproj
index 897473f..9eb7351 100644
--- a/src/SignaturePad.iOS/SignaturePad.iOS.csproj
+++ b/src/SignaturePad.iOS/SignaturePad.iOS.csproj
@@ -1,4 +1,4 @@
-
+
xamarin.ios1.0
@@ -30,15 +30,9 @@
xamarin,signature,handwriting,windows,ios,android,uwp
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/SignaturePad.sln b/src/SignaturePad.sln
index 800df94..79b1956 100644
--- a/src/SignaturePad.sln
+++ b/src/SignaturePad.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.26730.15
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.28711.60
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SignaturePad.iOS", "SignaturePad.iOS\SignaturePad.iOS.csproj", "{BEF71536-787B-431F-AC7F-A6469710D11F}"
EndProject
@@ -17,6 +17,18 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SignaturePad.UWP", "Signatu
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SignaturePad.Forms.UWP", "SignaturePad.Forms.UWP\SignaturePad.Forms.UWP.csproj", "{6FC62387-6717-4577-A48B-D15848741F08}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SignaturePad.WPF", "SignaturePad.WPF\SignaturePad.WPF.csproj", "{95F78ABF-197E-48D0-880C-6AA3A7A9FAA8}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SignaturePad.Forms.WPF", "SignaturePad.Forms.WPF\SignaturePad.Forms.WPF.csproj", "{873AB6F5-799A-417C-8FF3-9AE79C485B76}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SignaturePad.MacOS", "SignaturePad.MacOS\SignaturePad.MacOS.csproj", "{F38B60EA-24D9-4046-84A3-A9CE27D380D5}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SignaturePad.Forms.MacOS", "SignaturePad.Forms.MacOS\SignaturePad.Forms.MacOS.csproj", "{36299905-539E-4B5E-B2F8-669C37BA5EEC}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SignaturePad.GTK", "SignaturePad.GTK\SignaturePad.GTK.csproj", "{D2F332BC-5687-4339-877F-19E96286F24F}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SignaturePad.Forms.GTK", "SignaturePad.Forms.GTK\SignaturePad.Forms.GTK.csproj", "{BB7B3047-1AF8-46E8-BE1F-A9AD8600D72A}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -51,6 +63,30 @@ Global
{6FC62387-6717-4577-A48B-D15848741F08}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6FC62387-6717-4577-A48B-D15848741F08}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6FC62387-6717-4577-A48B-D15848741F08}.Release|Any CPU.Build.0 = Release|Any CPU
+ {95F78ABF-197E-48D0-880C-6AA3A7A9FAA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {95F78ABF-197E-48D0-880C-6AA3A7A9FAA8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {95F78ABF-197E-48D0-880C-6AA3A7A9FAA8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {95F78ABF-197E-48D0-880C-6AA3A7A9FAA8}.Release|Any CPU.Build.0 = Release|Any CPU
+ {873AB6F5-799A-417C-8FF3-9AE79C485B76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {873AB6F5-799A-417C-8FF3-9AE79C485B76}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {873AB6F5-799A-417C-8FF3-9AE79C485B76}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {873AB6F5-799A-417C-8FF3-9AE79C485B76}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F38B60EA-24D9-4046-84A3-A9CE27D380D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F38B60EA-24D9-4046-84A3-A9CE27D380D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F38B60EA-24D9-4046-84A3-A9CE27D380D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F38B60EA-24D9-4046-84A3-A9CE27D380D5}.Release|Any CPU.Build.0 = Release|Any CPU
+ {36299905-539E-4B5E-B2F8-669C37BA5EEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {36299905-539E-4B5E-B2F8-669C37BA5EEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {36299905-539E-4B5E-B2F8-669C37BA5EEC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {36299905-539E-4B5E-B2F8-669C37BA5EEC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D2F332BC-5687-4339-877F-19E96286F24F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D2F332BC-5687-4339-877F-19E96286F24F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D2F332BC-5687-4339-877F-19E96286F24F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D2F332BC-5687-4339-877F-19E96286F24F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {BB7B3047-1AF8-46E8-BE1F-A9AD8600D72A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {BB7B3047-1AF8-46E8-BE1F-A9AD8600D72A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {BB7B3047-1AF8-46E8-BE1F-A9AD8600D72A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {BB7B3047-1AF8-46E8-BE1F-A9AD8600D72A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/src/global.json b/src/global.json
new file mode 100644
index 0000000..7234e3b
--- /dev/null
+++ b/src/global.json
@@ -0,0 +1,5 @@
+{
+ "msbuild-sdks": {
+ "MSBuild.Sdk.Extras": "2.0.54"
+ }
+}
\ No newline at end of file
diff --git a/tools/packages.config b/tools/packages.config
index fff0175..4f3f97a 100644
--- a/tools/packages.config
+++ b/tools/packages.config
@@ -1,4 +1,4 @@
-
+