Repository: xamarin/SignaturePad
Branch: master
Commit: b32285178014
Files: 122
Total size: 369.9 KB
Directory structure:
gitextract_9f8fffgb/
├── .editorconfig
├── .gitignore
├── ISSUE_TEMPLATE.md
├── LICENSE
├── README.md
├── build.cake
├── build.ps1
├── build.sh
├── nuget/
│ ├── Xamarin.Controls.SignaturePad.Forms.nuspec
│ └── Xamarin.Controls.SignaturePad.nuspec
├── samples/
│ ├── Sample.Android/
│ │ ├── MainActivity.cs
│ │ ├── Properties/
│ │ │ ├── AndroidManifest.xml
│ │ │ └── AssemblyInfo.cs
│ │ ├── Resources/
│ │ │ ├── drawable/
│ │ │ │ └── background.xml
│ │ │ ├── layout/
│ │ │ │ └── main.axml
│ │ │ └── values/
│ │ │ └── strings.xml
│ │ ├── Sample.Android.csproj
│ │ └── Sample.Android.sln
│ ├── Sample.Forms/
│ │ ├── Sample.Forms.Mac.sln
│ │ ├── Sample.Forms.sln
│ │ ├── Samples/
│ │ │ ├── App.xaml
│ │ │ ├── App.xaml.cs
│ │ │ ├── BindingPage.xaml
│ │ │ ├── BindingPage.xaml.cs
│ │ │ ├── BindingPageViewModel.cs
│ │ │ ├── EventsPage.xaml
│ │ │ ├── EventsPage.xaml.cs
│ │ │ ├── Helpers/
│ │ │ │ ├── CaptureSignatureBehaviorBase.cs
│ │ │ │ ├── CaptureSignaturePointsBehavior.cs
│ │ │ │ ├── CaptureSignatureStrokesBehavior.cs
│ │ │ │ └── NotConverter.cs
│ │ │ ├── MainPage.xaml
│ │ │ ├── MainPage.xaml.cs
│ │ │ └── Samples.csproj
│ │ ├── Samples.Android/
│ │ │ ├── MainActivity.cs
│ │ │ ├── Properties/
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ └── AssemblyInfo.cs
│ │ │ ├── Resources/
│ │ │ │ ├── layout/
│ │ │ │ │ ├── tabs.xml
│ │ │ │ │ └── toolbar.xml
│ │ │ │ ├── values/
│ │ │ │ │ ├── colors.xml
│ │ │ │ │ ├── strings.xml
│ │ │ │ │ └── style.xml
│ │ │ │ └── values-v21/
│ │ │ │ └── style.xml
│ │ │ └── Samples.Android.csproj
│ │ ├── Samples.UWP/
│ │ │ ├── App.xaml
│ │ │ ├── App.xaml.cs
│ │ │ ├── MainPage.xaml
│ │ │ ├── MainPage.xaml.cs
│ │ │ ├── Package.appxmanifest
│ │ │ ├── Properties/
│ │ │ │ ├── AssemblyInfo.cs
│ │ │ │ └── Default.rd.xml
│ │ │ ├── Samples.UWP.csproj
│ │ │ └── Samples.UWP_TemporaryKey.pfx
│ │ └── Samples.iOS/
│ │ ├── AppDelegate.cs
│ │ ├── Entitlements.plist
│ │ ├── Info.plist
│ │ ├── LaunchScreen.storyboard
│ │ ├── Main.cs
│ │ ├── Properties/
│ │ │ └── AssemblyInfo.cs
│ │ ├── Resources/
│ │ │ └── Assets.xcassets/
│ │ │ └── AppIcons.appiconset/
│ │ │ └── Contents.json
│ │ └── Samples.iOS.csproj
│ ├── Sample.UWP/
│ │ ├── App.xaml
│ │ ├── App.xaml.cs
│ │ ├── MainPage.xaml
│ │ ├── MainPage.xaml.cs
│ │ ├── Package.appxmanifest
│ │ ├── Properties/
│ │ │ ├── AssemblyInfo.cs
│ │ │ └── Default.rd.xml
│ │ ├── Sample.UWP.csproj
│ │ ├── Sample.UWP.sln
│ │ └── Sample.UWP_TemporaryKey.pfx
│ └── Sample.iOS/
│ ├── AppDelegate.cs
│ ├── Entitlements.plist
│ ├── Info.plist
│ ├── LaunchScreen.storyboard
│ ├── Main.cs
│ ├── Main.storyboard
│ ├── Resources/
│ │ └── Assets.xcassets/
│ │ └── AppIcons.appiconset/
│ │ └── Contents.json
│ ├── Sample.iOS.csproj
│ ├── Sample.iOS.sln
│ ├── ViewController.cs
│ ├── ViewController.designer.cs
│ ├── iTunesArtwork
│ └── iTunesArtwork@2x
└── src/
├── SignaturePad.Android/
│ ├── InkPresenter.cs
│ ├── Resources/
│ │ ├── drawable/
│ │ │ └── signature_pad_background.xml
│ │ ├── layout/
│ │ │ └── signature_pad_layout.axml
│ │ └── values/
│ │ ├── attrs.xml
│ │ └── signature_pad_defaults.xml
│ ├── SignaturePad.Android.csproj
│ ├── SignaturePadCanvasView.cs
│ └── SignaturePadView.cs
├── SignaturePad.Forms/
│ ├── SignaturePad.Forms.csproj
│ └── SignaturePadCanvasRenderer.cs
├── SignaturePad.Forms.Droid/
│ ├── SignaturePad.Forms.Droid.csproj
│ └── SignaturePadViewRenderer.cs
├── SignaturePad.Forms.Platform.Shared/
│ ├── ColorExtensions.cs
│ └── SignaturePadCanvasRenderer.cs
├── SignaturePad.Forms.Shared/
│ ├── ImageConstructionSettings.cs
│ ├── SignatureImageFormat.cs
│ ├── SignaturePadCanvasView.cs
│ └── SignaturePadView.cs
├── SignaturePad.Forms.UWP/
│ └── SignaturePad.Forms.UWP.csproj
├── SignaturePad.Forms.iOS/
│ └── SignaturePad.Forms.iOS.csproj
├── SignaturePad.InkPresenter.Shared/
│ ├── InkPresenter.cs
│ └── InkStroke.cs
├── SignaturePad.Mac.sln
├── SignaturePad.Shared/
│ ├── Extensions.cs
│ ├── ImageConstructionSettings.cs
│ ├── PathSmoothing.cs
│ ├── SignatureImageFormat.cs
│ ├── SignaturePadCanvasView.cs
│ └── SignaturePadView.cs
├── SignaturePad.UWP/
│ ├── SignaturePad.UWP.csproj
│ ├── SignaturePad.cs
│ ├── SignaturePadCanvasView.cs
│ └── Themes/
│ └── Generic.xaml
├── SignaturePad.iOS/
│ ├── InkPresenter.cs
│ ├── SignaturePad.iOS.csproj
│ ├── SignaturePadCanvasView.cs
│ └── SignaturePadView.cs
└── SignaturePad.sln
================================================
FILE CONTENTS
================================================
================================================
FILE: .editorconfig
================================================
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Don't use tabs for indentation.
[*]
indent_style = space
# (Please don't specify an indent_size here; that has too many unintended consequences.)
# Code files
[*.{cs,csx,vb,vbx}]
indent_style = tab
indent_size = 4
insert_final_newline = true
charset = utf-8-bom
trim_trailing_whitespace = true
# Xml project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2
# Xml config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2
# JSON files
[*.json]
indent_size = 2
# .NET code style settings:
[*.{cs,vb}]
# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = true
# Avoid "this." and "Me." if not necessary
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion
# Use language keywords instead of framework type names for type references
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion
# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
# Expression-level preferences
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
# Null-checking preferences
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
# C# code style settings:
[*.cs]
# Modifier preferences
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
# Prefer "var" everywhere
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = true:suggestion
# Prefer method-like constructs to have a block body
csharp_style_expression_bodied_methods = false:suggestion
csharp_style_expression_bodied_constructors = false:suggestion
csharp_style_expression_bodied_operators = false:suggestion
# Prefer property-like constructs to have an expression-body
csharp_style_expression_bodied_properties = true:suggestion
csharp_style_expression_bodied_indexers = true:suggestion
csharp_style_expression_bodied_accessors = true:suggestion
# Pattern matching
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
# Inlined variable declarations
csharp_style_inlined_variable_declaration = true:suggestion
# Expression-level preferences
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_pattern_local_over_anonymous_function = true:suggestion
# "Null" checking preferences
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
# Code block preferences
csharp_prefer_braces = true:suggestion
# Newline settings
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true
# Indentation options
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = one_less_than_current
# Spacing options
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = do_not_ignore
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = true
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = true
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false
# Wrapping options
csharp_preserve_single_line_statements = false
csharp_preserve_single_line_blocks = true
# C# naming rules:
[*.cs]
# symbols
# const fields
dotnet_naming_symbols.constant_fields.required_modifiers = const
dotnet_naming_symbols.constant_fields.applicable_kinds = field
# methods|properties
dotnet_naming_symbols.methods_and_properties.applicable_kinds = delegate,event,enum,interface,struct,class,method,property
# parameters|fields
dotnet_naming_symbols.parameters_and_fields.applicable_kinds = field,parameter
# private|internal fields
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private,internal
# rules
# name all constant fields using PascalCase
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case
# name all methods and properties using PascalCase
dotnet_naming_rule.methods_and_properties_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.methods_and_properties_should_be_pascal_case.symbols = methods_and_properties
dotnet_naming_rule.methods_and_properties_should_be_pascal_case.style = pascal_case
# name all parameters and fields using camelCase
dotnet_naming_rule.parameters_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.parameters_should_be_pascal_case.symbols = parameters_and_fields
dotnet_naming_rule.parameters_should_be_pascal_case.style = camel_case
# internal and private fields should be camelCase
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case
================================================
FILE: .gitignore
================================================
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# Repo-specific files
tools/
output/
**/Resources/Resource.Designer.cs
component/*.xam
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.publishsettings
node_modules/
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
================================================
FILE: ISSUE_TEMPLATE.md
================================================
### Description
### Code
### Expected Behavior
### Actual Behavior
### Basic Information
- Version with issue:
- Last known good version:
- IDE:
- Platform Target Frameworks:
- Android:
- iOS:
- UWP:
- Xamarin.Forms:
- Target Devices:
-
### Screenshots
### Reproduction Link
================================================
FILE: LICENSE
================================================
The MIT License (MIT)
Copyright (c) 2017 Xamarin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
# Signature Pad
[](https://jenkins.mono-project.com/view/Components/job/Components-SignaturePad-Windows/) [](https://jenkins.mono-project.com/view/Components/job/Components-SignaturePad/)
[](https://www.nuget.org/packages/Xamarin.Controls.SignaturePad) [](https://www.nuget.org/packages/Xamarin.Controls.SignaturePad.Forms)
Signature Pad makes capturing, saving, exporting, and displaying signatures extremely simple on
Xamarin.iOS, Xamarin.Android and Windows.
Not only is Signature Pad available for native apps, but also available in Xamarin.Forms apps.

---
## Using Signature Pad
Signature Pad can be installed from [NuGet.org][nuget-link] for native Xamarin and Windows apps:
```
nuget install Xamarin.Controls.SignaturePad
```
And also for Xamarin.Forms apps:
```
nuget install Xamarin.Controls.SignaturePad.Forms
```
### Using Signature Pad on iOS
```csharp
using Xamarin.Controls;
var signatureView = new SignaturePadView (View.Frame) {
StrokeWidth = 3f,
StrokeColor = UIColor.Black,
BackgroundColor = UIColor.White,
};
```
### Using Signature Pad on Android
```csharp
using Xamarin.Controls;
var signatureView = new SignaturePadView (this) {
StrokeWidth = 3f,
StrokeColor = Color.White,
BackgroundColor = Color.Black
};
```
### Using Signature Pad on Windows
```xml
```
### Using Signature Pad on Xamarin.Forms
```xml
```
### Obtaining a Signature Image
The signature that was drawn on the canvas can be obtained as a image using the `GetImage(...)`
method overloads. The resulting image will be in the native platform image type:
```csharp
// iOS
UIImage image = signatureView.GetImage ();
// Android
Bitmap image = signatureView.GetImage ();
// Windows
WriteableBitmap bitmap = signatureView.GetImage ();
```
For Xamarin.Forms, there is no "native" image format, but `GetImageStreamAsync` can be used instead
to retrieve an encoded (jpeg or png) image stream:
```csharp
Stream bitmap = await signatureView.GetImageStreamAsync (SignatureImageFormat.Png);
```
### Obtaining the Signature Points
In addition to retrieving the signature as an image, the signature can also be retrieved as
as an array of points:
```csharp
var strokes = signatureView.Strokes;
```
These strokes can be used to save and restore a signature:
```csharp
// restore strokes (iOS, Android, Windows)
signatureView.LoadStrokes (newStrokes);
// restore strokes (Xamarin.Forms)
signatureView.Strokes = newStrokes;
```
---
## License
The license for this repository is specified in [LICENSE](LICENSE).
## .NET Foundation
This project is part of the [.NET Foundation](http://www.dotnetfoundation.org/projects).
[nuget-link]: https://www.nuget.org/packages/Xamarin.Controls.SignaturePad
================================================
FILE: build.cake
================================================
///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////
var CURRENT_PACKAGE_VERSION = "3.0.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") ?? "");
if (!string.IsNullOrEmpty(buildVersion)) {
buildVersion = $"-{buildVersion}";
}
///////////////////////////////////////////////////////////////////////////////
// TASKS
///////////////////////////////////////////////////////////////////////////////
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 } },
},
});
EnsureDirectoryExists("./output/android/");
EnsureDirectoryExists("./output/ios/");
EnsureDirectoryExists("./output/uwp/");
EnsureDirectoryExists("./output/uwp/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.UWP/bin/{configuration}/SignaturePad.*", "./output/uwp/");
CopyFiles($"./src/SignaturePad.UWP/bin/{configuration}/Themes/*", "./output/uwp/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.UWP/bin/{configuration}/SignaturePad.Forms.*", "./output/uwp/");
CopyFiles($"./src/SignaturePad.Forms.UWP/bin/{configuration}/Themes/*", "./output/uwp/Themes");
CopyFiles($"./src/SignaturePad.Forms/bin/{configuration}/SignaturePad.Forms.*", "./output/netstandard/");
});
Task("nuget")
.IsDependentOn("libs")
.WithCriteria(IsRunningOnWindows())
.Does(() =>
{
var nuget = Context.Tools.Resolve("nuget.exe");
var nuspecs = GetFiles("./nuget/*.nuspec");
var settings = new NuGetPackSettings {
BasePath = ".",
OutputDirectory = "./output",
Properties = new Dictionary {
{ "configuration", configuration },
{ "version", packageVersion },
},
};
EnsureDirectoryExists("./output");
NuGetPack(nuspecs, settings);
settings.Properties["version"] = $"{packageVersion}-preview{buildVersion}";
NuGetPack(nuspecs, settings);
});
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"),
};
if (IsRunningOnWindows()) {
MSBuild("./samples/Sample.Android/Sample.Android.sln", settings);
MSBuild("./samples/Sample.iOS/Sample.iOS.sln", settings);
MSBuild("./samples/Sample.UWP/Sample.UWP.sln", settings);
MSBuild("./samples/Sample.Forms/Sample.Forms.sln", settings);
} else {
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);
}
});
Task("Default")
.IsDependentOn("libs")
.IsDependentOn("nuget")
.IsDependentOn("samples");
Task("CI")
.IsDependentOn("Default");
RunTarget(target);
================================================
FILE: build.ps1
================================================
##########################################################################
# This is the Cake bootstrapper script for PowerShell.
# This file was downloaded from https://github.com/cake-build/resources
# Feel free to change this file to fit your needs.
##########################################################################
<#
.SYNOPSIS
This is a Powershell script to bootstrap a Cake build.
.DESCRIPTION
This Powershell script will download NuGet if missing, restore NuGet tools (including Cake)
and execute your Cake build script with the parameters you provide.
.PARAMETER Script
The build script to execute.
.PARAMETER Target
The build script target to run.
.PARAMETER Configuration
The build configuration to use.
.PARAMETER Verbosity
Specifies the amount of information to be displayed.
.PARAMETER ShowDescription
Shows description about tasks.
.PARAMETER DryRun
Performs a dry run.
.PARAMETER Experimental
Uses the nightly builds of the Roslyn script engine.
.PARAMETER Mono
Uses the Mono Compiler rather than the Roslyn script engine.
.PARAMETER SkipToolPackageRestore
Skips restoring of packages.
.PARAMETER ScriptArgs
Remaining arguments are added here.
.LINK
https://cakebuild.net
#>
[CmdletBinding()]
Param(
[string]$Script = "build.cake",
[string]$Target,
[string]$Configuration,
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
[string]$Verbosity,
[switch]$ShowDescription,
[Alias("WhatIf", "Noop")]
[switch]$DryRun,
[switch]$Experimental,
[switch]$Mono,
[switch]$SkipToolPackageRestore,
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
[string[]]$ScriptArgs
)
[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null
function MD5HashFile([string] $filePath)
{
if ([string]::IsNullOrEmpty($filePath) -or !(Test-Path $filePath -PathType Leaf))
{
return $null
}
[System.IO.Stream] $file = $null;
[System.Security.Cryptography.MD5] $md5 = $null;
try
{
$md5 = [System.Security.Cryptography.MD5]::Create()
$file = [System.IO.File]::OpenRead($filePath)
return [System.BitConverter]::ToString($md5.ComputeHash($file))
}
finally
{
if ($file -ne $null)
{
$file.Dispose()
}
}
}
function GetProxyEnabledWebClient
{
$wc = New-Object System.Net.WebClient
$proxy = [System.Net.WebRequest]::GetSystemWebProxy()
$proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
$wc.Proxy = $proxy
return $wc
}
Write-Host "Preparing to run build script..."
if(!$PSScriptRoot){
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
}
$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
$ADDINS_DIR = Join-Path $TOOLS_DIR "Addins"
$MODULES_DIR = Join-Path $TOOLS_DIR "Modules"
$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe"
$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config"
$PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum"
$ADDINS_PACKAGES_CONFIG = Join-Path $ADDINS_DIR "packages.config"
$MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config"
# Make sure tools folder exists
if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) {
Write-Verbose -Message "Creating tools directory..."
New-Item -Path $TOOLS_DIR -Type directory | out-null
}
# Make sure that packages.config exist.
if (!(Test-Path $PACKAGES_CONFIG)) {
Write-Verbose -Message "Downloading packages.config..."
try {
$wc = GetProxyEnabledWebClient
$wc.DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) } catch {
Throw "Could not download packages.config."
}
}
# Try find NuGet.exe in path if not exists
if (!(Test-Path $NUGET_EXE)) {
Write-Verbose -Message "Trying to find nuget.exe in PATH..."
$existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_ -PathType Container) }
$NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1
if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) {
Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)."
$NUGET_EXE = $NUGET_EXE_IN_PATH.FullName
}
}
# Try download NuGet.exe if not exists
if (!(Test-Path $NUGET_EXE)) {
Write-Verbose -Message "Downloading NuGet.exe..."
try {
$wc = GetProxyEnabledWebClient
$wc.DownloadFile($NUGET_URL, $NUGET_EXE)
} catch {
Throw "Could not download NuGet.exe."
}
}
# Save nuget.exe path to environment to be available to child processed
$ENV:NUGET_EXE = $NUGET_EXE
# Restore tools from NuGet?
if(-Not $SkipToolPackageRestore.IsPresent) {
Push-Location
Set-Location $TOOLS_DIR
# Check for changes in packages.config and remove installed tools if true.
[string] $md5Hash = MD5HashFile($PACKAGES_CONFIG)
if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or
($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) {
Write-Verbose -Message "Missing or changed package.config hash..."
Get-ChildItem -Exclude packages.config,nuget.exe,Cake.Bakery |
Remove-Item -Recurse
}
Write-Verbose -Message "Restoring tools from NuGet..."
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""
if ($LASTEXITCODE -ne 0) {
Throw "An error occurred while restoring NuGet tools."
}
else
{
$md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII"
}
Write-Verbose -Message ($NuGetOutput | out-string)
Pop-Location
}
# Restore addins from NuGet
if (Test-Path $ADDINS_PACKAGES_CONFIG) {
Push-Location
Set-Location $ADDINS_DIR
Write-Verbose -Message "Restoring addins from NuGet..."
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`""
if ($LASTEXITCODE -ne 0) {
Throw "An error occurred while restoring NuGet addins."
}
Write-Verbose -Message ($NuGetOutput | out-string)
Pop-Location
}
# Restore modules from NuGet
if (Test-Path $MODULES_PACKAGES_CONFIG) {
Push-Location
Set-Location $MODULES_DIR
Write-Verbose -Message "Restoring modules from NuGet..."
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`""
if ($LASTEXITCODE -ne 0) {
Throw "An error occurred while restoring NuGet modules."
}
Write-Verbose -Message ($NuGetOutput | out-string)
Pop-Location
}
# Make sure that Cake has been installed.
if (!(Test-Path $CAKE_EXE)) {
Throw "Could not find Cake.exe at $CAKE_EXE"
}
# Build Cake arguments
$cakeArguments = @("$Script");
if ($Target) { $cakeArguments += "-target=$Target" }
if ($Configuration) { $cakeArguments += "-configuration=$Configuration" }
if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" }
if ($ShowDescription) { $cakeArguments += "-showdescription" }
if ($DryRun) { $cakeArguments += "-dryrun" }
if ($Experimental) { $cakeArguments += "-experimental" }
if ($Mono) { $cakeArguments += "-mono" }
$cakeArguments += $ScriptArgs
# Start Cake
Write-Host "Running build script..."
&$CAKE_EXE $cakeArguments
exit $LASTEXITCODE
================================================
FILE: build.sh
================================================
#!/usr/bin/env bash
##########################################################################
# This is the Cake bootstrapper script for Linux and OS X.
# This file was downloaded from https://github.com/cake-build/resources
# Feel free to change this file to fit your needs.
##########################################################################
# Define directories.
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
TOOLS_DIR=$SCRIPT_DIR/tools
ADDINS_DIR=$TOOLS_DIR/Addins
MODULES_DIR=$TOOLS_DIR/Modules
NUGET_EXE=$TOOLS_DIR/nuget.exe
CAKE_EXE=$TOOLS_DIR/Cake/Cake.exe
PACKAGES_CONFIG=$TOOLS_DIR/packages.config
PACKAGES_CONFIG_MD5=$TOOLS_DIR/packages.config.md5sum
ADDINS_PACKAGES_CONFIG=$ADDINS_DIR/packages.config
MODULES_PACKAGES_CONFIG=$MODULES_DIR/packages.config
# Define md5sum or md5 depending on Linux/OSX
MD5_EXE=
if [[ "$(uname -s)" == "Darwin" ]]; then
MD5_EXE="md5 -r"
else
MD5_EXE="md5sum"
fi
# Define default arguments.
SCRIPT="build.cake"
CAKE_ARGUMENTS=()
# Parse arguments.
for i in "$@"; do
case $1 in
-s|--script) SCRIPT="$2"; shift ;;
--) shift; CAKE_ARGUMENTS+=("$@"); break ;;
*) CAKE_ARGUMENTS+=("$1") ;;
esac
shift
done
# Make sure the tools folder exist.
if [ ! -d "$TOOLS_DIR" ]; then
mkdir "$TOOLS_DIR"
fi
# Make sure that packages.config exist.
if [ ! -f "$TOOLS_DIR/packages.config" ]; then
echo "Downloading packages.config..."
curl -Lsfo "$TOOLS_DIR/packages.config" https://cakebuild.net/download/bootstrapper/packages
if [ $? -ne 0 ]; then
echo "An error occurred while downloading packages.config."
exit 1
fi
fi
# Download NuGet if it does not exist.
if [ ! -f "$NUGET_EXE" ]; then
echo "Downloading NuGet..."
curl -Lsfo "$NUGET_EXE" https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
if [ $? -ne 0 ]; then
echo "An error occurred while downloading nuget.exe."
exit 1
fi
fi
# Restore tools from NuGet.
pushd "$TOOLS_DIR" >/dev/null
if [ ! -f "$PACKAGES_CONFIG_MD5" ] || [ "$( cat "$PACKAGES_CONFIG_MD5" | sed 's/\r$//' )" != "$( $MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' )" ]; then
find . -type d ! -name . ! -name 'Cake.Bakery' | xargs rm -rf
fi
mono "$NUGET_EXE" install -ExcludeVersion
if [ $? -ne 0 ]; then
echo "Could not restore NuGet tools."
exit 1
fi
$MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' >| "$PACKAGES_CONFIG_MD5"
popd >/dev/null
# Restore addins from NuGet.
if [ -f "$ADDINS_PACKAGES_CONFIG" ]; then
pushd "$ADDINS_DIR" >/dev/null
mono "$NUGET_EXE" install -ExcludeVersion
if [ $? -ne 0 ]; then
echo "Could not restore NuGet addins."
exit 1
fi
popd >/dev/null
fi
# Restore modules from NuGet.
if [ -f "$MODULES_PACKAGES_CONFIG" ]; then
pushd "$MODULES_DIR" >/dev/null
mono "$NUGET_EXE" install -ExcludeVersion
if [ $? -ne 0 ]; then
echo "Could not restore NuGet modules."
exit 1
fi
popd >/dev/null
fi
# Make sure that Cake has been installed.
if [ ! -f "$CAKE_EXE" ]; then
echo "Could not find Cake.exe at '$CAKE_EXE'."
exit 1
fi
# Start Cake
exec mono "$CAKE_EXE" $SCRIPT "${CAKE_ARGUMENTS[@]}"
================================================
FILE: nuget/Xamarin.Controls.SignaturePad.Forms.nuspec
================================================
Xamarin.Controls.SignaturePad.Forms
SignaturePad for Xamarin.Forms
$version$
Microsoft
Microsoft
true
https://go.microsoft.com/fwlink/?linkid=874508
https://go.microsoft.com/fwlink/?linkid=874507
https://go.microsoft.com/fwlink/?linkid=874510
Makes capturing, saving, and displaying signatures extremely simple.
https://go.microsoft.com/fwlink/?linkid=874509
© Microsoft Corporation. All rights reserved.
xamarin,signature,handwriting,windows,ios,android,uwp,xamarin.forms
================================================
FILE: nuget/Xamarin.Controls.SignaturePad.nuspec
================================================
Xamarin.Controls.SignaturePad
SignaturePad for Xamarin and Windows
$version$
Microsoft
Microsoft
true
https://go.microsoft.com/fwlink/?linkid=874508
https://go.microsoft.com/fwlink/?linkid=874507
https://go.microsoft.com/fwlink/?linkid=874510
Makes capturing, saving, and displaying signatures extremely simple.
https://go.microsoft.com/fwlink/?linkid=874509
© Microsoft Corporation. All rights reserved.
xamarin,signature,handwriting,windows,ios,android,uwp
================================================
FILE: samples/Sample.Android/MainActivity.cs
================================================
using System.IO;
using Android.App;
using Android.Graphics;
using Android.OS;
using Android.Support.V7.App;
using Android.Widget;
using Xamarin.Controls;
namespace Sample.Android
{
[Activity (MainLauncher = true)]
public class MainActivity : AppCompatActivity
{
private System.Drawing.PointF[] points;
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.main);
var signatureView = FindViewById (Resource.Id.signatureView);
var btnSave = FindViewById