From 86c58476c6b369c5a74f8bd44782f266280bac78 Mon Sep 17 00:00:00 2001
From: NaBian <836904362@qq.com>
Date: Mon, 12 Aug 2019 00:24:15 +0800
Subject: [PATCH 1/2] init branch
---
.../HandyControlDemo_Core30.csproj | 3 +++
.../HandyControlDemo_Net_40.csproj | 3 +++
.../HandyControlDemo_Net_GE45.csproj | 3 +++
.../Data/MessageToken.cs | 2 ++
.../Data/MessageToken.tt | 3 ++-
.../HandyControlDemo_Shared.projitems | 7 ++++++
.../Properties/Langs/Lang.Designer.cs | 9 +++++++
.../Properties/Langs/Lang.en.resx | 3 +++
.../Properties/Langs/Lang.resx | 3 +++
.../Img/LeftMainContent/HandyControl.png | Bin 0 -> 2046 bytes
.../UserControl/Controls/SpriteDemoCtl.xaml | 7 ++++++
.../Controls/SpriteDemoCtl.xaml.cs | 10 ++++++++
.../UserControl/Main/LeftMainContent.xaml | 7 +++++-
.../Controls/Other/Sprite.cs | 7 ++++++
.../Controls/Panel/CirclePanel.cs | 23 +++++++++++++-----
.../Controls/Panel/HoneycombPanel.cs | 2 +-
.../HandyControl_Shared.projitems | 1 +
17 files changed, 84 insertions(+), 9 deletions(-)
create mode 100644 src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/HandyControl.png
create mode 100644 src/Shared/HandyControlDemo_Shared/UserControl/Controls/SpriteDemoCtl.xaml
create mode 100644 src/Shared/HandyControlDemo_Shared/UserControl/Controls/SpriteDemoCtl.xaml.cs
create mode 100644 src/Shared/HandyControl_Shared/Controls/Other/Sprite.cs
diff --git a/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj b/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj
index 0f5b3822..efb97896 100644
--- a/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj
+++ b/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj
@@ -399,6 +399,9 @@
Resources\Img\LeftMainContent\PolygonHexagon_16x.png
+
+ Resources\Img\LeftMainContent\HandyControl.png
+
Resources\Img\Dance.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 0af990f9..530c4e9d 100644
--- a/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj
+++ b/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj
@@ -417,6 +417,9 @@
TextTemplatingFileGenerator
MessageToken.cs
+
+ Resources\Img\LeftMainContent\HandyControl.png
+
Resources\Img\LeftMainContent\PolygonHexagon_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 2987971d..a2e724d7 100644
--- a/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj
+++ b/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj
@@ -480,6 +480,9 @@
TextTemplatingFileGenerator
MessageToken.cs
+
+ Resources\Img\LeftMainContent\HandyControl.png
+
Resources\Img\LeftMainContent\PolygonHexagon_16x.png
diff --git a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs
index 1fdfbf4a..1e09db7a 100644
--- a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs
+++ b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs
@@ -110,6 +110,8 @@
public static readonly string HoneycombPanelDemoCtl = nameof(HoneycombPanelDemoCtl);
+ public static readonly string SpriteDemoCtl = nameof(SpriteDemoCtl);
+
public static readonly string ButtonDemoCtl = nameof(ButtonDemoCtl);
public static readonly string RepeatButtonDemoCtl = nameof(RepeatButtonDemoCtl);
diff --git a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt
index efb23e47..5562e803 100644
--- a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt
+++ b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt
@@ -57,7 +57,8 @@ var controlList = new List
"MagnifierDemoCtl",
"ImageBlockDemoCtl",
"RunningBlockDemoCtl",
- "HoneycombPanelDemoCtl"
+ "HoneycombPanelDemoCtl",
+ "SpriteDemoCtl"
};
var styleList = new List
{
diff --git a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
index 3b28efa9..50700677 100644
--- a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
+++ b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
@@ -177,6 +177,9 @@
SideMenuDemoCtl.xaml
+
+ SpriteDemoCtl.xaml
+
StepBarDemoCtl.xaml
@@ -596,6 +599,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs
index 910885a1..628ef134 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs
@@ -1365,6 +1365,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
+ ///
+ /// 查找类似 精灵 的本地化字符串。
+ ///
+ public static string Sprite {
+ get {
+ return ResourceManager.GetString("Sprite", resourceCulture);
+ }
+ }
+
///
/// 查找类似 步骤 的本地化字符串。
///
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx
index 92647771..a9276065 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx
@@ -645,4 +645,7 @@
Remove an item
+
+ Sprite
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx
index c034998d..452d92b9 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx
@@ -645,4 +645,7 @@
删除项
+
+ 精灵
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/HandyControl.png b/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/HandyControl.png
new file mode 100644
index 0000000000000000000000000000000000000000..911df21948b7cb951e183a0c2b170ac540073620
GIT binary patch
literal 2046
zcmbVNeQeZZ9KH>hjE^yephCdfnK%c%e%(h~ImzvAa3{NMY)3W%2)*{bTj8$l+HQB-
z5;Fn+fB*r3fh-^zTm%^qBM>qPLLeFj!7yQ%U<{%HArS~4%9!HYyW24gLt>M*Z{PQM
zpWpNQcz<0{Q8sh*hzTPs7RzYA&sz!K`Q|-52R>i9{g8*RT-7&Mw^;Iyn|Id6DR~nu
zmSMe8u*RqflyZU+v+|-60@g%Kg=mXq+Vq6V3rm23gg``+UFeO@BPb$?F0|SnAOflf
z)Jnc44OBIi1%;+10xP1^-$JG(I7ko!29G3SQCa5_E;Px@!Ld1wqev2BEODW3(;!k4
zs6af51`xZ|feEC|jyPE>>7Z>aI~Ab_lEDcECuxjya5jRYC?tKM(3&QOxk~Shv@Q7M
zLTe2}<#0S6k6YukRna0i$+9d?P&h?l5P|89vcV@XSuf~k@B&@XB-M}<88I38kWz2B
zP^dKJLQKuj%6d9XFkpCsS8>uxm@XxOqL9I<^;$G(ToiB+1u-BSI>eG0tXiuWie9S>
zLY-ND%m55+Ads=~L@lvc#)NK^G(b1f0eK=?4>qa*uLQbMuL+=}0m>{ey-_)j26#i!
zf{GIDPgF&}WW?h!6T>2f)sieKas7<}dw`cWfD1L(F@nKJDo790=3bPL1ER1yutq`SQNOhqQ!XVvlQba09WM*iew_md6cN4LBmiTJ#gOd@lezT;xF+yNY>%NC@Yzi8whZISvPoD0Di9vh4HaUlE_hlKoSfsVrOhE!068AXa{xO7>@0y%HlD;nVVezO1ct{T
znceOr2|EwOeztN=f@hMC4rDb|iI7pWiw+^gQ&`9uf`S;E1LN&N2xA-~EmBUJq-epc
z{A4k4K1qjZZcLx0Do~dmMI|IzKO8TZ=fZ^wWXNY
zC2Yib4Y(sPcF$6X_+a{VzTxTWpDmjyS%av5RJi|BeL6ToEiXp^Y_&LQ`h%NIDU}-h
z-&sqp4QOEfaM%^iVWu6!k4!@cGNjgEyRO-Jz_3`dcKN;TAhY`Y^#OUTd))FPO|Hq`
zWQ}xt^IF#CcloCNu+Pgr=ezh`x4LX!XxQ#ULyCu^j&(1bSabQKYu53?n8|`0?_4;i
z`doAQroG#?mi+SK0ZY-Mp`}^f(}hLDPG!AT^>*)$&wF0ax%E?3Df`m)`4#Kk*`+P*
zZChICqXlj8N#C{9v^L+peCfpLF58Fr&a=I)->Uvqm*
z-M+r7A8@`q!Jq4n`c`$W99QU+`hLA~=@T~G`0(lsaE{+~xPia$=@*N)mkC?9`A%mq
zJbnHA!^znl-A3Cz@W4v+OpUaz+VM{OUeWMdUB9_EjdII*(ynb{Z4-TXJle|7D5^5)CFV@1b}V?SQWrw=8XqfJ9WM_}cIK4a{tueI6LD~dns
z>&jkD%B~F^52OVri})|;{jQ}ID^BLlU(j+eH)l^b_G`{UGg}XK
zPiUR!;yH3(wvEc-9|#o4USVbNJ8Z=d(tZ
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/SpriteDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/SpriteDemoCtl.xaml.cs
new file mode 100644
index 00000000..fa59e94e
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/SpriteDemoCtl.xaml.cs
@@ -0,0 +1,10 @@
+namespace HandyControlDemo.UserControl
+{
+ public partial class SpriteDemoCtl
+ {
+ public SpriteDemoCtl()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml
index b94ff6ec..9f3b9c51 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml
@@ -330,7 +330,7 @@
-
+
@@ -445,6 +445,11 @@
+
+
+
+
+
diff --git a/src/Shared/HandyControl_Shared/Controls/Other/Sprite.cs b/src/Shared/HandyControl_Shared/Controls/Other/Sprite.cs
new file mode 100644
index 00000000..fb7340e5
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Controls/Other/Sprite.cs
@@ -0,0 +1,7 @@
+namespace HandyControl.Controls
+{
+ public class Sprite : System.Windows.Window
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Controls/Panel/CirclePanel.cs b/src/Shared/HandyControl_Shared/Controls/Panel/CirclePanel.cs
index 1eebdf43..1ad31640 100644
--- a/src/Shared/HandyControl_Shared/Controls/Panel/CirclePanel.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Panel/CirclePanel.cs
@@ -35,18 +35,28 @@ namespace HandyControl.Controls
set => SetValue(OffsetAngleProperty, value);
}
- // ReSharper disable once RedundantAssignment
protected override Size MeasureOverride(Size availableSize)
{
if (Children.Count == 0) return new Size(Diameter, Diameter);
- availableSize = new Size(Diameter, Diameter);
+ var newSize = new Size(Diameter, Diameter);
+
+ foreach (UIElement element in Children)
+ {
+ element.Measure(newSize);
+ }
+
+ return newSize;
+ }
+
+ protected override Size ArrangeOverride(Size finalSize)
+ {
var i = 0;
var perDeg = 360.0 / Children.Count;
var radius = Diameter / 2;
+
foreach (UIElement element in Children)
{
- element.Measure(availableSize);
var centerX = element.DesiredSize.Width / 2.0;
var centerY = element.DesiredSize.Height / 2.0;
var angle = perDeg * i++ + OffsetAngle;
@@ -60,11 +70,12 @@ namespace HandyControl.Controls
var r = Math.PI * angle / 180.0;
var x = radius * Math.Cos(r);
var y = radius * Math.Sin(r);
- var rectX = x + availableSize.Width / 2 - centerX;
- var rectY = y + availableSize.Height / 2 - centerY;
+ var rectX = x + finalSize.Width / 2 - centerX;
+ var rectY = y + finalSize.Height / 2 - centerY;
element.Arrange(new Rect(rectX, rectY, element.DesiredSize.Width, element.DesiredSize.Height));
}
- return availableSize;
+
+ return finalSize;
}
}
}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Controls/Panel/HoneycombPanel.cs b/src/Shared/HandyControl_Shared/Controls/Panel/HoneycombPanel.cs
index 91982f7d..1b3c3045 100644
--- a/src/Shared/HandyControl_Shared/Controls/Panel/HoneycombPanel.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Panel/HoneycombPanel.cs
@@ -93,7 +93,7 @@ namespace HandyControl.Controls
child.Arrange(_stuffer.Move());
}
- return base.ArrangeOverride(finalSize);
+ return finalSize;
}
private class HoneycombStuffer
diff --git a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
index a974057f..1b95259b 100644
--- a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
+++ b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
@@ -24,6 +24,7 @@
+
From d25ff966c204f2e9a65ee9ae63a0253d624bedbc Mon Sep 17 00:00:00 2001
From: NaBian <836904362@qq.com>
Date: Tue, 13 Aug 2019 23:36:13 +0800
Subject: [PATCH 2/2] completed the branch
---
.../HandyControlDemo_Shared.projitems | 8 ++++
.../Properties/Langs/Lang.Designer.cs | 9 ++++
.../Properties/Langs/Lang.en.resx | 3 ++
.../Properties/Langs/Lang.resx | 3 ++
.../Resources/Themes/Styles/Style.xaml | 4 ++
.../UserControl/Controls/SpriteDemoCtl.xaml | 9 +++-
.../UserControl/Main/AppSprite.xaml | 9 ++++
.../UserControl/Main/AppSprite.xaml.cs | 10 +++++
.../ViewModel/Controls/SpriteDemoViewModel.cs | 18 ++++++++
.../ViewModel/ViewModelLocator.cs | 3 ++
.../Controls/Attach/WindowAttach.cs | 42 ++++++++++++++++++-
.../Controls/Growl/GrowlWindow.cs | 15 +------
.../HandyControl_Shared.projitems | 5 +++
.../Commands/CloseWindowCommand.cs | 24 +++++++++++
.../Interactivity/Commands/ControlCommands.cs | 5 +++
.../Themes/Styles/Growl.xaml | 2 +
.../Themes/Styles/Style.xaml | 1 +
17 files changed, 152 insertions(+), 18 deletions(-)
create mode 100644 src/Shared/HandyControlDemo_Shared/UserControl/Main/AppSprite.xaml
create mode 100644 src/Shared/HandyControlDemo_Shared/UserControl/Main/AppSprite.xaml.cs
create mode 100644 src/Shared/HandyControlDemo_Shared/ViewModel/Controls/SpriteDemoViewModel.cs
create mode 100644 src/Shared/HandyControl_Shared/Interactivity/Commands/CloseWindowCommand.cs
diff --git a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
index 50700677..984abb9a 100644
--- a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
+++ b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
@@ -328,6 +328,7 @@
+
@@ -339,6 +340,9 @@
AboutWindow.xaml
+
+ AppSprite.xaml
+
BlurWindow.xaml
@@ -787,6 +791,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs
index 628ef134..43270cfc 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs
@@ -987,6 +987,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
+ ///
+ /// 查找类似 打开精灵 的本地化字符串。
+ ///
+ public static string OpenSprite {
+ get {
+ return ResourceManager.GetString("OpenSprite", resourceCulture);
+ }
+ }
+
///
/// 查找类似 轮廓文本 的本地化字符串。
///
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx
index a9276065..3efb365c 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx
@@ -648,4 +648,7 @@
Sprite
+
+ Open sprite
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx
index 452d92b9..6b168ea6 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx
@@ -648,4 +648,7 @@
精灵
+
+ 打开精灵
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Resources/Themes/Styles/Style.xaml b/src/Shared/HandyControlDemo_Shared/Resources/Themes/Styles/Style.xaml
index 8bcccf6a..49a0d290 100644
--- a/src/Shared/HandyControlDemo_Shared/Resources/Themes/Styles/Style.xaml
+++ b/src/Shared/HandyControlDemo_Shared/Resources/Themes/Styles/Style.xaml
@@ -94,4 +94,8 @@
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/SpriteDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/SpriteDemoCtl.xaml
index e023b10b..282b15b0 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/SpriteDemoCtl.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/SpriteDemoCtl.xaml
@@ -1,7 +1,12 @@
-
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Main/AppSprite.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Main/AppSprite.xaml
new file mode 100644
index 00000000..4f135524
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Main/AppSprite.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Main/AppSprite.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Main/AppSprite.xaml.cs
new file mode 100644
index 00000000..b0cba5f3
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Main/AppSprite.xaml.cs
@@ -0,0 +1,10 @@
+namespace HandyControlDemo.UserControl
+{
+ public partial class AppSprite
+ {
+ public AppSprite()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/src/Shared/HandyControlDemo_Shared/ViewModel/Controls/SpriteDemoViewModel.cs b/src/Shared/HandyControlDemo_Shared/ViewModel/Controls/SpriteDemoViewModel.cs
new file mode 100644
index 00000000..46d154ab
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/ViewModel/Controls/SpriteDemoViewModel.cs
@@ -0,0 +1,18 @@
+using System;
+using GalaSoft.MvvmLight;
+using HandyControl.Controls;
+using HandyControlDemo.UserControl;
+#if netle40
+using GalaSoft.MvvmLight.Command;
+#else
+using GalaSoft.MvvmLight.CommandWpf;
+# endif
+
+namespace HandyControlDemo
+{
+ public class SpriteDemoViewModel : ViewModelBase
+ {
+ public RelayCommand OpenCmd => new Lazy(() =>
+ new RelayCommand(()=> Sprite.Show(new AppSprite()))).Value;
+ }
+}
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/ViewModel/ViewModelLocator.cs b/src/Shared/HandyControlDemo_Shared/ViewModel/ViewModelLocator.cs
index 94eeca7a..a623d046 100644
--- a/src/Shared/HandyControlDemo_Shared/ViewModel/ViewModelLocator.cs
+++ b/src/Shared/HandyControlDemo_Shared/ViewModel/ViewModelLocator.cs
@@ -39,6 +39,7 @@ namespace HandyControlDemo.ViewModel
SimpleIoc.Default.Register();
SimpleIoc.Default.Register();
SimpleIoc.Default.Register();
+ SimpleIoc.Default.Register();
}
public static ViewModelLocator Instance => new Lazy(() =>
@@ -90,6 +91,8 @@ namespace HandyControlDemo.ViewModel
public CardDemoViewModel CardDemo => new CardDemoViewModel(ServiceLocator.Current.GetInstance());
+ public SpriteDemoViewModel SpriteDemo => ServiceLocator.Current.GetInstance();
+
#endregion
}
}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Controls/Attach/WindowAttach.cs b/src/Shared/HandyControl_Shared/Controls/Attach/WindowAttach.cs
index fb600659..911f6fec 100644
--- a/src/Shared/HandyControl_Shared/Controls/Attach/WindowAttach.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Attach/WindowAttach.cs
@@ -1,6 +1,9 @@
-using System.Windows;
+using System;
+using System.Windows;
using System.Windows.Input;
+using System.Windows.Interop;
using HandyControl.Data;
+using HandyControl.Tools.Interop;
namespace HandyControl.Controls
{
@@ -21,7 +24,7 @@ namespace HandyControl.Controls
{
if ((bool)e.NewValue)
{
- ctl.MouseLeftButtonDown += DragElement_MouseLeftButtonDown; ;
+ ctl.MouseLeftButtonDown += DragElement_MouseLeftButtonDown;
}
else
{
@@ -69,5 +72,40 @@ namespace HandyControl.Controls
public static bool GetIgnoreAltF4(DependencyObject element)
=> (bool) element.GetValue(IgnoreAltF4Property);
+
+ public static readonly DependencyProperty ShowInTaskManagerProperty = DependencyProperty.RegisterAttached(
+ "ShowInTaskManager", typeof(bool), typeof(WindowAttach), new PropertyMetadata(ValueBoxes.TrueBox, OnShowInTaskManagerChanged));
+
+ private static void OnShowInTaskManagerChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ if (d is System.Windows.Window window)
+ {
+ if ((bool)e.NewValue)
+ {
+ window.SourceInitialized -= Window_SourceInitialized;
+ }
+ else
+ {
+ window.SourceInitialized += Window_SourceInitialized;
+ }
+ }
+ }
+
+ private static void Window_SourceInitialized(object sender, EventArgs e)
+ {
+ if (sender is System.Windows.Window window)
+ {
+ var _ = new WindowInteropHelper(window)
+ {
+ Owner = NativeMethods.GetDesktopWindow()
+ };
+ }
+ }
+
+ public static void SetShowInTaskManager(DependencyObject element, bool value)
+ => element.SetValue(ShowInTaskManagerProperty, value);
+
+ public static bool GetShowInTaskManager(DependencyObject element)
+ => (bool) element.GetValue(ShowInTaskManagerProperty);
}
}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Controls/Growl/GrowlWindow.cs b/src/Shared/HandyControl_Shared/Controls/Growl/GrowlWindow.cs
index a341abbc..38c75cd5 100644
--- a/src/Shared/HandyControl_Shared/Controls/Growl/GrowlWindow.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Growl/GrowlWindow.cs
@@ -1,8 +1,5 @@
-using System;
-using System.Windows;
+using System.Windows;
using System.Windows.Controls;
-using System.Windows.Interop;
-using HandyControl.Tools.Interop;
namespace HandyControl.Controls
{
@@ -26,16 +23,6 @@ namespace HandyControl.Controls
GrowlPanel = GetTemplateChild(ElementGrowPanel) as Panel;
}
- protected override void OnSourceInitialized(EventArgs e)
- {
- base.OnSourceInitialized(e);
-
- var _ = new WindowInteropHelper(this)
- {
- Owner = NativeMethods.GetDesktopWindow()
- };
- }
-
public void Init()
{
var desktopWorkingArea = SystemParameters.WorkArea;
diff --git a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
index 1b95259b..09c934eb 100644
--- a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
+++ b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
@@ -31,6 +31,7 @@
+
@@ -763,6 +764,10 @@
Designer
MSBuild:Compile
+
+ MSBuild:Compile
+ Designer
+
Designer
MSBuild:Compile
diff --git a/src/Shared/HandyControl_Shared/Interactivity/Commands/CloseWindowCommand.cs b/src/Shared/HandyControl_Shared/Interactivity/Commands/CloseWindowCommand.cs
new file mode 100644
index 00000000..392abeab
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Interactivity/Commands/CloseWindowCommand.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Windows;
+using System.Windows.Input;
+
+namespace HandyControl.Interactivity
+{
+ public class CloseWindowCommand : ICommand
+ {
+ public bool CanExecute(object parameter) => true;
+
+ public void Execute(object parameter)
+ {
+ if (parameter is DependencyObject dependencyObject)
+ {
+ if (Window.GetWindow(dependencyObject) is Window window)
+ {
+ window.Close();
+ }
+ }
+ }
+
+ public event EventHandler CanExecuteChanged;
+ }
+}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Interactivity/Commands/ControlCommands.cs b/src/Shared/HandyControl_Shared/Interactivity/Commands/ControlCommands.cs
index ab66b196..07c58353 100644
--- a/src/Shared/HandyControl_Shared/Interactivity/Commands/ControlCommands.cs
+++ b/src/Shared/HandyControl_Shared/Interactivity/Commands/ControlCommands.cs
@@ -156,5 +156,10 @@ namespace HandyControl.Interactivity
/// 前置主窗口
///
public static PushMainWindow2TopCommand PushMainWindow2Top { get; } = new PushMainWindow2TopCommand();
+
+ ///
+ /// 关闭窗口
+ ///
+ public static CloseWindowCommand CloseWindow { get; } = new CloseWindowCommand();
}
}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Growl.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Growl.xaml
index 9fd38d69..f54f7525 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Growl.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Growl.xaml
@@ -11,6 +11,8 @@