Commit c4d5b0a0 by liulongfei

补全缺失文件

parent 16647705
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- 箭头路径 资源 -->
<!-- 向右箭头 -->
<Geometry x:Key="ARROW_RESOURCE_LEFT">M0,5 5,0 5,3 20,3 20,7 5,7 5,10 0,5</Geometry>
<!-- 向左箭头 -->
<Geometry x:Key="ARROW_RESOURCE_RIGHT">M0,3 15,3 15,0 20,5 15,10 15,7 0,7 0,3</Geometry>
</ResourceDictionary>
\ No newline at end of file
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- 空样式按钮 -->
<Style x:Key="Button_None" TargetType="Button">
<Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter>
<Setter Property="Background" Value="Transparent"></Setter>
<Setter Property="BorderBrush" Value="Transparent"></Setter>
<Setter Property="BorderThickness" Value="0"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="bd"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}">
<ContentPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"></ContentPresenter>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 带白色背景按钮样式 -->
<Style x:Key="Button_None_WriteBackground" TargetType="Button">
<Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter>
<Setter Property="Background" Value="Transparent"></Setter>
<Setter Property="BorderBrush" Value="Transparent"></Setter>
<Setter Property="BorderThickness" Value="0"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="bd"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}">
<ContentPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"></ContentPresenter>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="bd" Property="Background" Value="#22ffffff"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
\ No newline at end of file
......@@ -66,10 +66,18 @@
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<Page Include="Path\ArrowPathResource.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Style\Button\Button_MessageBox.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Style\Button\Button_Normal.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Style\Button\Button_WindowTop.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
......
......@@ -299,6 +299,7 @@
</Compile>
<Compile Include="Widgets\DebugBorder\DebugBorder.cs" />
<Compile Include="Widgets\DragWindowBar\DragWindowBar.cs" />
<Compile Include="Widgets\FlashingBorder\FlashingBorder.cs" />
<Compile Include="Widgets\GPIOPinTestControl\GPIOPinTestControl.cs" />
<Compile Include="Widgets\HotkeyBox\HotkeyBox.cs" />
<Compile Include="Widgets\HotkeyBox\HotkeyHelper.cs" />
......
using log4net;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using VIZ.Framework.Core;
using VIZ.Framework.Domain;
namespace VIZ.Framework.Common
{
/// <summary>
/// 闪烁面板
/// </summary>
public class FlashingBorder : Border, IDisposable
{
/// <summary>
/// 日志
/// </summary>
private readonly static ILog log = LogManager.GetLogger(typeof(FlashingBorder));
/// <summary>
/// 时间控件
/// </summary>
public FlashingBorder()
{
ApplicationDomain.ObjectPoolManager.Add($"FlashingBorder__{Guid.NewGuid()}", this);
this.Loaded += FlashingBorder_Loaded;
}
#region IsFlashingEnabled -- 是否启用闪烁
/// <summary>
/// 是否启用闪烁
/// </summary>
public bool IsFlashingEnabled
{
get { return (bool)GetValue(IsFlashingEnabledProperty); }
set { SetValue(IsFlashingEnabledProperty, value); }
}
/// <summary>
/// Using a DependencyProperty as the backing store for IsFlashingEnabled. This enables animation, styling, binding, etc...
/// </summary>
public static readonly DependencyProperty IsFlashingEnabledProperty =
DependencyProperty.Register("IsFlashingEnabled", typeof(bool), typeof(FlashingBorder), new PropertyMetadata(false));
#endregion
#region FlashingInterval -- 闪烁间隔(单位:秒)
/// <summary>
/// 闪烁间隔(单位:秒)
/// </summary>
public TimeSpan FlashingInterval
{
get { return (TimeSpan)GetValue(FlashingIntervalProperty); }
set { SetValue(FlashingIntervalProperty, value); }
}
/// <summary>
/// Using a DependencyProperty as the backing store for FlashingInterval. This enables animation, styling, binding, etc...
/// </summary>
public static readonly DependencyProperty FlashingIntervalProperty =
DependencyProperty.Register("FlashingInterval", typeof(TimeSpan), typeof(FlashingBorder), new PropertyMetadata(TimeSpan.Zero));
#endregion
/// <summary>
/// 更新任务信息
/// </summary>
private TaskInfo updateTaskInfo;
/// <summary>
/// 更新任务
/// </summary>
private Task updateTask;
/// <summary>
/// 销毁
/// </summary>
public void Dispose()
{
if (this.updateTaskInfo == null)
return;
this.updateTaskInfo.IsCancel = true;
this.updateTaskInfo = null;
this.updateTask = null;
}
/// <summary>
/// 控件完成加载
/// </summary>
private void FlashingBorder_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
if (this.updateTask != null || WPFHelper.IsInDesignMode(this))
return;
this.updateTaskInfo = new TaskInfo();
this.updateTask = Task.Run(this.update);
}
/// <summary>
/// 更新
/// </summary>
[DebuggerNonUserCode]
private void update()
{
TaskInfo info = this.updateTaskInfo;
if (info == null)
return;
TimeSpan interval = TimeSpan.FromSeconds(1);
while (!info.IsCancel)
{
WPFHelper.Invoke(() =>
{
if (!this.IsFlashingEnabled)
{
this.Visibility = Visibility.Visible;
return;
}
this.Visibility = this.Visibility == Visibility.Visible ? Visibility.Hidden : Visibility.Visible;
interval = this.FlashingInterval;
});
if (interval > TimeSpan.Zero)
{
Task.Delay(interval).Wait();
}
else
{
Task.Delay(1000).Wait();
}
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment