1
0
Форкнуть 0

Merge pull request #20 from dotnet/maui

Convert GraphicsControls to be .NET MAUI Handlers
This commit is contained in:
Javier Suárez 2021-05-01 11:10:13 +02:00 коммит произвёл GitHub
Родитель 578c07d7ba d2fe25507d
Коммит 408a5c21c8
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
217 изменённых файлов: 24755 добавлений и 20667 удалений

3
.gitmodules поставляемый
Просмотреть файл

@ -0,0 +1,3 @@
[submodule "src/maui"]
path = src/maui
url = https://github.com/dotnet/maui

14
NuGet.config Normal file
Просмотреть файл

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" protocolVersion="3" />
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" protocolVersion="3" />
<add key="dotnet6" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />
<add key="xamarin" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/xamarin-impl/nuget/v3/index.json" />
</packageSources>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
<disabledPackageSources />
</configuration>

113
README.md
Просмотреть файл

@ -1,25 +1,6 @@
# Experimental GraphicsControls
# Microsoft.Maui.Graphics.Controls
Xamarin.Forms allows you to define the user interface once for multiple platforms. It offers an abstraction layer that is converted on each platform into native controls.
While the native controls proposal is great as it offers the native experience (appearance, performance, etc). it has certain adjacent limitations like customization possibilities etc.
_What if you could choose at any time between using the native control or a drawn control with the native look and feel?_
**GraphicsControls** is a library that offers the controls available in Xamarin.Forms Visual allowing to choose between **Cupertino, Fluent and Material** but, instead of creating native controls, are **drawn controls**. This project is a **.NET experiment** related to Xamarin / .NET MAUI with different tests to validate the interest and feasibility of drawn controls but is not covered by Microsoft support.
<img src="images/graphicscontrols.png" Width="220" />
There is currently support for:
* **iOS** using CoreGraphics
* **macOS** using CoreGraphics
* **Android** using Android Graphics
* **Tizen** using SkiaSharp
Soon, support will be added to:
* **Linux** using SkiaSharp
* **UWP** using Win2D
* **WPF** using SharpDX
**Microsoft.Maui.Graphics.Controls** is a **.NET MAUI experiment** that offers drawn controls allowing to choose between **Cupertino, Fluent and Material**.
<img src="images/graphicscontrols-platforms.png" Width="600" />
@ -30,98 +11,10 @@ Soon, support will be added to:
This project is using **Microsoft.Maui.Graphics**.
[Microsoft.Maui.Graphics](https://github.com/dotnet/Microsoft.Maui.Graphics) is a cross-platform graphics library for iOS, Android, Windows, macOS and Linux completely in C#. With this library you can use a common API to target multiple abstractions allowing you to share your drawing code between platforms, or mix and match graphics implentations within a singular application.
## What controls are available?
Currently there are the following controls:
* **ActivityIndicator** (Cupertino, Fluent, Material)
* **BoxView**
* **Button** (Cupertino, Fluent, Material)
* **CheckBox** (Cupertino, Fluent, Material)
* **DatePicker** (Cupertino, Fluent, Material)
* **Editor** (Cupertino, Fluent, Material)
* **Entry** (Cupertino, Fluent, Material)
* **Frame**
* **ProgressBar** (Cupertino, Fluent, Material)
* **RadioButton** (Cupertino, Fluent, Material)
* **Slider** (Cupertino, Fluent, Material)
* **Stepper** (Cupertino, Fluent, Material)
* **Switch** (Cupertino, Fluent, Material)
* **TimePicker** (Cupertino, Fluent, Material)
The controls have the same properties and events as those existing in Xamarin.Forms.
## Features
The main features are:
#### Drawn controls
The controls are drawn getting a pixel perfect option to adjust in the same way on all the platforms.
<img src="images/graphicscontrols-isenabled.gif" Width="220" />
#### Easy to extend
_Do you want to extend a drawn control?_ Create your own control class, inherit from the drawn control and override the **Draw** method.
```
public class CustomControl : GraphicsView
{
public override void Draw(ICanvas canvas, RectangleF dirtyRect)
{
base.Draw(canvas, dirtyRect);
}
}
```
On the other hand, if you want to modify how a specific layer of an existing control is drawn, you just have to overwrite the method that draws the layer.
```
public class CustomSlider : Slider
{
protected override void DrawSliderThumb(ICanvas canvas, RectangleF dirtyRect)
{
base.DrawSliderThumb(canvas, dirtyRect);
}
}
```
Also can add new layers, delete existing layers or reorganize the priority when drawing the layers.
#### Dark Theme support
All controls, in the different visual modes (Cupertino, Fluent and Material) supports both light and dark theme.
<img src="images/graphicscontrols-darktheme.gif" Width="220" />
#### RTL support (Work in progress)
All controls support RTL.
<img src="images/graphicscontrols-rtl.png" Width="220" />
#### Mobile & Desktop support
<img src="images/graphicscontrols-mac.gif" Width="600" />
#### Accesibility support
Building an accessible application ensures that the application is usable by people who approach the user interface with a range of needs and experiences.
GraphicsControls will allow to set AutomationProperties, which in turn set native accessibility values.
(Work in progress)
#### Performance
Some native controls are complex. For example, Entry using Visual Material is made up of different elements. When using it, each of the different elements must be instantiated (the text box, the placeholder text, etc.). Using the drawn control, create an instance of a Canvas and draw the content. The time required to instantiate etc is shorter.
<img src="images/graphicscontrols-performance.png" Width="600" />
## Goals
* Have pixel-perfect drawn controls working on all the Xamarin.Forms supported platforms.
* Have pixel-perfect drawn controls working on all the .NET MAUI supported platforms.
* High performance and customization options controls.
* In the short term, the goal is to have the controls for Xamarin.Forms, in the future they could reach Comet, .NET MAUI, etc.
## Contributing

6
global.json Normal file
Просмотреть файл

@ -0,0 +1,6 @@
{
"msbuild-sdks": {
"MSBuild.Sdk.Extras": "3.0.23",
"Microsoft.Build.NoTargets": "2.0.1"
}
}

Просмотреть файл

@ -1,121 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.809.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphicsControls", "GraphicsControls\GraphicsControls.csproj", "{474A33AE-06A4-4219-9545-17751EBF3F84}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Library", "Library", "{4F0017DB-8A18-4153-A129-782B29DECF51}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sample", "Sample", "{465D03D3-BA73-4E52-BBEA-02DC54647BC6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphicsControls.Sample.iOS", "GraphicsControls.Sample.iOS\GraphicsControls.Sample.iOS.csproj", "{27FAE6FC-C7E2-4B63-B713-906A59A0C0DF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphicsControls.Sample", "GraphicsControls.Sample\GraphicsControls.Sample.csproj", "{41B421AF-5731-4B8F-BEDE-96155879D929}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphicsControls.Sample.macOS", "GraphicsControls.Sample.macOS\GraphicsControls.Sample.macOS.csproj", "{C351DAA7-20C0-474D-B610-F00C8BE5B0F1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphicsControls.Sample.Android", "GraphicsControls.Sample.Android\GraphicsControls.Sample.Android.csproj", "{2EE53371-EFD9-4304-A231-93E6F75DBC81}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{A6CE0398-E304-48E5-955B-DA2F77D6B940}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphicsControls.Tests", "GraphicsControls.Tests\GraphicsControls.Tests.csproj", "{AAE3033F-3E70-4CAB-A66E-96EDBE4AAA33}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|iPhone = Debug|iPhone
Debug|iPhoneSimulator = Debug|iPhoneSimulator
Release|Any CPU = Release|Any CPU
Release|iPhone = Release|iPhone
Release|iPhoneSimulator = Release|iPhoneSimulator
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{474A33AE-06A4-4219-9545-17751EBF3F84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{474A33AE-06A4-4219-9545-17751EBF3F84}.Debug|Any CPU.Build.0 = Debug|Any CPU
{474A33AE-06A4-4219-9545-17751EBF3F84}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{474A33AE-06A4-4219-9545-17751EBF3F84}.Debug|iPhone.Build.0 = Debug|Any CPU
{474A33AE-06A4-4219-9545-17751EBF3F84}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{474A33AE-06A4-4219-9545-17751EBF3F84}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{474A33AE-06A4-4219-9545-17751EBF3F84}.Release|Any CPU.ActiveCfg = Release|Any CPU
{474A33AE-06A4-4219-9545-17751EBF3F84}.Release|Any CPU.Build.0 = Release|Any CPU
{474A33AE-06A4-4219-9545-17751EBF3F84}.Release|iPhone.ActiveCfg = Release|Any CPU
{474A33AE-06A4-4219-9545-17751EBF3F84}.Release|iPhone.Build.0 = Release|Any CPU
{474A33AE-06A4-4219-9545-17751EBF3F84}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{474A33AE-06A4-4219-9545-17751EBF3F84}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{27FAE6FC-C7E2-4B63-B713-906A59A0C0DF}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
{27FAE6FC-C7E2-4B63-B713-906A59A0C0DF}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
{27FAE6FC-C7E2-4B63-B713-906A59A0C0DF}.Debug|iPhone.ActiveCfg = Debug|iPhone
{27FAE6FC-C7E2-4B63-B713-906A59A0C0DF}.Debug|iPhone.Build.0 = Debug|iPhone
{27FAE6FC-C7E2-4B63-B713-906A59A0C0DF}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{27FAE6FC-C7E2-4B63-B713-906A59A0C0DF}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{27FAE6FC-C7E2-4B63-B713-906A59A0C0DF}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator
{27FAE6FC-C7E2-4B63-B713-906A59A0C0DF}.Release|Any CPU.Build.0 = Release|iPhoneSimulator
{27FAE6FC-C7E2-4B63-B713-906A59A0C0DF}.Release|iPhone.ActiveCfg = Release|iPhone
{27FAE6FC-C7E2-4B63-B713-906A59A0C0DF}.Release|iPhone.Build.0 = Release|iPhone
{27FAE6FC-C7E2-4B63-B713-906A59A0C0DF}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{27FAE6FC-C7E2-4B63-B713-906A59A0C0DF}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{41B421AF-5731-4B8F-BEDE-96155879D929}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{41B421AF-5731-4B8F-BEDE-96155879D929}.Debug|Any CPU.Build.0 = Debug|Any CPU
{41B421AF-5731-4B8F-BEDE-96155879D929}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{41B421AF-5731-4B8F-BEDE-96155879D929}.Debug|iPhone.Build.0 = Debug|Any CPU
{41B421AF-5731-4B8F-BEDE-96155879D929}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{41B421AF-5731-4B8F-BEDE-96155879D929}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{41B421AF-5731-4B8F-BEDE-96155879D929}.Release|Any CPU.ActiveCfg = Release|Any CPU
{41B421AF-5731-4B8F-BEDE-96155879D929}.Release|Any CPU.Build.0 = Release|Any CPU
{41B421AF-5731-4B8F-BEDE-96155879D929}.Release|iPhone.ActiveCfg = Release|Any CPU
{41B421AF-5731-4B8F-BEDE-96155879D929}.Release|iPhone.Build.0 = Release|Any CPU
{41B421AF-5731-4B8F-BEDE-96155879D929}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{41B421AF-5731-4B8F-BEDE-96155879D929}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{C351DAA7-20C0-474D-B610-F00C8BE5B0F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C351DAA7-20C0-474D-B610-F00C8BE5B0F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C351DAA7-20C0-474D-B610-F00C8BE5B0F1}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{C351DAA7-20C0-474D-B610-F00C8BE5B0F1}.Debug|iPhone.Build.0 = Debug|Any CPU
{C351DAA7-20C0-474D-B610-F00C8BE5B0F1}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{C351DAA7-20C0-474D-B610-F00C8BE5B0F1}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{C351DAA7-20C0-474D-B610-F00C8BE5B0F1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C351DAA7-20C0-474D-B610-F00C8BE5B0F1}.Release|Any CPU.Build.0 = Release|Any CPU
{C351DAA7-20C0-474D-B610-F00C8BE5B0F1}.Release|iPhone.ActiveCfg = Release|Any CPU
{C351DAA7-20C0-474D-B610-F00C8BE5B0F1}.Release|iPhone.Build.0 = Release|Any CPU
{C351DAA7-20C0-474D-B610-F00C8BE5B0F1}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{C351DAA7-20C0-474D-B610-F00C8BE5B0F1}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Debug|iPhone.Build.0 = Debug|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Release|Any CPU.Build.0 = Release|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Release|iPhone.ActiveCfg = Release|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Release|iPhone.Build.0 = Release|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{AAE3033F-3E70-4CAB-A66E-96EDBE4AAA33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AAE3033F-3E70-4CAB-A66E-96EDBE4AAA33}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AAE3033F-3E70-4CAB-A66E-96EDBE4AAA33}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{AAE3033F-3E70-4CAB-A66E-96EDBE4AAA33}.Debug|iPhone.Build.0 = Debug|Any CPU
{AAE3033F-3E70-4CAB-A66E-96EDBE4AAA33}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{AAE3033F-3E70-4CAB-A66E-96EDBE4AAA33}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{AAE3033F-3E70-4CAB-A66E-96EDBE4AAA33}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AAE3033F-3E70-4CAB-A66E-96EDBE4AAA33}.Release|Any CPU.Build.0 = Release|Any CPU
{AAE3033F-3E70-4CAB-A66E-96EDBE4AAA33}.Release|iPhone.ActiveCfg = Release|Any CPU
{AAE3033F-3E70-4CAB-A66E-96EDBE4AAA33}.Release|iPhone.Build.0 = Release|Any CPU
{AAE3033F-3E70-4CAB-A66E-96EDBE4AAA33}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{AAE3033F-3E70-4CAB-A66E-96EDBE4AAA33}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{474A33AE-06A4-4219-9545-17751EBF3F84} = {4F0017DB-8A18-4153-A129-782B29DECF51}
{27FAE6FC-C7E2-4B63-B713-906A59A0C0DF} = {465D03D3-BA73-4E52-BBEA-02DC54647BC6}
{41B421AF-5731-4B8F-BEDE-96155879D929} = {465D03D3-BA73-4E52-BBEA-02DC54647BC6}
{C351DAA7-20C0-474D-B610-F00C8BE5B0F1} = {465D03D3-BA73-4E52-BBEA-02DC54647BC6}
{2EE53371-EFD9-4304-A231-93E6F75DBC81} = {465D03D3-BA73-4E52-BBEA-02DC54647BC6}
{AAE3033F-3E70-4CAB-A66E-96EDBE4AAA33} = {A6CE0398-E304-48E5-955B-DA2F77D6B940}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {475B4FFA-17B6-449C-9D09-DE4E2B0D2F4B}
EndGlobalSection
EndGlobal

Просмотреть файл

@ -54,14 +54,11 @@
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.8.0.1687" />
<PackageReference Include="Xamarin.Essentials" Version="1.5.3.2" />
</ItemGroup>
<ItemGroup>
<Compile Include="MainActivity.cs" />
<Compile Include="Resources\Resource.designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="MainApplication.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\AboutResources.txt" />
@ -98,6 +95,18 @@
<Project>{474A33AE-06A4-4219-9545-17751EBF3F84}</Project>
<Name>GraphicsControls</Name>
</ProjectReference>
<ProjectReference Include="..\maui\src\Core\src\Core.csproj">
<Project>{8EF59C96-7972-41C6-830B-59FC81B9AD7B}</Project>
<Name>Core</Name>
</ProjectReference>
<ProjectReference Include="..\maui\src\Compatibility\Core\src\Android\Compatibility.Android.csproj">
<Project>{F602BE45-8096-4A38-BF1B-28EF078E51E1}</Project>
<Name>Compatibility.Android</Name>
</ProjectReference>
<ProjectReference Include="..\maui\src\Compatibility\Core\src\Android.FormsViewGroup\Compatibility.Android.FormsViewGroup.csproj">
<Project>{FDA97CEE-D0A1-48ED-B555-1E90B7CA1468}</Project>
<Name>Compatibility.Android.FormsViewGroup</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
</Project>

Просмотреть файл

@ -1,7 +1,6 @@
using Android.App;
using Android.Content.PM;
using Android.Runtime;
using Android.OS;
using Microsoft.Maui;
namespace GraphicsControls.Sample.Droid
{
@ -11,25 +10,7 @@ namespace GraphicsControls.Sample.Droid
Theme = "@style/MainTheme",
MainLauncher = true,
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize)]
public class MainActivity : Xamarin.Forms.Platform.Android.FormsAppCompatActivity
public class MainActivity : MauiAppCompatActivity
{
protected override void OnCreate(Bundle savedInstanceState)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(savedInstanceState);
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
Xamarin.Forms.Forms.Init(this, savedInstanceState);
LoadApplication(new App());
}
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Permission[] grantResults)
{
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
}
}
}

Просмотреть файл

@ -0,0 +1,16 @@
using System;
using Android.App;
using Android.Runtime;
using Microsoft.Maui;
using Microsoft.Maui.Graphics.Controls;
namespace GraphicsControls.Sample.Droid
{
[Application]
public class MainApplication : MauiApplication<Startup>
{
public MainApplication(IntPtr handle, JniHandleOwnership ownership) : base(handle, ownership)
{
}
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,124 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Xamarin.Forms.4.8.0.1687\build\Xamarin.Forms.props" Condition="Exists('..\packages\Xamarin.Forms.4.8.0.1687\build\Xamarin.Forms.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{79952688-FF1B-4813-A7E7-97C15F73B534}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>GraphicsControls.Sample.GTK</RootNamespace>
<AssemblyName>GraphicsControls.Sample.GTK</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="OpenTK, Version=3.0.1.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<HintPath>..\packages\OpenTK.3.0.1\lib\net20\OpenTK.dll</HintPath>
</Reference>
<Reference Include="SkiaSharp, Version=2.80.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\SkiaSharp.2.80.2\lib\net462\SkiaSharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SkiaSharp.Views.Desktop.Common, Version=2.80.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\SkiaSharp.Views.Desktop.Common.2.80.2\lib\net462\SkiaSharp.Views.Desktop.Common.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SkiaSharp.Views.Gtk, Version=2.80.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\SkiaSharp.Views.Gtk2.2.80.2\lib\net462\SkiaSharp.Views.Gtk.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.4.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="webkit-sharp, Version=1.1.15.0, Culture=neutral, PublicKeyToken=eaa1d335d2e19745, processorArchitecture=MSIL">
<HintPath>..\packages\Xamarin.Forms.Platform.GTK.4.8.0.1687\lib\net45\webkit-sharp.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Xamarin.Forms.4.8.0.1687\lib\netstandard2.0\Xamarin.Forms.Core.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Xamarin.Forms.4.8.0.1687\lib\netstandard2.0\Xamarin.Forms.Platform.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform.GTK, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Xamarin.Forms.Platform.GTK.4.8.0.1687\lib\net45\Xamarin.Forms.Platform.GTK.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Xaml, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Xamarin.Forms.4.8.0.1687\lib\netstandard2.0\Xamarin.Forms.Xaml.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GraphicsControls.Sample\GraphicsControls.Sample.csproj">
<Project>{41b421af-5731-4b8f-bede-96155879d929}</Project>
<Name>GraphicsControls.Sample</Name>
</ProjectReference>
<ProjectReference Include="..\GraphicsControls\GraphicsControls.csproj">
<Project>{474a33ae-06a4-4219-9545-17751ebf3f84}</Project>
<Name>GraphicsControls</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="OpenTK.dll.config" />
<None Include="packages.config" />
<None Include="webkit-sharp.dll.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Xamarin.Forms.4.8.0.1687\build\Xamarin.Forms.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Forms.4.8.0.1687\build\Xamarin.Forms.props'))" />
<Error Condition="!Exists('..\packages\Xamarin.Forms.4.8.0.1687\build\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Forms.4.8.0.1687\build\Xamarin.Forms.targets'))" />
<Error Condition="!Exists('..\packages\SkiaSharp.2.80.2\build\net462\SkiaSharp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SkiaSharp.2.80.2\build\net462\SkiaSharp.targets'))" />
</Target>
<Import Project="..\packages\Xamarin.Forms.4.8.0.1687\build\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.4.8.0.1687\build\Xamarin.Forms.targets')" />
<Import Project="..\packages\SkiaSharp.2.80.2\build\net462\SkiaSharp.targets" Condition="Exists('..\packages\SkiaSharp.2.80.2\build\net462\SkiaSharp.targets')" />
</Project>

Просмотреть файл

@ -1,25 +0,0 @@
<configuration>
<dllmap os="linux" dll="opengl32.dll" target="libGL.so.1"/>
<dllmap os="linux" dll="glu32.dll" target="libGLU.so.1"/>
<dllmap os="linux" dll="openal32.dll" target="libopenal.so.1"/>
<dllmap os="linux" dll="alut.dll" target="libalut.so.0"/>
<dllmap os="linux" dll="opencl.dll" target="libOpenCL.so"/>
<dllmap os="linux" dll="libX11" target="libX11.so.6"/>
<dllmap os="linux" dll="libXi" target="libXi.so.6"/>
<dllmap os="linux" dll="SDL2.dll" target="libSDL2-2.0.so.0"/>
<dllmap os="osx" dll="opengl32.dll" target="/System/Library/Frameworks/OpenGL.framework/OpenGL"/>
<dllmap os="osx" dll="openal32.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
<dllmap os="osx" dll="alut.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
<dllmap os="osx" dll="libGLES.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
<dllmap os="osx" dll="libGLESv1_CM.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
<dllmap os="osx" dll="libGLESv2.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
<dllmap os="osx" dll="opencl.dll" target="/System/Library/Frameworks/OpenCL.framework/OpenCL"/>
<dllmap os="osx" dll="SDL2.dll" target="libSDL2.dylib"/>
<!-- XQuartz compatibility (X11 on Mac) -->
<dllmap os="osx" dll="libGL.so.1" target="/usr/X11/lib/libGL.dylib"/>
<dllmap os="osx" dll="libX11" target="/usr/X11/lib/libX11.dylib"/>
<dllmap os="osx" dll="libXcursor.so.1" target="/usr/X11/lib/libXcursor.dylib"/>
<dllmap os="osx" dll="libXi" target="/usr/X11/lib/libXi.dylib"/>
<dllmap os="osx" dll="libXinerama" target="/usr/X11/lib/libXinerama.dylib"/>
<dllmap os="osx" dll="libXrandr.so.2" target="/usr/X11/lib/libXrandr.dylib"/>
</configuration>

Просмотреть файл

@ -1,28 +0,0 @@
using System;
using Xamarin.Forms;
using Xamarin.Forms.Platform.GTK;
using Xamarin.Forms.Platform.GTK.Extensions;
namespace GraphicsControls.Sample.GTK
{
class Program
{
[STAThread]
static void Main(string[] args)
{
Gtk.Application.Init();
Forms.Init();
var app = new App();
var window = new FormsWindow();
window.LoadApplication(app);
window.SetApplicationTitle("GraphicsControls");
//window.SetSize(800, 1000);
window.Show();
Gtk.Application.Run();
GraphicsControls.GTK.GraphicsViewRenderer.Init();
}
}
}

Просмотреть файл

@ -1,36 +0,0 @@
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("GraphicsControls.Sample.GTK")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GraphicsControls.Sample.GTK")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[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("79952688-ff1b-4813-a7e7-97c15f73b534")]
// 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")]

Просмотреть файл

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="OpenTK" version="3.0.1" targetFramework="net471" />
<package id="SkiaSharp" version="2.80.2" targetFramework="net471" />
<package id="SkiaSharp.Views.Desktop.Common" version="2.80.2" targetFramework="net471" />
<package id="SkiaSharp.Views.Gtk2" version="2.80.2" targetFramework="net471" />
<package id="System.Buffers" version="4.4.0" targetFramework="net471" />
<package id="System.Memory" version="4.5.3" targetFramework="net471" />
<package id="System.Numerics.Vectors" version="4.4.0" targetFramework="net471" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net471" />
<package id="Xamarin.Forms" version="4.8.0.1687" targetFramework="net471" />
<package id="Xamarin.Forms.Platform.GTK" version="4.8.0.1687" targetFramework="net471" />
</packages>

Просмотреть файл

@ -1,5 +0,0 @@
<configuration>
<dllmap dll="webkit-1.0" target="libwebkitgtk-1.0.0.dylib"/>
<dllmap dll="webkit-1.0" os="linux" target="libwebkitgtk-1.0.so.0"/>
<dllmap dll="webkit-1.0" os="windows" target="libwebkitgtk-1.0-0.dll"/>
</configuration>

Просмотреть файл

@ -1,19 +0,0 @@
<Project Sdk="Tizen.NET.Sdk/1.1.5">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>tizen40</TargetFramework>
<AssemblyName>GraphicsControls.Sample.Tizen</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="5.0.0.1905" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GraphicsControls.Sample\GraphicsControls.Sample.csproj" />
<ProjectReference Include="..\GraphicsControls\GraphicsControls.csproj" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,30 +0,0 @@
using System;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Tizen;
using System.Graphics.Skia.Views;
namespace GraphicsControls.Sample.Tizen
{
class Program : FormsApplication
{
protected override void OnCreate()
{
base.OnCreate();
var app = new App();
app.UserAppTheme = OSAppTheme.Light;
LoadApplication(app);
}
static void Main(string[] args)
{
var app = new Program();
var option = new InitializationOptions(app)
{
DisplayResolutionUnit = DisplayResolutionUnit.DP(true),
UseSkiaSharp = true
};
Forms.Init(option);
app.Run(args);
}
}
}

Двоичные данные
src/GraphicsControls.Sample.Tizen/res/image.jpg

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 253 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 9.9 KiB

Просмотреть файл

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns="http://tizen.org/ns/packages" api-version="4" package="org.tizen.example.GraphicsControls.Sample.Tizen" version="1.0.0">
<profile name="common" />
<ui-application appid="org.tizen.example.GraphicsControls.Sample.Tizen"
exec="GraphicsControls.Sample.Tizen.dll"
type="dotnet"
multiple="false"
taskmanage="true"
nodisplay="false"
launch_mode="single"
>
<label>GraphicsControls.Sample.Tizen</label>
<icon>GraphicsControls.Sample.Tizen.png</icon>
<metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
</ui-application>
</manifest>

Просмотреть файл

@ -1,28 +1,11 @@
using Foundation;
using UIKit;
using Microsoft.Maui;
using Microsoft.Maui.Graphics.Controls;
namespace GraphicsControls.Sample.iOS
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
// application events from iOS.
[Register("AppDelegate")]
public partial class AppDelegate : Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
Xamarin.Forms.FormsMaterial.Init();
Xamarin.Forms.Forms.Init();
LoadApplication(new App());
return base.FinishedLaunching(app, options);
}
}
}
public class AppDelegate : MauiUIApplicationDelegate<Startup>
{
}
}

