diff --git a/README.md b/README.md index b29f80ff..a00fe919 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,12 @@ Step 4:enjoy coding ## Latest examples +### ImageBlock + +![ImageBlock](https://raw.githubusercontent.com/NaBian/HandyControl/master/Resources/ImageBlock.gif) + +![ImageBlock](https://raw.githubusercontent.com/NaBian/HandyControl/master/Resources/ImageBlock.png) + ### Magnifier ![Magnifier](https://raw.githubusercontent.com/NaBian/HandyControl/master/Resources/Magnifier.png) @@ -75,6 +81,8 @@ Step 4:enjoy coding ![ButtonGroup](https://raw.githubusercontent.com/NaBian/HandyControl/master/Resources/ButtonGroup.png) +## History publication + ### Grid ![Grid](https://raw.githubusercontent.com/NaBian/HandyControl/master/Resources/Grid.gif) @@ -83,8 +91,6 @@ Step 4:enjoy coding ![SideMenu](https://raw.githubusercontent.com/NaBian/HandyControl/master/Resources/SideMenu.png) -## History publication - ### NotifyIcon ![NotifyIcon](https://raw.githubusercontent.com/NaBian/HandyControl/master/Resources/NotifyIcon.png) diff --git a/Resources/ImageBlock.gif b/Resources/ImageBlock.gif new file mode 100644 index 00000000..d64e99d5 Binary files /dev/null and b/Resources/ImageBlock.gif differ diff --git a/Resources/ImageBlock.png b/Resources/ImageBlock.png new file mode 100644 index 00000000..4157f8a2 Binary files /dev/null and b/Resources/ImageBlock.png differ diff --git a/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj b/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj index 9243d394..ffdca70a 100644 --- a/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj +++ b/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj @@ -5,7 +5,7 @@ true HandyControlDemo HandyControlDemo - 2.0.0 + 2.1.0 ..\..\Shared\HandyControlDemo_Shared\Resources\Img\icon.ico Debug;Release Copyright © HandyOrg 2018-2019 diff --git a/src/Core_30/HandyControl_Core_30/HandyControl_Core_30.csproj b/src/Core_30/HandyControl_Core_30/HandyControl_Core_30.csproj index 34c1ddeb..36811f33 100644 --- a/src/Core_30/HandyControl_Core_30/HandyControl_Core_30.csproj +++ b/src/Core_30/HandyControl_Core_30/HandyControl_Core_30.csproj @@ -4,7 +4,7 @@ true HandyControl HandyControl - 2.0.0 + 2.1.0 2.0.0.0 false false diff --git a/src/Shared/HandyControlDemo_Shared/Properties/AssemblyInfo.cs b/src/Shared/HandyControlDemo_Shared/Properties/AssemblyInfo.cs index e13e70bb..d7e7e5cc 100644 --- a/src/Shared/HandyControlDemo_Shared/Properties/AssemblyInfo.cs +++ b/src/Shared/HandyControlDemo_Shared/Properties/AssemblyInfo.cs @@ -13,5 +13,5 @@ using System.Windows; [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] -[assembly: AssemblyVersion("2.0.0")] +[assembly: AssemblyVersion("2.1.0")] #endif \ No newline at end of file diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ImageBlockDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ImageBlockDemoCtl.xaml index 7b94f8bc..e226326e 100644 --- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ImageBlockDemoCtl.xaml +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ImageBlockDemoCtl.xaml @@ -1,18 +1,20 @@  - - - - - - - - - - - - + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Shared/HandyControl_Shared/Controls/Image/ImageBlock.cs b/src/Shared/HandyControl_Shared/Controls/Image/ImageBlock.cs index d11fb550..9b9b37b1 100644 --- a/src/Shared/HandyControl_Shared/Controls/Image/ImageBlock.cs +++ b/src/Shared/HandyControl_Shared/Controls/Image/ImageBlock.cs @@ -24,25 +24,13 @@ namespace HandyControl.Controls Interval = Interval }; _dispatcherTimer.Tick += DispatcherTimer_Tick; - _dispatcherTimer.Start(); } - protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo) - { - base.OnRenderSizeChanged(sizeInfo); - OnPositionsChanged(); - } - - private void DispatcherTimer_Tick(object sender, EventArgs e) => InvalidateVisual(); - - public static readonly DependencyProperty StartColumnProperty = DependencyProperty.Register( - "StartColumn", typeof(int), typeof(ImageBlock), new FrameworkPropertyMetadata(ValueBoxes.Int0Box, - FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender, OnPositionsChanged)); - private void OnPositionsChanged() { _indexMin = StartRow * Columns + StartColumn; _indexMax = EndRow * Columns + EndColumn; + _currentIndex = _indexMin; } private static void OnPositionsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) @@ -51,6 +39,12 @@ namespace HandyControl.Controls ctl.OnPositionsChanged(); } + private void DispatcherTimer_Tick(object sender, EventArgs e) => InvalidateVisual(); + + public static readonly DependencyProperty StartColumnProperty = DependencyProperty.Register( + "StartColumn", typeof(int), typeof(ImageBlock), new FrameworkPropertyMetadata(ValueBoxes.Int0Box, + FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender, OnPositionsChanged)); + public int StartColumn { get => (int) GetValue(StartColumnProperty); @@ -88,13 +82,20 @@ namespace HandyControl.Controls } public static readonly DependencyProperty IsPlayingProperty = DependencyProperty.Register( - "IsPlaying", typeof(bool), typeof(ImageBlock), new FrameworkPropertyMetadata(ValueBoxes.TrueBox, + "IsPlaying", typeof(bool), typeof(ImageBlock), new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender, OnIsPlayingChanged)); private static void OnIsPlayingChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var ctl = (ImageBlock)d; - ctl._dispatcherTimer.IsEnabled = (bool) e.NewValue; + if ((bool) e.NewValue) + { + ctl._dispatcherTimer.Start(); + } + else + { + ctl._dispatcherTimer.Stop(); + } } public bool IsPlaying diff --git a/src/Shared/HandyControl_Shared/Properties/AssemblyInfo.cs b/src/Shared/HandyControl_Shared/Properties/AssemblyInfo.cs index ebffaf6a..0be451ad 100644 --- a/src/Shared/HandyControl_Shared/Properties/AssemblyInfo.cs +++ b/src/Shared/HandyControl_Shared/Properties/AssemblyInfo.cs @@ -12,7 +12,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] -[assembly: AssemblyVersion("2.0.0")] +[assembly: AssemblyVersion("2.1.0")] #endif [assembly: XmlnsDefinition("https://handyorg.github.io/handycontrol", "HandyControl.Controls")]