From 84463bef4b410d731b8bc7d4d6a27189af253a36 Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Sat, 30 Nov 2019 00:56:41 +0800 Subject: [PATCH 01/34] init branch --- .../HandyControlDemo_Core30.csproj | 3 +++ .../HandyControlDemo_Net_40.csproj | 3 +++ .../HandyControlDemo_Net_GE45.csproj | 3 +++ .../HandyControlDemo_Shared/Data/DemoInfo.json | 3 ++- .../HandyControlDemo_Shared.projitems | 7 +++++++ .../Img/LeftMainContent/TransformRelative_16x.png | Bin 0 -> 169 bytes .../Controls/RelativePanelDemoCtl.xaml | 8 ++++++++ .../Controls/RelativePanelDemoCtl.xaml.cs | 10 ++++++++++ .../Controls/Panel/RelativePanel.cs | 9 +++++++++ .../HandyControl_Shared.projitems | 1 + 10 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/TransformRelative_16x.png create mode 100644 src/Shared/HandyControlDemo_Shared/UserControl/Controls/RelativePanelDemoCtl.xaml create mode 100644 src/Shared/HandyControlDemo_Shared/UserControl/Controls/RelativePanelDemoCtl.xaml.cs create mode 100644 src/Shared/HandyControl_Shared/Controls/Panel/RelativePanel.cs diff --git a/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj b/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj index e9ef66a4..afdbaac0 100644 --- a/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj +++ b/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj @@ -448,6 +448,9 @@ Resources\Img\LeftMainContent\View_Portrait_16x.png + + Resources\Img\LeftMainContent\TransformRelative_16x.png + diff --git a/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj b/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj index e5a658ad..65e72972 100644 --- a/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj +++ b/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj @@ -430,6 +430,9 @@ TextTemplatingFileGenerator MessageToken.cs + + Resources\Img\LeftMainContent\TransformRelative_16x.png + Resources\Img\LeftMainContent\View_Portrait_16x.png diff --git a/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj b/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj index 1fa83a40..8a6b97f4 100644 --- a/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj +++ b/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj @@ -496,6 +496,9 @@ TextTemplatingFileGenerator MessageToken.cs + + Resources\Img\LeftMainContent\TransformRelative_16x.png + Resources\Img\LeftMainContent\View_Portrait_16x.png diff --git a/src/Shared/HandyControlDemo_Shared/Data/DemoInfo.json b/src/Shared/HandyControlDemo_Shared/Data/DemoInfo.json index 6c5f4f76..92439c37 100644 --- a/src/Shared/HandyControlDemo_Shared/Data/DemoInfo.json +++ b/src/Shared/HandyControlDemo_Shared/Data/DemoInfo.json @@ -40,7 +40,7 @@ [ "Gravatar", "GravatarDemoCtl", "User_16x", "" ], [ "Badge", "BadgeDemoCtl", "DotLarge_16x", "" ], [ "GotoTop", "GotoTopDemoCtl", "GoToTop_16x", "" ], - [ "SplitButton", "SplitButtonDemoCtl", "SplitButton_16x", "1" ], + [ "SplitButton", "SplitButtonDemoCtl", "SplitButton_16x", "" ], [ "ButtonGroup", "ButtonGroupDemoCtl", "ButtonGroup_16x", "" ], [ "ProgressButton", "ProgressButtonDemoCtl", "ProgressButton_16x", "" ], [ "ChatBubble", "ChatBubbleDemoCtl", "Bubble_16xLG", "" ], @@ -68,6 +68,7 @@ [ "Divider", "DividerDemoCtl", "DottedSplitter_16x", "1" ], [ "CirclePanel", "CirclePanelDemoCtl", "ColorWheel_16x", "" ], [ "Grid", "GridDemoCtl", "GridPane_16x", "" ], + [ "RelativePanel", "RelativePanelDemoCtl", "TransformRelative_16x", "1" ], [ "WaterfallPanel", "WaterfallPanelDemoCtl", "Panel_16x", "" ], [ "HoneycombPanel", "HoneycombPanelDemoCtl", "PolygonHexagon_16x", "" ], [ "TransitioningContentControl", "TransitioningContentControlDemoCtl", "TransitioningContentControl_16x", "" ], diff --git a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems index 6d09742c..4fe569a5 100644 --- a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems +++ b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems @@ -182,6 +182,9 @@ RateDemoCtl.xaml + + RelativePanelDemoCtl.xaml + RunningBlockDemoCtl.xaml @@ -640,6 +643,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/TransformRelative_16x.png b/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/TransformRelative_16x.png new file mode 100644 index 0000000000000000000000000000000000000000..bf04a7a9a92bf580162b967a05aafe97208dde84 GIT binary patch literal 169 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9F5he4R}c>anMpkTD8 zi(^Pd+|kL7Tn7v|SZZhg|L=XN`}!0a7QyY=nyQClMA8x+6O+?kcTRH%_5RkYwlkqm zJBaJfnFc2Nv`7EuC|njh@JU87w?6CtRE6oKeg_(urm$q%pML+oin(`kw!O>ou5UnV O7(8A5T-G@yGywpb_&a9+ literal 0 HcmV?d00001 diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RelativePanelDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RelativePanelDemoCtl.xaml new file mode 100644 index 00000000..b59bb5c8 --- /dev/null +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RelativePanelDemoCtl.xaml @@ -0,0 +1,8 @@ + + + + + diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RelativePanelDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RelativePanelDemoCtl.xaml.cs new file mode 100644 index 00000000..747c9b57 --- /dev/null +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RelativePanelDemoCtl.xaml.cs @@ -0,0 +1,10 @@ +namespace HandyControlDemo.UserControl +{ + public partial class RelativePanelDemoCtl + { + public RelativePanelDemoCtl() + { + InitializeComponent(); + } + } +} diff --git a/src/Shared/HandyControl_Shared/Controls/Panel/RelativePanel.cs b/src/Shared/HandyControl_Shared/Controls/Panel/RelativePanel.cs new file mode 100644 index 00000000..0c48f95a --- /dev/null +++ b/src/Shared/HandyControl_Shared/Controls/Panel/RelativePanel.cs @@ -0,0 +1,9 @@ +using System.Windows.Controls; + +namespace HandyControl.Controls +{ + public class RelativePanel : Panel + { + + } +} diff --git a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems index bb56f6d3..233e5817 100644 --- a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems +++ b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems @@ -35,6 +35,7 @@ + From 23b9c41301f54b2cdc614525387e50a6d874a776 Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Sat, 30 Nov 2019 01:16:57 +0800 Subject: [PATCH 02/34] add basic codes --- .../Controls/Panel/RelativePanel.cs | 168 +++++++++++++++++- 1 file changed, 167 insertions(+), 1 deletion(-) diff --git a/src/Shared/HandyControl_Shared/Controls/Panel/RelativePanel.cs b/src/Shared/HandyControl_Shared/Controls/Panel/RelativePanel.cs index 0c48f95a..918c18c4 100644 --- a/src/Shared/HandyControl_Shared/Controls/Panel/RelativePanel.cs +++ b/src/Shared/HandyControl_Shared/Controls/Panel/RelativePanel.cs @@ -1,9 +1,175 @@ -using System.Windows.Controls; +using System.Windows; +using System.Windows.Controls; +using HandyControl.Data; namespace HandyControl.Controls { public class RelativePanel : Panel { + #region Panel alignment relationships + public static readonly DependencyProperty AlignLeftWithPanelProperty = DependencyProperty.RegisterAttached( + "AlignLeftWithPanel", typeof(bool), typeof(RelativePanel), new PropertyMetadata(ValueBoxes.FalseBox)); + + public static void SetAlignLeftWithPanel(DependencyObject element, bool value) + => element.SetValue(AlignLeftWithPanelProperty, value); + + public static bool GetAlignLeftWithPanel(DependencyObject element) + => (bool) element.GetValue(AlignLeftWithPanelProperty); + + public static readonly DependencyProperty AlignTopWithPanelProperty = DependencyProperty.RegisterAttached( + "AlignTopWithPanel", typeof(bool), typeof(RelativePanel), new PropertyMetadata(ValueBoxes.FalseBox)); + + public static void SetAlignTopWithPanel(DependencyObject element, bool value) + => element.SetValue(AlignTopWithPanelProperty, value); + + public static bool GetAlignTopWithPanel(DependencyObject element) + => (bool) element.GetValue(AlignTopWithPanelProperty); + + public static readonly DependencyProperty AlignRightWithPanelProperty = DependencyProperty.RegisterAttached( + "AlignRightWithPanel", typeof(bool), typeof(RelativePanel), new PropertyMetadata(ValueBoxes.FalseBox)); + + public static void SetAlignRightWithPanel(DependencyObject element, bool value) + => element.SetValue(AlignRightWithPanelProperty, value); + + public static bool GetAlignRightWithPanel(DependencyObject element) + => (bool) element.GetValue(AlignRightWithPanelProperty); + + public static readonly DependencyProperty AlignBottomWithPanelProperty = DependencyProperty.RegisterAttached( + "AlignBottomWithPanel", typeof(bool), typeof(RelativePanel), new PropertyMetadata(ValueBoxes.FalseBox)); + + public static void SetAlignBottomWithPanel(DependencyObject element, bool value) + => element.SetValue(AlignBottomWithPanelProperty, value); + + public static bool GetAlignBottomWithPanel(DependencyObject element) + => (bool) element.GetValue(AlignBottomWithPanelProperty); + + public static readonly DependencyProperty AlignHorizontalCenterWithPanelProperty = DependencyProperty.RegisterAttached( + "AlignHorizontalCenterWithPanel", typeof(bool), typeof(RelativePanel), new PropertyMetadata(ValueBoxes.FalseBox)); + + public static void SetAlignHorizontalCenterWithPanel(DependencyObject element, bool value) + => element.SetValue(AlignHorizontalCenterWithPanelProperty, value); + + public static bool GetAlignHorizontalCenterWithPanel(DependencyObject element) + => (bool) element.GetValue(AlignHorizontalCenterWithPanelProperty); + + public static readonly DependencyProperty AlignVerticalCenterWithPanelProperty = DependencyProperty.RegisterAttached( + "AlignVerticalCenterWithPanel", typeof(bool), typeof(RelativePanel), new PropertyMetadata(ValueBoxes.FalseBox)); + + public static void SetAlignVerticalCenterWithPanel(DependencyObject element, bool value) + => element.SetValue(AlignVerticalCenterWithPanelProperty, value); + + public static bool GetAlignVerticalCenterWithPanel(DependencyObject element) + => (bool) element.GetValue(AlignVerticalCenterWithPanelProperty); + + #endregion + + #region Sibling alignment relationships + + public static readonly DependencyProperty AlignLeftWithProperty = DependencyProperty.RegisterAttached( + "AlignLeftWith", typeof(string), typeof(RelativePanel), new PropertyMetadata(default(string))); + + public static void SetAlignLeftWith(DependencyObject element, string value) + => element.SetValue(AlignLeftWithProperty, value); + + public static string GetAlignLeftWith(DependencyObject element) + => (string) element.GetValue(AlignLeftWithProperty); + + public static readonly DependencyProperty AlignTopWithProperty = DependencyProperty.RegisterAttached( + "AlignTopWith", typeof(string), typeof(RelativePanel), new PropertyMetadata(default(string))); + + public static void SetAlignTopWith(DependencyObject element, string value) + => element.SetValue(AlignTopWithProperty, value); + + public static string GetAlignTopWith(DependencyObject element) + => (string) element.GetValue(AlignTopWithProperty); + + public static readonly DependencyProperty AlignRightWithProperty = DependencyProperty.RegisterAttached( + "AlignRightWith", typeof(string), typeof(RelativePanel), new PropertyMetadata(default(string))); + + public static void SetAlignRightWith(DependencyObject element, string value) + => element.SetValue(AlignRightWithProperty, value); + + public static string GetAlignRightWith(DependencyObject element) + => (string) element.GetValue(AlignRightWithProperty); + + public static readonly DependencyProperty AlignBottomWithProperty = DependencyProperty.RegisterAttached( + "AlignBottomWith", typeof(string), typeof(RelativePanel), new PropertyMetadata(default(string))); + + public static void SetAlignBottomWith(DependencyObject element, string value) + => element.SetValue(AlignBottomWithProperty, value); + + public static string GetAlignBottomWith(DependencyObject element) + => (string) element.GetValue(AlignBottomWithProperty); + + public static readonly DependencyProperty AlignHorizontalCenterWithProperty = DependencyProperty.RegisterAttached( + "AlignHorizontalCenterWith", typeof(string), typeof(RelativePanel), new PropertyMetadata(default(string))); + + public static void SetAlignHorizontalCenterWith(DependencyObject element, string value) + => element.SetValue(AlignHorizontalCenterWithProperty, value); + + public static string GetAlignHorizontalCenterWith(DependencyObject element) + => (string) element.GetValue(AlignHorizontalCenterWithProperty); + + public static readonly DependencyProperty AlignVerticalCenterWithProperty = DependencyProperty.RegisterAttached( + "AlignVerticalCenterWith", typeof(string), typeof(RelativePanel), new PropertyMetadata(default(string))); + + public static void SetAlignVerticalCenterWith(DependencyObject element, string value) + => element.SetValue(AlignVerticalCenterWithProperty, value); + + public static string GetAlignVerticalCenterWith(DependencyObject element) + => (string) element.GetValue(AlignVerticalCenterWithProperty); + + #endregion + + #region Sibling positional relationships + + public static readonly DependencyProperty LeftOfProperty = DependencyProperty.RegisterAttached( + "LeftOf", typeof(string), typeof(RelativePanel), new PropertyMetadata(default(string))); + + public static void SetLeftOf(DependencyObject element, string value) + => element.SetValue(LeftOfProperty, value); + + public static string GetLeftOf(DependencyObject element) + => (string)element.GetValue(LeftOfProperty); + + public static readonly DependencyProperty AboveProperty = DependencyProperty.RegisterAttached( + "Above", typeof(string), typeof(RelativePanel), new PropertyMetadata(default(string))); + + public static void SetAbove(DependencyObject element, string value) + => element.SetValue(AboveProperty, value); + + public static string GetAbove(DependencyObject element) + => (string)element.GetValue(AboveProperty); + + public static readonly DependencyProperty RightOfProperty = DependencyProperty.RegisterAttached( + "RightOf", typeof(string), typeof(RelativePanel), new PropertyMetadata(default(string))); + + public static void SetRightOf(DependencyObject element, string value) + => element.SetValue(RightOfProperty, value); + + public static string GetRightOf(DependencyObject element) + => (string)element.GetValue(RightOfProperty); + + public static readonly DependencyProperty BelowProperty = DependencyProperty.RegisterAttached( + "Below", typeof(string), typeof(RelativePanel), new PropertyMetadata(default(string))); + + public static void SetBelow(DependencyObject element, string value) + => element.SetValue(BelowProperty, value); + + public static string GetBelow(DependencyObject element) + => (string) element.GetValue(BelowProperty); + + #endregion + + protected override Size MeasureOverride(Size availableSize) + { + return availableSize; + } + + protected override Size ArrangeOverride(Size arrangeSize) + { + return arrangeSize; + } } } From 2474e99f1f2634e0ec9b22b1e3d3ca6cb06d4dc6 Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Sun, 1 Dec 2019 15:07:13 +0800 Subject: [PATCH 03/34] fixed #241 --- .../HandyControl_Shared/Controls/TabControl/TabItem.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Shared/HandyControl_Shared/Controls/TabControl/TabItem.cs b/src/Shared/HandyControl_Shared/Controls/TabControl/TabItem.cs index e78a4491..f0430347 100644 --- a/src/Shared/HandyControl_Shared/Controls/TabControl/TabItem.cs +++ b/src/Shared/HandyControl_Shared/Controls/TabControl/TabItem.cs @@ -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 /// private int CalLocationIndex(double left) { + if (_isWaiting) + { + return CurrentIndex; + } + var maxIndex = TabControlParent.Items.Count - 1; var div = (int)(left / ItemWidth); var rest = left % ItemWidth; From e3eab0fada391ec1b7fd4e702680451c7bc096c3 Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Sun, 1 Dec 2019 19:10:58 +0800 Subject: [PATCH 04/34] use cake to build project --- .gitignore | 6 +- build/build.cake | 62 +++++ build/build.nuspec | 70 +++++ build/build.ps1 | 256 ++++++++++++++++++ .../HandyControl_Shared.projitems | 6 - 5 files changed, 393 insertions(+), 7 deletions(-) create mode 100644 build/build.cake create mode 100644 build/build.nuspec create mode 100644 build/build.ps1 diff --git a/.gitignore b/.gitignore index 0c602ad8..73a9dc99 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,8 @@ *.xml [Bb]in/ [Oo]bj/ -packages/ \ No newline at end of file +packages/ +build/* +!build/build.cake +!build/build.nuspec +!build/build.ps1 \ No newline at end of file diff --git a/build/build.cake b/build/build.cake new file mode 100644 index 00000000..7a5769ed --- /dev/null +++ b/build/build.cake @@ -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); \ No newline at end of file diff --git a/build/build.nuspec b/build/build.nuspec new file mode 100644 index 00000000..d40e941a --- /dev/null +++ b/build/build.nuspec @@ -0,0 +1,70 @@ + + + + HandyControl + 2.3.0 + HandyOrg + HandyOrg + HandyOrg + false + https://github.com/NaBian/HandyControl + https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/icon.png + Contains some commonly used simple WPF controls + Changes are detailed at https://github.com/HandyOrg/HandyControl/releases + Copyright © HandyOrg 2018-2019 + + WPF C# Control + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/build/build.ps1 b/build/build.ps1 new file mode 100644 index 00000000..23a48b73 --- /dev/null +++ b/build/build.ps1 @@ -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 diff --git a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems index bb56f6d3..32a40820 100644 --- a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems +++ b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems @@ -909,10 +909,4 @@ - - - Designer - MSBuild:Compile - - \ No newline at end of file From 3e98a60246a2e9cab88f945cb8e38b72839342bf Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Sun, 1 Dec 2019 19:32:40 +0800 Subject: [PATCH 05/34] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 79b7a3f1..c2ae3353 100644 --- a/README.md +++ b/README.md @@ -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 From 309f4a72e6a641a57e49b6981db89db260cc2111 Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Sun, 1 Dec 2019 21:12:51 +0800 Subject: [PATCH 06/34] fixed a bug of NotifyIcon --- .../Controls/Other/NotifyIcon.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Shared/HandyControl_Shared/Controls/Other/NotifyIcon.cs b/src/Shared/HandyControl_Shared/Controls/Other/NotifyIcon.cs index ca4ad40b..988b72c4 100644 --- a/src/Shared/HandyControl_Shared/Controls/Other/NotifyIcon.cs +++ b/src/Shared/HandyControl_Shared/Controls/Other/NotifyIcon.cs @@ -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; From 5099bfe39356801505f97a3d498a4ceaf5b256ca Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Sun, 1 Dec 2019 21:48:38 +0800 Subject: [PATCH 07/34] update vsix to v2.3.0 --- .../VS2019/HandyControl_VS2019/source.extension.vsixmanifest | 2 +- Installers/VS2019/WpfApp/ProjectTemplate.csproj | 4 ++-- Installers/VS2019/WpfApp/Properties/AssemblyInfo.cs | 4 ++-- Installers/VS2019/WpfApp/packages.config | 2 +- Installers/VS2019/WpfCoreApp/ProjectTemplate.csproj | 2 +- Installers/VS2019/WpfCoreApp/Properties/AssemblyInfo.cs | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Installers/VS2019/HandyControl_VS2019/source.extension.vsixmanifest b/Installers/VS2019/HandyControl_VS2019/source.extension.vsixmanifest index 2b7872fa..6824b141 100644 --- a/Installers/VS2019/HandyControl_VS2019/source.extension.vsixmanifest +++ b/Installers/VS2019/HandyControl_VS2019/source.extension.vsixmanifest @@ -1,7 +1,7 @@  - + HandyControl for VS2019 This VSIX Project will help people initialize a HandyControl project. https://handyorg.github.io/handycontrol diff --git a/Installers/VS2019/WpfApp/ProjectTemplate.csproj b/Installers/VS2019/WpfApp/ProjectTemplate.csproj index 36c31f3e..d8a830db 100644 --- a/Installers/VS2019/WpfApp/ProjectTemplate.csproj +++ b/Installers/VS2019/WpfApp/ProjectTemplate.csproj @@ -34,8 +34,8 @@ 4 - - ..\packages\HandyControl.2.2.0\lib\net47\HandyControl.dll + + ..\packages\HandyControl.2.3.0\lib\net47\HandyControl.dll diff --git a/Installers/VS2019/WpfApp/Properties/AssemblyInfo.cs b/Installers/VS2019/WpfApp/Properties/AssemblyInfo.cs index 48d57882..b45d8c50 100644 --- a/Installers/VS2019/WpfApp/Properties/AssemblyInfo.cs +++ b/Installers/VS2019/WpfApp/Properties/AssemblyInfo.cs @@ -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")] \ No newline at end of file +[assembly: AssemblyVersion("2.3.0")] +[assembly: AssemblyFileVersion("2.3.0")] \ No newline at end of file diff --git a/Installers/VS2019/WpfApp/packages.config b/Installers/VS2019/WpfApp/packages.config index 49835227..4889bb7d 100644 --- a/Installers/VS2019/WpfApp/packages.config +++ b/Installers/VS2019/WpfApp/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Installers/VS2019/WpfCoreApp/ProjectTemplate.csproj b/Installers/VS2019/WpfCoreApp/ProjectTemplate.csproj index 7be21c89..c453863b 100644 --- a/Installers/VS2019/WpfCoreApp/ProjectTemplate.csproj +++ b/Installers/VS2019/WpfCoreApp/ProjectTemplate.csproj @@ -19,6 +19,6 @@ TRACE;Core - + \ No newline at end of file diff --git a/Installers/VS2019/WpfCoreApp/Properties/AssemblyInfo.cs b/Installers/VS2019/WpfCoreApp/Properties/AssemblyInfo.cs index 2c7b05f5..afd74fb0 100644 --- a/Installers/VS2019/WpfCoreApp/Properties/AssemblyInfo.cs +++ b/Installers/VS2019/WpfCoreApp/Properties/AssemblyInfo.cs @@ -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")] \ No newline at end of file +[assembly: AssemblyVersion("2.3.0")] +[assembly: AssemblyFileVersion("2.3.0")] \ No newline at end of file From 1e913c27f42e1932459b1f7085b9338cee7d1887 Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Mon, 2 Dec 2019 22:22:14 +0800 Subject: [PATCH 08/34] fixed a bug of GrowlWindow --- .../Controls/Growl/Growl.cs | 2 +- .../Controls/Growl/GrowlWindow.cs | 19 +++++++++++-------- .../Themes/Styles/Growl.xaml | 9 --------- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs b/src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs index 8e285916..c62a0a39 100644 --- a/src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs +++ b/src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs @@ -800,7 +800,7 @@ namespace HandyControl.Controls _timerClose?.Stop(); var transform = new TranslateTransform(); _gridMain.RenderTransform = transform; - var animation = AnimationHelper.CreateAnimation(MaxWidth); + var animation = AnimationHelper.CreateAnimation(ActualWidth); animation.Completed += (s, e) => { if (Parent is Panel panel) diff --git a/src/Shared/HandyControl_Shared/Controls/Growl/GrowlWindow.cs b/src/Shared/HandyControl_Shared/Controls/Growl/GrowlWindow.cs index 38c75cd5..662dfcc1 100644 --- a/src/Shared/HandyControl_Shared/Controls/Growl/GrowlWindow.cs +++ b/src/Shared/HandyControl_Shared/Controls/Growl/GrowlWindow.cs @@ -3,24 +3,27 @@ using System.Windows.Controls; namespace HandyControl.Controls { - [TemplatePart(Name = ElementGrowPanel, Type = typeof(Panel))] internal class GrowlWindow : Window { - private const string ElementGrowPanel = "PART_GrowPanel"; - public Panel GrowlPanel { get; set; } public GrowlWindow() { WindowStyle = WindowStyle.None; AllowsTransparency = true; - } - public override void OnApplyTemplate() - { - base.OnApplyTemplate(); + GrowlPanel = new StackPanel + { + VerticalAlignment = VerticalAlignment.Top, + Margin = new Thickness(0, 10, 10, 10) + }; - GrowlPanel = GetTemplateChild(ElementGrowPanel) as Panel; + Content = new ScrollViewer + { + VerticalScrollBarVisibility = ScrollBarVisibility.Hidden, + IsEnableInertia = true, + Content = GrowlPanel + }; } public void Init() diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Growl.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Growl.xaml index f54f7525..796609c5 100644 --- a/src/Shared/HandyControl_Shared/Themes/Styles/Growl.xaml +++ b/src/Shared/HandyControl_Shared/Themes/Styles/Growl.xaml @@ -19,15 +19,6 @@ - - - - - - - - -