Просмотреть файл

@ -122,13 +122,6 @@
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.8.0.1687" />
<PackageReference Include="Xamarin.Essentials" Version="1.5.3.2" />
<PackageReference Include="Xamarin.Forms.Visual.Material">
<Version>4.8.0.1687</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GraphicsControls.Sample\GraphicsControls.Sample.csproj">
<Project>{41B421AF-5731-4B8F-BEDE-96155879D929}</Project>
@ -138,6 +131,14 @@
<Project>{474A33AE-06A4-4219-9545-17751EBF3F84}</Project>
<Name>GraphicsControls</Name>
</ProjectReference>
<ProjectReference Include="..\maui\src\Core\src\Core.csproj">
<Project>{8EF59C96-7972-41C6-830B-59FC81B9AD7B}</Project>
<Name>Core</Name>
</ProjectReference>
<ProjectReference Include="..\maui\src\Compatibility\Core\src\iOS\Compatibility.iOS.csproj">
<Project>{271193C1-6E7C-429C-A36D-3F1BE5267231}</Project>
<Name>Compatibility.iOS</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\image.jpg" />

Просмотреть файл

@ -1,44 +0,0 @@
using AppKit;
using CoreGraphics;
using Foundation;
using Xamarin.Forms;
using Xamarin.Forms.Platform.MacOS;
namespace GraphicsControls.Sample.macOS
{
[Register("AppDelegate")]
public class AppDelegate : FormsApplicationDelegate
{
readonly NSWindow _window;
public AppDelegate()
{
var style = NSWindowStyle.Closable | NSWindowStyle.Resizable | NSWindowStyle.Titled;
var rect = new CGRect(500, 1000, 1024, 768);
_window = new NSWindow(rect, style, NSBackingStore.Buffered, false)
{
Title = "GraphicsControls",
TitleVisibility = NSWindowTitleVisibility.Hidden
};
}
public override NSWindow MainWindow
{
get { return _window; }
}
public override void DidFinishLaunching(NSNotification notification)
{
Forms.Init();
LoadApplication(new App());
base.DidFinishLaunching(notification);
}
public override void WillTerminate(NSNotification notification)
{
// Insert code here to tear down your application
}
}
}

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 7.9 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 20 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 711 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 20 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 58 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 3.3 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 58 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 174 KiB

Просмотреть файл

@ -1,68 +0,0 @@
{
"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"
}
}

Просмотреть файл

@ -1,6 +0,0 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Просмотреть файл

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
</dict>
</plist>

Просмотреть файл

