fixed some bugs
This commit is contained in:
1 parent
203fbb4541
commit
f261f3199f
11 files changed
+147
-19
No files matched your search
@@ -483,6 +483,11 @@
|
||||
<LastGenOutput>Lang.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\Shared\HandyControlDemo_Shared\Properties\App.config">
|
||||
<Link>Properties\App.config</Link>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="..\..\Shared\HandyControlDemo_Shared\Data\MessageToken.tt">
|
||||
<Link>Data\MessageToken.tt</Link>
|
||||
|
||||
@@ -419,6 +419,11 @@
|
||||
<LastGenOutput>Lang.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\Shared\HandyControlDemo_Shared\Properties\App.config">
|
||||
<Link>Properties\App.config</Link>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\fabric-icons.ttf">
|
||||
<Link>Resources\fabric-icons.ttf</Link>
|
||||
|
||||
@@ -488,6 +488,11 @@
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\Shared\HandyControlDemo_Shared\Properties\App.config">
|
||||
<Link>Properties\App.config</Link>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\RepeatButton_16x.png">
|
||||
<Link>Resources\Img\LeftMainContent\RepeatButton_16x.png</Link>
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Runtime;
|
||||
using System.Security.Authentication;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
@@ -21,6 +22,19 @@ namespace HandyControlDemo
|
||||
private static Mutex AppMutex;
|
||||
#pragma warning restore IDE0052
|
||||
|
||||
public App()
|
||||
{
|
||||
#if !netle40
|
||||
var cachePath = $"{AppDomain.CurrentDomain.BaseDirectory}Cache";
|
||||
if (!Directory.Exists(cachePath))
|
||||
{
|
||||
Directory.CreateDirectory(cachePath);
|
||||
}
|
||||
ProfileOptimization.SetProfileRoot(cachePath);
|
||||
ProfileOptimization.StartProfile("Profile");
|
||||
#endif
|
||||
}
|
||||
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
AppMutex = new Mutex(true, "HandyControlDemo", out var createdNew);
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
</configuration>
|
||||
@@ -6,7 +6,7 @@
|
||||
<ResourceDictionary Source="Geometries.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<DrawingBrush o:Freeze="True" x:Key="MainContentForegroundDrawingBrush" RenderOptions.CachingHint="Cache" Viewport="0,0,16,16" ViewportUnits="Absolute" Stretch="None" TileMode="Tile">
|
||||
<DrawingBrush o:Freeze="True" x:Key="MainContentForegroundDrawingBrush" RenderOptions.CacheInvalidationThresholdMinimum="0.5" RenderOptions.CacheInvalidationThresholdMaximum="2.0" RenderOptions.CachingHint="Cache" Viewport="0,0,16,16" ViewportUnits="Absolute" Stretch="None" TileMode="Tile">
|
||||
<DrawingBrush.Drawing>
|
||||
<DrawingGroup o:Freeze="True">
|
||||
<GeometryDrawing o:Freeze="True" Brush="{DynamicResource MainContentForegroundBrush}">
|
||||
@@ -21,7 +21,7 @@
|
||||
</DrawingBrush.Drawing>
|
||||
</DrawingBrush>
|
||||
|
||||
<DrawingBrush o:Freeze="True" x:Key="GitHubDrawingBrush" RenderOptions.CachingHint="Cache" Viewport="0,0,200,100" ViewportUnits="Absolute" Stretch="Uniform" TileMode="Tile">
|
||||
<DrawingBrush o:Freeze="True" x:Key="GitHubDrawingBrush" RenderOptions.CacheInvalidationThresholdMinimum="0.5" RenderOptions.CacheInvalidationThresholdMaximum="2.0" RenderOptions.CachingHint="Cache" Viewport="0,0,200,100" ViewportUnits="Absolute" Stretch="Uniform" TileMode="Tile">
|
||||
<DrawingBrush.Transform>
|
||||
<TransformGroup o:Freeze="True">
|
||||
<RotateTransform o:Freeze="True" Angle="20"/>
|
||||
@@ -34,7 +34,7 @@
|
||||
</DrawingBrush.Drawing>
|
||||
</DrawingBrush>
|
||||
|
||||
<DrawingBrush o:Freeze="True" x:Key="QqDrawingBrush" RenderOptions.CachingHint="Cache" Viewport="0,0,100,200" ViewportUnits="Absolute" Stretch="Uniform" TileMode="Tile">
|
||||
<DrawingBrush o:Freeze="True" x:Key="QqDrawingBrush" RenderOptions.CacheInvalidationThresholdMinimum="0.5" RenderOptions.CacheInvalidationThresholdMaximum="2.0" RenderOptions.CachingHint="Cache" Viewport="0,0,100,200" ViewportUnits="Absolute" Stretch="Uniform" TileMode="Tile">
|
||||
<DrawingBrush.Transform>
|
||||
<TransformGroup o:Freeze="True">
|
||||
<RotateTransform o:Freeze="True" Angle="20"/>
|
||||
@@ -47,7 +47,7 @@
|
||||
</DrawingBrush.Drawing>
|
||||
</DrawingBrush>
|
||||
|
||||
<DrawingBrush o:Freeze="True" x:Key="BlogDrawingBrush" RenderOptions.CachingHint="Cache" Viewport="0,0,160,100" ViewportUnits="Absolute" Stretch="Uniform" TileMode="Tile">
|
||||
<DrawingBrush o:Freeze="True" x:Key="BlogDrawingBrush" RenderOptions.CacheInvalidationThresholdMinimum="0.5" RenderOptions.CacheInvalidationThresholdMaximum="2.0" RenderOptions.CachingHint="Cache" Viewport="0,0,160,100" ViewportUnits="Absolute" Stretch="Uniform" TileMode="Tile">
|
||||
<DrawingBrush.Transform>
|
||||
<TransformGroup o:Freeze="True">
|
||||
<RotateTransform o:Freeze="True" Angle="20"/>
|
||||
@@ -59,7 +59,7 @@
|
||||
<RectangleGeometry o:Freeze="True" Rect="0,0,160,100"></RectangleGeometry>
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Brush>
|
||||
<VisualBrush o:Freeze="True">
|
||||
<VisualBrush o:Freeze="True" RenderOptions.CachingHint="Cache" RenderOptions.CacheInvalidationThresholdMinimum="0.5" RenderOptions.CacheInvalidationThresholdMaximum="2.0" >
|
||||
<VisualBrush.Visual>
|
||||
<StackPanel>
|
||||
<TextBlock Text="Blog" Foreground="{DynamicResource DarkMaskBrush}"/>
|
||||
@@ -71,7 +71,7 @@
|
||||
</DrawingBrush.Drawing>
|
||||
</DrawingBrush>
|
||||
|
||||
<DrawingBrush o:Freeze="True" x:Key="WebsiteDrawingBrush" RenderOptions.CachingHint="Cache" Viewport="0,0,320,100" ViewportUnits="Absolute" Stretch="Uniform" TileMode="Tile">
|
||||
<DrawingBrush o:Freeze="True" x:Key="WebsiteDrawingBrush" RenderOptions.CacheInvalidationThresholdMinimum="0.5" RenderOptions.CacheInvalidationThresholdMaximum="2.0" RenderOptions.CachingHint="Cache" Viewport="0,0,320,100" ViewportUnits="Absolute" Stretch="Uniform" TileMode="Tile">
|
||||
<DrawingBrush.Transform>
|
||||
<TransformGroup o:Freeze="True">
|
||||
<RotateTransform o:Freeze="True" Angle="20"/>
|
||||
@@ -83,7 +83,7 @@
|
||||
<RectangleGeometry o:Freeze="True" Rect="0,0,320,100"></RectangleGeometry>
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Brush>
|
||||
<VisualBrush o:Freeze="True">
|
||||
<VisualBrush o:Freeze="True" RenderOptions.CachingHint="Cache" RenderOptions.CacheInvalidationThresholdMinimum="0.5" RenderOptions.CacheInvalidationThresholdMaximum="2.0">
|
||||
<VisualBrush.Visual>
|
||||
<StackPanel>
|
||||
<TextBlock Text="Website" Foreground="{DynamicResource DarkMaskBrush}"/>
|
||||
@@ -95,7 +95,7 @@
|
||||
</DrawingBrush.Drawing>
|
||||
</DrawingBrush>
|
||||
|
||||
<DrawingBrush o:Freeze="True" x:Key="ProjectDrawingBrush" RenderOptions.CachingHint="Cache" Viewport="0,0,240,100" ViewportUnits="Absolute" Stretch="Uniform" TileMode="Tile">
|
||||
<DrawingBrush o:Freeze="True" x:Key="ProjectDrawingBrush" RenderOptions.CacheInvalidationThresholdMinimum="0.5" RenderOptions.CacheInvalidationThresholdMaximum="2.0" RenderOptions.CachingHint="Cache" Viewport="0,0,240,100" ViewportUnits="Absolute" Stretch="Uniform" TileMode="Tile">
|
||||
<DrawingBrush.Transform>
|
||||
<TransformGroup o:Freeze="True">
|
||||
<RotateTransform o:Freeze="True" Angle="20"/>
|
||||
@@ -107,7 +107,7 @@
|
||||
<RectangleGeometry o:Freeze="True" Rect="0,0,240,100"></RectangleGeometry>
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Brush>
|
||||
<VisualBrush o:Freeze="True">
|
||||
<VisualBrush o:Freeze="True" RenderOptions.CachingHint="Cache" RenderOptions.CacheInvalidationThresholdMinimum="0.5" RenderOptions.CacheInvalidationThresholdMaximum="2.0" >
|
||||
<VisualBrush.Visual>
|
||||
<StackPanel>
|
||||
<TextBlock Text="Project" Foreground="{DynamicResource DarkMaskBrush}"/>
|
||||
|
||||
@@ -27,7 +27,10 @@
|
||||
</UserControl.Resources>
|
||||
<UserControl.Triggers>
|
||||
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
|
||||
<BeginStoryboard Storyboard="{StaticResource StoryboardOnLoaded}"/>
|
||||
<BeginStoryboard Name="BeginStoryboard" Storyboard="{StaticResource StoryboardOnLoaded}"/>
|
||||
</EventTrigger>
|
||||
<EventTrigger RoutedEvent="FrameworkElement.Unloaded">
|
||||
<StopStoryboard BeginStoryboardName="BeginStoryboard"/>
|
||||
</EventTrigger>
|
||||
</UserControl.Triggers>
|
||||
<hc:TransitioningContentControl>
|
||||
|
||||
@@ -23,13 +23,46 @@ namespace HandyControl.Controls
|
||||
|
||||
private int _blockHeight;
|
||||
|
||||
private bool _isDisposed;
|
||||
|
||||
public ImageBlock()
|
||||
{
|
||||
_dispatcherTimer = new DispatcherTimer(DispatcherPriority.Render)
|
||||
{
|
||||
Interval = Interval
|
||||
};
|
||||
_dispatcherTimer.Tick += DispatcherTimer_Tick;
|
||||
|
||||
IsVisibleChanged += ImageBlock_IsVisibleChanged;
|
||||
}
|
||||
|
||||
~ImageBlock() => Dispose();
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_isDisposed) return;
|
||||
|
||||
IsVisibleChanged -= ImageBlock_IsVisibleChanged;
|
||||
_dispatcherTimer.Stop();
|
||||
_isDisposed = true;
|
||||
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
private void ImageBlock_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if(IsVisible)
|
||||
{
|
||||
_dispatcherTimer.Tick += DispatcherTimer_Tick;
|
||||
if (IsPlaying)
|
||||
{
|
||||
_dispatcherTimer.Start();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_dispatcherTimer.Stop();
|
||||
_dispatcherTimer.Tick -= DispatcherTimer_Tick;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateDatas()
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace HandyControl.Controls
|
||||
[ContentProperty("Items")]
|
||||
[TemplatePart(Name = ElementPanelPage, Type = typeof(Panel))]
|
||||
[TemplatePart(Name = ElementItemsControl, Type = typeof(ItemsPresenter))]
|
||||
public class Carousel : ListBox
|
||||
public class Carousel : ListBox, IDisposable
|
||||
{
|
||||
#region Constants
|
||||
|
||||
@@ -33,6 +33,8 @@ namespace HandyControl.Controls
|
||||
|
||||
#region Data
|
||||
|
||||
private bool _isDisposed;
|
||||
|
||||
private Panel _panelPage;
|
||||
|
||||
private bool _appliedTemplate;
|
||||
@@ -119,6 +121,36 @@ namespace HandyControl.Controls
|
||||
CommandBindings.Add(new CommandBinding(ControlCommands.Selected, ButtonPages_OnClick));
|
||||
|
||||
Loaded += (s, e) => UpdatePageButtons();
|
||||
IsVisibleChanged += Carousel_IsVisibleChanged;
|
||||
}
|
||||
|
||||
~Carousel() => Dispose();
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_isDisposed) return;
|
||||
|
||||
IsVisibleChanged -= Carousel_IsVisibleChanged;
|
||||
_updateTimer.Stop();
|
||||
_isDisposed = true;
|
||||
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
private void Carousel_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (_updateTimer == null) return;
|
||||
|
||||
if (IsVisible)
|
||||
{
|
||||
_updateTimer.Tick += UpdateTimer_Tick;
|
||||
_updateTimer.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
_updateTimer.Stop();
|
||||
_updateTimer.Tick -= UpdateTimer_Tick;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
|
||||
|
||||
@@ -93,10 +93,7 @@ namespace HandyControl.Controls
|
||||
if (Application.Current != null) Application.Current.Exit += (s, e) => Dispose();
|
||||
}
|
||||
|
||||
~NotifyIcon()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
~NotifyIcon() => Dispose(false);
|
||||
|
||||
public void Init()
|
||||
{
|
||||
|
||||
@@ -8,6 +8,10 @@ namespace HandyControl.Controls
|
||||
{
|
||||
public class FlipClock : Control
|
||||
{
|
||||
private readonly DispatcherTimer _dispatcherTimer;
|
||||
|
||||
private bool _isDisposed;
|
||||
|
||||
public static readonly DependencyProperty NumberListProperty = DependencyProperty.Register(
|
||||
"NumberList", typeof(List<int>), typeof(FlipClock), new PropertyMetadata(new List<int> {0, 0, 0, 0, 0, 0}));
|
||||
|
||||
@@ -44,12 +48,39 @@ namespace HandyControl.Controls
|
||||
|
||||
public FlipClock()
|
||||
{
|
||||
var dispatcherTimer = new DispatcherTimer
|
||||
_dispatcherTimer = new DispatcherTimer(DispatcherPriority.Render)
|
||||
{
|
||||
Interval = TimeSpan.FromMilliseconds(200)
|
||||
};
|
||||
dispatcherTimer.Tick += DispatcherTimer_Tick;
|
||||
dispatcherTimer.Start();
|
||||
|
||||
IsVisibleChanged += FlipClock_IsVisibleChanged;
|
||||
}
|
||||
|
||||
~FlipClock() => Dispose();
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_isDisposed) return;
|
||||
|
||||
IsVisibleChanged -= FlipClock_IsVisibleChanged;
|
||||
_dispatcherTimer.Stop();
|
||||
_isDisposed = true;
|
||||
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
private void FlipClock_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (IsVisible)
|
||||
{
|
||||
_dispatcherTimer.Tick += DispatcherTimer_Tick;
|
||||
_dispatcherTimer.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
_dispatcherTimer.Stop();
|
||||
_dispatcherTimer.Tick -= DispatcherTimer_Tick;
|
||||
}
|
||||
}
|
||||
|
||||
private void DispatcherTimer_Tick(object sender, EventArgs e) => DisplayTime = DateTime.Now;
|
||||
|
||||
Reference in new issue
Block a user