Merge branch 'master' into add-RelativePanel

This commit is contained in:
NaBian committed 2019-12-01 21:50:10 +08:00
commit 33ff9658cb
14 files changed
+428 -17

No files matched your search

+5 -1
View File
@@ -3,4 +3,8 @@
*.xml
[Bb]in/
[Oo]bj/
packages/
packages/
build/*
!build/build.cake
!build/build.nuspec
!build/build.ps1
@@ -1,7 +1,7 @@
<?xml version="1.0" ?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="5949c79d-eb43-4033-8b7b-9349d34512c6" Version="2.2.0" Language="en-US" Publisher="HandyOrg" />
<Identity Id="5949c79d-eb43-4033-8b7b-9349d34512c6" Version="2.3.0" Language="en-US" Publisher="HandyOrg" />
<DisplayName>HandyControl for VS2019</DisplayName>
<Description xml:space="preserve">This VSIX Project will help people initialize a HandyControl project.</Description>
<MoreInfo>https://handyorg.github.io/handycontrol</MoreInfo>
@@ -34,8 +34,8 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="HandyControl, Version=2.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HandyControl.2.2.0\lib\net47\HandyControl.dll</HintPath>
<Reference Include="HandyControl, Version=2.3.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HandyControl.2.3.0\lib\net47\HandyControl.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Xaml">
@@ -10,5 +10,5 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("2.2.0")]
[assembly: AssemblyFileVersion("2.2.0")]
[assembly: AssemblyVersion("2.3.0")]
[assembly: AssemblyFileVersion("2.3.0")]
+1 -1
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="HandyControl" version="2.2.0" targetFramework="net47" />
<package id="HandyControl" version="2.3.0" targetFramework="net47" />
</packages>
@@ -19,6 +19,6 @@
<DefineConstants>TRACE;Core</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="HandyControl" Version="2.2.0" />
<PackageReference Include="HandyControl" Version="2.3.0" />
</ItemGroup>
</Project>
@@ -10,5 +10,5 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("2.2.0")]
[assembly: AssemblyFileVersion("2.2.0")]
[assembly: AssemblyVersion("2.3.0")]
[assembly: AssemblyFileVersion("2.3.0")]
+4
View File
@@ -49,7 +49,11 @@
## Special thanks to
[![Visual Studio Community 2019](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/vs2019_logo.png)](https://visualstudio.microsoft.com/free-developer-offers/)
[![JetBrains](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/resharper_logo.png)](https://www.jetbrains.com/?from=HandyControl)
[![Cake](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/cake_logo.png)](https://cakebuild.net/)
[![AppVeyor](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/appveyor_logo.png)](https://www.appveyor.com/)
[![Gitter](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/gitter_logo.png)](https://gitter.im/)
## Usage
+62
View File
@@ -0,0 +1,62 @@
var target = Argument("target", "Build");
Task("Clean")
.Does(() =>
{
CleanDirectory("lib");
});
Task("Build")
.IsDependentOn("Clean")
.Does(() =>
{
var vsLatest = VSWhereLatest();
var msBuildPath = vsLatest?.CombineWithFilePath("./MSBuild/Current/Bin/MSBuild.exe");
NuGetRestore("../src/Net_40/HandyControl_Net_40/HandyControl_Net_40.csproj");
var settingsNet40 = new MSBuildSettings
{
Configuration = "Release",
ToolPath = msBuildPath,
}.WithProperty("OutputPath", MakeAbsolute(Directory("lib/net40")).FullPath);
var settingsNet45 = new MSBuildSettings
{
Configuration = "Release-Net45",
ToolPath = msBuildPath,
}.WithProperty("OutputPath", MakeAbsolute(Directory("lib/net45")).FullPath);
var settingsNet462 = new MSBuildSettings
{
Configuration = "Release-Net462",
ToolPath = msBuildPath,
}.WithProperty("OutputPath", MakeAbsolute(Directory("lib/net462")).FullPath);
var settingsNet47 = new MSBuildSettings
{
Configuration = "Release-Net47",
ToolPath = msBuildPath,
}.WithProperty("OutputPath", MakeAbsolute(Directory("lib/net47")).FullPath);
var settingsNet48 = new MSBuildSettings
{
Configuration = "Release-Net48",
ToolPath = msBuildPath,
}.WithProperty("OutputPath", MakeAbsolute(Directory("lib/net48")).FullPath);
var settingsCore30 = new DotNetCoreBuildSettings
{
Framework = "netcoreapp3.0",
Configuration = "Release",
OutputDirectory = "lib/netcoreapp3.0"
};
MSBuild("../src/Net_40/HandyControl_Net_40/HandyControl_Net_40.csproj", settingsNet40);
MSBuild("../src/Net_GE45/HandyControl_Net_GE45/HandyControl_Net_GE45.csproj", settingsNet45);
MSBuild("../src/Net_GE45/HandyControl_Net_GE45/HandyControl_Net_GE45.csproj", settingsNet462);
MSBuild("../src/Net_GE45/HandyControl_Net_GE45/HandyControl_Net_GE45.csproj", settingsNet47);
MSBuild("../src/Net_GE45/HandyControl_Net_GE45/HandyControl_Net_GE45.csproj", settingsNet48);
DotNetCoreBuild("../src/Core_30/HandyControl_Core_30/HandyControl_Core_30.csproj", settingsCore30);
});
RunTarget(target);
+70
View File
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>HandyControl</id>
<version>2.3.0</version>
<title>HandyOrg</title>
<authors>HandyOrg</authors>
<owners>HandyOrg</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<projectUrl>https://github.com/NaBian/HandyControl</projectUrl>
<iconUrl>https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/icon.png</iconUrl>
<description>Contains some commonly used simple WPF controls</description>
<releaseNotes>Changes are detailed at https://github.com/HandyOrg/HandyControl/releases</releaseNotes>
<copyright>Copyright © HandyOrg 2018-2019</copyright>
<language></language>
<tags>WPF C# Control</tags>
<repository type="git" url="https://github.com/HandyOrg/HandyControl" commit="1af8ac90f497e6c65e4d596604f89f54e21cbcc6" />
<dependencies>
<group targetFramework=".NETFramework4.0">
<dependency id="Microsoft.Windows.Shell" version="3.0.1" />
</group>
<group targetFramework=".NETFramework4.5" />
<group targetFramework=".NETFramework4.6.2" />
<group targetFramework=".NETFramework4.7" />
<group targetFramework=".NETFramework4.8" />
<group targetFramework=".NETCoreApp3.0" />
</dependencies>
</metadata>
<files>
<file src="lib\net40\en\HandyControl.resources.dll" target="lib\net40\en\HandyControl.resources.dll" />
<file src="lib\net40\fa\HandyControl.resources.dll" target="lib\net40\fa\HandyControl.resources.dll" />
<file src="lib\net40\fr\HandyControl.resources.dll" target="lib\net40\fr\HandyControl.resources.dll" />
<file src="lib\net40\HandyControl.dll" target="lib\net40\HandyControl.dll" />
<file src="lib\net40\HandyControl.pdb" target="lib\net40\HandyControl.pdb" />
<file src="lib\net40\HandyControl.xml" target="lib\net40\HandyControl.xml" />
<file src="lib\net40\Microsoft.Windows.Shell.dll" target="lib\net40\Microsoft.Windows.Shell.dll" />
<file src="lib\net40\Microsoft.Windows.Shell.pdb" target="lib\net40\Microsoft.Windows.Shell.pdb" />
<file src="lib\net45\en\HandyControl.resources.dll" target="lib\net45\en\HandyControl.resources.dll" />
<file src="lib\net45\fa\HandyControl.resources.dll" target="lib\net45\fa\HandyControl.resources.dll" />
<file src="lib\net45\fr\HandyControl.resources.dll" target="lib\net45\fr\HandyControl.resources.dll" />
<file src="lib\net45\HandyControl.dll" target="lib\net45\HandyControl.dll" />
<file src="lib\net45\HandyControl.pdb" target="lib\net45\HandyControl.pdb" />
<file src="lib\net45\HandyControl.xml" target="lib\net45\HandyControl.xml" />
<file src="lib\net462\en\HandyControl.resources.dll" target="lib\net462\en\HandyControl.resources.dll" />
<file src="lib\net462\fa\HandyControl.resources.dll" target="lib\net462\fa\HandyControl.resources.dll" />
<file src="lib\net462\fr\HandyControl.resources.dll" target="lib\net462\fr\HandyControl.resources.dll" />
<file src="lib\net462\HandyControl.dll" target="lib\net462\HandyControl.dll" />
<file src="lib\net462\HandyControl.pdb" target="lib\net462\HandyControl.pdb" />
<file src="lib\net462\HandyControl.xml" target="lib\net462\HandyControl.xml" />
<file src="lib\net47\en\HandyControl.resources.dll" target="lib\net47\en\HandyControl.resources.dll" />
<file src="lib\net47\fa\HandyControl.resources.dll" target="lib\net47\fa\HandyControl.resources.dll" />
<file src="lib\net47\fr\HandyControl.resources.dll" target="lib\net47\fr\HandyControl.resources.dll" />
<file src="lib\net47\HandyControl.dll" target="lib\net47\HandyControl.dll" />
<file src="lib\net47\HandyControl.pdb" target="lib\net47\HandyControl.pdb" />
<file src="lib\net47\HandyControl.xml" target="lib\net47\HandyControl.xml" />
<file src="lib\net48\en\HandyControl.resources.dll" target="lib\net48\en\HandyControl.resources.dll" />
<file src="lib\net48\fa\HandyControl.resources.dll" target="lib\net48\fa\HandyControl.resources.dll" />
<file src="lib\net48\fr\HandyControl.resources.dll" target="lib\net48\fr\HandyControl.resources.dll" />
<file src="lib\net48\HandyControl.dll" target="lib\net48\HandyControl.dll" />
<file src="lib\net48\HandyControl.pdb" target="lib\net48\HandyControl.pdb" />
<file src="lib\net48\HandyControl.xml" target="lib\net48\HandyControl.xml" />
<file src="lib\netcoreapp3.0\en\HandyControl.resources.dll" target="lib\netcoreapp3.0\en\HandyControl.resources.dll" />
<file src="lib\netcoreapp3.0\fa\HandyControl.resources.dll" target="lib\netcoreapp3.0\fa\HandyControl.resources.dll" />
<file src="lib\netcoreapp3.0\fr\HandyControl.resources.dll" target="lib\netcoreapp3.0\fr\HandyControl.resources.dll" />
<file src="lib\netcoreapp3.0\HandyControl.deps.json" target="lib\netcoreapp3.0\HandyControl.deps.json" />
<file src="lib\netcoreapp3.0\HandyControl.dll" target="lib\netcoreapp3.0\HandyControl.dll" />
<file src="lib\netcoreapp3.0\HandyControl.pdb" target="lib\netcoreapp3.0\HandyControl.pdb" />
<file src="lib\netcoreapp3.0\HandyControl.xml" target="lib\netcoreapp3.0\HandyControl.xml" />
</files>
</package>
+256
View File
@@ -0,0 +1,256 @@
##########################################################################
# This is the Cake bootstrapper script for PowerShell.
# This file was downloaded from https://github.com/cake-build/resources
# Feel free to change this file to fit your needs.
##########################################################################
<#
.SYNOPSIS
This is a Powershell script to bootstrap a Cake build.
.DESCRIPTION
This Powershell script will download NuGet if missing, restore NuGet tools (including Cake)
and execute your Cake build script with the parameters you provide.
.PARAMETER Script
The build script to execute.
.PARAMETER Target
The build script target to run.
.PARAMETER Configuration
The build configuration to use.
.PARAMETER Verbosity
Specifies the amount of information to be displayed.
.PARAMETER ShowDescription
Shows description about tasks.
.PARAMETER DryRun
Performs a dry run.
.PARAMETER SkipToolPackageRestore
Skips restoring of packages.
.PARAMETER ScriptArgs
Remaining arguments are added here.
.LINK
https://cakebuild.net
#>
[CmdletBinding()]
Param(
[string]$Script = "build.cake",
[string]$Target,
[string]$Configuration,
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
[string]$Verbosity,
[switch]$ShowDescription,
[Alias("WhatIf", "Noop")]
[switch]$DryRun,
[switch]$SkipToolPackageRestore,
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
[string[]]$ScriptArgs
)
# Attempt to set highest encryption available for SecurityProtocol.
# PowerShell will not set this by default (until maybe .NET 4.6.x). This
# will typically produce a message for PowerShell v2 (just an info
# message though)
try {
# Set TLS 1.2 (3072), then TLS 1.1 (768), then TLS 1.0 (192), finally SSL 3.0 (48)
# Use integers because the enumeration values for TLS 1.2 and TLS 1.1 won't
# exist in .NET 4.0, even though they are addressable if .NET 4.5+ is
# installed (.NET 4.5 is an in-place upgrade).
# PowerShell Core already has support for TLS 1.2 so we can skip this if running in that.
if (-not $IsCoreCLR) {
[System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor 192 -bor 48
}
} catch {
Write-Output 'Unable to set PowerShell to use TLS 1.2 and TLS 1.1 due to old .NET Framework installed. If you see underlying connection closed or trust errors, you may need to upgrade to .NET Framework 4.5+ and PowerShell v3'
}
[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null
function MD5HashFile([string] $filePath)
{
if ([string]::IsNullOrEmpty($filePath) -or !(Test-Path $filePath -PathType Leaf))
{
return $null
}
[System.IO.Stream] $file = $null;
[System.Security.Cryptography.MD5] $md5 = $null;
try
{
$md5 = [System.Security.Cryptography.MD5]::Create()
$file = [System.IO.File]::OpenRead($filePath)
return [System.BitConverter]::ToString($md5.ComputeHash($file))
}
finally
{
if ($file -ne $null)
{
$file.Dispose()
}
}
}
function GetProxyEnabledWebClient
{
$wc = New-Object System.Net.WebClient
$proxy = [System.Net.WebRequest]::GetSystemWebProxy()
$proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
$wc.Proxy = $proxy
return $wc
}
Write-Host "Preparing to run build script..."
if(!$PSScriptRoot){
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
}
$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
$ADDINS_DIR = Join-Path $TOOLS_DIR "Addins"
$MODULES_DIR = Join-Path $TOOLS_DIR "Modules"
$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe"
$NUGET_URL = "https://github.com/HandyOrg/HandyOrgResource/blob/master/Tools/nuget.exe?raw=true"
$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config"
$PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum"
$ADDINS_PACKAGES_CONFIG = Join-Path $ADDINS_DIR "packages.config"
$MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config"
# Make sure tools folder exists
if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) {
Write-Verbose -Message "Creating tools directory..."
New-Item -Path $TOOLS_DIR -Type Directory | Out-Null
}
# Make sure that packages.config exist.
if (!(Test-Path $PACKAGES_CONFIG)) {
Write-Verbose -Message "Downloading packages.config..."
try {
$wc = GetProxyEnabledWebClient
$wc.DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG)
} catch {
Throw "Could not download packages.config."
}
}
# Try find NuGet.exe in path if not exists
if (!(Test-Path $NUGET_EXE)) {
Write-Verbose -Message "Trying to find nuget.exe in PATH..."
$existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_ -PathType Container) }
$NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1
if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) {
Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)."
$NUGET_EXE = $NUGET_EXE_IN_PATH.FullName
}
}
# Try download NuGet.exe if not exists
if (!(Test-Path $NUGET_EXE)) {
Write-Verbose -Message "Downloading NuGet.exe..."
try {
$wc = GetProxyEnabledWebClient
$wc.DownloadFile($NUGET_URL, $NUGET_EXE)
} catch {
Throw "Could not download NuGet.exe."
}
}
# Save nuget.exe path to environment to be available to child processed
$env:NUGET_EXE = $NUGET_EXE
$env:NUGET_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) {
"mono `"$NUGET_EXE`""
} else {
"`"$NUGET_EXE`""
}
# Restore tools from NuGet?
if(-Not $SkipToolPackageRestore.IsPresent) {
Push-Location
Set-Location $TOOLS_DIR
# Check for changes in packages.config and remove installed tools if true.
[string] $md5Hash = MD5HashFile $PACKAGES_CONFIG
if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or
($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) {
Write-Verbose -Message "Missing or changed package.config hash..."
Get-ChildItem -Exclude packages.config,nuget.exe,Cake.Bakery |
Remove-Item -Recurse -Force
}
Write-Verbose -Message "Restoring tools from NuGet..."
$NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""
if ($LASTEXITCODE -ne 0) {
Throw "An error occurred while restoring NuGet tools."
}
else
{
$md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII"
}
Write-Verbose -Message ($NuGetOutput | Out-String)
Pop-Location
}
# Restore addins from NuGet
if (Test-Path $ADDINS_PACKAGES_CONFIG) {
Push-Location
Set-Location $ADDINS_DIR
Write-Verbose -Message "Restoring addins from NuGet..."
$NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`""
if ($LASTEXITCODE -ne 0) {
Throw "An error occurred while restoring NuGet addins."
}
Write-Verbose -Message ($NuGetOutput | Out-String)
Pop-Location
}
# Restore modules from NuGet
if (Test-Path $MODULES_PACKAGES_CONFIG) {
Push-Location
Set-Location $MODULES_DIR
Write-Verbose -Message "Restoring modules from NuGet..."
$NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`""
if ($LASTEXITCODE -ne 0) {
Throw "An error occurred while restoring NuGet modules."
}
Write-Verbose -Message ($NuGetOutput | Out-String)
Pop-Location
}
# Make sure that Cake has been installed.
if (!(Test-Path $CAKE_EXE)) {
Throw "Could not find Cake.exe at $CAKE_EXE"
}
$CAKE_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) {
"mono `"$CAKE_EXE`""
} else {
"`"$CAKE_EXE`""
}
# Build an array (not a string) of Cake arguments to be joined later
$cakeArguments = @()
if ($Script) { $cakeArguments += "`"$Script`"" }
if ($Target) { $cakeArguments += "-target=`"$Target`"" }
if ($Configuration) { $cakeArguments += "-configuration=$Configuration" }
if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" }
if ($ShowDescription) { $cakeArguments += "-showdescription" }
if ($DryRun) { $cakeArguments += "-dryrun" }
$cakeArguments += $ScriptArgs
# Start Cake
Write-Host "Running build script..."
Invoke-Expression "& $CAKE_EXE_INVOCATION $($cakeArguments -join " ")"
exit $LASTEXITCODE
@@ -636,6 +636,22 @@ namespace HandyControl.Controls
}
else if (ContextMenu != null)
{
if (ContextMenu.Items.Count == 0) return;
ContextMenu.InvalidateProperty(StyleProperty);
foreach (var item in ContextMenu.Items)
{
if (item is MenuItem menuItem)
{
menuItem.InvalidateProperty(StyleProperty);
}
else
{
var container = ContextMenu.ItemContainerGenerator.ContainerFromItem(item) as MenuItem;
container?.InvalidateProperty(StyleProperty);
}
}
ContextMenu.Placement = PlacementMode.Mouse;
ContextMenu.IsOpen = true;
@@ -304,7 +304,7 @@ namespace HandyControl.Controls
ItemIsDragging = true;
_isWaiting = true;
_dragPoint = e.GetPosition(parent);
_dragPoint = new Point(_dragPoint.X + +_scrollHorizontalOffset, _dragPoint.Y);
_dragPoint = new Point(_dragPoint.X + _scrollHorizontalOffset, _dragPoint.Y);
_mouseDownPoint = _dragPoint;
CaptureMouse();
}
@@ -432,6 +432,11 @@ namespace HandyControl.Controls
/// <returns></returns>
private int CalLocationIndex(double left)
{
if (_isWaiting)
{
return CurrentIndex;
}
var maxIndex = TabControlParent.Items.Count - 1;
var div = (int)(left / ItemWidth);
var rest = left % ItemWidth;
@@ -910,10 +910,4 @@
<Folder Include="$(MSBuildThisFileDirectory)Controls\Growl\" />
<Folder Include="$(MSBuildThisFileDirectory)Tools\Generator\" />
</ItemGroup>
<ItemGroup>
<Page Update="E:\Work\GitHub\HandyControl\src\Shared\HandyControl_Shared\Themes\Styles\Base\SplitButtonBaseStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
</Project>