@ -1,109 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Xamarin.Forms.4.8.0.1687\build\Xamarin.Forms.props" Condition="Exists('..\packages\Xamarin.Forms.4.8.0.1687\build\Xamarin.Forms.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C351DAA7-20C0-474D-B610-F00C8BE5B0F1}</ProjectGuid>
<ProjectTypeGuids>{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>GraphicsControls.Sample.macOS</RootNamespace>
<AssemblyName>GraphicsControls.Sample.macOS</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<TargetFrameworkIdentifier>Xamarin.Mac</TargetFrameworkIdentifier>
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<EnableCodeSigning>false</EnableCodeSigning>
<CodeSigningKey>Mac Developer</CodeSigningKey>
<CreatePackage>false</CreatePackage>
<EnablePackageSigning>false</EnablePackageSigning>
<IncludeMonoRuntime>false</IncludeMonoRuntime>
<UseSGen>true</UseSGen>
<UseRefCounting>true</UseRefCounting>
<HttpClientHandler></HttpClientHandler>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<DefineConstants></DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<EnableCodeSigning>false</EnableCodeSigning>
<CreatePackage>true</CreatePackage>
<EnablePackageSigning>false</EnablePackageSigning>
<IncludeMonoRuntime>true</IncludeMonoRuntime>
<UseSGen>true</UseSGen>
<UseRefCounting>true</UseRefCounting>
<CodeSignEntitlements>Entitlements.plist</CodeSignEntitlements>
<LinkMode>SdkOnly</LinkMode>
<HttpClientHandler></HttpClientHandler>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.Mac" />
<Reference Include="Xamarin.Forms.Core">
<HintPath>..\packages\Xamarin.Forms.4.8.0.1687\lib\Xamarin.Mac\Xamarin.Forms.Core.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform">
<HintPath>..\packages\Xamarin.Forms.4.8.0.1687\lib\Xamarin.Mac\Xamarin.Forms.Platform.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Xaml">
<HintPath>..\packages\Xamarin.Forms.4.8.0.1687\lib\Xamarin.Mac\Xamarin.Forms.Xaml.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-128.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-128%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-16.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-16%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-256.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-256%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-32.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-32%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-512.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-512%402x.png" />
<ImageAsset Include="Assets.xcassets\Contents.json" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
<None Include="Entitlements.plist" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<Compile Include="ViewController.cs" />
<Compile Include="ViewController.designer.cs">
<DependentUpon>ViewController.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="Main.storyboard" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GraphicsControls\GraphicsControls.csproj">
<Project>{474A33AE-06A4-4219-9545-17751EBF3F84}</Project>
<Name>GraphicsControls</Name>
</ProjectReference>
<ProjectReference Include="..\GraphicsControls.Sample\GraphicsControls.Sample.csproj">
<Project>{41B421AF-5731-4B8F-BEDE-96155879D929}</Project>
<Name>GraphicsControls.Sample</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
<Import Project="..\packages\Xamarin.Forms.4.8.0.1687\build\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.4.8.0.1687\build\Xamarin.Forms.targets')" />
</Project>

Просмотреть файл

@ -1,32 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>GraphicsControls.Sample.macOS</string>
<key>CFBundleIdentifier</key>
<string>com.companyname.GraphicsControls-Sample-macOS</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>10.14</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSMainStoryboardFile</key>
<string>Main</string>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/AppIcon.appiconset</string>
</dict>
</plist>

Просмотреть файл

@ -1,14 +0,0 @@
using AppKit;
namespace GraphicsControls.Sample.macOS
{
static class MainClass
{
static void Main(string[] args)
{
NSApplication.Init();
NSApplication.SharedApplication.Delegate = new AppDelegate();
NSApplication.Main(args);
}
}
}

Просмотреть файл

@ -1,719 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17701"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Application-->
<scene sceneID="JPo-4y-FX3">
<objects>
<application id="hnw-xV-0zn" sceneMemberID="viewController">
<menu key="mainMenu" title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
<items>
<menuItem title="GraphicsControls.Sample.macOS" id="1Xt-HY-uBw">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="GraphicsControls.Sample.macOS" systemMenu="apple" id="uQy-DD-JDr">
<items>
<menuItem title="About GraphicsControls.Sample.macOS" id="5kV-Vb-QxS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontStandardAboutPanel:" target="Ady-hI-5gd" id="Exp-CZ-Vem"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
<menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"/>
<menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/>
<menuItem title="Services" id="NMo-om-nkz">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
<menuItem title="Hide GraphicsControls.Sample.macOS" keyEquivalent="h" id="Olw-nP-bQN">
<connections>
<action selector="hide:" target="Ady-hI-5gd" id="PnN-Uc-m68"/>
</connections>
</menuItem>
<menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="hideOtherApplications:" target="Ady-hI-5gd" id="VT4-aY-XCT"/>
</connections>
</menuItem>
<menuItem title="Show All" id="Kd2-mp-pUS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="unhideAllApplications:" target="Ady-hI-5gd" id="Dhg-Le-xox"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
<menuItem title="Quit GraphicsControls.Sample.macOS" keyEquivalent="q" id="4sb-4s-VLi">
<connections>
<action selector="terminate:" target="Ady-hI-5gd" id="Te7-pn-YzF"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="File" id="dMs-cI-mzQ">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="File" id="bib-Uj-vzu">
<items>
<menuItem title="New" keyEquivalent="n" id="Was-JA-tGl">
<connections>
<action selector="newDocument:" target="Ady-hI-5gd" id="4Si-XN-c54"/>
</connections>
</menuItem>
<menuItem title="Open…" keyEquivalent="o" id="IAo-SY-fd9">
<connections>
<action selector="openDocument:" target="Ady-hI-5gd" id="bVn-NM-KNZ"/>
</connections>
</menuItem>
<menuItem title="Open Recent" id="tXI-mr-wws">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Open Recent" systemMenu="recentDocuments" id="oas-Oc-fiZ">
<items>
<menuItem title="Clear Menu" id="vNY-rz-j42">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="clearRecentDocuments:" target="Ady-hI-5gd" id="Daa-9d-B3U"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem isSeparatorItem="YES" id="m54-Is-iLE"/>
<menuItem title="Close" keyEquivalent="w" id="DVo-aG-piG">
<connections>
<action selector="performClose:" target="Ady-hI-5gd" id="HmO-Ls-i7Q"/>
</connections>
</menuItem>
<menuItem title="Save…" keyEquivalent="s" id="pxx-59-PXV">
<connections>
<action selector="saveDocument:" target="Ady-hI-5gd" id="teZ-XB-qJY"/>
</connections>
</menuItem>
<menuItem title="Save As…" keyEquivalent="S" id="Bw7-FT-i3A">
<connections>
<action selector="saveDocumentAs:" target="Ady-hI-5gd" id="mDf-zr-I0C"/>
</connections>
</menuItem>
<menuItem title="Revert to Saved" keyEquivalent="r" id="KaW-ft-85H">
<connections>
<action selector="revertDocumentToSaved:" target="Ady-hI-5gd" id="iJ3-Pv-kwq"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="aJh-i4-bef"/>
<menuItem title="Page Setup…" keyEquivalent="P" id="qIS-W8-SiK">
<modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
<connections>
<action selector="runPageLayout:" target="Ady-hI-5gd" id="Din-rz-gC5"/>
</connections>
</menuItem>
<menuItem title="Print…" keyEquivalent="p" id="aTl-1u-JFS">
<connections>
<action selector="print:" target="Ady-hI-5gd" id="qaZ-4w-aoO"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Edit" id="5QF-Oa-p0T">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Edit" id="W48-6f-4Dl">
<items>
<menuItem title="Undo" keyEquivalent="z" id="dRJ-4n-Yzg">
<connections>
<action selector="undo:" target="Ady-hI-5gd" id="M6e-cu-g7V"/>
</connections>
</menuItem>
<menuItem title="Redo" keyEquivalent="Z" id="6dh-zS-Vam">
<connections>
<action selector="redo:" target="Ady-hI-5gd" id="oIA-Rs-6OD"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="WRV-NI-Exz"/>
<menuItem title="Cut" keyEquivalent="x" id="uRl-iY-unG">
<connections>
<action selector="cut:" target="Ady-hI-5gd" id="YJe-68-I9s"/>
</connections>
</menuItem>
<menuItem title="Copy" keyEquivalent="c" id="x3v-GG-iWU">
<connections>
<action selector="copy:" target="Ady-hI-5gd" id="G1f-GL-Joy"/>
</connections>
</menuItem>
<menuItem title="Paste" keyEquivalent="v" id="gVA-U4-sdL">
<connections>
<action selector="paste:" target="Ady-hI-5gd" id="UvS-8e-Qdg"/>
</connections>
</menuItem>
<menuItem title="Paste and Match Style" keyEquivalent="V" id="WeT-3V-zwk">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="pasteAsPlainText:" target="Ady-hI-5gd" id="cEh-KX-wJQ"/>
</connections>
</menuItem>
<menuItem title="Delete" id="pa3-QI-u2k">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="delete:" target="Ady-hI-5gd" id="0Mk-Ml-PaM"/>
</connections>
</menuItem>
<menuItem title="Select All" keyEquivalent="a" id="Ruw-6m-B2m">
<connections>
<action selector="selectAll:" target="Ady-hI-5gd" id="VNm-Mi-diN"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="uyl-h8-XO2"/>
<menuItem title="Find" id="4EN-yA-p0u">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Find" id="1b7-l0-nxx">
<items>
<menuItem title="Find…" tag="1" keyEquivalent="f" id="Xz5-n4-O0W">
<connections>
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="cD7-Qs-BN4"/>
</connections>
</menuItem>
<menuItem title="Find and Replace…" tag="12" keyEquivalent="f" id="YEy-JH-Tfz">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="WD3-Gg-5AJ"/>
</connections>
</menuItem>
<menuItem title="Find Next" tag="2" keyEquivalent="g" id="q09-fT-Sye">
<connections>
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="NDo-RZ-v9R"/>
</connections>
</menuItem>
<menuItem title="Find Previous" tag="3" keyEquivalent="G" id="OwM-mh-QMV">
<connections>
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="HOh-sY-3ay"/>
</connections>
</menuItem>
<menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="buJ-ug-pKt">
<connections>
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="U76-nv-p5D"/>
</connections>
</menuItem>
<menuItem title="Jump to Selection" keyEquivalent="j" id="S0p-oC-mLd">
<connections>
<action selector="centerSelectionInVisibleArea:" target="Ady-hI-5gd" id="IOG-6D-g5B"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Spelling and Grammar" id="Dv1-io-Yv7">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Spelling" id="3IN-sU-3Bg">
<items>
<menuItem title="Show Spelling and Grammar" keyEquivalent=":" id="HFo-cy-zxI">
<connections>
<action selector="showGuessPanel:" target="Ady-hI-5gd" id="vFj-Ks-hy3"/>
</connections>
</menuItem>
<menuItem title="Check Document Now" keyEquivalent=";" id="hz2-CU-CR7">
<connections>
<action selector="checkSpelling:" target="Ady-hI-5gd" id="fz7-VC-reM"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="bNw-od-mp5"/>
<menuItem title="Check Spelling While Typing" id="rbD-Rh-wIN">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleContinuousSpellChecking:" target="Ady-hI-5gd" id="7w6-Qz-0kB"/>
</connections>
</menuItem>
<menuItem title="Check Grammar With Spelling" id="mK6-2p-4JG">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleGrammarChecking:" target="Ady-hI-5gd" id="muD-Qn-j4w"/>
</connections>
</menuItem>
<menuItem title="Correct Spelling Automatically" id="78Y-hA-62v">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticSpellingCorrection:" target="Ady-hI-5gd" id="2lM-Qi-WAP"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Substitutions" id="9ic-FL-obx">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Substitutions" id="FeM-D8-WVr">
<items>
<menuItem title="Show Substitutions" id="z6F-FW-3nz">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontSubstitutionsPanel:" target="Ady-hI-5gd" id="oku-mr-iSq"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="gPx-C9-uUO"/>
<menuItem title="Smart Copy/Paste" id="9yt-4B-nSM">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleSmartInsertDelete:" target="Ady-hI-5gd" id="3IJ-Se-DZD"/>
</connections>
</menuItem>
<menuItem title="Smart Quotes" id="hQb-2v-fYv">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticQuoteSubstitution:" target="Ady-hI-5gd" id="ptq-xd-QOA"/>
</connections>
</menuItem>
<menuItem title="Smart Dashes" id="rgM-f4-ycn">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticDashSubstitution:" target="Ady-hI-5gd" id="oCt-pO-9gS"/>
</connections>
</menuItem>
<menuItem title="Smart Links" id="cwL-P1-jid">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticLinkDetection:" target="Ady-hI-5gd" id="Gip-E3-Fov"/>
</connections>
</menuItem>
<menuItem title="Data Detectors" id="tRr-pd-1PS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticDataDetection:" target="Ady-hI-5gd" id="R1I-Nq-Kbl"/>
</connections>
</menuItem>
<menuItem title="Text Replacement" id="HFQ-gK-NFA">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticTextReplacement:" target="Ady-hI-5gd" id="DvP-Fe-Py6"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Transformations" id="2oI-Rn-ZJC">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Transformations" id="c8a-y6-VQd">
<items>
<menuItem title="Make Upper Case" id="vmV-6d-7jI">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="uppercaseWord:" target="Ady-hI-5gd" id="sPh-Tk-edu"/>
</connections>
</menuItem>
<menuItem title="Make Lower Case" id="d9M-CD-aMd">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="lowercaseWord:" target="Ady-hI-5gd" id="iUZ-b5-hil"/>
</connections>
</menuItem>
<menuItem title="Capitalize" id="UEZ-Bs-lqG">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="capitalizeWord:" target="Ady-hI-5gd" id="26H-TL-nsh"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Speech" id="xrE-MZ-jX0">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Speech" id="3rS-ZA-NoH">
<items>
<menuItem title="Start Speaking" id="Ynk-f8-cLZ">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="startSpeaking:" target="Ady-hI-5gd" id="654-Ng-kyl"/>
</connections>
</menuItem>
<menuItem title="Stop Speaking" id="Oyz-dy-DGm">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="stopSpeaking:" target="Ady-hI-5gd" id="dX8-6p-jy9"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Format" id="jxT-CU-nIS">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Format" id="GEO-Iw-cKr">
<items>
<menuItem title="Font" id="Gi5-1S-RQB">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Font" systemMenu="font" id="aXa-aM-Jaq">
<items>
<menuItem title="Show Fonts" keyEquivalent="t" id="Q5e-8K-NDq">
<connections>
<action selector="orderFrontFontPanel:" target="YLy-65-1bz" id="WHr-nq-2xA"/>
</connections>
</menuItem>
<menuItem title="Bold" tag="2" keyEquivalent="b" id="GB9-OM-e27">
<connections>
<action selector="addFontTrait:" target="YLy-65-1bz" id="hqk-hr-sYV"/>
</connections>
</menuItem>
<menuItem title="Italic" tag="1" keyEquivalent="i" id="Vjx-xi-njq">
<connections>
<action selector="addFontTrait:" target="YLy-65-1bz" id="IHV-OB-c03"/>
</connections>
</menuItem>
<menuItem title="Underline" keyEquivalent="u" id="WRG-CD-K1S">
<connections>
<action selector="underline:" target="Ady-hI-5gd" id="FYS-2b-JAY"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="5gT-KC-WSO"/>
<menuItem title="Bigger" tag="3" keyEquivalent="+" id="Ptp-SP-VEL">
<connections>
<action selector="modifyFont:" target="YLy-65-1bz" id="Uc7-di-UnL"/>
</connections>
</menuItem>
<menuItem title="Smaller" tag="4" keyEquivalent="-" id="i1d-Er-qST">
<connections>
<action selector="modifyFont:" target="YLy-65-1bz" id="HcX-Lf-eNd"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="kx3-Dk-x3B"/>
<menuItem title="Kern" id="jBQ-r6-VK2">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Kern" id="tlD-Oa-oAM">
<items>
<menuItem title="Use Default" id="GUa-eO-cwY">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="useStandardKerning:" target="Ady-hI-5gd" id="6dk-9l-Ckg"/>
</connections>
</menuItem>
<menuItem title="Use None" id="cDB-IK-hbR">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="turnOffKerning:" target="Ady-hI-5gd" id="U8a-gz-Maa"/>
</connections>
</menuItem>
<menuItem title="Tighten" id="46P-cB-AYj">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="tightenKerning:" target="Ady-hI-5gd" id="hr7-Nz-8ro"/>
</connections>
</menuItem>
<menuItem title="Loosen" id="ogc-rX-tC1">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="loosenKerning:" target="Ady-hI-5gd" id="8i4-f9-FKE"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Ligatures" id="o6e-r0-MWq">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Ligatures" id="w0m-vy-SC9">
<items>
<menuItem title="Use Default" id="agt-UL-0e3">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="useStandardLigatures:" target="Ady-hI-5gd" id="7uR-wd-Dx6"/>
</connections>
</menuItem>
<menuItem title="Use None" id="J7y-lM-qPV">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="turnOffLigatures:" target="Ady-hI-5gd" id="iX2-gA-Ilz"/>
</connections>
</menuItem>
<menuItem title="Use All" id="xQD-1f-W4t">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="useAllLigatures:" target="Ady-hI-5gd" id="KcB-kA-TuK"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Baseline" id="OaQ-X3-Vso">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Baseline" id="ijk-EB-dga">
<items>
<menuItem title="Use Default" id="3Om-Ey-2VK">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="unscript:" target="Ady-hI-5gd" id="0vZ-95-Ywn"/>
</connections>
</menuItem>
<menuItem title="Superscript" id="Rqc-34-cIF">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="superscript:" target="Ady-hI-5gd" id="3qV-fo-wpU"/>
</connections>
</menuItem>
<menuItem title="Subscript" id="I0S-gh-46l">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="subscript:" target="Ady-hI-5gd" id="Q6W-4W-IGz"/>
</connections>
</menuItem>
<menuItem title="Raise" id="2h7-ER-AoG">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="raiseBaseline:" target="Ady-hI-5gd" id="4sk-31-7Q9"/>
</connections>
</menuItem>
<menuItem title="Lower" id="1tx-W0-xDw">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="lowerBaseline:" target="Ady-hI-5gd" id="OF1-bc-KW4"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem isSeparatorItem="YES" id="Ndw-q3-faq"/>
<menuItem title="Show Colors" keyEquivalent="C" id="bgn-CT-cEk">
<connections>
<action selector="orderFrontColorPanel:" target="Ady-hI-5gd" id="mSX-Xz-DV3"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="iMs-zA-UFJ"/>
<menuItem title="Copy Style" keyEquivalent="c" id="5Vv-lz-BsD">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="copyFont:" target="Ady-hI-5gd" id="GJO-xA-L4q"/>
</connections>
</menuItem>
<menuItem title="Paste Style" keyEquivalent="v" id="vKC-jM-MkH">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="pasteFont:" target="Ady-hI-5gd" id="JfD-CL-leO"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Text" id="Fal-I4-PZk">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Text" id="d9c-me-L2H">
<items>
<menuItem title="Align Left" keyEquivalent="{" id="ZM1-6Q-yy1">
<connections>
<action selector="alignLeft:" target="Ady-hI-5gd" id="zUv-R1-uAa"/>
</connections>
</menuItem>
<menuItem title="Center" keyEquivalent="|" id="VIY-Ag-zcb">
<connections>
<action selector="alignCenter:" target="Ady-hI-5gd" id="spX-mk-kcS"/>
</connections>
</menuItem>
<menuItem title="Justify" id="J5U-5w-g23">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="alignJustified:" target="Ady-hI-5gd" id="ljL-7U-jND"/>
</connections>
</menuItem>
<menuItem title="Align Right" keyEquivalent="}" id="wb2-vD-lq4">
<connections>
<action selector="alignRight:" target="Ady-hI-5gd" id="r48-bG-YeY"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="4s2-GY-VfK"/>
<menuItem title="Writing Direction" id="H1b-Si-o9J">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Writing Direction" id="8mr-sm-Yjd">
<items>
<menuItem title="Paragraph" enabled="NO" id="ZvO-Gk-QUH">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem id="YGs-j5-SAR">
<string key="title"> Default</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeBaseWritingDirectionNatural:" target="Ady-hI-5gd" id="qtV-5e-UBP"/>
</connections>
</menuItem>
<menuItem id="Lbh-J2-qVU">
<string key="title"> Left to Right</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeBaseWritingDirectionLeftToRight:" target="Ady-hI-5gd" id="S0X-9S-QSf"/>
</connections>
</menuItem>
<menuItem id="jFq-tB-4Kx">
<string key="title"> Right to Left</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeBaseWritingDirectionRightToLeft:" target="Ady-hI-5gd" id="5fk-qB-AqJ"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="swp-gr-a21"/>
<menuItem title="Selection" enabled="NO" id="cqv-fj-IhA">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem id="Nop-cj-93Q">
<string key="title"> Default</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeTextWritingDirectionNatural:" target="Ady-hI-5gd" id="lPI-Se-ZHp"/>
</connections>
</menuItem>
<menuItem id="BgM-ve-c93">
<string key="title"> Left to Right</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeTextWritingDirectionLeftToRight:" target="Ady-hI-5gd" id="caW-Bv-w94"/>
</connections>
</menuItem>
<menuItem id="RB4-Sm-HuC">
<string key="title"> Right to Left</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeTextWritingDirectionRightToLeft:" target="Ady-hI-5gd" id="EXD-6r-ZUu"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem isSeparatorItem="YES" id="fKy-g9-1gm"/>
<menuItem title="Show Ruler" id="vLm-3I-IUL">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleRuler:" target="Ady-hI-5gd" id="FOx-HJ-KwY"/>
</connections>
</menuItem>
<menuItem title="Copy Ruler" keyEquivalent="c" id="MkV-Pr-PK5">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="copyRuler:" target="Ady-hI-5gd" id="71i-fW-3W2"/>
</connections>
</menuItem>
<menuItem title="Paste Ruler" keyEquivalent="v" id="LVM-kO-fVI">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="pasteRuler:" target="Ady-hI-5gd" id="cSh-wd-qM2"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="View" id="H8h-7b-M4v">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="View" id="HyV-fh-RgO">
<items>
<menuItem title="Show Toolbar" keyEquivalent="t" id="snW-S8-Cw5">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="toggleToolbarShown:" target="Ady-hI-5gd" id="BXY-wc-z0C"/>
</connections>
</menuItem>
<menuItem title="Customize Toolbar…" id="1UK-8n-QPP">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="runToolbarCustomizationPalette:" target="Ady-hI-5gd" id="pQI-g3-MTW"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="hB3-LF-h0Y"/>
<menuItem title="Show Sidebar" keyEquivalent="s" id="kIP-vf-haE">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="toggleSidebar:" target="Ady-hI-5gd" id="iwa-gc-5KM"/>
</connections>
</menuItem>
<menuItem title="Enter Full Screen" keyEquivalent="f" id="4J7-dP-txa">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="toggleFullScreen:" target="Ady-hI-5gd" id="dU3-MA-1Rq"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Window" id="aUF-d1-5bR">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
<items>
<menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
<connections>
<action selector="performMiniaturize:" target="Ady-hI-5gd" id="VwT-WD-YPe"/>
</connections>
</menuItem>
<menuItem title="Zoom" id="R4o-n2-Eq4">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="performZoom:" target="Ady-hI-5gd" id="DIl-cC-cCs"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
<menuItem title="Bring All to Front" id="LE2-aR-0XJ">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="arrangeInFront:" target="Ady-hI-5gd" id="DRN-fu-gQh"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Help" id="wpr-3q-Mcd">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
<items>
<menuItem title="GraphicsControls.Sample.macOS Help" keyEquivalent="?" id="FKE-Sm-Kum">
<connections>
<action selector="showHelp:" target="Ady-hI-5gd" id="y7X-2Q-9no"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
<connections>
<outlet property="delegate" destination="Voe-Tx-rLC" id="PrD-fu-P6m"/>
</connections>
</application>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate"/>
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
<customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="75" y="0.0"/>
</scene>
<!--Window Controller-->
<scene sceneID="R2V-B0-nI4">
<objects>
<windowController id="B8D-0N-5wS" sceneMemberID="viewController">
<window key="window" title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<connections>
<outlet property="delegate" destination="B8D-0N-5wS" id="98r-iN-zZc"/>
</connections>
</window>
<connections>
<segue destination="XfG-lQ-9wD" kind="relationship" relationship="window.shadowedContentViewController" id="cq2-FE-JQM"/>
</connections>
</windowController>
<customObject id="Oky-zY-oP4" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="75" y="250"/>
</scene>
<!--View Controller-->
<scene sceneID="hIz-AP-VOD">
<objects>
<viewController id="XfG-lQ-9wD" customClass="ViewController" sceneMemberID="viewController">
<view key="view" wantsLayer="YES" id="m2S-Jp-Qdl">
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
<autoresizingMask key="autoresizingMask"/>
</view>
</viewController>
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="75" y="655"/>
</scene>
</scenes>
</document>

Просмотреть файл

@ -1,33 +0,0 @@
using System;
using AppKit;
using Foundation;
namespace GraphicsControls.Sample.macOS
{
public partial class ViewController : NSViewController
{
public ViewController(IntPtr handle) : base(handle)
{
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
// Do any additional setup after loading the view.
}
public override NSObject RepresentedObject
{
get
{
return base.RepresentedObject;
}
set
{
base.RepresentedObject = value;
// Update the view, if already loaded.
}
}
}
}

Просмотреть файл

@ -1,18 +0,0 @@
// WARNING
//
// This file has been generated automatically by Xamarin Studio to store outlets and
// actions made in the UI designer. If it is removed, they will be lost.
// Manual changes to this file may not be handled correctly.
//
using Foundation;
namespace GraphicsControls.Sample.macOS
{
[Register("ViewController")]
partial class ViewController
{
void ReleaseDesignerOutlets()
{
}
}
}

Просмотреть файл

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Xamarin.Forms" version="4.8.0.1687" targetFramework="xamarinmac20" />
</packages>

Просмотреть файл

@ -0,0 +1,17 @@
using Microsoft.Maui.Controls;
namespace Microsoft.Maui.Graphics.Controls
{
public class MyApp : Application
{
public MyApp()
{
}
public override IWindow CreateWindow(IActivationState activationState)
{
return new MainWindow();
}
}
}

Просмотреть файл

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<Application xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="GraphicsControls.Sample.App">
<Application.Resources>
</Application.Resources>
</Application>

Просмотреть файл

@ -1,31 +0,0 @@
using Xamarin.Forms;
namespace GraphicsControls.Sample
{
public partial class App : Application
{
public App()
{
InitializeComponent();
if (Device.RuntimePlatform == Device.GTK)
MainPage = new OnlyDrawnControlsPage();
else
MainPage = new MixedControlsPage();
//MainPage = new NavigationPage(new BenchmarkPage());
}
protected override void OnStart()
{
}
protected override void OnSleep()
{
}
protected override void OnResume()
{
}
}
}

Просмотреть файл

@ -1,3 +0,0 @@
using Xamarin.Forms.Xaml;
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]

Просмотреть файл

@ -1,48 +0,0 @@
using System;
using Xamarin.Forms;
namespace GraphicsControls.Sample
{
public static class BenchmarkSettings
{
public static int NumberOfViews { get; } = 10;
}
public class BenchmarkPage : ContentPage
{
public BenchmarkPage()
{
Title = "GraphicsControls Benchmark";
var layout = new StackLayout();
var nativeButton = new Button
{
Text = "Use Native Controls"
};
var drawnButton = new Button
{
Text = "Use Drawn Controls"
};
layout.Children.Add(nativeButton);
layout.Children.Add(drawnButton);
Content = layout;
nativeButton.Clicked += OnNativeButtonClicked;
drawnButton.Clicked += OnDrawnButtonClicked;
}
void OnNativeButtonClicked(object sender, EventArgs e)
{
Navigation.PushAsync(new NativeBenchmarkPage());
}
void OnDrawnButtonClicked(object sender, EventArgs e)
{
Navigation.PushAsync(new DrawnBenchmarkPage());
}
}
}

Просмотреть файл

@ -1,50 +0,0 @@
using System.Diagnostics;
using Xamarin.Forms;
namespace GraphicsControls.Sample
{
public class DrawnBenchmarkPage : ContentPage
{
readonly Stopwatch _stopwatch;
readonly Label _infoLabel;
public DrawnBenchmarkPage()
{
Title = "Use Drawn Controls";
_stopwatch = new Stopwatch();
_stopwatch.Start();
var scrollView = new ScrollView();
var layout = new StackLayout();
_infoLabel = new Label
{
FontSize = 36,
HorizontalOptions = LayoutOptions.Center
};
layout.Children.Add(_infoLabel);
for (int i = 0; i < BenchmarkSettings.NumberOfViews; i++)
{
var drawnButton = new Button { VisualType = VisualType.Material, Text = $"Button {i + 1}" };
layout.Children.Add(drawnButton);
}
scrollView.Content = layout;
Content = scrollView;
}
protected override void OnAppearing()
{
base.OnAppearing();
_stopwatch.Stop();
_infoLabel.Text = $"{_stopwatch.ElapsedMilliseconds} ms";
}
}
}

Просмотреть файл

@ -1,50 +0,0 @@
using System.Diagnostics;
using Xamarin.Forms;
namespace GraphicsControls.Sample
{
public class NativeBenchmarkPage : ContentPage
{
readonly Stopwatch _stopwatch;
readonly Label _infoLabel;
public NativeBenchmarkPage()
{
Title = "Use Native Controls";
_stopwatch = new Stopwatch();
_stopwatch.Start();
var scrollView = new ScrollView();
var layout = new StackLayout();
_infoLabel = new Label
{
FontSize = 36,
HorizontalOptions = LayoutOptions.Center
};
layout.Children.Add(_infoLabel);
for (int i = 0; i < BenchmarkSettings.NumberOfViews; i++)
{
var drawnButton = new Xamarin.Forms.Button { Visual = VisualMarker.Material, Text = $"Button {i + 1}" };
layout.Children.Add(drawnButton);
}
scrollView.Content = layout;
Content = scrollView;
}
protected override void OnAppearing()
{
base.OnAppearing();
_stopwatch.Stop();
_infoLabel.Text = $"{_stopwatch.ElapsedMilliseconds} ms";
}
}
}

Просмотреть файл

@ -1,33 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="MSBuild.Sdk.Extras">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>MonoAndroid10.0;Xamarin.iOS10</TargetFrameworks>
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.8.0.1687" />
<PackageReference Include="Xamarin.Essentials" Version="1.5.3.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GraphicsControls\GraphicsControls.csproj" />
<ProjectReference Include="..\maui\src\Core\src\Core.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Benchmark\" />
<ItemGroup Condition="$(TargetFramework.StartsWith('Xamarin.iOS')) == true ">
<ProjectReference Include="..\maui\src\Compatibility\Core\src\iOS\Compatibility.iOS.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="MixedControlsPage.xaml.cs">
<DependentUpon>MixedControlsPage.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="OnlyDrawnControlsPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<ItemGroup Condition="$(TargetFramework.StartsWith('MonoAndroid')) == true ">
<ProjectReference Include="..\maui\src\Compatibility\Core\src\Android\Compatibility.Android.csproj" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,78 @@
using Microsoft.Maui.Controls;
namespace Microsoft.Maui.Graphics.Controls
{
public class MainPage : ContentPage, IPage
{
public MainPage()
{
BackgroundColor = Colors.White;
var verticalStack = new VerticalStackLayout() { Margin = 12 };
verticalStack.Add(new Label { FontSize = 18, Text = "Microsoft.Maui.Graphics.Controls", Margin = new Thickness(0, 24) });
// BUTTON
verticalStack.Add(new Label { FontSize = 9, Text = "Button" });
verticalStack.Add(new Button { Text = "Button" });
verticalStack.Add(new Label { FontSize = 9, Text = "Disabled Button" });
verticalStack.Add(new Button { IsEnabled = false, Text = "Disabled Button" });
verticalStack.Add(new Label { FontSize = 9, Text = "Custom Button" });
verticalStack.Add(new Button { BackgroundColor = Colors.Red, TextColor = Colors.Yellow, Text = "Custom Button" });
// CHECKBOX
verticalStack.Add(new Label { FontSize = 9, Text = "CheckBox" });
verticalStack.Add(new CheckBox { IsChecked = true });
verticalStack.Add(new Label { FontSize = 9, Text = "Disabled CheckBox" });
verticalStack.Add(new CheckBox { IsEnabled = false, IsChecked = true });
verticalStack.Add(new Label { FontSize = 9, Text = "Custom CheckBox" });
verticalStack.Add(new CheckBox { BackgroundColor = Colors.Purple, IsChecked = true });
// PROGRESSBAR
verticalStack.Add(new Label { FontSize = 9, Text = "ProgressBar" });
verticalStack.Add(new ProgressBar { Progress = 0.5d });
verticalStack.Add(new Label { FontSize = 9, Text = "Disabled ProgressBar" });
verticalStack.Add(new ProgressBar { IsEnabled = false, Progress = 0.5d });
verticalStack.Add(new Label { FontSize = 9, Text = "Custom ProgressBar" });
verticalStack.Add(new ProgressBar { ProgressColor = Colors.Orange, Progress = 0.5d });
// SLIDER
verticalStack.Add(new Label { FontSize = 9, Text = "Slider" });
verticalStack.Add(new Slider { Minimum = 0, Maximum = 10, Value = 5 });
verticalStack.Add(new Label { FontSize = 9, Text = "Disabled Slider" });
verticalStack.Add(new Slider { IsEnabled = false, Minimum = 0, Maximum = 10, Value = 5 });
verticalStack.Add(new Label { FontSize = 9, Text = "Custom Slider" });
verticalStack.Add(new Slider { Minimum = 0, MinimumTrackColor = Colors.Orange, Maximum = 10, MaximumTrackColor = Colors.YellowGreen, Value = 5, ThumbColor = Colors.BlueViolet });
// STEPPER
verticalStack.Add(new Label { FontSize = 9, Text = "Stepper" });
verticalStack.Add(new Stepper { Minimum = 0, Maximum = 10, Value = 5, Increment = 1 });
verticalStack.Add(new Label { FontSize = 9, Text = "Disabled Stepper" });
verticalStack.Add(new Stepper { IsEnabled = false, Minimum = 0, Maximum = 10, Value = 5, Increment = 1 });
verticalStack.Add(new Label { FontSize = 9, Text = "Custom Stepper" });
verticalStack.Add(new Stepper { BackgroundColor = Colors.CadetBlue, Minimum = 0, Maximum = 10, Value = 5, Increment = 1 });
// SWITCH
verticalStack.Add(new Label { FontSize = 9, Text = "Switch" });
verticalStack.Add(new Switch { IsToggled = true });
verticalStack.Add(new Label { FontSize = 9, Text = "Disabled Switch" });
verticalStack.Add(new Switch { IsEnabled = false, IsToggled = true });
verticalStack.Add(new Label { FontSize = 9, Text = "Custom Switch" });
verticalStack.Add(new Switch { OnColor = Colors.YellowGreen, ThumbColor = Colors.Green, IsToggled = true });
Content = verticalStack;
}
}
}

Просмотреть файл

@ -0,0 +1,14 @@
namespace Microsoft.Maui.Graphics.Controls
{
public class MainWindow : IWindow
{
public MainWindow()
{
Page = new MainPage();
}
public IPage Page { get; set; }
public IMauiContext MauiContext { get; set; }
}
}

Просмотреть файл

@ -1,173 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:graphics="clr-namespace:GraphicsControls;assembly=GraphicsControls"
xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
x:Class="GraphicsControls.Sample.MixedControlsPage"
ios:Page.UseSafeArea="true"
BackgroundColor="White"
Title="GraphicsControls">
<ScrollView
BackgroundColor="{AppThemeBinding Light=White, Dark=Black}">
<StackLayout
Padding="12">
<graphics:BoxView
HeightRequest="100"
CornerRadius="12"
Color="LightSkyBlue"/>
<graphics:Frame
HeightRequest="100"
BorderColor="DarkBlue"
BackgroundColor="LightBlue"
CornerRadius="12, 0, 0, 24"
HasShadow="True">
<Grid>
<Label
HorizontalOptions="Center"
VerticalOptions="Center"
FontSize="Large"
Text="Frame"/>
</Grid>
</graphics:Frame>
<Label
Text="Cupertino"
FontSize="Large"
Margin="0, 12, 0, 0"/>
<graphics:ActivityIndicator
VisualType="Cupertino"
IsRunning="True"
HorizontalOptions="Center"/>
<graphics:Button
VisualType="Cupertino"
Text="Cupertino Button"
Clicked="OnButtonClicked"/>
<graphics:CheckBox
VisualType="Cupertino"
Text="CheckBox"/>
<graphics:DatePicker
VisualType="Cupertino"
MinimumDate="01/01/2021"
MaximumDate="12/31/2021"
Date="01/02/2021"/>
<graphics:Editor
VisualType="Cupertino"
Placeholder="Placeholder"/>
<graphics:Entry
VisualType="Cupertino"
Placeholder="Placeholder"/>
<graphics:ProgressBar
VisualType="Cupertino"
Progress="0.25"/>
<graphics:RadioButton
VisualType="Cupertino"
IsChecked="True"/>
<graphics:Slider
VisualType="Cupertino"
Minimum="0"
Maximum="10"
Value="5"/>
<graphics:Stepper
VisualType="Cupertino"
Minimum="0"
Maximum="100"
Value="50"/>
<graphics:Switch
VisualType="Cupertino"/>
<graphics:TimePicker
VisualType="Cupertino"/>
<Label
Text="Fluent"
FontSize="Large"
Margin="0, 12, 0, 0"/>
<graphics:ActivityIndicator
VisualType="Fluent"
IsRunning="True"
HorizontalOptions="Center"/>
<graphics:Button
VisualType="Fluent"
Text="Fluent Button"
Clicked="OnButtonClicked"/>
<graphics:CheckBox
VisualType="Fluent"
IsChecked="True"
Text="CheckBox"/>
<graphics:DatePicker
VisualType="Fluent"
MinimumDate="01/01/2021"
MaximumDate="12/31/2021"
Date="01/02/2021"/>
<graphics:Editor
VisualType="Fluent"
Placeholder="Placeholder"/>
<graphics:Entry
VisualType="Fluent"
Placeholder="Placeholder"/>
<graphics:ProgressBar
VisualType="Fluent"
Progress="0.25"/>
<graphics:RadioButton
VisualType="Fluent"
IsChecked="True"/>
<graphics:Slider
VisualType="Fluent"
Minimum="0"
Maximum="10"
Value="5"/>
<graphics:Stepper
VisualType="Fluent"
Minimum="0"
Maximum="100"
Value="50"/>
<graphics:Switch
VisualType="Fluent"/>
<graphics:TimePicker
VisualType="Fluent"/>
<Label
Text="Material"
FontSize="Large"
Margin="0, 12, 0, 0"/>
<graphics:ActivityIndicator
VisualType="Material"
IsRunning="True"
HorizontalOptions="Center"/>
<graphics:Button
VisualType="Material"
Text="Material Button"
Clicked="OnButtonClicked"/>
<graphics:CheckBox
VisualType="Material"/>
<graphics:DatePicker
VisualType="Material"
MinimumDate="01/01/2021"
MaximumDate="12/31/2021"
Date="01/02/2021"/>
<graphics:Editor
VisualType="Material"
Placeholder="Placeholder"/>
<graphics:Entry
VisualType="Material"
Placeholder="Placeholder"/>
<graphics:ProgressBar
VisualType="Material"
Progress="0.25"/>
<graphics:RadioButton
VisualType="Material"
IsChecked="True"/>
<graphics:Slider
VisualType="Material"
Minimum="0"
Maximum="10"
Value="5"/>
<graphics:Stepper
VisualType="Material"
Minimum="0"
Maximum="100"
Value="50"/>
<graphics:Switch
VisualType="Material"/>
<graphics:TimePicker
VisualType="Material"/>
</StackLayout>
</ScrollView>
</ContentPage>

Просмотреть файл

@ -1,18 +0,0 @@
using System;
using Xamarin.Forms;
namespace GraphicsControls.Sample
{
public partial class MixedControlsPage : ContentPage
{
public MixedControlsPage()
{
InitializeComponent();
}
void OnButtonClicked(object sender, EventArgs e)
{
DisplayAlert("GraphicsControls", "Button Clicked", "Ok");
}
}
}

Просмотреть файл

@ -1,119 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:graphics="clr-namespace:GraphicsControls;assembly=GraphicsControls"
xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
x:Class="GraphicsControls.Sample.OnlyDrawnControlsPage"
ios:Page.UseSafeArea="true"
Title="GraphicsControls">
<ScrollView
BackgroundColor="White">
<StackLayout
Padding="12">
<graphics:BoxView
HeightRequest="60"
CornerRadius="12"
Color="LightSkyBlue"/>
<Label
Text="Cupertino"
FontSize="Large"
Margin="0, 12, 0, 0"/>
<graphics:ActivityIndicator
VisualType="Cupertino"
IsRunning="True"
HorizontalOptions="Center"/>
<graphics:Button
VisualType="Cupertino"
Text="Cupertino Button"
Clicked="OnButtonClicked"/>
<graphics:CheckBox
VisualType="Cupertino"
Text="CheckBox"/>
<graphics:ProgressBar
VisualType="Cupertino"
Progress="0.25"/>
<graphics:RadioButton
VisualType="Cupertino"
IsChecked="True"/>
<graphics:Slider
VisualType="Cupertino"
Minimum="0"
Maximum="10"
Value="5"/>
<graphics:Stepper
VisualType="Cupertino"
Minimum="0"
Maximum="100"
Value="50"/>
<graphics:Switch
VisualType="Cupertino"/>
<Label
Text="Fluent"
FontSize="Large"
Margin="0, 12, 0, 0"/>
<graphics:ActivityIndicator
VisualType="Fluent"
IsRunning="True"
HorizontalOptions="Center"/>
<graphics:Button
VisualType="Fluent"
Text="Fluent Button"
Clicked="OnButtonClicked"/>
<graphics:CheckBox
VisualType="Fluent"
IsChecked="True"
Text="CheckBox"/>
<graphics:ProgressBar
VisualType="Fluent"
Progress="0.25"/>
<graphics:RadioButton
VisualType="Fluent"
IsChecked="True"/>
<graphics:Slider
VisualType="Fluent"
Minimum="0"
Maximum="10"
Value="5"/>
<graphics:Stepper
VisualType="Fluent"
Minimum="0"
Maximum="100"
Value="50"/>
<graphics:Switch
VisualType="Fluent"/>
<Label
Text="Material"
FontSize="Large"
Margin="0, 12, 0, 0"/>
<graphics:ActivityIndicator
VisualType="Material"
IsRunning="True"
HorizontalOptions="Center"/>
<graphics:Button
VisualType="Material"
Text="Material Button"
Clicked="OnButtonClicked"/>
<graphics:CheckBox
VisualType="Material"/>
<graphics:ProgressBar
VisualType="Material"
Progress="0.25"/>
<graphics:RadioButton
VisualType="Material"
IsChecked="True"/>
<graphics:Slider
VisualType="Material"
Minimum="0"
Maximum="10"
Value="5"/>
<graphics:Stepper
VisualType="Material"
Minimum="0"
Maximum="100"
Value="50"/>
<graphics:Switch
VisualType="Material"/>
</StackLayout>
</ScrollView>
</ContentPage>

Просмотреть файл

@ -1,18 +0,0 @@
using System;
using Xamarin.Forms;
namespace GraphicsControls.Sample
{
public partial class OnlyDrawnControlsPage : ContentPage
{
public OnlyDrawnControlsPage()
{
InitializeComponent();
}
void OnButtonClicked(object sender, EventArgs e)
{
DisplayAlert("GraphicsControls", "Button Clicked", "Ok");
}
}
}

Просмотреть файл

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using Microsoft.Maui.Controls.Compatibility;
using Microsoft.Maui.Hosting;
namespace Microsoft.Maui.Graphics.Controls
{
public class Startup : IStartup
{
public void Configure(IAppHostBuilder appBuilder)
{
appBuilder
.UseFormsCompatibility()
.ConfigureMauiHandlers((_, handlersCollection) => handlersCollection.AddHandlers(new Dictionary<Type, Type>
{
{ typeof(IButton), typeof(ButtonHandler) },
{ typeof(ICheckBox), typeof(CheckBoxHandler) },
{ typeof(IProgress), typeof(ProgressBarHandler) },
{ typeof(ISlider), typeof(SliderHandler) },
{ typeof(IStepper), typeof(StepperHandler) },
{ typeof(ISwitch), typeof(SwitchHandler) }
}))
.UseMauiApp<MyApp>();
}
}
}

Просмотреть файл

@ -1,28 +0,0 @@
using Xamarin.Forms;
using Xunit;
namespace GraphicsControls.Tests
{
public class ActivityIndicatorTests
{
public ActivityIndicatorTests()
=> Device.PlatformServices = new MockPlatformServices();
[Fact]
public void ActivityIndicatorTest()
{
var activityIndicator = new ActivityIndicator();
Assert.NotNull(activityIndicator);
}
[Fact]
public void ActivityIndicatorLayersTest()
{
var activityIndicator = new ActivityIndicator();
int layersCount = activityIndicator.GraphicsLayers.Count;
Assert.NotEqual(0, layersCount);
}
}
}

Просмотреть файл

@ -1,22 +0,0 @@
using Xamarin.Forms;
using Xunit;
namespace GraphicsControls.Tests
{
public class BoxViewTests
{
public BoxViewTests()
=> Device.PlatformServices = new MockPlatformServices();
[Fact]
public void ConstructorTest()
{
var box = new BoxView
{
CornerRadius = 12
};
Assert.Equal(12, box.CornerRadius);
}
}
}

Просмотреть файл

@ -1,40 +0,0 @@
using Xamarin.Forms;
using Xunit;
namespace GraphicsControls.Tests
{
public class ButtonTests
{
public ButtonTests()
=> Device.PlatformServices = new MockPlatformServices();
[Fact]
public void ConstructorTest()
{
Button button = new Button();
Assert.NotNull(button);
}
[Fact]
public void ButtonLayersTest()
{
var button = new Button();
int layersCount = button.GraphicsLayers.Count;
Assert.NotEqual(0, layersCount);
}
[Fact]
public void TextTest()
{
string text = "Button";
Button button = new Button();
button.Text = text;
Assert.Equal(text, button.Text);
}
}
}

Просмотреть файл

@ -1,28 +0,0 @@
using Xamarin.Forms;
using Xunit;
namespace GraphicsControls.Tests
{
public class DatePickerTests
{
public DatePickerTests()
=> Device.PlatformServices = new MockPlatformServices();
[Fact]
public void ConstructorTest()
{
var datePicker = new DatePicker();
Assert.NotNull(datePicker);
}
[Fact]
public void DatePickerLayersTest()
{
var datePicker = new DatePicker();
int layersCount = datePicker.GraphicsLayers.Count;
Assert.NotEqual(0, layersCount);
}
}
}

Просмотреть файл

@ -1,28 +0,0 @@
using Xamarin.Forms;
using Xunit;
namespace GraphicsControls.Tests
{
public class EditorTests
{
public EditorTests()
=> Device.PlatformServices = new MockPlatformServices();
[Fact]
public void ConstructorTest()
{
Editor editor = new Editor();
Assert.NotNull(editor);
}
[Fact]
public void EditorLayersTest()
{
var editor = new Editor();
int layersCount = editor.GraphicsLayers.Count;
Assert.NotEqual(0, layersCount);
}
}
}

Просмотреть файл

@ -1,28 +0,0 @@
using Xamarin.Forms;
using Xunit;
namespace GraphicsControls.Tests
{
public class EntryTests
{
public EntryTests()
=> Device.PlatformServices = new MockPlatformServices();
[Fact]
public void ConstructorTest()
{
Entry entry = new Entry();
Assert.NotNull(entry);
}
[Fact]
public void EntryLayersTest()
{
var entry = new Entry();
int layersCount = entry.GraphicsLayers.Count;
Assert.NotEqual(0, layersCount);
}
}
}

Просмотреть файл

@ -1,28 +0,0 @@
using Xamarin.Forms;
using Xunit;
namespace GraphicsControls.Tests
{
public class FrameTests
{
public FrameTests()
=> Device.PlatformServices = new MockPlatformServices();
[Fact]
public void ConstructorTest()
{
Frame frame = new Frame();
Assert.Null(frame.Content);
}
[Fact]
public void FrameLayersTest()
{
var frame = new Frame();
int layersCount = frame.GraphicsLayers.Count;
Assert.NotEqual(0, layersCount);
}
}
}

Просмотреть файл

@ -1,52 +0,0 @@
using System.Linq;
using Xamarin.Forms;
using Xunit;
namespace GraphicsControls.Tests
{
public class GraphicsViewTests
{
public GraphicsViewTests()
=> Device.PlatformServices = new MockPlatformServices();
[Fact]
public void LayersTest()
{
var view = new Slider();
Assert.NotEmpty(view.GraphicsLayers);
}
[Fact]
public void AddLayerTest()
{
var view = new Slider();
var layersCount = view.GraphicsLayers.Count;
Assert.Equal(4, layersCount);
view.AddLayer("NewLayer");
var newLayersCount = view.GraphicsLayers.Count;
Assert.Equal(5, newLayersCount);
}
[Fact]
public void RemoveLayerTest()
{
var view = new Slider();
var layersCount = view.GraphicsLayers.Count;
Assert.Equal(4, layersCount);
view.RemoveLayer(Slider.Layers.TrackBackground);
var newLayersCount = view.GraphicsLayers.Count;
Assert.Equal(3, newLayersCount);
}
}
}

Просмотреть файл

@ -1,40 +0,0 @@
using Xamarin.Forms;
using Xunit;
namespace GraphicsControls.Tests
{
public class ProgressBarTests
{
public ProgressBarTests()
=> Device.PlatformServices = new MockPlatformServices();
[Fact]
public void ConstructorTest()
{
ProgressBar progressBar = new ProgressBar();
Assert.NotNull(progressBar);
}
[Fact]
public void ProgressBarLayersTest()
{
var progressBar = new ProgressBar();
int layersCount = progressBar.GraphicsLayers.Count;
Assert.NotEqual(0, layersCount);
}
[Fact]
public void ClampTest()
{
ProgressBar bar = new ProgressBar();
bar.Progress = 2;
Assert.Equal(1, bar.Progress);
bar.Progress = -1;
Assert.Equal(0, bar.Progress);
}
}
}

Просмотреть файл

@ -1,181 +0,0 @@
using Xamarin.Forms;
using Xunit;
namespace GraphicsControls.Tests
{
public class RadioButtonTests
{
public RadioButtonTests()
=> Device.PlatformServices = new MockPlatformServices();
[Fact]
public void ConstructorTest()
{
var radioButton = new RadioButton();
Assert.NotNull(radioButton);
}
[Fact]
public void RadioButtonLayersTest()
{
var radioButton = new RadioButton();
int layersCount = radioButton.GraphicsLayers.Count;
Assert.NotEqual(0, layersCount);
}
[Fact]
public void ThereCanBeOnlyOneTest()
{
var groupName = "foo";
var radioButton1 = new RadioButton() { GroupName = groupName };
var radioButton2 = new RadioButton() { GroupName = groupName };
var radioButton3 = new RadioButton() { GroupName = groupName };
var radioButton4 = new RadioButton() { GroupName = groupName };
var layout = new Grid();
layout.Children.Add(radioButton1);
layout.Children.Add(radioButton2);
layout.Children.Add(radioButton3);
layout.Children.Add(radioButton4);
radioButton1.IsChecked = true;
Assert.True(radioButton1.IsChecked);
Assert.False(radioButton2.IsChecked);
Assert.False(radioButton3.IsChecked);
Assert.False(radioButton4.IsChecked);
radioButton3.IsChecked = true;
Assert.False(radioButton1.IsChecked);
Assert.False(radioButton2.IsChecked);
Assert.True(radioButton3.IsChecked);
Assert.False(radioButton4.IsChecked);
}
[Fact]
public void ImpliedGroupTest()
{
var radioButton1 = new RadioButton();
var radioButton2 = new RadioButton();
var radioButton3 = new RadioButton();
var layout = new Grid();
layout.Children.Add(radioButton1);
layout.Children.Add(radioButton2);
layout.Children.Add(radioButton3);
radioButton1.IsChecked = true;
Assert.True(radioButton1.IsChecked);
Assert.False(radioButton2.IsChecked);
Assert.False(radioButton3.IsChecked);
radioButton3.IsChecked = true;
Assert.False(radioButton1.IsChecked);
Assert.False(radioButton2.IsChecked);
Assert.True(radioButton3.IsChecked);
}
[Fact]
public void ImpliedGroupDoesNotIncludeExplicitGroupsTest()
{
var radioButton1 = new RadioButton();
var radioButton2 = new RadioButton();
var radioButton3 = new RadioButton() { GroupName = "foo" };
var layout = new Grid();
layout.Children.Add(radioButton1);
layout.Children.Add(radioButton2);
layout.Children.Add(radioButton3);
radioButton1.IsChecked = true;
radioButton3.IsChecked = true;
Assert.True(radioButton1.IsChecked);
Assert.False(radioButton2.IsChecked);
Assert.True(radioButton3.IsChecked);
}
[Fact]
public void RemovingSelectedButtonFromGroupClearsSelectionTest()
{
var radioButton1 = new RadioButton() { GroupName = "foo" };
var radioButton2 = new RadioButton() { GroupName = "foo" };
var radioButton3 = new RadioButton() { GroupName = "foo" };
radioButton1.IsChecked = true;
radioButton2.IsChecked = true;
Assert.False(radioButton1.IsChecked);
Assert.True(radioButton2.IsChecked);
Assert.False(radioButton3.IsChecked);
radioButton2.GroupName = "bar";
Assert.False(radioButton1.IsChecked);
Assert.True(radioButton2.IsChecked);
Assert.False(radioButton3.IsChecked);
}
[Fact]
public void GroupControllerSelectionIsNullWhenSelectedButtonRemovedTest()
{
var layout = new Grid();
layout.SetValue(RadioButtonGroup.GroupNameProperty, "foo");
var selected = layout.GetValue(RadioButtonGroup.SelectedValueProperty);
Assert.Null(selected);
var radioButton1 = new RadioButton() { Value = 1 };
var radioButton2 = new RadioButton() { Value = 2 };
var radioButton3 = new RadioButton() { Value = 3 };
layout.Children.Add(radioButton1);
layout.Children.Add(radioButton2);
layout.Children.Add(radioButton3);
Assert.Null(selected);
radioButton1.IsChecked = true;
selected = layout.GetValue(RadioButtonGroup.SelectedValueProperty);
Assert.Equal(selected, 1);
Assert.Equal(radioButton1.GroupName, "foo");
radioButton1.GroupName = "bar";
selected = layout.GetValue(RadioButtonGroup.SelectedValueProperty);
Assert.Null(selected);
}
[Fact]
public void GroupSelectedValueUpdatesWhenSelectedButtonValueUpdatesTest()
{
var layout = new Grid();
layout.SetValue(RadioButtonGroup.GroupNameProperty, "foo");
var radioButton1 = new RadioButton() { Value = 1, IsChecked = true };
var radioButton2 = new RadioButton() { Value = 2 };
var radioButton3 = new RadioButton() { Value = 3 };
layout.Children.Add(radioButton1);
layout.Children.Add(radioButton2);
layout.Children.Add(radioButton3);
Assert.Equal(1, layout.GetValue(RadioButtonGroup.SelectedValueProperty));
radioButton1.Value = "updated";
Assert.Equal("updated", layout.GetValue(RadioButtonGroup.SelectedValueProperty));
}
}
}

Просмотреть файл

@ -1,94 +0,0 @@
using System;
using Xamarin.Forms;
using Xunit;
namespace GraphicsControls.Tests
{
public class SliderTests
{
public SliderTests()
=> Device.PlatformServices = new MockPlatformServices();
[Fact]
public void ConstructorTest()
{
var slider = new Slider(20, 200, 50);
Assert.Equal(20, slider.Minimum);
Assert.Equal(200, slider.Maximum);
Assert.Equal(50, slider.Value);
}
[Fact]
public void SliderLayersTest()
{
var slider = new Slider();
int layersCount = slider.GraphicsLayers.Count;
Assert.NotEqual(0, layersCount);
}
[Fact]
public void InvalidConstructorTest()
{
Assert.Throws<ArgumentOutOfRangeException>(() => new Slider(10, 5, 10));
}
[Fact]
public void ConstructorClampingTest()
{
Slider slider = new Slider(50, 100, 0);
Assert.Equal(50, slider.Value);
}
[Fact]
public void MinValueClampTest()
{
Slider slider = new Slider(0, 100, 0);
slider.Minimum = 10;
Assert.Equal(10, slider.Value);
Assert.Equal(10, slider.Minimum);
}
[Fact]
public void MaxValueClampTest()
{
Slider slider = new Slider(0, 100, 100);
slider.Maximum = 10;
Assert.Equal(10, slider.Value);
Assert.Equal(10, slider.Maximum);
}
[Fact]
public void TestInvalidMaxValue()
{
var slider = new Slider();
Assert.Throws<ArgumentException>(() => slider.Maximum = slider.Minimum - 1);
}
[Fact]
public void InvalidMinValueTest()
{
var slider = new Slider();
Assert.Throws<ArgumentException>(() => slider.Minimum = slider.Maximum + 1);
}
[Fact]
public void ValueChangedTest()
{
var slider = new Slider();
var changed = false;
slider.ValueChanged += (sender, arg) => changed = true;
slider.Value += 1;
Assert.True(changed);
}
}
}

Просмотреть файл

@ -1,147 +0,0 @@
using System;
using Xamarin.Forms;
using Xunit;
namespace GraphicsControls.Tests
{
public class StepperTests
{
public StepperTests()
=> Device.PlatformServices = new MockPlatformServices();
[Fact]
public void ConstructorTest()
{
var stepper = new Stepper(120, 200, 150, 2);
Assert.Equal(120, stepper.Minimum);
Assert.Equal(200, stepper.Maximum);
Assert.Equal(150, stepper.Value);
Assert.Equal(2, stepper.Increment);
}
[Fact]
public void StepperLayersTest()
{
var stepper = new Stepper();
int layersCount = stepper.GraphicsLayers.Count;
Assert.NotEqual(0, layersCount);
}
[Fact]
public void InvalidConstructorTest()
{
Assert.Throws<ArgumentOutOfRangeException>(() => new Stepper(100, 0, 50, 1));
}
[Fact]
public void InvalidMaxValueTest()
{
Stepper stepper = new Stepper();
Assert.Throws<ArgumentException>(() => stepper.Maximum = stepper.Minimum - 1);
}
[Fact]
public void InvalidMinValueTest()
{
Stepper stepper = new Stepper();
Assert.Throws<ArgumentException>(() => stepper.Minimum = stepper.Maximum + 1);
}
[Fact]
public void ValidMaxValueTest()
{
Stepper stepper = new Stepper();
stepper.Maximum = 2000;
Assert.Equal(2000, stepper.Maximum);
}
[Fact]
public void ValidMinValueTest()
{
Stepper stepper = new Stepper();
stepper.Maximum = 2000;
stepper.Minimum = 200;
Assert.Equal(200, stepper.Minimum);
}
[Fact]
public void ConstructorClampValueTest()
{
Stepper stepper = new Stepper(0, 100, 2000, 1);
Assert.Equal(100, stepper.Value);
stepper = new Stepper(0, 100, -200, 1);
Assert.Equal(0, stepper.Value);
}
[Fact]
public void MinClampValueTest()
{
Stepper stepper = new Stepper();
bool minThrown = false;
bool valThrown = false;
stepper.PropertyChanged += (sender, e) =>
{
switch (e.PropertyName)
{
case "Minimum":
minThrown = true;
break;
case "Value":
Assert.False(minThrown);
valThrown = true;
break;
}
};
stepper.Minimum = 10;
Assert.Equal(10, stepper.Minimum);
Assert.Equal(10, stepper.Value);
Assert.True(minThrown);
Assert.True(valThrown);
}
[Fact]
public void MaxClampValueTest()
{
Stepper stepper = new Stepper();
stepper.Value = 50;
bool maxThrown = false;
bool valThrown = false;
stepper.PropertyChanged += (sender, e) =>
{
switch (e.PropertyName)
{
case "Maximum":
maxThrown = true;
break;
case "Value":
Assert.False(maxThrown);
valThrown = true;
break;
}
};
stepper.Maximum = 25;
Assert.Equal(25, stepper.Maximum);
Assert.Equal(25, stepper.Value);
Assert.True(maxThrown);
Assert.True(valThrown);
}
}
}

Просмотреть файл

@ -1,28 +0,0 @@
using Xamarin.Forms;
using Xunit;
namespace GraphicsControls.Tests
{
public class SwitchTests
{
public SwitchTests()
=> Device.PlatformServices = new MockPlatformServices();
[Fact]
public void ConstructorTest()
{
Switch sw = new Switch();
Assert.False(sw.IsToggled);
}
[Fact]
public void SwitchLayersTest()
{
var sw = new Switch();
int layersCount = sw.GraphicsLayers.Count;
Assert.NotEqual(0, layersCount);
}
}
}

Просмотреть файл

@ -1,28 +0,0 @@
using Xamarin.Forms;
using Xunit;
namespace GraphicsControls.Tests
{
public class TimePickerTests
{
public TimePickerTests()
=> Device.PlatformServices = new MockPlatformServices();
[Fact]
public void ConstructorTest()
{
var timePicker = new TimePicker();
Assert.NotNull(timePicker);
}
[Fact]
public void TimePickerLayersTest()
{
var timePicker = new TimePicker();
int layersCount = timePicker.GraphicsLayers.Count;
Assert.NotEqual(0, layersCount);
}
}
}

Просмотреть файл

@ -1,29 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net461</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\GraphicsControls\GraphicsControls.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
<PackageReference Include="NSubstitute" Version="4.2.2" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="1.3.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Mocks\" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,78 +0,0 @@
using System;
using System.IO;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Internals;
namespace GraphicsControls.Tests
{
class MockPlatformServices : IPlatformServices
{
public string GetHash(string input)
=> string.Empty;
public string GetMD5Hash(string input)
=> string.Empty;
public double GetNamedSize(NamedSize size, Type targetElement, bool useOldSizes)
=> 0;
public Color GetNamedColor(string name)
=> Color.Default;
public void OpenUriAction(Uri uri)
{
}
public bool IsInvokeRequired
=> false;
public OSAppTheme RequestedTheme => OSAppTheme.Unspecified;
public string RuntimePlatform { get; set; }
public void BeginInvokeOnMainThread(Action action)
=> action();
public Ticker CreateTicker()
=> new MockTicker();
public void StartTimer(TimeSpan interval, Func<bool> callback)
{
}
public Task<Stream> GetStreamAsync(Uri uri, CancellationToken cancellationToken)
=> Task.FromResult<Stream>(new MemoryStream());
public Assembly[] GetAssemblies()
=> new Assembly[0];
public IIsolatedStorageFile GetUserStoreForApplication()
=> null;
Assembly[] IPlatformServices.GetAssemblies()
=> new Assembly[0];
public void QuitApplication()
{
}
public SizeRequest GetNativeSize(Xamarin.Forms.VisualElement view, double widthConstraint, double heightConstraint)
{
return default;
}
}
class MockTicker : Ticker
{
protected override void DisableTimer()
{
}
protected override void EnableTimer()
{
}
}
}

Просмотреть файл

@ -1,10 +0,0 @@
using System.Globalization;
using System.Resources;
namespace GraphicsControls.Tests
{
class MockResourceManager : ResourceManager
{
public override string GetString(string name, CultureInfo culture) => culture.EnglishName;
}
}

Просмотреть файл

@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.809.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphicsControls", "GraphicsControls\GraphicsControls.csproj", "{474A33AE-06A4-4219-9545-17751EBF3F84}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphicsControls", "GraphicsControls\GraphicsControls.csproj", "{474A33AE-06A4-4219-9545-17751EBF3F84}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Library", "Library", "{4F0017DB-8A18-4153-A129-782B29DECF51}"
EndProject
@ -13,11 +13,19 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphicsControls.Sample.iOS
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphicsControls.Sample", "GraphicsControls.Sample\GraphicsControls.Sample.csproj", "{41B421AF-5731-4B8F-BEDE-96155879D929}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphicsControls.Sample.Tizen", "GraphicsControls.Sample.Tizen\GraphicsControls.Sample.Tizen.csproj", "{F89D5E3A-5531-412B-A8B2-D4E8A9F07B9E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphicsControls.Sample.Android", "GraphicsControls.Sample.Android\GraphicsControls.Sample.Android.csproj", "{2EE53371-EFD9-4304-A231-93E6F75DBC81}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphicsControls.Sample.GTK", "GraphicsControls.Sample.GTK\GraphicsControls.Sample.GTK.csproj", "{79952688-FF1B-4813-A7E7-97C15F73B534}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core", "maui\src\Core\src\Core.csproj", "{8EF59C96-7972-41C6-830B-59FC81B9AD7B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".NET MAUI", ".NET MAUI", "{0F195BB7-38CF-45F6-BAF2-AB4ED1F362B3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Controls.Core", "maui\src\Controls\src\Core\Controls.Core.csproj", "{C2BBDE92-E870-498B-9878-20538DCE3FAE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Compatibility.iOS", "maui\src\Compatibility\Core\src\iOS\Compatibility.iOS.csproj", "{271193C1-6E7C-429C-A36D-3F1BE5267231}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Compatibility.Android", "maui\src\Compatibility\Core\src\Android\Compatibility.Android.csproj", "{F602BE45-8096-4A38-BF1B-28EF078E51E1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Compatibility.Android.FormsViewGroup", "maui\src\Compatibility\Core\src\Android.FormsViewGroup\Compatibility.Android.FormsViewGroup.csproj", "{FDA97CEE-D0A1-48ED-B555-1E90B7CA1468}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -65,48 +73,78 @@ Global
{41B421AF-5731-4B8F-BEDE-96155879D929}.Release|iPhone.Build.0 = Release|Any CPU
{41B421AF-5731-4B8F-BEDE-96155879D929}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{41B421AF-5731-4B8F-BEDE-96155879D929}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{F89D5E3A-5531-412B-A8B2-D4E8A9F07B9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F89D5E3A-5531-412B-A8B2-D4E8A9F07B9E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F89D5E3A-5531-412B-A8B2-D4E8A9F07B9E}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{F89D5E3A-5531-412B-A8B2-D4E8A9F07B9E}.Debug|iPhone.Build.0 = Debug|Any CPU
{F89D5E3A-5531-412B-A8B2-D4E8A9F07B9E}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{F89D5E3A-5531-412B-A8B2-D4E8A9F07B9E}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{F89D5E3A-5531-412B-A8B2-D4E8A9F07B9E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F89D5E3A-5531-412B-A8B2-D4E8A9F07B9E}.Release|Any CPU.Build.0 = Release|Any CPU
{F89D5E3A-5531-412B-A8B2-D4E8A9F07B9E}.Release|iPhone.ActiveCfg = Release|Any CPU
{F89D5E3A-5531-412B-A8B2-D4E8A9F07B9E}.Release|iPhone.Build.0 = Release|Any CPU
{F89D5E3A-5531-412B-A8B2-D4E8A9F07B9E}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{F89D5E3A-5531-412B-A8B2-D4E8A9F07B9E}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Debug|iPhone.Build.0 = Debug|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Debug|iPhone.Deploy.0 = Debug|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Release|Any CPU.Build.0 = Release|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Release|Any CPU.Deploy.0 = Release|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Release|iPhone.ActiveCfg = Release|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Release|iPhone.Build.0 = Release|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Release|iPhone.Deploy.0 = Release|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{2EE53371-EFD9-4304-A231-93E6F75DBC81}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU
{79952688-FF1B-4813-A7E7-97C15F73B534}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{79952688-FF1B-4813-A7E7-97C15F73B534}.Debug|Any CPU.Build.0 = Debug|Any CPU
{79952688-FF1B-4813-A7E7-97C15F73B534}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{79952688-FF1B-4813-A7E7-97C15F73B534}.Debug|iPhone.Build.0 = Debug|Any CPU
{79952688-FF1B-4813-A7E7-97C15F73B534}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{79952688-FF1B-4813-A7E7-97C15F73B534}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{79952688-FF1B-4813-A7E7-97C15F73B534}.Release|Any CPU.ActiveCfg = Release|Any CPU
{79952688-FF1B-4813-A7E7-97C15F73B534}.Release|Any CPU.Build.0 = Release|Any CPU
{79952688-FF1B-4813-A7E7-97C15F73B534}.Release|iPhone.ActiveCfg = Release|Any CPU
{79952688-FF1B-4813-A7E7-97C15F73B534}.Release|iPhone.Build.0 = Release|Any CPU
{79952688-FF1B-4813-A7E7-97C15F73B534}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{79952688-FF1B-4813-A7E7-97C15F73B534}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{8EF59C96-7972-41C6-830B-59FC81B9AD7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8EF59C96-7972-41C6-830B-59FC81B9AD7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8EF59C96-7972-41C6-830B-59FC81B9AD7B}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{8EF59C96-7972-41C6-830B-59FC81B9AD7B}.Debug|iPhone.Build.0 = Debug|Any CPU
{8EF59C96-7972-41C6-830B-59FC81B9AD7B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{8EF59C96-7972-41C6-830B-59FC81B9AD7B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{8EF59C96-7972-41C6-830B-59FC81B9AD7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8EF59C96-7972-41C6-830B-59FC81B9AD7B}.Release|Any CPU.Build.0 = Release|Any CPU
{8EF59C96-7972-41C6-830B-59FC81B9AD7B}.Release|iPhone.ActiveCfg = Release|Any CPU
{8EF59C96-7972-41C6-830B-59FC81B9AD7B}.Release|iPhone.Build.0 = Release|Any CPU
{8EF59C96-7972-41C6-830B-59FC81B9AD7B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{8EF59C96-7972-41C6-830B-59FC81B9AD7B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{C2BBDE92-E870-498B-9878-20538DCE3FAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C2BBDE92-E870-498B-9878-20538DCE3FAE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C2BBDE92-E870-498B-9878-20538DCE3FAE}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{C2BBDE92-E870-498B-9878-20538DCE3FAE}.Debug|iPhone.Build.0 = Debug|Any CPU
{C2BBDE92-E870-498B-9878-20538DCE3FAE}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{C2BBDE92-E870-498B-9878-20538DCE3FAE}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{C2BBDE92-E870-498B-9878-20538DCE3FAE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C2BBDE92-E870-498B-9878-20538DCE3FAE}.Release|Any CPU.Build.0 = Release|Any CPU
{C2BBDE92-E870-498B-9878-20538DCE3FAE}.Release|iPhone.ActiveCfg = Release|Any CPU
{C2BBDE92-E870-498B-9878-20538DCE3FAE}.Release|iPhone.Build.0 = Release|Any CPU
{C2BBDE92-E870-498B-9878-20538DCE3FAE}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{C2BBDE92-E870-498B-9878-20538DCE3FAE}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{271193C1-6E7C-429C-A36D-3F1BE5267231}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{271193C1-6E7C-429C-A36D-3F1BE5267231}.Debug|Any CPU.Build.0 = Debug|Any CPU
{271193C1-6E7C-429C-A36D-3F1BE5267231}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{271193C1-6E7C-429C-A36D-3F1BE5267231}.Debug|iPhone.Build.0 = Debug|Any CPU
{271193C1-6E7C-429C-A36D-3F1BE5267231}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{271193C1-6E7C-429C-A36D-3F1BE5267231}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{271193C1-6E7C-429C-A36D-3F1BE5267231}.Release|Any CPU.ActiveCfg = Release|Any CPU
{271193C1-6E7C-429C-A36D-3F1BE5267231}.Release|Any CPU.Build.0 = Release|Any CPU
{271193C1-6E7C-429C-A36D-3F1BE5267231}.Release|iPhone.ActiveCfg = Release|Any CPU
{271193C1-6E7C-429C-A36D-3F1BE5267231}.Release|iPhone.Build.0 = Release|Any CPU
{271193C1-6E7C-429C-A36D-3F1BE5267231}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{271193C1-6E7C-429C-A36D-3F1BE5267231}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{F602BE45-8096-4A38-BF1B-28EF078E51E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F602BE45-8096-4A38-BF1B-28EF078E51E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F602BE45-8096-4A38-BF1B-28EF078E51E1}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{F602BE45-8096-4A38-BF1B-28EF078E51E1}.Debug|iPhone.Build.0 = Debug|Any CPU
{F602BE45-8096-4A38-BF1B-28EF078E51E1}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{F602BE45-8096-4A38-BF1B-28EF078E51E1}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{F602BE45-8096-4A38-BF1B-28EF078E51E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F602BE45-8096-4A38-BF1B-28EF078E51E1}.Release|Any CPU.Build.0 = Release|Any CPU
{F602BE45-8096-4A38-BF1B-28EF078E51E1}.Release|iPhone.ActiveCfg = Release|Any CPU
{F602BE45-8096-4A38-BF1B-28EF078E51E1}.Release|iPhone.Build.0 = Release|Any CPU
{F602BE45-8096-4A38-BF1B-28EF078E51E1}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{F602BE45-8096-4A38-BF1B-28EF078E51E1}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{FDA97CEE-D0A1-48ED-B555-1E90B7CA1468}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FDA97CEE-D0A1-48ED-B555-1E90B7CA1468}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FDA97CEE-D0A1-48ED-B555-1E90B7CA1468}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{FDA97CEE-D0A1-48ED-B555-1E90B7CA1468}.Debug|iPhone.Build.0 = Debug|Any CPU
{FDA97CEE-D0A1-48ED-B555-1E90B7CA1468}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{FDA97CEE-D0A1-48ED-B555-1E90B7CA1468}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{FDA97CEE-D0A1-48ED-B555-1E90B7CA1468}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FDA97CEE-D0A1-48ED-B555-1E90B7CA1468}.Release|Any CPU.Build.0 = Release|Any CPU
{FDA97CEE-D0A1-48ED-B555-1E90B7CA1468}.Release|iPhone.ActiveCfg = Release|Any CPU
{FDA97CEE-D0A1-48ED-B555-1E90B7CA1468}.Release|iPhone.Build.0 = Release|Any CPU
{FDA97CEE-D0A1-48ED-B555-1E90B7CA1468}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{FDA97CEE-D0A1-48ED-B555-1E90B7CA1468}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -115,9 +153,12 @@ Global
{474A33AE-06A4-4219-9545-17751EBF3F84} = {4F0017DB-8A18-4153-A129-782B29DECF51}
{27FAE6FC-C7E2-4B63-B713-906A59A0C0DF} = {465D03D3-BA73-4E52-BBEA-02DC54647BC6}
{41B421AF-5731-4B8F-BEDE-96155879D929} = {465D03D3-BA73-4E52-BBEA-02DC54647BC6}
{F89D5E3A-5531-412B-A8B2-D4E8A9F07B9E} = {465D03D3-BA73-4E52-BBEA-02DC54647BC6}
{2EE53371-EFD9-4304-A231-93E6F75DBC81} = {465D03D3-BA73-4E52-BBEA-02DC54647BC6}
{79952688-FF1B-4813-A7E7-97C15F73B534} = {465D03D3-BA73-4E52-BBEA-02DC54647BC6}
{8EF59C96-7972-41C6-830B-59FC81B9AD7B} = {0F195BB7-38CF-45F6-BAF2-AB4ED1F362B3}
{C2BBDE92-E870-498B-9878-20538DCE3FAE} = {0F195BB7-38CF-45F6-BAF2-AB4ED1F362B3}
{271193C1-6E7C-429C-A36D-3F1BE5267231} = {0F195BB7-38CF-45F6-BAF2-AB4ED1F362B3}
{F602BE45-8096-4A38-BF1B-28EF078E51E1} = {0F195BB7-38CF-45F6-BAF2-AB4ED1F362B3}
{FDA97CEE-D0A1-48ED-B555-1E90B7CA1468} = {0F195BB7-38CF-45F6-BAF2-AB4ED1F362B3}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {475B4FFA-17B6-449C-9D09-DE4E2B0D2F4B}

Просмотреть файл

@ -1,8 +0,0 @@
using Xamarin.Forms;
using Xamarin.Forms.Internals;
[assembly: Preserve]
[assembly: XmlnsDefinition("http://xamarin.com/schemas/2020/graphics", "GraphicsControls")]
[assembly: XmlnsDefinition("http://xamarin.com/schemas/2020/graphics", "GraphicsControls.Effects")]
[assembly: XmlnsDefinition("http://xamarin.com/schemas/2020/graphics", "GraphicsControls.Extensions")]
[assembly: XmlnsDefinition("http://xamarin.com/schemas/2020/graphics", "GraphicsControls.Helpers")]

Просмотреть файл

@ -1,56 +0,0 @@
using System.Graphics;
using GraphicsControls.Extensions;
using Xamarin.Forms;
namespace GraphicsControls
{
public partial class ActivityIndicator
{
float _cupertinoActivityIndicatorAngle;
float CupertinoActivityIndicatorAngle
{
get { return _cupertinoActivityIndicatorAngle; }
set
{
_cupertinoActivityIndicatorAngle = value;
InvalidateDraw();
}
}
void DrawCupertinoActivityIndicator(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
canvas.Scale(0.75f, 0.75f);
var vBuilder = new PathBuilder();
var path =
vBuilder.BuildPath(
"M16,23.353012C16.551999,23.353013,17,23.801012,17,24.353012L17,31.00001C17,31.55201 16.551999,32.00001 16,32.00001 15.447999,32.00001 15,31.55201 15,31.00001L15,24.353012C15,23.801012,15.447999,23.353013,16,23.353012z M11.882349,22.25521C12.043656,22.258505 12.206556,22.300968 12.356859,22.386598 12.835829,22.660613 13.002818,23.271647 12.729836,23.751674L9.4370441,29.525996C9.2520552,29.849014 8.9150772,30.030025 8.5670986,30.030025 8.3991098,30.030025 8.2291203,29.988022 8.0721302,29.899017 7.5931606,29.625001 7.4261713,29.013968 7.6991539,28.533941L10.991945,22.759619C11.180308,22.430288,11.527474,22.247962,11.882349,22.25521z M20.027796,21.917202C20.365566,21.924239,20.691196,22.102265,20.872964,22.415953L24.385011,28.478001C24.661991,28.956001 24.499026,29.566997 24.020995,29.844007 23.864012,29.935987 23.691037,29.978987 23.520992,29.978987 23.176019,29.978987 22.840018,29.8 22.655019,29.479991L19.142972,23.418949C18.865993,22.94095 19.028958,22.328947 19.505951,22.051967 19.670609,21.956745 19.850868,21.913516 20.027796,21.917202z M8.7567263,19.218469C9.1115561,19.207652 9.4607439,19.386006 9.6525459,19.71324 9.9305305,20.189217 9.7705393,20.802187 9.2935658,21.081173L3.5568819,24.437009C3.397891,24.530005 3.2239008,24.574002 3.0529099,24.574003 2.7089291,24.574002 2.3749466,24.397011 2.1889572,24.079026 1.9099731,23.60205 2.0709648,22.99008 2.5469379,22.711094L8.2836218,19.354258C8.4329882,19.267387,8.5954399,19.223385,8.7567263,19.218469z M22.971681,18.948197C23.132897,18.951152,23.295456,18.993068,23.444831,19.07776L29.536846,22.53792C30.016848,22.810932 30.184848,23.421961 29.912848,23.901983 29.728847,24.225998 29.389846,24.408006 29.041845,24.408006 28.874845,24.408006 28.704844,24.366004 28.548844,24.278L22.457829,20.81784C21.976828,20.544827 21.808827,19.933799 22.081828,19.453777 22.268828,19.123762 22.617005,18.941694 22.971681,18.948197z M23.993983,15.00001L30.999997,15.00001C31.551998,15.00001 31.999999,15.448009 31.999999,16.00001 31.999999,16.55201 31.551998,17.00001 30.999997,17.00001L23.993983,17.00001C23.441982,17.00001 22.993981,16.55201 22.993981,16.00001 22.993981,15.448009 23.441982,15.00001 23.993983,15.00001z M1.0000019,15.00001L7.6470232,15.00001C8.1990252,15.00001 8.647027,15.448009 8.647027,16.00001 8.647027,16.55201 8.1990252,17.00001 7.6470232,17.00001L1.0000019,17.00001C0.44799995,17.00001 0,16.55201 0,16.00001 0,15.448009 0.44799995,15.00001 1.0000019,15.00001z M2.9774418,7.592205C3.1385689,7.5952778,3.3011475,7.6374035,3.4508352,7.7223969L9.2308588,11.004143C9.7108612,11.277122 9.8788614,11.888074 9.6068602,12.368037 9.4228592,12.692012 9.0838585,12.873998 8.735857,12.873998 8.5688562,12.873998 8.3988552,12.832001 8.2428551,12.744008L2.4638309,9.4612627C1.98283,9.1882839 1.8148289,8.578331 2.0878296,8.0983677 2.2755184,7.7677059 2.6229649,7.5854464 2.9774418,7.592205z M28.914661,7.4264841C29.269417,7.4156685 29.618884,7.5940228 29.810011,7.921257 30.089013,8.3972349 29.928012,9.0102053 29.452008,9.2891922L23.40496,12.826025C23.245958,12.919021 23.071957,12.963018 22.900956,12.963018 22.556953,12.963018 22.22295,12.786027 22.036949,12.468042 21.757947,11.991065 21.918948,11.379094 22.394952,11.100107L28.441999,7.562274C28.591063,7.4754028,28.753408,7.4314013,28.914661,7.4264841z M8.4513187,2.0223866C8.8060827,2.012846,9.1544075,2.1928482,9.3448553,2.5207958L12.677041,8.2719717C12.954057,8.7499866 12.791048,9.3610048 12.313021,9.6380138 12.156012,9.7300167 11.983003,9.7730179 11.812993,9.7730179 11.467974,9.7730179 11.131955,9.5940123 10.946945,9.274003L7.613759,3.5228271C7.3367434,3.0448112 7.5007524,2.433794 7.9777794,2.1567841 8.1274757,2.070219 8.290062,2.026722 8.4513187,2.0223866z M23.451962,1.9692326C23.613253,1.9726448 23.776271,2.0153179 23.926888,2.1012535 24.40586,2.3742447 24.572851,2.9852276 24.299866,3.4652119L20.829065,9.5510302C20.644076,9.8740206 20.307095,10.055015 19.959115,10.055015 19.791125,10.055015 19.621134,10.013016 19.464143,9.9240189 18.985171,9.6500273 18.81818,9.0390453 19.091165,8.5590601L22.562966,2.4742432C22.750643,2.1442528,23.097123,1.9617271,23.451962,1.9692326z M16,0C16.551999,0,17,0.44800186,17,1.0000038L17,8.0060177C17,8.5580187 16.551999,9.0060196 16,9.0060196 15.447999,9.0060196 15,8.5580187 15,8.0060177L15,1.0000038C15,0.44800186,15.447999,0,16,0z");
canvas.FillColor = Color.ToGraphicsColor(Application.Current?.RequestedTheme == OSAppTheme.Light ? Material.Color.Gray1 : Material.Color.Gray4);
float rX = 16.0f;
float rY = 16.0f;
if (IsRunning)
canvas.Rotate(CupertinoActivityIndicatorAngle, rX, rY);
else
canvas.Rotate(0, rX, rY);
canvas.FillPath(path);
canvas.RestoreState();
}
void AnimateCupertinoActivityIndicatorAnimation()
{
var startAngle = 0;
var endAngle = 360;
var cupertinoActivityIndicatorAngleAnimation = new Animation(v => CupertinoActivityIndicatorAngle = (int)v, startAngle, endAngle, easing: Easing.Linear);
cupertinoActivityIndicatorAngleAnimation.Commit(this, "CupertinoActivityIndicator", length: 4000, repeat: () => true, finished: (l, c) => cupertinoActivityIndicatorAngleAnimation = null);
}
}
}

Просмотреть файл

@ -1,103 +0,0 @@
using System.Graphics;
using GraphicsControls.Extensions;
using GraphicsControls.Helpers;
using Xamarin.Forms;
namespace GraphicsControls
{
public partial class ActivityIndicator
{
float _fluentActivityIndicatorEndAngle;
float FluentActivityIndicatorStartAngle { get; set; }
float FluentActivityIndicatorEndAngle
{
get { return _fluentActivityIndicatorEndAngle; }
set
{
_fluentActivityIndicatorEndAngle = value;
InvalidateDraw();
}
}
void DrawFluentActivityIndicatorBackground(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
float size = 28f;
float strokeWidth = 1.5f;
if (IsEnabled)
canvas.StrokeColor = ColorHelper.GetGraphicsColor(Fluent.Color.Primary.ThemeLight, Fluent.Color.Primary.ThemeDark);
else
canvas.StrokeColor = ColorHelper.GetGraphicsColor(Fluent.Color.Background.NeutralTertiaryAlt, Fluent.Color.Background.NeutralQuaternaryAlt);
canvas.StrokeSize = strokeWidth;
var x = (dirtyRect.Width - size) / 2;
var y = dirtyRect.Y + strokeWidth;
canvas.DrawEllipse(x, y, size, size);
canvas.RestoreState();
}
void DrawFluentActivityIndicator(ICanvas canvas, RectangleF dirtyRect)
{
if (IsRunning)
{
canvas.SaveState();
float size = 28f;
float strokeWidth = 1.5f;
canvas.StrokeColor = Color.ToGraphicsColor(Fluent.Color.Primary.ThemePrimary);
canvas.StrokeSize = strokeWidth;
var x = (dirtyRect.Width - size) / 2;
var y = dirtyRect.Y + strokeWidth;
canvas.DrawArc(x, y, size, size, FluentActivityIndicatorStartAngle, FluentActivityIndicatorEndAngle, true, false);
canvas.RestoreState();
}
}
void DrawFluentActivityIndicatorText(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
if (IsEnabled)
canvas.FontColor = Color.ToGraphicsColor(Fluent.Color.Primary.ThemePrimary);
else
canvas.FontColor = ColorHelper.GetGraphicsColor(Fluent.Color.Background.NeutralTertiaryAlt, Fluent.Color.Background.NeutralQuaternaryAlt);
canvas.FontSize = 12f;
var height = dirtyRect.Height;
var width = dirtyRect.Width;
canvas.DrawString("Loading...", 0, 0, width, height, HorizontalAlignment.Center, VerticalAlignment.Bottom);
canvas.RestoreState();
}
void AnimateFluentActivityIndicatorAnimation()
{
var fluentActivityIndicatorAnimation = new Animation();
var startAngle = 90;
var endAngle = 360;
var startAngleAnimation = new Animation(v => FluentActivityIndicatorStartAngle = (int)v, startAngle, startAngle - 360, easing: Easing.Linear);
var endAngleAnimation = new Animation(v => FluentActivityIndicatorEndAngle = (int)v, endAngle, endAngle - 360, easing: Easing.Linear);
fluentActivityIndicatorAnimation.Add(0, 1, startAngleAnimation);
fluentActivityIndicatorAnimation.Add(0, 1, endAngleAnimation);
fluentActivityIndicatorAnimation.Commit(this, "FluentActivityIndicator", length: 1000, repeat: () => true, finished: (l, c) => fluentActivityIndicatorAnimation = null);
}
}
}

Просмотреть файл

@ -1,71 +0,0 @@
using System.Graphics;
using Xamarin.Forms;
using GColor = System.Graphics.Color;
namespace GraphicsControls
{
public partial class ActivityIndicator
{
float _materialActivityIndicatorEndAngle;
float MaterialActivityIndicatorRotate { get; set; }
float MaterialActivityIndicatorStartAngle { get; set; }
float MaterialActivityIndicatorEndAngle
{
get { return _materialActivityIndicatorEndAngle; }
set
{
_materialActivityIndicatorEndAngle = value;
InvalidateDraw();
}
}
void DrawMaterialActivityIndicator(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
float size = 40f;
float strokeWidth = 4f;
canvas.StrokeSize = strokeWidth;
var x = dirtyRect.X;
var y = dirtyRect.Y;
if (IsRunning)
{
canvas.Rotate(MaterialActivityIndicatorRotate, x + strokeWidth + size / 2, y + strokeWidth + size / 2);
canvas.StrokeColor = new GColor(Material.Color.Blue);
canvas.DrawArc(x + strokeWidth, y + strokeWidth, size, size, MaterialActivityIndicatorStartAngle, MaterialActivityIndicatorEndAngle, false, false);
}
else
{
canvas.Rotate(0, x + strokeWidth + size / 2, y + strokeWidth + size / 2);
canvas.StrokeColor = new GColor(Material.Color.LightBlue);
canvas.DrawArc(x + strokeWidth, y + strokeWidth, size, size, 0, 360, false, false);
}
canvas.RestoreState();
}
void AnimateMaterialActivityIndicatorAnimation()
{
var materialActivityIndicatorAngleAnimation = new Animation();
var startAngle = 90;
var endAngle = 360;
var rotateAnimation = new Animation(v => MaterialActivityIndicatorRotate = (int)v, 0, 0, easing: Easing.Linear);
var startAngleAnimation = new Animation(v => MaterialActivityIndicatorStartAngle = (int)v, startAngle, startAngle - 360, easing: Easing.Linear);
var endAngleAnimation = new Animation(v => MaterialActivityIndicatorEndAngle = (int)v, endAngle, endAngle - 360, easing: Easing.Linear);
materialActivityIndicatorAngleAnimation.Add(0, 1, rotateAnimation);
materialActivityIndicatorAngleAnimation.Add(0, 1, startAngleAnimation);
materialActivityIndicatorAngleAnimation.Add(0, 1, endAngleAnimation);
materialActivityIndicatorAngleAnimation.Commit(this, "MaterialActivityIndicator", length: 1400, repeat: () => true, finished: (l, c) => materialActivityIndicatorAngleAnimation = null);
}
}
}

Просмотреть файл

@ -1,165 +0,0 @@
using System.Collections.Generic;
using System.Graphics;
using System.Runtime.CompilerServices;
using Xamarin.Forms;
using XColor = Xamarin.Forms.Color;
namespace GraphicsControls
{
public partial class ActivityIndicator : GraphicsVisualView, IColor
{
public static class Layers
{
public const string Background = "ActivityIndicator.Layers.Background";
public const string Indicator = "ActivityIndicator.Layers.Indicator";
public const string IndicatorText = "ActivityIndicator.Layers.IndicatorText";
}
public static readonly BindableProperty ColorProperty = ColorElement.ColorProperty;
public static readonly BindableProperty IsRunningProperty =
BindableProperty.Create(nameof(IsRunning), typeof(bool), typeof(ActivityIndicator), default(bool),
propertyChanged: OnIsRunningChanged);
static void OnIsRunningChanged(BindableObject bindable, object oldValue, object newValue)
{
if (bindable is ActivityIndicator activityIndicator)
{
if (activityIndicator.IsEnabled && (bool)newValue)
activityIndicator.StartActivityIndicatorAnimation();
else
activityIndicator.StopActivityIndicatorAnimation();
}
}
public XColor Color
{
get { return (XColor)GetValue(ColorElement.ColorProperty); }
set { SetValue(ColorElement.ColorProperty, value); }
}
public bool IsRunning
{
get { return (bool)GetValue(IsRunningProperty); }
set { SetValue(IsRunningProperty, value); }
}
public List<string> ActivityIndicatorLayers = new List<string>
{
Layers.Background,
Layers.Indicator,
Layers.IndicatorText
};
public override void Load()
{
base.Load();
switch (VisualType)
{
case VisualType.Material:
default:
HeightRequest = 48;
WidthRequest = 48;
break;
case VisualType.Cupertino:
HeightRequest = 24;
WidthRequest = 24;
break;
case VisualType.Fluent:
HeightRequest = 52;
WidthRequest = 60;
break;
}
}
public override List<string> GraphicsLayers =>
ActivityIndicatorLayers;
public override void DrawLayer(string layer, ICanvas canvas, RectangleF dirtyRect)
{
switch (layer)
{
case Layers.Background:
DrawActivityIndicatorBackground(canvas, dirtyRect);
break;
case Layers.Indicator:
DrawActivityIndicator(canvas, dirtyRect);
break;
case Layers.IndicatorText:
DrawActivityIndicatorText(canvas, dirtyRect);
break;
}
}
protected override void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
base.OnPropertyChanged(propertyName);
if (propertyName == IsRunningProperty.PropertyName ||
propertyName == BackgroundColorProperty.PropertyName ||
propertyName == FlowDirectionProperty.PropertyName)
InvalidateDraw();
}
protected virtual void DrawActivityIndicatorBackground(ICanvas canvas, RectangleF dirtyRect)
{
switch (VisualType)
{
case VisualType.Fluent:
DrawFluentActivityIndicatorBackground(canvas, dirtyRect);
break;
}
}
protected virtual void DrawActivityIndicator(ICanvas canvas, RectangleF dirtyRect)
{
switch (VisualType)
{
case VisualType.Material:
default:
DrawMaterialActivityIndicator(canvas, dirtyRect);
break;
case VisualType.Cupertino:
DrawCupertinoActivityIndicator(canvas, dirtyRect);
break;
case VisualType.Fluent:
DrawFluentActivityIndicator(canvas, dirtyRect);
break;
}
}
protected virtual void DrawActivityIndicatorText(ICanvas canvas, RectangleF dirtyRect)
{
switch (VisualType)
{
case VisualType.Fluent:
DrawFluentActivityIndicatorText(canvas, dirtyRect);
break;
}
}
void StartActivityIndicatorAnimation()
{
switch (VisualType)
{
case VisualType.Material:
default:
AnimateMaterialActivityIndicatorAnimation();
break;
case VisualType.Cupertino:
AnimateCupertinoActivityIndicatorAnimation();
break;
case VisualType.Fluent:
AnimateFluentActivityIndicatorAnimation();
break;
}
}
void StopActivityIndicatorAnimation()
{
ViewExtensions.CancelAnimations(this);
InvalidateDraw();
}
}
}

Просмотреть файл

@ -1,46 +0,0 @@
using System.Graphics;
using GraphicsControls.Extensions;
using Xamarin.Forms;
using XColor = Xamarin.Forms.Color;
namespace GraphicsControls
{
public class BoxView : GraphicsView, IColor, ICornerRadius
{
public static readonly BindableProperty ColorProperty = ColorElement.ColorProperty;
public static readonly BindableProperty CornerRadiusProperty = CornerRadiusElement.CornerRadiusProperty;
public XColor Color
{
get { return (XColor)GetValue(ColorProperty); }
set { SetValue(ColorProperty, value); }
}
public double CornerRadius
{
get { return (double)GetValue(CornerRadiusElement.CornerRadiusProperty); }
set { SetValue(CornerRadiusElement.CornerRadiusProperty, value); }
}
public override void Draw(ICanvas canvas, RectangleF dirtyRect)
{
base.Draw(canvas, dirtyRect);
canvas.SaveState();
var color = Color != XColor.Default ? Color : BackgroundColor;
canvas.FillColor = color.ToGraphicsColor();
var x = dirtyRect.X;
var y = dirtyRect.Y;
var height = dirtyRect.Height;
var width = dirtyRect.Width;
canvas.FillRoundedRectangle(x, y, width, height, (float)CornerRadius);
canvas.RestoreState();
}
}
}

Просмотреть файл

@ -1,42 +0,0 @@
using System.Graphics;
using GraphicsControls.Extensions;
namespace GraphicsControls
{
public partial class Button
{
void DrawCupertinoButtonBackground(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
canvas.FillColor = BackgroundColor.ToGraphicsColor(Cupertino.Color.SystemColor.Light.Blue, Cupertino.Color.SystemColor.Dark.Blue);
var x = dirtyRect.X;
var y = dirtyRect.Y;
var width = dirtyRect.Width;
var height = dirtyRect.Height;
canvas.FillRoundedRectangle(x, y, width, height, (float)CornerRadius);
canvas.RestoreState();
_backgroundRect = new RectangleF(x, y, width, height);
}
void DrawCupertinoButtonText(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
canvas.FontColor = TextColor.ToGraphicsColor(Cupertino.Color.Label.Light.Primary, Cupertino.Color.Label.Dark.Primary);
canvas.FontSize = 17f;
var height = dirtyRect.Height;
var width = dirtyRect.Width;
canvas.DrawString(Text, 0, 0, width, height, HorizontalAlignment.Center, VerticalAlignment.Center);
canvas.RestoreState();
}
}
}

Просмотреть файл

@ -1,64 +0,0 @@
using System.Graphics;
using GraphicsControls.Extensions;
using GraphicsControls.Helpers;
using GColor = System.Graphics.Color;
namespace GraphicsControls
{
public partial class Button
{
protected virtual void DrawFluentButtonBackground(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
var strokeWidth = 1;
if (IsEnabled)
{
canvas.StrokeColor = Colors.Black;
canvas.FillColor = BackgroundColor.ToGraphicsColor(Fluent.Color.Primary.ThemePrimary);
}
else
{
var disabledColor = ColorHelper.GetGraphicsColor(Fluent.Color.Background.NeutralLighter, Fluent.Color.Background.NeutralDark);
canvas.StrokeColor = canvas.FillColor = disabledColor;
}
canvas.StrokeSize = strokeWidth;
var x = dirtyRect.X;
var y = dirtyRect.Y;
var width = dirtyRect.Width;
var height = dirtyRect.Height;
canvas.DrawRoundedRectangle(x, y, width, height, (float)CornerRadius);
float margin = strokeWidth * 2;
canvas.FillRoundedRectangle(x + strokeWidth, y + strokeWidth, width - margin, height - margin, (float)CornerRadius);
canvas.RestoreState();
_backgroundRect = new RectangleF(x + strokeWidth, y + strokeWidth, width - margin, height - margin);
}
protected virtual void DrawFluentButtonText(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
if (IsEnabled)
canvas.FontColor = TextColor.ToGraphicsColor(Fluent.Color.Foreground.White);
else
canvas.FontColor = ColorHelper.GetGraphicsColor(Fluent.Color.Foreground.NeutralPrimary, Fluent.Color.Foreground.NeutralTertiary);
canvas.FontSize = 14f;
var height = dirtyRect.Height;
var width = dirtyRect.Width;
canvas.DrawString(Text, 0, 0, width, height, HorizontalAlignment.Center, VerticalAlignment.Center);
canvas.RestoreState();
}
}
}

Просмотреть файл

@ -1,50 +0,0 @@
using System.Graphics;
using GraphicsControls.Extensions;
using Xamarin.Forms;
using GColor = System.Graphics.Color;
namespace GraphicsControls
{
public partial class Button
{
const float MaterialBackgroundHeight = 36f;
const float MaterialShadowOffset = 3f;
void DrawMaterialButtonBackground(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
canvas.FillColor = BackgroundColor.ToGraphicsColor(Material.Color.Blue);
var x = dirtyRect.X;
var y = dirtyRect.Y;
var width = dirtyRect.Width - MaterialShadowOffset;
canvas.SetShadow(new SizeF(0, 1), 3, new GColor(Application.Current?.RequestedTheme == OSAppTheme.Light ? Material.Color.Gray2 : Material.Color.Gray1));
canvas.FillRoundedRectangle(x, y, width, MaterialBackgroundHeight, (float)CornerRadius);
canvas.RestoreState();
_backgroundRect = new RectangleF(x, y, width, MaterialBackgroundHeight);
}
void DrawMaterialButtonText(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
canvas.FontName = "Roboto";
canvas.FontColor = TextColor.ToGraphicsColor(Material.Color.White);
canvas.FontSize = Material.Font.Button;
var x = dirtyRect.X;
var y = dirtyRect.Y;
var width = dirtyRect.Width - MaterialShadowOffset;
canvas.DrawString(Text.ToUpper(), x, y, width, MaterialBackgroundHeight, HorizontalAlignment.Center, VerticalAlignment.Center);
canvas.RestoreState();
}
}
}

Просмотреть файл

@ -1,217 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Graphics;
using System.Runtime.CompilerServices;
using System.Windows.Input;
using GraphicsControls.Effects;
using Xamarin.Forms;
using Point = System.Graphics.Point;
using XColor = Xamarin.Forms.Color;
namespace GraphicsControls
{
public partial class Button : GraphicsVisualView, IButton, ICornerRadius
{
public static class Layers
{
public const string Background = "Button.Layers.Background";
public const string Text = "Button.Layers.Text";
}
readonly RippleEffect _rippleEffect;
RectangleF _backgroundRect;
public Button()
{
_backgroundRect = RectangleF.Zero;
_rippleEffect = new RippleEffect();
TextColor = XColor.White;
CornerRadius = 2;
}
public static readonly BindableProperty CommandProperty = ButtonElement.CommandProperty;
public static readonly BindableProperty CommandParameterProperty = ButtonElement.CommandParameterProperty;
internal static readonly BindablePropertyKey IsPressedPropertyKey =
BindableProperty.CreateReadOnly(nameof(IsPressed), typeof(bool), typeof(Button), default(bool));
public static readonly BindableProperty IsPressedProperty = IsPressedPropertyKey.BindableProperty;
public static readonly BindableProperty TextProperty = TextElement.TextProperty;
public static readonly BindableProperty TextColorProperty = TextElement.TextColorProperty;
public static readonly BindableProperty CornerRadiusProperty = CornerRadiusElement.CornerRadiusProperty;
public ICommand Command
{
get { return (ICommand)GetValue(CommandProperty); }
set { SetValue(CommandProperty, value); }
}
public object CommandParameter
{
get { return GetValue(CommandParameterProperty); }
set { SetValue(CommandParameterProperty, value); }
}
public bool IsPressed => (bool)GetValue(IsPressedProperty);
public string Text
{
get { return (string)GetValue(TextElement.TextProperty); }
set { SetValue(TextElement.TextProperty, value); }
}
public XColor TextColor
{
get { return (XColor)GetValue(TextElement.TextColorProperty); }
set { SetValue(TextElement.TextColorProperty, value); }
}
public double CornerRadius
{
get { return (double)GetValue(CornerRadiusElement.CornerRadiusProperty); }
set { SetValue(CornerRadiusElement.CornerRadiusProperty, value); }
}
bool IButton.IsEnabledCore
{
set { SetValueCore(IsEnabledProperty, value); }
}
[EditorBrowsable(EditorBrowsableState.Never)]
void IButton.SetIsPressed(bool isPressed) => SetValue(IsPressedPropertyKey, isPressed);
[EditorBrowsable(EditorBrowsableState.Never)]
void IButton.PropagateUpClicked() => Clicked?.Invoke(this, EventArgs.Empty);
[EditorBrowsable(EditorBrowsableState.Never)]
void IButton.PropagateUpPressed() => Pressed?.Invoke(this, EventArgs.Empty);
[EditorBrowsable(EditorBrowsableState.Never)]
void IButton.PropagateUpReleased() => Released?.Invoke(this, EventArgs.Empty);
void IButton.OnCommandCanExecuteChanged(object sender, EventArgs e) =>
ButtonElement.CommandCanExecuteChanged(this, EventArgs.Empty);
public List<string> ButtonLayers = new List<string>
{
Layers.Background,
Layers.Text
};
public event EventHandler Clicked;
public event EventHandler Pressed;
public event EventHandler Released;
public override void Load()
{
switch (VisualType)
{
case VisualType.Material:
default:
HeightRequest = MaterialBackgroundHeight + MaterialShadowOffset;
GraphicsEffects.Add(_rippleEffect);
break;
case VisualType.Cupertino:
HeightRequest = 44;
break;
case VisualType.Fluent:
HeightRequest = 32;
break;
}
base.Load();
}
public override List<string> GraphicsLayers =>
ButtonLayers;
public override void DrawLayer(string layer, ICanvas canvas, RectangleF dirtyRect)
{
switch (layer)
{
case Layers.Background:
DrawButtonBackground(canvas, dirtyRect);
break;
case Layers.Text:
DrawButtonText(canvas, dirtyRect);
break;
}
}
protected override void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
base.OnPropertyChanged(propertyName);
if (propertyName == BackgroundColorProperty.PropertyName ||
propertyName == FlowDirectionProperty.PropertyName)
InvalidateDraw();
}
public override void OnTouchDown(Point point)
{
base.OnTouchDown(point);
if (VisualType == VisualType.Material)
{
_rippleEffect.ClipRectangle = _backgroundRect;
var touchDownPoint = new PointF((float)point.X, (float)point.Y);
_rippleEffect.TouchPoint = touchDownPoint;
}
Pressed?.Invoke(this, EventArgs.Empty);
Clicked?.Invoke(this, EventArgs.Empty);
}
public override void OnTouchUp(Point point)
{
base.OnTouchUp(point);
Released?.Invoke(this, EventArgs.Empty);
}
protected virtual void DrawButtonBackground(ICanvas canvas, RectangleF dirtyRect)
{
switch (VisualType)
{
case VisualType.Material:
default:
DrawMaterialButtonBackground(canvas, dirtyRect);
break;
case VisualType.Cupertino:
DrawCupertinoButtonBackground(canvas, dirtyRect);
break;
case VisualType.Fluent:
DrawFluentButtonBackground(canvas, dirtyRect);
break;
}
}
protected virtual void DrawButtonText(ICanvas canvas, RectangleF dirtyRect)
{
switch (VisualType)
{
case VisualType.Material:
default:
DrawMaterialButtonText(canvas, dirtyRect);
break;
case VisualType.Cupertino:
DrawCupertinoButtonText(canvas, dirtyRect);
break;
case VisualType.Fluent:
DrawFluentButtonText(canvas, dirtyRect);
break;
}
}
}
}

Просмотреть файл

@ -1,86 +0,0 @@
using System.Graphics;
using GraphicsControls.Extensions;
using GraphicsControls.Helpers;
namespace GraphicsControls
{
public partial class CheckBox
{
const string FluentCheckBoxMark = "M13.3516 1.35156L5 9.71094L0.648438 5.35156L1.35156 4.64844L5 8.28906L12.6484 0.648438L13.3516 1.35156Z";
void DrawFluentCheckBoxBackground(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
float size = 20f;
var x = dirtyRect.X;
var y = dirtyRect.Y;
if (IsChecked)
{
if (IsEnabled)
canvas.FillColor = Color.ToGraphicsColor(Fluent.Color.Primary.ThemePrimary);
else
canvas.FillColor = ColorHelper.GetGraphicsColor(Fluent.Color.Background.NeutralLighter, Fluent.Color.Background.NeutralDark);
canvas.FillRoundedRectangle(x, y, size, size, 2);
}
else
{
var strokeWidth = 2;
canvas.StrokeSize = strokeWidth;
if (IsEnabled)
canvas.StrokeColor = Color.ToGraphicsColor(Fluent.Color.Primary.ThemePrimary);
else
canvas.FillColor = ColorHelper.GetGraphicsColor(Fluent.Color.Background.NeutralLighter, Fluent.Color.Background.NeutralDark);
canvas.DrawRoundedRectangle(x + strokeWidth / 2, y + strokeWidth / 2, size - strokeWidth, size - strokeWidth, 2);
}
canvas.RestoreState();
}
void DrawFluentCheckBoxMark(ICanvas canvas, RectangleF dirtyRect)
{
if (IsChecked)
{
canvas.SaveState();
canvas.Translate(3, 5);
var vBuilder = new PathBuilder();
var path = vBuilder.BuildPath(FluentCheckBoxMark);
canvas.StrokeColor = Colors.White;
canvas.DrawPath(path);
canvas.RestoreState();
}
}
void DrawFluentCheckBoxText(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
if (IsEnabled)
canvas.FontColor = ColorHelper.GetGraphicsColor(Fluent.Color.Foreground.Black, Fluent.Color.Foreground.White);
else
canvas.FontColor = ColorHelper.GetGraphicsColor(Fluent.Color.Foreground.NeutralPrimary, Fluent.Color.Foreground.NeutralTertiary);
canvas.FontSize = 14f;
float size = 20f;
float margin = 8f;
var height = dirtyRect.Height;
var width = dirtyRect.Width;
canvas.DrawString(Text, size + margin, 0, width - (size + margin), height, HorizontalAlignment.Left, VerticalAlignment.Center);
canvas.RestoreState();
}
}
}

Просмотреть файл

@ -1,72 +0,0 @@
using System.Graphics;
using GraphicsControls.Extensions;
namespace GraphicsControls
{
public partial class CheckBox
{
const string MaterialCheckBoxMark = "M13.3516 1.35156L5 9.71094L0.648438 5.35156L1.35156 4.64844L5 8.28906L12.6484 0.648438L13.3516 1.35156Z";
void DrawMaterialCheckBoxBackground(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
float size = 18f;
var x = dirtyRect.X;
var y = dirtyRect.Y;
if (IsChecked)
{
canvas.FillColor = Color.ToGraphicsColor(Material.Color.Blue);
canvas.FillRoundedRectangle(x, y, size, size, 2);
}
else
{
var strokeWidth = 2;
canvas.StrokeSize = strokeWidth;
canvas.StrokeColor = Color.ToGraphicsColor(Material.Color.Gray1);
canvas.DrawRoundedRectangle(x + strokeWidth / 2, y + strokeWidth / 2, size - strokeWidth, size - strokeWidth, 2);
}
canvas.RestoreState();
}
void DrawMaterialCheckBoxMark(ICanvas canvas, RectangleF dirtyRect)
{
if (IsChecked)
{
canvas.SaveState();
canvas.Translate(2, 4);
var vBuilder = new PathBuilder();
var path = vBuilder.BuildPath(MaterialCheckBoxMark);
canvas.StrokeColor = Colors.White;
canvas.DrawPath(path);
canvas.RestoreState();
}
}
void DrawMaterialCheckBoxText(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
canvas.FontColor = TextColor.ToGraphicsColor(Cupertino.Color.Label.Light.Primary, Cupertino.Color.Label.Dark.Primary);
canvas.FontSize = 14f;
float size = 20f;
float margin = 8f;
var height = dirtyRect.Height;
var width = dirtyRect.Width;
canvas.DrawString(Text, size + margin, 0, width - (size + margin), height, HorizontalAlignment.Left, VerticalAlignment.Center);
canvas.RestoreState();
}
}
}

Просмотреть файл

@ -1,191 +0,0 @@
using System;
using System.Collections.Generic;
using System.Graphics;
using System.Runtime.CompilerServices;
using Xamarin.Forms;
using Point = System.Graphics.Point;
using XColor = Xamarin.Forms.Color;
namespace GraphicsControls
{
public partial class CheckBox : GraphicsVisualView, IColor
{
public static class Layers
{
public const string Background = "CheckBox.Layers.Background";
public const string Mark = "CheckBox.Layers.Mark";
public const string Text = "CheckBox.Layers.Text";
}
public const string IsCheckedVisualState = "IsChecked";
public static readonly BindableProperty IsCheckedProperty =
BindableProperty.Create(nameof(IsChecked), typeof(bool), typeof(CheckBox), false,
propertyChanged: (bindable, oldValue, newValue) =>
{
((CheckBox)bindable).CheckedChanged?.Invoke(bindable, new CheckedChangedEventArgs((bool)newValue));
((CheckBox)bindable).ChangeVisualState();
}, defaultBindingMode: BindingMode.TwoWay);
public static readonly BindableProperty TextProperty =
BindableProperty.Create(nameof(Text), typeof(string), typeof(CheckBox), string.Empty);
public static readonly BindableProperty TextColorProperty =
BindableProperty.Create(nameof(TextColor), typeof(XColor), typeof(CheckBox), XColor.Default);
public static readonly BindableProperty ColorProperty = ColorElement.ColorProperty;
public bool IsChecked
{
get { return (bool)GetValue(IsCheckedProperty); }
set { SetValue(IsCheckedProperty, value); }
}
public string Text
{
get { return (string)GetValue(TextProperty); }
set { SetValue(TextProperty, value); }
}
public XColor TextColor
{
get { return (XColor)GetValue(TextColorProperty); }
set { SetValue(TextColorProperty, value); }
}
public XColor Color
{
get { return (XColor)GetValue(ColorProperty); }
set { SetValue(ColorProperty, value); }
}
public List<string> CheckBoxLayers = new List<string>
{
Layers.Background,
Layers.Mark,
Layers.Text
};
public event EventHandler<CheckedChangedEventArgs> CheckedChanged;
public override List<string> GraphicsLayers =>
CheckBoxLayers;
public override void DrawLayer(string layer, ICanvas canvas, RectangleF dirtyRect)
{
switch (layer)
{
case Layers.Background:
DrawCheckBoxBackground(canvas, dirtyRect);
break;
case Layers.Mark:
DrawCheckBoxMark(canvas, dirtyRect);
break;
case Layers.Text:
DrawCheckBoxText(canvas, dirtyRect);
break;
}
}
protected override void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
base.OnPropertyChanged(propertyName);
if (propertyName == IsCheckedProperty.PropertyName ||
propertyName == BackgroundColorProperty.PropertyName ||
propertyName == FlowDirectionProperty.PropertyName)
InvalidateDraw();
}
public override void Load()
{
base.Load();
switch (VisualType)
{
case VisualType.Cupertino:
HeightRequest = 24;
WidthRequest = 65;
break;
case VisualType.Material:
default:
HeightRequest = 18;
WidthRequest = 65;
break;
case VisualType.Fluent:
HeightRequest = 20;
WidthRequest = 65;
break;
}
}
protected override void ChangeVisualState()
{
if (IsEnabled && IsChecked)
VisualStateManager.GoToState(this, IsCheckedVisualState);
else
base.ChangeVisualState();
}
public override void OnTouchDown(Point point)
{
UpdateIsChecked();
}
protected virtual void DrawCheckBoxBackground(ICanvas canvas, RectangleF dirtyRect)
{
switch (VisualType)
{
case VisualType.Material:
default:
DrawMaterialCheckBoxBackground(canvas, dirtyRect);
break;
case VisualType.Cupertino:
DrawCupertinoCheckBoxBackground(canvas, dirtyRect);
break;
case VisualType.Fluent:
DrawFluentCheckBoxBackground(canvas, dirtyRect);
break;
}
}
protected virtual void DrawCheckBoxMark(ICanvas canvas, RectangleF dirtyRect)
{
switch (VisualType)
{
case VisualType.Material:
default:
DrawMaterialCheckBoxMark(canvas, dirtyRect);
break;
case VisualType.Cupertino:
DrawCupertinoCheckBoxMark(canvas, dirtyRect);
break;
case VisualType.Fluent:
DrawFluentCheckBoxMark(canvas, dirtyRect);
break;
}
}
protected virtual void DrawCheckBoxText(ICanvas canvas, RectangleF dirtyRect)
{
switch (VisualType)
{
case VisualType.Material:
default:
DrawMaterialCheckBoxText(canvas, dirtyRect);
break;
case VisualType.Cupertino:
DrawCupertinoCheckBoxText(canvas, dirtyRect);
break;
case VisualType.Fluent:
DrawFluentCheckBoxText(canvas, dirtyRect);
break;
}
}
void UpdateIsChecked()
{
IsChecked = !IsChecked;
}
}
}

Просмотреть файл

@ -1,65 +0,0 @@
using System.Graphics;
using GraphicsControls.Extensions;
using GraphicsControls.Helpers;
namespace GraphicsControls
{
public partial class DatePicker
{
void DrawCupertinoDatePickerBackground(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
canvas.FillColor = BackgroundColor.ToGraphicsColor(Material.Color.White, Material.Color.Black);
var x = dirtyRect.X;
var y = dirtyRect.Y;
var width = dirtyRect.Width;
var height = dirtyRect.Height;
canvas.FillRoundedRectangle(x, y, width, height, 2);
canvas.RestoreState();
}
void DrawCupertinoDatePickerBorder(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
var strokeWidth = 1.0f;
canvas.StrokeColor = ColorHelper.GetGraphicsColor(Material.Color.Gray3, Material.Color.Gray6);
canvas.StrokeSize = strokeWidth;
var x = dirtyRect.X;
var y = dirtyRect.Y;
var width = dirtyRect.Width;
var height = dirtyRect.Height;
canvas.DrawRoundedRectangle(x + strokeWidth / 2, y + strokeWidth / 2, width - strokeWidth, height - strokeWidth, 8);
canvas.RestoreState();
}
void DrawCupertinoDatePickerDate(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
canvas.FontColor = TextColor.ToGraphicsColor(Material.Color.Black, Material.Color.White);
canvas.FontSize = 14f;
float margin = 8f;
var x = dirtyRect.X + margin;
var height = dirtyRect.Height;
var width = dirtyRect.Width;
canvas.DrawString(GetDate().ToShortDateString(), x, 0, width - margin, height, HorizontalAlignment.Left, VerticalAlignment.Center);
canvas.RestoreState();
}
}
}

Просмотреть файл

@ -1,103 +0,0 @@
using System.Graphics;
using GraphicsControls.Extensions;
using GraphicsControls.Helpers;
using GColor = System.Graphics.Color;
namespace GraphicsControls
{
public partial class DatePicker
{
const string FluentDatePickerIcon = "M4.5 4.5H5.25V5.25H4.5V4.5ZM6.75 9H7.5V9.75H6.75V9ZM9 4.5H9.75V5.25H9V4.5ZM6.75 4.5H7.5V5.25H6.75V4.5ZM4.5 6H5.25V6.75H4.5V6ZM2.25 6H3V6.75H2.25V6ZM9 6H9.75V6.75H9V6ZM6.75 6H7.5V6.75H6.75V6ZM4.5 7.5H5.25V8.25H4.5V7.5ZM2.25 7.5H3V8.25H2.25V7.5ZM9 7.5H9.75V8.25H9V7.5ZM6.75 7.5H7.5V8.25H6.75V7.5ZM4.5 9H5.25V9.75H4.5V9ZM2.25 9H3V9.75H2.25V9ZM12 0.75V11.25H0V0.75H2.25V0H3V0.75H9V0H9.75V0.75H12ZM0.75 1.5V3H11.25V1.5H9.75V2.25H9V1.5H3V2.25H2.25V1.5H0.75ZM11.25 10.5V3.75H0.75V10.5H11.25Z";
const float FluentDatePickerHeight = 32.0f;
void DrawFluentDatePickerBackground(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
if (IsEnabled)
canvas.FillColor = BackgroundColor.ToGraphicsColor(Fluent.Color.Foreground.White, Fluent.Color.Foreground.NeutralPrimaryAlt);
else
canvas.FillColor = ColorHelper.GetGraphicsColor(Fluent.Color.Background.NeutralLighter, Fluent.Color.Background.NeutralDark);
var x = dirtyRect.X;
var y = dirtyRect.Y;
var width = dirtyRect.Width;
var height = dirtyRect.Height;
canvas.FillRoundedRectangle(x, y, width, height, 2);
canvas.RestoreState();
}
void DrawFluentDatePickerBorder(ICanvas canvas, RectangleF dirtyRect)
{
if (IsEnabled)
{
canvas.SaveState();
var strokeWidth = 1.0f;
canvas.StrokeColor = ColorHelper.GetGraphicsColor(Fluent.Color.Foreground.NeutralSecondary, Fluent.Color.Foreground.White);
canvas.StrokeSize = strokeWidth;
if (IsFocused)
{
strokeWidth = 2.0f;
canvas.StrokeColor = new GColor(Fluent.Color.Primary.ThemePrimary);
canvas.StrokeSize = strokeWidth;
}
var x = dirtyRect.X;
var y = dirtyRect.Y;
var width = dirtyRect.Width;
var height = dirtyRect.Height;
canvas.DrawRoundedRectangle(x + strokeWidth / 2, y + strokeWidth / 2, width - strokeWidth, height - strokeWidth, 2);
canvas.RestoreState();
}
}
void DrawFluentDatePickerIcon(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
var margin = 10;
canvas.Translate(dirtyRect.Width - (2 * margin), margin);
var vBuilder = new PathBuilder();
var path = vBuilder.BuildPath(FluentDatePickerIcon);
canvas.FillColor = ColorHelper.GetGraphicsColor(Fluent.Color.Foreground.NeutralSecondary, Fluent.Color.Foreground.White);
canvas.FillPath(path);
canvas.RestoreState();
}
void DrawFluentDatePickerDate(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
if (IsEnabled)
canvas.FontColor = TextColor.ToGraphicsColor(Fluent.Color.Foreground.Black, Fluent.Color.Foreground.White);
else
canvas.FontColor = TextColor.ToGraphicsColor(Fluent.Color.Foreground.NeutralTertiary, Fluent.Color.Foreground.White);
canvas.FontSize = 14f;
float margin = 8f;
var x = dirtyRect.X + margin;
var height = FluentDatePickerHeight;
var width = dirtyRect.Width;
canvas.DrawString(GetDate().ToShortDateString(), x, 0, width - margin, height, HorizontalAlignment.Left, VerticalAlignment.Center);
canvas.RestoreState();
}
}
}

Просмотреть файл

@ -1,107 +0,0 @@
using System.Graphics;
using GraphicsControls.Extensions;
using GraphicsControls.Helpers;
using Xamarin.Forms;
using GColor = System.Graphics.Color;
namespace GraphicsControls
{
public partial class DatePicker
{
void DrawMaterialDatePickerBackground(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
canvas.FillColor = BackgroundColor.ToGraphicsColor(Material.Color.Gray5, Material.Color.Dark);
var width = dirtyRect.Width;
var vBuilder = new PathBuilder();
var path =
vBuilder.BuildPath(
$"M0 4C0 1.79086 1.79086 0 4 0H{width - 4}C{width - 2}.209 0 {width} 1.79086 {width} 4V56H0V4Z");
canvas.FillPath(path);
canvas.RestoreState();
}
void DrawMaterialDatePickerBorder(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
var strokeWidth = 1.0f;
canvas.FillColor = ColorHelper.GetGraphicsColor(Material.Color.Black, Material.Color.White);
if (IsFocused)
{
strokeWidth = 2.0f;
canvas.FillColor = new GColor(Material.Color.Blue);
}
var x = dirtyRect.X;
var y = 53.91f;
var width = dirtyRect.Width;
var height = strokeWidth;
canvas.FillRectangle(x, y, width, height);
canvas.RestoreState();
}
void DrawMaterialDatePickerPlaceholder(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
canvas.FontColor = ColorHelper.GetGraphicsColor(Material.Color.Gray1, Material.Color.Gray6);
canvas.FontSize = 12f;
float margin = 12f;
var horizontalAlignment = HorizontalAlignment.Left;
var x = dirtyRect.X + margin;
if (FlowDirection == FlowDirection.RightToLeft)
{
x = dirtyRect.X;
horizontalAlignment = HorizontalAlignment.Right;
}
var height = dirtyRect.Height;
var width = dirtyRect.Width;
canvas.DrawString("Date", x, 6f, width - margin, height, horizontalAlignment, VerticalAlignment.Top);
canvas.RestoreState();
}
void DrawMaterialDatePickerDate(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
canvas.FontColor = TextColor.ToGraphicsColor(Material.Color.Dark, Material.Color.Light);
canvas.FontSize = 16f;
float margin = 12f;
var horizontalAlignment = HorizontalAlignment.Left;
var x = dirtyRect.X + margin;
if (FlowDirection == FlowDirection.RightToLeft)
{
x = dirtyRect.X;
horizontalAlignment = HorizontalAlignment.Right;
}
var height = dirtyRect.Height;
var width = dirtyRect.Width;
canvas.DrawString(GetDate().ToShortDateString(), x, 22f, width - margin, height, horizontalAlignment, VerticalAlignment.Top);
canvas.RestoreState();
}
}
}

Просмотреть файл

@ -1,283 +0,0 @@
using System;
using System.Collections.Generic;
using System.Graphics;
using System.Runtime.CompilerServices;
using GraphicsControls.Effects;
using Xamarin.Forms;
using XColor = Xamarin.Forms.Color;
namespace GraphicsControls
{
public partial class DatePicker : GraphicsVisualView
{
DatePickerDialogRoutingEffect _datePickerEffect;
public static class Layers
{
public const string Background = "DatePicker.Layers.Background";
public const string Border = "DatePicker.Layers.Border";
public const string Icon = "DatePicker.Layers.Icon";
public const string Placeholder = "DatePicker.Layers.Placeholder";
public const string Date = "DatePicker.Layers.Date";
}
public static readonly BindableProperty DateProperty =
BindableProperty.Create(nameof(Date), typeof(DateTime), typeof(DatePicker), default(DateTime), BindingMode.TwoWay,
coerceValue: CoerceDate,
propertyChanged: DatePropertyChanged,
defaultValueCreator: (bindable) => DateTime.Today);
public static readonly BindableProperty MinimumDateProperty =
BindableProperty.Create(nameof(MinimumDate), typeof(DateTime), typeof(DatePicker), new DateTime(1900, 1, 1),
validateValue: ValidateMinimumDate, coerceValue: CoerceMinimumDate);
public static readonly BindableProperty MaximumDateProperty =
BindableProperty.Create(nameof(MaximumDate), typeof(DateTime), typeof(DatePicker), new DateTime(2100, 12, 31),
validateValue: ValidateMaximumDate, coerceValue: CoerceMaximumDate);
public static readonly BindableProperty TextColorProperty =
BindableProperty.Create(nameof(TextColor), typeof(XColor), typeof(TimePicker), XColor.Default);
static object CoerceDate(BindableObject bindable, object value)
{
var picker = (DatePicker)bindable;
DateTime dateValue = ((DateTime)value).Date;
if (dateValue > picker.MaximumDate)
dateValue = picker.MaximumDate;
if (dateValue < picker.MinimumDate)
dateValue = picker.MinimumDate;
return dateValue;
}
static void DatePropertyChanged(BindableObject bindable, object oldValue, object newValue)
{
var datePicker = (DatePicker)bindable;
datePicker.DateSelected?.Invoke(datePicker, new DateChangedEventArgs((DateTime)oldValue, (DateTime)newValue));
}
static bool ValidateMinimumDate(BindableObject bindable, object value)
{
return ((DateTime)value).Date <= ((DatePicker)bindable).MaximumDate.Date;
}
static object CoerceMinimumDate(BindableObject bindable, object value)
{
DateTime dateValue = ((DateTime)value).Date;
var picker = (DatePicker)bindable;
if (picker.Date < dateValue)
picker.Date = dateValue;
return dateValue;
}
static bool ValidateMaximumDate(BindableObject bindable, object value)
{
return ((DateTime)value).Date >= ((DatePicker)bindable).MinimumDate.Date;
}
static object CoerceMaximumDate(BindableObject bindable, object value)
{
DateTime dateValue = ((DateTime)value).Date;
var picker = (DatePicker)bindable;
if (picker.Date > dateValue)
picker.Date = dateValue;
return dateValue;
}
public DateTime Date
{
get { return (DateTime)GetValue(DateProperty); }
set { SetValue(DateProperty, value); }
}
public DateTime MaximumDate
{
get { return (DateTime)GetValue(MaximumDateProperty); }
set { SetValue(MaximumDateProperty, value); }
}
public DateTime MinimumDate
{
get { return (DateTime)GetValue(MinimumDateProperty); }
set { SetValue(MinimumDateProperty, value); }
}
public XColor TextColor
{
get { return (XColor)GetValue(TextColorProperty); }
set { SetValue(TextColorProperty, value); }
}
public List<string> DatePickerLayers = new List<string>
{
Layers.Background,
Layers.Border,
Layers.Icon,
Layers.Placeholder,
Layers.Date
};
public event EventHandler<DateChangedEventArgs> DateSelected;
public override void Load()
{
base.Load();
switch (VisualType)
{
case VisualType.Material:
default:
HeightRequest = 56;
break;
case VisualType.Cupertino:
HeightRequest = 36;
break;
case VisualType.Fluent:
HeightRequest = 32;
break;
}
_datePickerEffect = new DatePickerDialogRoutingEffect();
Effects.Add(_datePickerEffect);
UpdateMaximumDate();
UpdateMinimumDate();
}
public override void Unload()
{
Effects.Remove(_datePickerEffect);
}
public override List<string> GraphicsLayers =>
DatePickerLayers;
public override void DrawLayer(string layer, ICanvas canvas, RectangleF dirtyRect)
{
switch (layer)
{
case Layers.Background:
DrawDatePickerBackground(canvas, dirtyRect);
break;
case Layers.Border:
DrawDatePickerBorder(canvas, dirtyRect);
break;
case Layers.Icon:
DrawDatePickerIcon(canvas, dirtyRect);
break;
case Layers.Placeholder:
DrawDatePickerPlaceholder(canvas, dirtyRect);
break;
case Layers.Date:
DrawDatePickerDate(canvas, dirtyRect);
break;
}
}
protected override void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
base.OnPropertyChanged(propertyName);
if (propertyName == MaximumDateProperty.PropertyName)
UpdateMaximumDate();
else if (propertyName == MinimumDateProperty.PropertyName)
UpdateMinimumDate();
}
protected virtual void DrawDatePickerBackground(ICanvas canvas, RectangleF dirtyRect)
{
switch (VisualType)
{
case VisualType.Material:
default:
DrawMaterialDatePickerBackground(canvas, dirtyRect);
break;
case VisualType.Cupertino:
DrawCupertinoDatePickerBackground(canvas, dirtyRect);
break;
case VisualType.Fluent:
DrawFluentDatePickerBackground(canvas, dirtyRect);
break;
}
}
protected virtual void DrawDatePickerBorder(ICanvas canvas, RectangleF dirtyRect)
{
switch (VisualType)
{
case VisualType.Material:
default:
DrawMaterialDatePickerBorder(canvas, dirtyRect);
break;
case VisualType.Cupertino:
DrawCupertinoDatePickerBorder(canvas, dirtyRect);
break;
case VisualType.Fluent:
DrawFluentDatePickerBorder(canvas, dirtyRect);
break;
}
}
protected virtual void DrawDatePickerIcon(ICanvas canvas, RectangleF dirtyRect)
{
switch (VisualType)
{
case VisualType.Fluent:
DrawFluentDatePickerIcon(canvas, dirtyRect);
break;
}
}
protected virtual void DrawDatePickerPlaceholder(ICanvas canvas, RectangleF dirtyRect)
{
switch (VisualType)
{
case VisualType.Material:
DrawMaterialDatePickerPlaceholder(canvas, dirtyRect);
break;
}
}
protected virtual void DrawDatePickerDate(ICanvas canvas, RectangleF dirtyRect)
{
switch (VisualType)
{
case VisualType.Material:
default:
DrawMaterialDatePickerDate(canvas, dirtyRect);
break;
case VisualType.Cupertino:
DrawCupertinoDatePickerDate(canvas, dirtyRect);
break;
case VisualType.Fluent:
DrawFluentDatePickerDate(canvas, dirtyRect);
break;
}
}
void UpdateMaximumDate()
{
DatePickerDialog.SetMaximumDate(this, MaximumDate);
}
void UpdateMinimumDate()
{
DatePickerDialog.SetMinimumDate(this, MinimumDate);
}
DateTime GetDate()
{
var date = DatePickerDialog.GetDate(this);
if (date == default)
return MinimumDate;
return date;
}
}
}

Просмотреть файл

@ -1,22 +0,0 @@
using Android.Content;
using GraphicsControls;
using GraphicsControls.Android;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
[assembly: ExportRenderer(typeof(BorderlessEditor), typeof(BorderlessEditorRenderer))]
namespace GraphicsControls.Android
{
public class BorderlessEditorRenderer : EditorRenderer
{
public BorderlessEditorRenderer(Context context) : base(context) { }
protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Editor> e)
{
base.OnElementChanged(e);
if (e.OldElement == null)
Control.Background = null;
}
}
}

Просмотреть файл

@ -1,69 +0,0 @@
using System.Graphics;
using GraphicsControls.Extensions;
using GraphicsControls.Helpers;
namespace GraphicsControls
{
public partial class Editor
{
void DrawCupertinoEditorBackground(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
canvas.FillColor = BackgroundColor.ToGraphicsColor(Material.Color.White, Material.Color.Black);
var x = dirtyRect.X;
var y = dirtyRect.Y;
var width = dirtyRect.Width;
var height = dirtyRect.Height;
canvas.FillRoundedRectangle(x, y, width, height, 8);
canvas.RestoreState();
}
void DrawCupertinoEditorBorder(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
var strokeWidth = 1.0f;
canvas.StrokeColor = ColorHelper.GetGraphicsColor(Material.Color.Gray3, Material.Color.Gray6);
canvas.StrokeSize = strokeWidth;
var x = dirtyRect.X;
var y = dirtyRect.Y;
var width = dirtyRect.Width;
var height = dirtyRect.Height;
canvas.DrawRoundedRectangle(x + strokeWidth / 2, y + strokeWidth / 2, width - strokeWidth, height - strokeWidth, 8);
canvas.RestoreState();
}
void DrawCupertinoEditorPlaceholder(ICanvas canvas, RectangleF dirtyRect)
{
if (!IsFocused && string.IsNullOrEmpty(Text))
{
canvas.SaveState();
canvas.FontColor = PlaceholderColor.ToGraphicsColor(Material.Color.Black, Material.Color.White);
canvas.FontSize = 14f;
float margin = 8f;
var x = dirtyRect.X + margin;
var y = dirtyRect.Y + margin;
var height = dirtyRect.Height;
var width = dirtyRect.Width;
canvas.DrawString(Placeholder, x, y, width - margin, height, HorizontalAlignment.Left, VerticalAlignment.Top);
canvas.RestoreState();
}
}
}
}

Просмотреть файл

@ -1,87 +0,0 @@
using System.Graphics;
using GraphicsControls.Extensions;
using GraphicsControls.Helpers;
using GColor = System.Graphics.Color;
namespace GraphicsControls
{
public partial class Editor
{
void DrawFluentEditorBackground(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
if (IsEnabled)
canvas.FillColor = BackgroundColor.ToGraphicsColor(Fluent.Color.Foreground.White, Fluent.Color.Foreground.NeutralPrimaryAlt);
else
canvas.FillColor = ColorHelper.GetGraphicsColor(Fluent.Color.Background.NeutralLighter, Fluent.Color.Background.NeutralDark);
var x = dirtyRect.X;
var y = dirtyRect.Y;
var width = dirtyRect.Width;
var height = dirtyRect.Height;
canvas.FillRoundedRectangle(x, y, width, height, 2);
canvas.RestoreState();
}
void DrawFluentEditorBorder(ICanvas canvas, RectangleF dirtyRect)
{
if (IsEnabled)
{
canvas.SaveState();
var strokeWidth = 1.0f;
canvas.StrokeColor = ColorHelper.GetGraphicsColor(Fluent.Color.Foreground.NeutralSecondary, Fluent.Color.Foreground.White);
canvas.StrokeSize = strokeWidth;
if (IsFocused)
{
strokeWidth = 2.0f;
canvas.StrokeColor = new GColor(Fluent.Color.Primary.ThemePrimary);
canvas.StrokeSize = strokeWidth;
}
var x = dirtyRect.X;
var y = dirtyRect.Y;
var width = dirtyRect.Width;
var height = dirtyRect.Height;
canvas.DrawRoundedRectangle(x + strokeWidth / 2, y + strokeWidth / 2, width - strokeWidth, height - strokeWidth, 2);
canvas.RestoreState();
}
}
void DrawFluentEditorPlaceholder(ICanvas canvas, RectangleF dirtyRect)
{
if (!IsFocused && string.IsNullOrEmpty(Text))
{
canvas.SaveState();
if (IsEnabled)
canvas.FontColor = PlaceholderColor.ToGraphicsColor(Fluent.Color.Foreground.Black, Fluent.Color.Foreground.White);
else
canvas.FontColor = new GColor(Fluent.Color.Foreground.NeutralTertiary);
canvas.FontSize = 14f;
float margin = 8f;
var x = dirtyRect.X + margin;
var y = dirtyRect.Y + margin;
var height = dirtyRect.Height;
var width = dirtyRect.Width;
canvas.DrawString(Placeholder, x, y, width - margin, height, HorizontalAlignment.Left, VerticalAlignment.Top);
canvas.RestoreState();
}
}
}
}

Просмотреть файл

@ -1,20 +0,0 @@
using GraphicsControls;
using GraphicsControls.iOS;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
[assembly: ExportRenderer(typeof(BorderlessEditor), typeof(BorderlessEditorRenderer))]
namespace GraphicsControls.iOS
{
public class BorderlessEditorRenderer : EditorRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Editor> e)
{
base.OnElementChanged(e);
if (Control != null)
Control.Layer.BorderColor = UIColor.Clear.CGColor;
}
}
}

Просмотреть файл

@ -1,23 +0,0 @@
using AppKit;
using GraphicsControls;
using GraphicsControls.Mac;
using Xamarin.Forms;
using Xamarin.Forms.Platform.MacOS;
[assembly: ExportRenderer(typeof(BorderlessEditor), typeof(BorderlessEditorRenderer))]
namespace GraphicsControls.Mac
{
public class BorderlessEditorRenderer : EditorRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Editor> e)
{
base.OnElementChanged(e);
if (Control != null)
{
Control.Bordered = false;
Control.FocusRingType = NSFocusRingType.None;
}
}
}
}

Просмотреть файл

@ -1,130 +0,0 @@
using System.Graphics;
using GraphicsControls.Extensions;
using GraphicsControls.Helpers;
using Xamarin.Forms;
using GColor = System.Graphics.Color;
namespace GraphicsControls
{
public partial class Editor
{
const float FocusedMaterialPlaceholderFontSize = 12f;
const float UnfocusedMaterialPlaceholderFontSize = 16f;
const float FocusedMaterialPlaceholderPosition = 6f;
const float UnfocusedMaterialPlaceholderPosition = 22f;
float _placeholderY;
float _placeholderFontSize;
float PlaceholderY
{
get { return _placeholderY; }
set
{
_placeholderY = value;
InvalidateDraw();
}
}
float PlaceholderFontSize
{
get { return _placeholderFontSize; }
set
{
_placeholderFontSize = value;
InvalidateDraw();
}
}
void DrawMaterialEditorBackground(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
canvas.FillColor = BackgroundColor.ToGraphicsColor(Material.Color.Gray5, Material.Color.Dark);
var width = dirtyRect.Width;
var vBuilder = new PathBuilder();
var path =
vBuilder.BuildPath(
$"M0 4C0 1.79086 1.79086 0 4 0H{width - 4}C{width - 2}.209 0 {width} 1.79086 {width} 4V114.95H0V4Z");
canvas.FillPath(path);
canvas.RestoreState();
}
void DrawMaterialEditorBorder(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
var strokeWidth = 1.0f;
canvas.FillColor = ColorHelper.GetGraphicsColor(Material.Color.Black, Material.Color.White);
if (IsFocused)
{
strokeWidth = 2.0f;
canvas.FillColor = new GColor(Material.Color.Blue);
}
var x = dirtyRect.X;
var y = 112.91f;
var width = dirtyRect.Width;
var height = strokeWidth;
canvas.FillRectangle(x, y, width, height);
canvas.RestoreState();
}
void DrawMaterialEditorPlaceholder(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
canvas.FontColor = PlaceholderColor.ToGraphicsColor(Material.Color.Dark, Material.Color.Light);
canvas.FontSize = PlaceholderFontSize;
float margin = 12f;
var horizontalAlignment = HorizontalAlignment.Left;
var x = dirtyRect.X + margin;
if (FlowDirection == FlowDirection.RightToLeft)
{
x = dirtyRect.X;
horizontalAlignment = HorizontalAlignment.Right;
}
var height = dirtyRect.Height;
var width = dirtyRect.Width;
canvas.DrawString(Placeholder, x, PlaceholderY, width - margin, height, horizontalAlignment, VerticalAlignment.Top);
canvas.RestoreState();
}
void AnimateMaterialPlaceholder(bool isFocused)
{
if (IsFocused && !string.IsNullOrEmpty(Text))
return;
var materialPlaceholderAnimation = new Animation();
float startFontSize = isFocused ? UnfocusedMaterialPlaceholderFontSize : FocusedMaterialPlaceholderFontSize;
float endFontSize = (isFocused || !string.IsNullOrEmpty(Text)) ? FocusedMaterialPlaceholderFontSize : UnfocusedMaterialPlaceholderFontSize;
var fontSizeAnimation = new Animation(v => PlaceholderFontSize = (int)v, startFontSize, endFontSize, easing: Easing.Linear);
float startPosition = isFocused ? UnfocusedMaterialPlaceholderPosition : FocusedMaterialPlaceholderPosition;
float endPosition = (isFocused || !string.IsNullOrEmpty(Text)) ? FocusedMaterialPlaceholderPosition : UnfocusedMaterialPlaceholderPosition;
var placeholderPositionAnimation = new Animation(v => PlaceholderY = (int)v, startPosition, endPosition, easing: Easing.Linear);
materialPlaceholderAnimation.Add(0, 1, fontSizeAnimation);
materialPlaceholderAnimation.Add(0, 1, placeholderPositionAnimation);
materialPlaceholderAnimation.Commit(this, "MaterialPlaceholderAnimation", length: 100, finished: (l, c) => materialPlaceholderAnimation = null);
}
}
}

Просмотреть файл

@ -1,410 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Graphics;
using System.Runtime.CompilerServices;
using GraphicsControls.Extensions;
using Xamarin.Forms;
using Point = System.Graphics.Point;
using XColor = Xamarin.Forms.Color;
namespace GraphicsControls
{
[EditorBrowsable(EditorBrowsableState.Never)]
public class BorderlessEditor : Xamarin.Forms.Editor { }
public partial class Editor : GraphicsVisualView, IInput
{
public static class Layers
{
public const string Background = "Editor.Layers.Background";
public const string Border = "Editor.Layers.Border";
public const string Placeholder = "Editor.Layers.Placeholder";
}
readonly BorderlessEditor _editor;
public Editor()
{
_editor = new BorderlessEditor
{
BackgroundColor = XColor.Transparent,
VerticalOptions = LayoutOptions.Start
};
Content = _editor;
}
public static readonly BindableProperty TextProperty =
BindableProperty.Create(nameof(IInput.Text), typeof(string), typeof(IInput), string.Empty,
propertyChanged: OnTextChanged);
static void OnTextChanged(BindableObject bindable, object oldValue, object newValue)
{
(bindable as Editor)?.UpdateText();
}
public static readonly BindableProperty TextColorProperty =
BindableProperty.Create(nameof(IInput.TextColor), typeof(XColor), typeof(IInput), XColor.Default,
propertyChanged: OnTextColorChanged);
static void OnTextColorChanged(BindableObject bindable, object oldValue, object newValue)
{
(bindable as Editor)?.UpdateTextColor();
}
public static readonly BindableProperty CharacterSpacingProperty =
BindableProperty.Create(nameof(IInput.CharacterSpacing), typeof(double), typeof(IInput), 0.0d,
propertyChanged: OnCharacterSpacingChanged);
private static void OnCharacterSpacingChanged(BindableObject bindable, object oldValue, object newValue)
{
(bindable as Editor)?.UpdateCharacterSpacing();
}
public static readonly BindableProperty PlaceholderProperty = InputElement.PlaceholderProperty;
public static readonly BindableProperty PlaceholderColorProperty = InputElement.PlaceholderColorProperty;
public static readonly BindableProperty FontAttributesProperty =
BindableProperty.Create(nameof(IFont.FontAttributes), typeof(FontAttributes), typeof(IFont), FontAttributes.None,
propertyChanged: OnFontAttributesChanged);
private static void OnFontAttributesChanged(BindableObject bindable, object oldValue, object newValue)
{
(bindable as Editor)?.UpdateFontAttributes();
}
public static readonly BindableProperty FontFamilyProperty =
BindableProperty.Create(nameof(IFont.FontFamily), typeof(string), typeof(IFont), string.Empty,
propertyChanged: OnFontFamilyChanged);
private static void OnFontFamilyChanged(BindableObject bindable, object oldValue, object newValue)
{
(bindable as Editor)?.UpdateFontFamily();
}
public static readonly BindableProperty FontSizeProperty =
BindableProperty.Create(nameof(IFont.FontSize), typeof(double), typeof(IInput), Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
propertyChanged: OnFontSizeChanged);
private static void OnFontSizeChanged(BindableObject bindable, object oldValue, object newValue)
{
(bindable as Editor)?.UpdateFontSize();
}
public static readonly BindableProperty IsTextPredictionEnabledProperty =
BindableProperty.Create(nameof(IsTextPredictionEnabled), typeof(bool), typeof(Editor), true, BindingMode.Default,
propertyChanged: OnIsTextPredictionEnabledChanged);
private static void OnIsTextPredictionEnabledChanged(BindableObject bindable, object oldValue, object newValue)
{
(bindable as Editor)?.UpdateIsTextPredictionEnabled();
}
public string Text
{
get { return (string)GetValue(TextProperty); }
set { SetValue(TextProperty, value); }
}
public XColor TextColor
{
get { return (XColor)GetValue(TextColorProperty); }
set { SetValue(TextColorProperty, value); }
}
public double CharacterSpacing
{
get { return (double)GetValue(CharacterSpacingProperty); }
set { SetValue(CharacterSpacingProperty, value); }
}
public string Placeholder
{
get { return (string)GetValue(PlaceholderProperty); }
set { SetValue(PlaceholderProperty, value); }
}
public XColor PlaceholderColor
{
get { return (XColor)GetValue(PlaceholderColorProperty); }
set { SetValue(PlaceholderColorProperty, value); }
}
public FontAttributes FontAttributes
{
get { return (FontAttributes)GetValue(FontAttributesProperty); }
set { SetValue(FontAttributesProperty, value); }
}
public string FontFamily
{
get { return (string)GetValue(FontFamilyProperty); }
set { SetValue(FontFamilyProperty, value); }
}
public double FontSize
{
get { return (double)GetValue(FontSizeProperty); }
set { SetValue(FontSizeProperty, value); }
}
public bool IsTextPredictionEnabled
{
get { return (bool)GetValue(IsTextPredictionEnabledProperty); }
set { SetValue(IsTextPredictionEnabledProperty, value); }
}
public event EventHandler Completed;
public List<string> EditorLayers = new List<string>
{
Layers.Background,
Layers.Border,
Layers.Placeholder
};
public override void Load()
{
base.Load();
switch (VisualType)
{
case VisualType.Material:
default:
HeightRequest = _editor.HeightRequest = 114.95d;
break;
case VisualType.Cupertino:
case VisualType.Fluent:
HeightRequest = _editor.HeightRequest = 60;
break;
}
_editor.TextChanged += OnEditorTextChanged;
_editor.Focused += OnEditorFocused;
_editor.Unfocused += OnEditorUnfocused;
if (VisualType == VisualType.Material)
AnimateMaterialPlaceholder(IsFocused);
UpdateEditorPosition();
UpdateText();
UpdateTextColor();
UpdateCharacterSpacing();
UpdateFlowDirection();
UpdateFontAttributes();
UpdateFontFamily();
UpdateFontSize();
UpdateIsTextPredictionEnabled();
}
public override void Unload()
{
base.Unload();
_editor.TextChanged -= OnEditorTextChanged;
_editor.Focused -= OnEditorFocused;
_editor.Unfocused -= OnEditorUnfocused;
}
public override List<string> GraphicsLayers =>
EditorLayers;
public override void DrawLayer(string layer, ICanvas canvas, RectangleF dirtyRect)
{
switch (layer)
{
case Layers.Background:
DrawEditorBackground(canvas, dirtyRect);
break;
case Layers.Border:
DrawEditorBorder(canvas, dirtyRect);
break;
case Layers.Placeholder:
DrawEntryPlaceholder(canvas, dirtyRect);
break;
}
}
public override void Draw(ICanvas canvas, RectangleF dirtyRect)
{
base.Draw(canvas, dirtyRect);
DrawEditorBackground(canvas, dirtyRect);
DrawEditorBorder(canvas, dirtyRect);
DrawEntryPlaceholder(canvas, dirtyRect);
}
protected override void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
base.OnPropertyChanged(propertyName);
if (propertyName == VisualTypeProperty.PropertyName)
UpdateEditorPosition();
else if (propertyName == IsFocusedProperty.PropertyName)
UpdateIsFocused();
else if (propertyName == FlowDirectionProperty.PropertyName)
UpdateFlowDirection();
}
public override void OnTouchDown(Point point)
{
base.OnTouchDown(point);
FocusInternalEditorIfNeeded();
}
protected virtual void DrawEditorBackground(ICanvas canvas, RectangleF dirtyRect)
{
switch (VisualType)
{
case VisualType.Material:
default:
DrawMaterialEditorBackground(canvas, dirtyRect);
break;
case VisualType.Cupertino:
DrawCupertinoEditorBackground(canvas, dirtyRect);
break;
case VisualType.Fluent:
DrawFluentEditorBackground(canvas, dirtyRect);
break;
}
}
protected virtual void DrawEditorBorder(ICanvas canvas, RectangleF dirtyRect)
{
switch (VisualType)
{
case VisualType.Material:
default:
DrawMaterialEditorBorder(canvas, dirtyRect);
break;
case VisualType.Cupertino:
DrawCupertinoEditorBorder(canvas, dirtyRect);
break;
case VisualType.Fluent:
DrawFluentEditorBorder(canvas, dirtyRect);
break;
}
}
protected virtual void DrawEntryPlaceholder(ICanvas canvas, RectangleF dirtyRect)
{
switch (VisualType)
{
case VisualType.Material:
default:
DrawMaterialEditorPlaceholder(canvas, dirtyRect);
break;
case VisualType.Cupertino:
DrawCupertinoEditorPlaceholder(canvas, dirtyRect);
break;
case VisualType.Fluent:
DrawFluentEditorPlaceholder(canvas, dirtyRect);
break;
}
}
void UpdateIsFocused()
{
switch (VisualType)
{
case VisualType.Material:
default:
AnimateMaterialPlaceholder(IsFocused);
break;
}
}
void UpdateEditorPosition()
{
switch (VisualType)
{
case VisualType.Cupertino:
case VisualType.Fluent:
_editor.Margin = new Thickness(6, 2);
break;
case VisualType.Material:
default:
_editor.Margin = new Thickness(6, 16, 6, 6);
break;
}
}
void OnEditorTextChanged(object sender, TextChangedEventArgs e)
{
Text = e.NewTextValue;
}
void OnEditorFocused(object sender, FocusEventArgs e)
{
UpdateIsFocused(true);
}
void OnEditorUnfocused(object sender, FocusEventArgs e)
{
UpdateIsFocused(false);
Completed?.Invoke(this, EventArgs.Empty);
}
void FocusInternalEditorIfNeeded()
{
if (!_editor.IsFocused)
_editor.Focus();
}
void UpdateIsFocused(bool isFocused)
{
var isFocusedPropertyKey = this.GetInternalField<BindablePropertyKey>("IsFocusedPropertyKey");
((IElementController)this).SetValueFromRenderer(isFocusedPropertyKey, isFocused);
}
void UpdateText()
{
_editor.Text = Text;
}
void UpdateTextColor()
{
if (TextColor != XColor.Default)
_editor.TextColor = TextColor;
else
{
var textColor = Application.Current?.RequestedTheme == OSAppTheme.Light ? XColor.Black : XColor.White;
_editor.TextColor = textColor;
}
}
void UpdateCharacterSpacing()
{
_editor.CharacterSpacing = CharacterSpacing;
}
void UpdateFlowDirection()
{
_editor.FlowDirection = FlowDirection;
}
void UpdateFontAttributes()
{
_editor.FontAttributes = FontAttributes;
}
void UpdateFontFamily()
{
_editor.FontFamily = FontFamily;
}
void UpdateFontSize()
{
_editor.FontSize = FontSize;
}
void UpdateIsTextPredictionEnabled()
{
_editor.IsTextPredictionEnabled = IsTextPredictionEnabled;
}
}
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше