Synchronize the Net40
This commit is contained in:
1 parent
b3c3173c46
commit
ab6e2efe21
87 files changed
+2743
-349
No files matched your search
@@ -1,6 +1,6 @@
|
||||
namespace HandyControl.Data
|
||||
{
|
||||
public class ResourceToken
|
||||
public class ResourceToken
|
||||
{
|
||||
public const string SuccessGeometry = nameof(SuccessGeometry);
|
||||
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
<#@ template debug="false" hostspecific="false" language="C#" #>
|
||||
<#@ import namespace="System.Collections.Generic"#>
|
||||
<#@ output extension=".cs" #>
|
||||
<#
|
||||
var geometryList = new List<string>
|
||||
{
|
||||
"SuccessGeometry",
|
||||
"InfoGeometry",
|
||||
"ErrorGeometry",
|
||||
"WarningGeometry",
|
||||
"AskGeometry",
|
||||
"FatalGeometry",
|
||||
"PrimaryBrush"
|
||||
};
|
||||
var brushList = new List<string>
|
||||
{
|
||||
"SuccessBrush",
|
||||
"InfoBrush",
|
||||
"DangerBrush",
|
||||
"WarningBrush",
|
||||
"AccentBrush",
|
||||
"PrimaryTextBrush",
|
||||
"ThirdlyTextBrush",
|
||||
"BlurGradientValue"
|
||||
};
|
||||
var styleList = new List<string>
|
||||
{
|
||||
"ButtonCustom",
|
||||
"PaginationButtonStyle",
|
||||
"WindowWin10",
|
||||
"AddTagButtonStyle",
|
||||
"RadioGroupItemDefault",
|
||||
"RadioGroupItemSingle",
|
||||
"RadioGroupItemHorizontalFirst",
|
||||
"RadioGroupItemHorizontalLast",
|
||||
"RadioGroupItemVerticalFirst",
|
||||
"RadioGroupItemVerticalLast",
|
||||
"TabItemCapsuleDefault",
|
||||
"TabItemCapsuleSingle",
|
||||
"TabItemCapsuleHorizontalFirst",
|
||||
"TabItemCapsuleHorizontalLast",
|
||||
"TabItemCapsuleVerticalFirst",
|
||||
"TabItemCapsuleVerticalLast"
|
||||
};
|
||||
#>
|
||||
namespace HandyControl.Data
|
||||
{
|
||||
internal class ResourceToken
|
||||
{
|
||||
<#foreach(var item in geometryList){#>
|
||||
public const string <#=item#> = nameof(<#=item#>);
|
||||
|
||||
<#}#>
|
||||
<#foreach(var item in brushList){#>
|
||||
public const string <#=item#> = nameof(<#=item#>);
|
||||
|
||||
<#}#>
|
||||
<#foreach(var item in styleList){#>
|
||||
public const string <#=item#> = nameof(<#=item#>);
|
||||
|
||||
<#}#>
|
||||
}
|
||||
}
|
||||
@@ -170,6 +170,7 @@
|
||||
<Compile Include="Data\Gif\GifPropertyItemInternal.cs" />
|
||||
<Compile Include="Data\Gif\GPStream.cs" />
|
||||
<Compile Include="Data\MessageBoxInfo.cs" />
|
||||
<Compile Include="Data\ResourceToken.cs" />
|
||||
<Compile Include="Data\SystemVersionInfo.cs" />
|
||||
<Compile Include="Tools\Converter\Boolean2StrConverter.cs" />
|
||||
<Compile Include="Tools\Converter\Int2StrConverter.cs" />
|
||||
@@ -179,11 +180,6 @@
|
||||
<Compile Include="Data\GrowlInfo.cs" />
|
||||
<Compile Include="Data\Operation\OperationResult!1.cs" />
|
||||
<Compile Include="Data\Operation\OperationResult.cs" />
|
||||
<Compile Include="Data\ResourceToken.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>ResourceToken.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Expression\Drawing\BezierCurveFlattener.cs" />
|
||||
<Compile Include="Expression\Drawing\CommonExtensions.cs" />
|
||||
<Compile Include="Expression\Drawing\ExceptionStringTable.cs" />
|
||||
@@ -771,12 +767,6 @@
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Data\ResourceToken.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>ResourceToken.cs</LastGenOutput>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Net;
|
||||
using System.Security.Authentication;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using HandyControl.Controls;
|
||||
@@ -28,6 +30,8 @@ namespace HandyControlDemo
|
||||
}
|
||||
|
||||
BlurWindow.SystemVersionInfo = CommonHelper.GetSystemVersionInfo();
|
||||
|
||||
ServicePointManager.SecurityProtocol = (SecurityProtocolType)(SslProtocols)0x00000C00;
|
||||
}
|
||||
|
||||
protected override void OnExit(ExitEventArgs e)
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace HandyControlDemo.Data
|
||||
{
|
||||
internal class AppConfig
|
||||
{
|
||||
public static string SavePath = $"{AppDomain.CurrentDomain.BaseDirectory}AppConfig.json";
|
||||
public static readonly string SavePath = $"{AppDomain.CurrentDomain.BaseDirectory}AppConfig.json";
|
||||
|
||||
public string Lang { get; set; } = "zh-cn";
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace HandyControlDemo.Data
|
||||
|
||||
@@ -76,6 +76,12 @@
|
||||
|
||||
public static readonly string CoverFlowDemoCtl = nameof(CoverFlowDemoCtl);
|
||||
|
||||
public static readonly string ProgressButtonDemoCtl = nameof(ProgressButtonDemoCtl);
|
||||
|
||||
public static readonly string TransferDemoCtl = nameof(TransferDemoCtl);
|
||||
|
||||
public static readonly string ChatBubbleDemoCtl = nameof(ChatBubbleDemoCtl);
|
||||
|
||||
public static readonly string ButtonDemoCtl = nameof(ButtonDemoCtl);
|
||||
|
||||
public static readonly string ToggleButtonDemoCtl = nameof(ToggleButtonDemoCtl);
|
||||
@@ -132,12 +138,15 @@
|
||||
|
||||
public static readonly string CustomNonClientAreaWindow = nameof(CustomNonClientAreaWindow);
|
||||
|
||||
public static readonly string LoadShowContent = nameof(LoadShowContent);
|
||||
public static readonly string LoadShowContent = nameof(LoadShowContent);
|
||||
|
||||
public static readonly string FullSwitch = nameof(FullSwitch);
|
||||
public static readonly string FullSwitch = nameof(FullSwitch);
|
||||
|
||||
public static readonly string ContributorsView = nameof(ContributorsView);
|
||||
public static readonly string ContributorsView = nameof(ContributorsView);
|
||||
|
||||
public static readonly string ClearLeftSelected = nameof(ClearLeftSelected);
|
||||
}
|
||||
public static readonly string ClearLeftSelected = nameof(ClearLeftSelected);
|
||||
|
||||
public static readonly string SendChatMessage = nameof(SendChatMessage);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,10 @@ var controlList = new List<string>
|
||||
"ShieldDemoCtl",
|
||||
"WaterfallPanelDemoCtl",
|
||||
"CoverViewDemoCtl",
|
||||
"CoverFlowDemoCtl"
|
||||
"CoverFlowDemoCtl",
|
||||
"ProgressButtonDemoCtl",
|
||||
"TransferDemoCtl",
|
||||
"ChatBubbleDemoCtl"
|
||||
};
|
||||
var styleList = new List<string>
|
||||
{
|
||||
@@ -76,6 +79,14 @@ var windowList = new List<string>
|
||||
"CommonWindow",
|
||||
"CustomNonClientAreaWindow"
|
||||
};
|
||||
var messageList = new List<string>
|
||||
{
|
||||
"LoadShowContent",
|
||||
"FullSwitch",
|
||||
"ContributorsView",
|
||||
"ClearLeftSelected",
|
||||
"SendChatMessage"
|
||||
};
|
||||
#>
|
||||
namespace HandyControlDemo.Data
|
||||
{
|
||||
@@ -93,12 +104,9 @@ namespace HandyControlDemo.Data
|
||||
public static readonly string <#=item#> = nameof(<#=item#>);
|
||||
|
||||
<#}#>
|
||||
public static readonly string LoadShowContent = nameof(LoadShowContent);
|
||||
<#foreach(var item in messageList){#>
|
||||
public static readonly string <#=item#> = nameof(<#=item#>);
|
||||
|
||||
public static readonly string FullSwitch = nameof(FullSwitch);
|
||||
|
||||
public static readonly string ContributorsView = nameof(ContributorsView);
|
||||
|
||||
public static readonly string ClearLeftSelected = nameof(ClearLeftSelected);
|
||||
}
|
||||
<#}#>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using HandyControl.Data;
|
||||
|
||||
namespace HandyControlDemo.Data
|
||||
{
|
||||
public struct ChatInfoModel
|
||||
{
|
||||
public object Message { get; set; }
|
||||
|
||||
public string SenderId { get; set; }
|
||||
|
||||
public ChatRoleType Role { get; set; }
|
||||
|
||||
public ChatMessageType Type { get; set; }
|
||||
|
||||
public object Enclosure { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -82,6 +82,7 @@
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>MessageToken.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Data\Model\ChatInfoModel.cs" />
|
||||
<Compile Include="Data\Model\ContributorModel.cs" />
|
||||
<Compile Include="Data\Model\DemoDataModel.cs" />
|
||||
<Compile Include="Data\Model\StepBarDemoModel.cs" />
|
||||
@@ -96,12 +97,16 @@
|
||||
<DependentUpon>Lang.en.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Service\DataService.cs" />
|
||||
<Compile Include="Tools\AssemblyHelper.cs" />
|
||||
<Compile Include="Tools\CommonHelper.cs" />
|
||||
<Compile Include="Tools\Helper\AssemblyHelper.cs" />
|
||||
<Compile Include="Tools\Helper\CommonHelper.cs" />
|
||||
<Compile Include="Tools\Converter\StringRepeatConverter.cs" />
|
||||
<Compile Include="Tools\Helper\ExternDllHelper.cs" />
|
||||
<Compile Include="UserControl\Basic\Avatar.xaml.cs">
|
||||
<DependentUpon>Avatar.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserControl\Basic\ChatBox.xaml.cs">
|
||||
<DependentUpon>ChatBox.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserControl\Controls\AnimationPathDemoCtl.xaml.cs">
|
||||
<DependentUpon>AnimationPathDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -111,6 +116,9 @@
|
||||
<Compile Include="UserControl\Controls\CarouselDemoCtl.xaml.cs">
|
||||
<DependentUpon>CarouselDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserControl\Controls\ChatBubbleDemoCtl.xaml.cs">
|
||||
<DependentUpon>ChatBubbleDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserControl\Controls\CirclePanelDemoCtl.xaml.cs">
|
||||
<DependentUpon>CirclePanelDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -168,6 +176,9 @@
|
||||
<Compile Include="UserControl\Controls\PreviewSliderDemoCtl.xaml.cs">
|
||||
<DependentUpon>PreviewSliderDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserControl\Controls\ProgressButtonDemoCtl.xaml.cs">
|
||||
<DependentUpon>ProgressButtonDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserControl\Controls\RateDemoCtl.xaml.cs">
|
||||
<DependentUpon>RateDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -192,6 +203,9 @@
|
||||
<Compile Include="UserControl\Controls\TimePickerDemoCtl.xaml.cs">
|
||||
<DependentUpon>TimePickerDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserControl\Controls\TransferDemoCtl.xaml.cs">
|
||||
<DependentUpon>TransferDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserControl\Controls\WaterfallPanelDemoCtl.xaml.cs">
|
||||
<DependentUpon>WaterfallPanelDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -297,15 +311,16 @@
|
||||
<Compile Include="UserControl\Styles\TreeViewDemoCtl.xaml.cs">
|
||||
<DependentUpon>TreeViewDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ViewModel\ComboBoxDemoViewModel.cs" />
|
||||
<Compile Include="ViewModel\ContributorsViewModel.cs" />
|
||||
<Compile Include="ViewModel\GrowlDemoViewModel.cs" />
|
||||
<Compile Include="ViewModel\ImageBrowserDemoViewModel.cs" />
|
||||
<Compile Include="ViewModel\MainViewModel.cs" />
|
||||
<Compile Include="ViewModel\PaginationDemoViewModel.cs" />
|
||||
<Compile Include="ViewModel\StepBarDemoViewModel.cs" />
|
||||
<Compile Include="ViewModel\Basic\ChatBoxViewModel.cs" />
|
||||
<Compile Include="ViewModel\Common\ComboBoxDemoViewModel.cs" />
|
||||
<Compile Include="ViewModel\Main\ContributorsViewModel.cs" />
|
||||
<Compile Include="ViewModel\Controls\GrowlDemoViewModel.cs" />
|
||||
<Compile Include="ViewModel\Controls\ImageBrowserDemoViewModel.cs" />
|
||||
<Compile Include="ViewModel\Main\MainViewModel.cs" />
|
||||
<Compile Include="ViewModel\Controls\PaginationDemoViewModel.cs" />
|
||||
<Compile Include="ViewModel\Controls\StepBarDemoViewModel.cs" />
|
||||
<Compile Include="ViewModel\ViewModelLocator.cs" />
|
||||
<Compile Include="ViewModel\WindowDemoViewModel.cs" />
|
||||
<Compile Include="ViewModel\Controls\WindowDemoViewModel.cs" />
|
||||
<Compile Include="Window\AboutWindow.xaml.cs">
|
||||
<DependentUpon>AboutWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -381,6 +396,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UserControl\Basic\ChatBox.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UserControl\Controls\AnimationPathDemoCtl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -393,6 +412,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UserControl\Controls\ChatBubbleDemoCtl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UserControl\Controls\CirclePanelDemoCtl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -469,6 +492,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UserControl\Controls\ProgressButtonDemoCtl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>XamlIntelliSenseFileGenerator</Generator>
|
||||
</Page>
|
||||
<Page Include="UserControl\Controls\RateDemoCtl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -501,6 +528,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UserControl\Controls\TransferDemoCtl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UserControl\Controls\WaterfallPanelDemoCtl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -683,6 +714,11 @@
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>MessageToken.cs</LastGenOutput>
|
||||
</Content>
|
||||
<Resource Include="Resources\Img\Chat\chat_back1.jpg" />
|
||||
<Resource Include="Resources\Img\Chat\chat_back2.jpg" />
|
||||
<Resource Include="Resources\Img\LeftMainContent\Bubble_16xLG.png" />
|
||||
<Resource Include="Resources\Img\LeftMainContent\ProgressButton_16x.png" />
|
||||
<Resource Include="Resources\Img\LeftMainContent\Transfer_16x.png" />
|
||||
<Resource Include="Resources\Img\LeftMainContent\SortAscending_grey_16x.png" />
|
||||
<Resource Include="Resources\Img\LeftMainContent\LinearCarousel_16x.png" />
|
||||
<Resource Include="Resources\Img\Album\1.jpg" />
|
||||
|
||||
@@ -1,23 +1,26 @@
|
||||
<controls:BlurWindow x:Class="HandyControlDemo.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
|
||||
xmlns:userControl="clr-namespace:HandyControlDemo.UserControl"
|
||||
mc:Ignorable="d"
|
||||
BorderThickness="1"
|
||||
BorderBrush="#262e2f"
|
||||
NonClientAreaBackground="#262e2f"
|
||||
OtherButtonHoverBackground="#888580"
|
||||
Style="{StaticResource WindowBlur}"
|
||||
WindowState="Maximized"
|
||||
Title="MainWindow"
|
||||
ResizeMode="CanResizeWithGrip"
|
||||
Name="MyWindow"
|
||||
DataContext="{Binding Main,Source={StaticResource Locator}}"
|
||||
d:DesignHeight="800"
|
||||
d:DesignWidth="1400">
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
|
||||
xmlns:userControl="clr-namespace:HandyControlDemo.UserControl"
|
||||
mc:Ignorable="d"
|
||||
BorderThickness="1"
|
||||
BorderBrush="#262e2f"
|
||||
NonClientAreaBackground="#262e2f"
|
||||
OtherButtonHoverBackground="#888580"
|
||||
CloseButtonForeground="White"
|
||||
OtherButtonHoverForeground="White"
|
||||
OtherButtonForeground="White"
|
||||
Style="{StaticResource WindowBlur}"
|
||||
WindowState="Maximized"
|
||||
Title="MainWindow"
|
||||
ResizeMode="CanResizeWithGrip"
|
||||
Name="MyWindow"
|
||||
DataContext="{Binding Main,Source={StaticResource Locator}}"
|
||||
d:DesignHeight="800"
|
||||
d:DesignWidth="1400">
|
||||
<controls:Window.NonClientAreaContent>
|
||||
<userControl:NoUserContent/>
|
||||
</controls:Window.NonClientAreaContent>
|
||||
|
||||
@@ -177,6 +177,15 @@ namespace HandyControlDemo.Properties.Langs {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 对话气泡 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string ChatBubble {
|
||||
get {
|
||||
return ResourceManager.GetString("ChatBubble", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 讨论室 的本地化字符串。
|
||||
/// </summary>
|
||||
@@ -654,6 +663,15 @@ namespace HandyControlDemo.Properties.Langs {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 点击打开自定义消息窗口 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string OpenCustomMessageWindow {
|
||||
get {
|
||||
return ResourceManager.GetString("OpenCustomMessageWindow", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 点击打开自定义非客户端区域窗口 的本地化字符串。
|
||||
/// </summary>
|
||||
@@ -789,6 +807,24 @@ namespace HandyControlDemo.Properties.Langs {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 进度按钮 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string ProgressButton {
|
||||
get {
|
||||
return ResourceManager.GetString("ProgressButton", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 按住说话 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string PushToTalk {
|
||||
get {
|
||||
return ResourceManager.GetString("PushToTalk", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 QQ群 的本地化字符串。
|
||||
/// </summary>
|
||||
@@ -879,6 +915,15 @@ namespace HandyControlDemo.Properties.Langs {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 秒 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string Second {
|
||||
get {
|
||||
return ResourceManager.GetString("Second", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 选中 的本地化字符串。
|
||||
/// </summary>
|
||||
@@ -1077,6 +1122,15 @@ namespace HandyControlDemo.Properties.Langs {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 穿梭框 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string Transfer {
|
||||
get {
|
||||
return ResourceManager.GetString("Transfer", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 树视图 的本地化字符串。
|
||||
/// </summary>
|
||||
@@ -1104,6 +1158,15 @@ namespace HandyControlDemo.Properties.Langs {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 上传;上传中 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string UploadStr {
|
||||
get {
|
||||
return ResourceManager.GetString("UploadStr", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 警告 的本地化字符串。
|
||||
/// </summary>
|
||||
|
||||
@@ -474,4 +474,25 @@
|
||||
<data name="MessageBox" xml:space="preserve">
|
||||
<value>MessageBox</value>
|
||||
</data>
|
||||
</root>
|
||||
<data name="ProgressButton" xml:space="preserve">
|
||||
<value>ProgressButton</value>
|
||||
</data>
|
||||
<data name="UploadStr" xml:space="preserve">
|
||||
<value>Upload;Uploading</value>
|
||||
</data>
|
||||
<data name="OpenCustomMessageWindow" xml:space="preserve">
|
||||
<value>open custom message window</value>
|
||||
</data>
|
||||
<data name="Transfer" xml:space="preserve">
|
||||
<value>Transfer</value>
|
||||
</data>
|
||||
<data name="ChatBubble" xml:space="preserve">
|
||||
<value>ChatBubble</value>
|
||||
</data>
|
||||
<data name="PushToTalk" xml:space="preserve">
|
||||
<value>Push to talk</value>
|
||||
</data>
|
||||
<data name="Second" xml:space="preserve">
|
||||
<value>Sec</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -474,4 +474,25 @@
|
||||
<data name="MessageBox" xml:space="preserve">
|
||||
<value>消息框</value>
|
||||
</data>
|
||||
</root>
|
||||
<data name="ProgressButton" xml:space="preserve">
|
||||
<value>进度按钮</value>
|
||||
</data>
|
||||
<data name="UploadStr" xml:space="preserve">
|
||||
<value>上传;上传中</value>
|
||||
</data>
|
||||
<data name="OpenCustomMessageWindow" xml:space="preserve">
|
||||
<value>点击打开自定义消息窗口</value>
|
||||
</data>
|
||||
<data name="Transfer" xml:space="preserve">
|
||||
<value>穿梭框</value>
|
||||
</data>
|
||||
<data name="ChatBubble" xml:space="preserve">
|
||||
<value>对话气泡</value>
|
||||
</data>
|
||||
<data name="PushToTalk" xml:space="preserve">
|
||||
<value>按住说话</value>
|
||||
</data>
|
||||
<data name="Second" xml:space="preserve">
|
||||
<value>秒</value>
|
||||
</data>
|
||||
</root>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 57 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 312 B |
Binary file not shown.
|
After Width: | Height: | Size: 200 B |
Binary file not shown.
|
After Width: | Height: | Size: 164 B |
@@ -9,6 +9,8 @@
|
||||
<Geometry x:Key="NugetGeometry">M449.722947 199.412211H706.021053c130.967579 0 237.136842 106.169263 237.136842 237.136842v256.298105c0 130.967579-106.169263 237.136842-237.136842 237.136842H449.722947c-130.965895 0-237.136842-106.169263-237.136842-237.136842V436.549053c0-130.967579 106.170947-237.136842 237.136842-237.136842z m-201.205894-21.557895c0-64.299789-70.085053-104.704-125.850948-72.55579s-55.764211 112.96 0 145.111579 125.850947-8.257684 125.850948-72.555789z m239.528421 234.74021c0-68.003368-74.088421-110.736842-133.037474-76.734315s-58.950737 119.467789 0 153.470315 133.039158-8.730947 133.039158-76.736zM835.368421 692.847158c0-117.596632-128.154947-191.494737-230.123789-132.695579s-101.970526 206.593684 0 265.391158S835.368421 810.443789 835.368421 692.847158z</Geometry>
|
||||
<Geometry x:Key="EmailGeometry">M430.079734 481.464543c45.196365 45.596478 118.486578 45.596478 163.68499 0l360.684736-324.939627c0.547469 3.751441 1.13894 7.490601 1.13894 11.401678l0 404.753417 0 116.754121c0 42.995233-34.547841 77.838809-77.145008 77.838809L145.397996 767.272941c-42.597167 0-77.145008-34.844599-77.145008-77.838809L68.252988 494.839155 68.252988 167.926594c0-3.911076 0.593518-7.65126 1.139963-11.401678L430.079734 481.464543zM910.960992 74.226538 562.044278 387.28558c-38.470173 38.811957-62.276369 38.811957-100.770078 0L112.538611 74.408687c10.011005-4.789073 21.069875-7.673773 32.859385-7.673773l733.044372 0C890.095779 66.735937 901.065622 69.539796 910.960992 74.226538z</Geometry>
|
||||
<Geometry x:Key="GitterGeometry">M260.8 645H160V0h100.8v645zM461.8 152.2h-100.8V1024h100.8V152.2z m201.2 0h-100.8V1024h100.8V152.2zM864 152h-100.8v494H864V152z</Geometry>
|
||||
<Geometry x:Key="ImageGeometry">M736 224H288a64 64 0 0 0-64 64v448a64 64 0 0 0 64 64h448a64 64 0 0 0 64-64V288a64 64 0 0 0-64-64z m-416 160a64 64 0 1 1 128.032 0.032A64 64 0 0 1 320 384z m416 320a32 32 0 0 1-32 32H384a32 32 0 0 1-32-32l96-160c26.432-2.048 68.128 6.016 128 64l128-224a32 32 0 0 1 32 32v288z</Geometry>
|
||||
<Geometry x:Key="KeyboardGeometry">M19.692308 512A25 25 0 1 1 19.692308 531.692308ZM512 303.027832C512 286.548884 524.86564 273.174666 540.717948 273.174666L598.153846 273.174666C614.006154 273.174666 626.871794 286.548884 626.871794 303.027832L626.871794 362.734167C626.871794 379.213115 614.006154 392.587333 598.153846 392.587333L540.717948 392.587333C524.86564 392.587333 512 379.213115 512 362.734167L512 303.027832 512 303.027832ZM512 482.146834 512 541.853166C512 558.332115 499.13436 571.706335 483.282052 571.706335L425.846154 571.706335C409.993846 571.706335 397.128206 558.332115 397.128206 541.853166L397.128206 482.146834C397.128206 465.667885 409.993846 452.293665 425.846154 452.293665L483.282052 452.293665C499.13436 452.293665 512 465.667885 512 482.146834L512 482.146834ZM339.692308 303.027832C339.692308 286.548884 352.557948 273.174666 368.410256 273.174666L425.846154 273.174666C441.698462 273.174666 454.564102 286.548884 454.564102 303.027832L454.564102 362.734167C454.564102 379.213115 441.698462 392.587333 425.846154 392.587333L368.410256 392.587333C352.557948 392.587333 339.692308 379.213115 339.692308 362.734167L339.692308 303.027832 339.692308 303.027832ZM167.384615 303.027832C167.384615 286.548884 180.250256 273.174666 196.102564 273.174666L253.538462 273.174666C269.390769 273.174666 282.25641 286.548884 282.25641 303.027832L282.25641 362.734167C282.25641 379.213115 269.390769 392.587333 253.538462 392.587333L196.102564 392.587333C180.250256 392.587333 167.384615 379.213115 167.384615 362.734167L167.384615 303.027832 167.384615 303.027832ZM282.25641 720.972168C282.25641 737.451116 269.390769 750.825334 253.538462 750.825334L196.102564 750.825334C180.250256 750.825334 167.384615 737.451116 167.384615 720.972168L167.384615 661.265833C167.384615 644.786885 180.250256 631.412667 196.102564 631.412667L253.538462 631.412667C269.390769 631.412667 282.25641 644.786885 282.25641 661.265833L282.25641 720.972168 282.25641 720.972168ZM310.97436 571.706335 253.538462 571.706335C237.686154 571.706335 224.820513 558.332115 224.820513 541.853166L224.820513 482.146834C224.820513 465.667885 237.686154 452.293665 253.538462 452.293665L310.97436 452.293665C326.826667 452.293665 339.692308 465.667885 339.692308 482.146834L339.692308 541.853166C339.692308 558.332115 326.826667 571.706335 310.97436 571.706335L310.97436 571.706335ZM569.435898 720.972168C569.435898 737.451116 556.570256 750.825334 540.717948 750.825334L368.410256 750.825334C352.557948 750.825334 339.692308 737.451116 339.692308 720.972168L339.692308 661.265833C339.692308 644.786885 352.557948 631.412667 368.410256 631.412667L540.717948 631.412667C556.570256 631.412667 569.435898 644.786885 569.435898 661.265833L569.435898 720.972168 569.435898 720.972168ZM569.435898 541.853166 569.435898 482.146834C569.435898 465.667885 582.301538 452.293665 598.153846 452.293665L655.589744 452.293665C671.442052 452.293665 684.307692 465.667885 684.307692 482.146834L684.307692 541.853166C684.307692 558.332115 671.442052 571.706335 655.589744 571.706335L598.153846 571.706335C582.301538 571.706335 569.435898 558.332115 569.435898 541.853166L569.435898 541.853166ZM856.615385 720.972168C856.615385 737.451116 843.749744 750.825334 827.897437 750.825334L655.589744 750.825334C639.737437 750.825334 626.871794 737.451116 626.871794 720.972168L626.871794 661.265833C626.871794 644.786885 639.737437 631.412667 655.589744 631.412667L713.02564 631.412667C728.877948 631.412667 741.74359 618.038449 741.74359 601.559501L741.74359 482.146834C741.74359 465.667885 754.609231 452.293665 770.461538 452.293665L827.897437 452.293665C843.749744 452.293665 856.615385 465.667885 856.615385 482.146834L856.615385 720.972168 856.615385 720.972168ZM856.615385 362.734167C856.615385 379.213115 843.749744 392.587333 827.897437 392.587333L713.02564 392.587333C697.173333 392.587333 684.307692 379.213115 684.307692 362.734167L684.307692 303.027832C684.307692 286.548884 697.173333 273.174666 713.02564 273.174666L827.897437 273.174666C843.749744 273.174666 856.615385 286.548884 856.615385 303.027832L856.615385 362.734167 856.615385 362.734167Z</Geometry>
|
||||
<Geometry x:Key="LoveGeometry">M890.2 208.2c-91.8-91.9-242.1-91.9-334 0L544.4 220c-18.2 18.2-47.6 18.2-65.8 0l-11.8-11.8c-91.9-91.9-242.1-91.9-334 0C41 300 24.7 533.9 203.6 722.1 304 827.8 412.4 882.3 470 905.9c26.6 10.9 56.5 10.9 83 0 57.6-23.6 166-78.1 266.4-183.8 178.9-188.2 162.6-422 70.8-513.9z</Geometry>
|
||||
<Geometry x:Key="CnblogsGeometry">M512 0C229.234472 0 0 229.226146 0 512 0 794.765528 229.234472 1024 512 1024S1024 794.765528 1024 512C1024 229.226146 794.765528 0 512 0zM228.776585 836.066862c-63.163317 0-114.371642-51.208325-114.371642-114.371642S165.613268 607.323577 228.776585 607.323577s114.371642 51.208325 114.371643 114.371643c0 63.171642-51.208325 114.371642-114.371643 114.371642z m420.555968-89.612488a391.867317 391.867317 0 0 1-1.989724 16.975089c-7.259577 30.203837-33.950179 52.898341-66.376845 52.898342-38.104455 0-68.990959-34.158309-68.99096-72.204488 0-5.877593 0.81587-11.463805 2.206179-16.775284-1.756618-131.096976-103.981789-237.867707-233.205593-246.883903l-6.343805-0.740943-1.015675-0.041626c-5.453008-0.216455-10.930992-0.732618-16.142569-2.331057a67.958634 67.958634 0 0 1-47.91987-65.078114c0-37.604943 30.245463-68.091837 67.550699-68.091837 0.299707 0 0.591089 0.041626 0.890797 0.049951l0.124878-0.049951c205.707447 2.139577 371.836878 169.484488 371.836878 375.699772 0 7.717463-0.341333 15.34335-0.824195 22.94426 0.066602 1.207154 0.19148 2.397659 0.199805 3.629789z m254.085203-63.329821c-10.856065 45.172553-25.80813 104.114992-74.310764 104.114992-56.994341 0-48.236228-66.085463-48.236228-122.996553 0-8.791415 1.223805-17.149919 3.296781-25.100488-2.639089-196.108488-169.834146-387.812943-363.137041-401.291447l-35.806699-5.827642c-42.117203-7.492683-111.715902-3.255154-111.715903-49.193626 0-56.253398 50.234276-81.861724 106.038114-81.861724 0.449561 0 0.882472 0.058276 1.332033 0.066602l0.183154-0.066602c307.724488 3.180228 526.252748 208.546341 526.252748 517.028423a538.474146 538.474146 0 0 1-1.23213 34.316488c0.108228 1.806569 0.291382 3.596488 0.308033 5.428032a542.72 542.72 0 0 1-2.972098 25.383545z</Geometry>
|
||||
<Geometry x:Key="ConfigGeometry">M827.904 541.184a278.592 278.592 0 0 0 0-58.368l73.728-58.368c15.872-13.056 20.224-35.584 9.728-53.504l-78.592-137.728c-9.984-17.408-31.232-25.856-51.712-18.176l-86.528 35.072c-15.872-11.52-32.512-21.248-49.664-29.184l-12.8-92.928c-3.072-20.224-20.736-35.584-41.216-35.584h-157.44c-20.736 0-38.144 14.848-41.216 35.84L378.88 221.44c-17.152 7.936-33.792 17.92-49.664 29.184L242.688 215.296c-18.688-7.168-41.216 0.768-51.2 18.176L112.64 371.2c-10.24 17.92-6.144 40.448 10.24 53.76l73.472 58.112c-1.024 9.472-1.536 19.2-1.536 29.184 0 9.728 0.512 19.456 1.536 29.184l-73.984 58.368c-15.872 13.056-19.968 35.584-9.728 53.248l78.848 137.728c9.984 17.408 32 25.856 51.456 17.92l86.528-35.072c15.872 11.52 32.512 21.248 49.664 29.184l13.056 93.696c3.328 20.48 20.48 35.328 41.216 35.328h157.44c20.48 0 38.144-15.36 41.216-35.84l13.056-93.184c17.152-7.936 33.792-17.664 49.664-29.184l86.784 35.328c4.864 1.792 9.984 2.816 15.104 2.816 14.848 0 28.672-7.936 36.096-20.992l78.592-137.728c10.24-17.664 6.4-40.192-9.984-53.76l-73.472-58.112z m-25.344 231.168l-99.584-40.448c-7.424-3.072-15.872-1.792-22.272 3.072-19.712 15.36-40.704 27.648-62.464 36.608-7.424 3.072-12.544 9.728-13.568 17.664l-14.592 104.96-155.392 2.304-15.104-107.264c-1.024-7.936-6.4-14.592-13.568-17.664-21.76-8.96-42.752-21.504-62.464-36.608-4.096-3.072-8.96-4.608-13.824-4.608-2.816 0-5.888 0.512-8.448 1.536l-96.256 41.472-80.896-137.216 84.48-66.816c6.144-4.864 9.472-12.8 8.448-20.48-1.536-12.032-2.56-24.32-2.56-36.608 0-12.288 1.024-24.576 2.56-36.608 1.024-7.936-2.048-15.616-8.448-20.48l-83.712-64 76.544-139.264 99.584 40.448c7.424 3.072 15.872 1.792 22.272-3.072 19.712-15.36 40.96-27.648 62.72-36.864 7.424-3.072 12.544-9.728 13.568-17.664l12.544-104.704 157.696-2.304 15.104 107.264c1.024 7.936 6.4 14.592 13.568 17.664 21.76 8.96 42.752 21.504 62.464 36.864 6.4 4.864 14.848 6.144 22.272 3.072l96.256-41.472 80.896 137.216-84.48 66.816c-6.144 4.864-9.472 12.544-8.448 20.48 1.536 12.032 2.56 24.32 2.56 36.608 0 12.288-1.024 24.576-2.56 36.608-1.024 7.936 2.304 15.616 8.448 20.48l83.712 63.744-77.056 139.264zM512 345.6c-91.136 0-165.12 74.752-165.12 166.4s73.984 166.4 165.12 166.4 165.12-74.752 165.12-166.4-73.984-166.4-165.12-166.4z m0 297.216c-71.168 0-129.28-58.624-129.28-130.816 0-72.192 58.112-130.816 129.28-130.816s129.28 58.624 129.28 130.816c0 72.192-57.856 130.816-129.28 130.816z</Geometry>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
|
||||
xmlns:interactivity="clr-namespace:HandyControl.Interactivity;assembly=HandyControl">
|
||||
xmlns:interactivity="clr-namespace:HandyControl.Interactivity;assembly=HandyControl"
|
||||
xmlns:langs="clr-namespace:HandyControl.Properties.Langs;assembly=HandyControl">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../Basic/Geometries.xaml"/>
|
||||
@@ -90,4 +91,37 @@
|
||||
</WrapPanel>
|
||||
</ItemsPanelTemplate>
|
||||
|
||||
<Style x:Key="MessageBoxCustom" TargetType="controls:MessageBox" BasedOn="{StaticResource {x:Type controls:MessageBox}}">
|
||||
<Setter Property="NonClientAreaBackground" Value="#262e2f"/>
|
||||
<Setter Property="OtherButtonHoverBackground" Value="#888580"/>
|
||||
<Setter Property="OtherButtonForeground" Value="White"/>
|
||||
<Setter Property="OtherButtonHoverForeground" Value="White"/>
|
||||
<Setter Property="NonClientAreaForeground" Value="White"/>
|
||||
<Setter Property="CloseButtonForeground" Value="White"/>
|
||||
<Setter Property="Content">
|
||||
<Setter.Value>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Path x:Name="PART_Image" HorizontalAlignment="Center" Visibility="Collapsed" Grid.Row="0" Grid.Column="0" VerticalAlignment="Top" Margin="20,32,0,0" Width="30" Height="30" Stretch="Uniform"/>
|
||||
<ScrollViewer Grid.Column="1" Grid.Row="0">
|
||||
<TextBlock Margin="10,39,10,10" x:Name="PART_Message" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||
</ScrollViewer>
|
||||
<StackPanel Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Margin="0,10,0,16" Orientation="Horizontal" Background="{DynamicResource RegionBrush}" HorizontalAlignment="Center">
|
||||
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsCancel="True" MinWidth="88" Command="interactivity:ControlCommands.Cancel" Content="{x:Static langs:Lang.Cancel}" Margin="5,0"/>
|
||||
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsDefault="True" MinWidth="88" Command="interactivity:ControlCommands.Confirm" Content="{x:Static langs:Lang.Confirm}" Margin="5,0" Background="#262e2f" Style="{StaticResource ButtonPrimary}"/>
|
||||
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsCancel="True" MinWidth="88" Command="interactivity:ControlCommands.No" Content="{x:Static langs:Lang.No}" Margin="5,0"/>
|
||||
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsDefault="True" MinWidth="88" Command="interactivity:ControlCommands.Yes" Content="{x:Static langs:Lang.Yes}" Margin="5,0" Background="#262e2f" Style="{StaticResource ButtonPrimary}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -14,7 +14,7 @@ namespace HandyControlDemo.Service
|
||||
internal List<DemoDataModel> GetDemoDataList()
|
||||
{
|
||||
var list = new List<DemoDataModel>();
|
||||
for (var i = 1; i <= 6; i++)
|
||||
for (var i = 1; i <= 20; i++)
|
||||
{
|
||||
var dataList = new List<DemoDataModel>();
|
||||
for (int j = 0; j < 3; j++)
|
||||
@@ -34,7 +34,7 @@ namespace HandyControlDemo.Service
|
||||
Name = $"Name{i}",
|
||||
Type = (DemoType)i,
|
||||
DataList = dataList,
|
||||
ImgPath = $"/HandyControlDemo;component/Resources/Img/Avatar/avatar{i}.png",
|
||||
ImgPath = $"/HandyControlDemo;component/Resources/Img/Avatar/avatar{i % 7}.png",
|
||||
Remark = new string(i.ToString()[0], 10)
|
||||
};
|
||||
list.Add(model);
|
||||
|
||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,12 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace HandyControlDemo.Tools
|
||||
{
|
||||
internal class ExternDllHelper
|
||||
{
|
||||
private const string Winmm = "winmm.dll";
|
||||
|
||||
[DllImport(Winmm, EntryPoint = "mciSendString", CharSet = CharSet.Auto)]
|
||||
public static extern int MciSendString(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<UserControl x:Class="HandyControlDemo.UserControl.ChatBox"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
|
||||
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
|
||||
xmlns:interactivity="clr-namespace:HandyControl.Interactivity;assembly=HandyControl"
|
||||
mc:Ignorable="d"
|
||||
Height="486"
|
||||
Effect="{StaticResource EffectShadow5}"
|
||||
Background="{DynamicResource RegionBrush}"
|
||||
DataContext="{Binding ChatBox,Source={StaticResource Locator}}"
|
||||
Width="300">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ListBox ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.CanContentScroll="False" Background="Transparent" controls:ChatBubble.MaxWidth="300" BorderThickness="0" Style="{StaticResource StackPanelVerticalListBox}" ItemsSource="{Binding ChatInfos}">
|
||||
<interactivity:Interaction.Triggers>
|
||||
<interactivity:RoutedEventTrigger RoutedEvent="controls:ChatBubble.Selected">
|
||||
<interactivity:EventToCommand Command="{Binding ReadMessageCmd}" PassEventArgsToCommand="True" />
|
||||
</interactivity:RoutedEventTrigger>
|
||||
</interactivity:Interaction.Triggers>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<controls:ChatBubble Role="{Binding Role}" Type="{Binding Type}" Content="{Binding Message}" Tag="{Binding}"/>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<Border Background="{DynamicResource DarkDefaultBrush}" Grid.Row="1">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ToggleButton Name="ToggleButtonAudio" controls:BorderElement.CornerRadius="15" Width="30" Height="30" Padding="7" Margin="6" controls:IconSwitchElement.Geometry="{StaticResource AudioGeometry}" controls:IconSwitchElement.GeometrySelected="{StaticResource KeyboardGeometry}" Style="{StaticResource ToggleButtonIcon}"/>
|
||||
<Button Command="{Binding OpenImageCmd}" Grid.Column="2" Margin="6,0,6,0" controls:BorderElement.CornerRadius="15" Width="30" Height="30" Padding="7" controls:IconElement.Geometry="{StaticResource ImageGeometry}"/>
|
||||
<TextBox Grid.Column="1" Text="{Binding ChatString,UpdateSourceTrigger=PropertyChanged}" Visibility="{Binding IsChecked,ElementName=ToggleButtonAudio,Converter={StaticResource Boolean2VisibilityReConverter}}">
|
||||
<interactivity:Interaction.Triggers>
|
||||
<interactivity:EventTrigger EventName="KeyDown">
|
||||
<interactivity:EventToCommand Command="{Binding SendStringCmd}" PassEventArgsToCommand="True" />
|
||||
</interactivity:EventTrigger>
|
||||
</interactivity:Interaction.Triggers>
|
||||
</TextBox>
|
||||
<Button Grid.Column="1" Visibility="{Binding IsChecked,ElementName=ToggleButtonAudio,Converter={StaticResource Boolean2VisibilityConverter}}" Content="{x:Static langs:Lang.PushToTalk}" HorizontalAlignment="Stretch">
|
||||
<interactivity:Interaction.Triggers>
|
||||
<interactivity:EventTrigger EventName="PreviewMouseLeftButtonDown">
|
||||
<interactivity:EventToCommand Command="{Binding StartRecordCmd}"/>
|
||||
</interactivity:EventTrigger>
|
||||
<interactivity:EventTrigger EventName="PreviewMouseLeftButtonUp">
|
||||
<interactivity:EventToCommand Command="{Binding StopRecordCmd}"/>
|
||||
</interactivity:EventTrigger>
|
||||
</interactivity:Interaction.Triggers>
|
||||
</Button>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
{
|
||||
public partial class ChatBox
|
||||
{
|
||||
public ChatBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<UserControl x:Class="HandyControlDemo.UserControl.ChatBubbleDemoCtl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:userControl="clr-namespace:HandyControlDemo.UserControl"
|
||||
Background="{DynamicResource RegionBrush}">
|
||||
<ContentControl>
|
||||
<StackPanel Orientation="Horizontal" Margin="32">
|
||||
<userControl:ChatBox>
|
||||
<userControl:ChatBox.Background>
|
||||
<ImageBrush ImageSource="/HandyControlDemo;component/Resources/Img/Chat/chat_back1.jpg" Stretch="Uniform"/>
|
||||
</userControl:ChatBox.Background>
|
||||
</userControl:ChatBox>
|
||||
<userControl:ChatBox Margin="32,0,0,0">
|
||||
<userControl:ChatBox.Background>
|
||||
<ImageBrush ImageSource="/HandyControlDemo;component/Resources/Img/Chat/chat_back2.jpg" Stretch="Uniform"/>
|
||||
</userControl:ChatBox.Background>
|
||||
</userControl:ChatBox>
|
||||
</StackPanel>
|
||||
</ContentControl>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
{
|
||||
public partial class ChatBubbleDemoCtl
|
||||
{
|
||||
public ChatBubbleDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<UserControl x:Class="HandyControlDemo.UserControl.ProgressButtonDemoCtl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
|
||||
Background="{DynamicResource RegionBrush}">
|
||||
<controls:TransitioningContentControl>
|
||||
<StackPanel Margin="32" Width="300" Button.Click="ButtonProgress_OnClick" VerticalAlignment="Center">
|
||||
<controls:ProgressButton IsChecked="{Binding IsUploading,Mode=TwoWay}" Progress="{Binding Progress}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StrConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
|
||||
<controls:ProgressButton Style="{StaticResource ProgressButtonPrimary}" IsChecked="{Binding IsUploading,Mode=TwoWay}" Progress="{Binding Progress}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StrConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
|
||||
<controls:ProgressButton Style="{StaticResource ProgressButtonSuccess}" IsChecked="{Binding IsUploading,Mode=TwoWay}" Progress="{Binding Progress}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StrConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
|
||||
<controls:ProgressButton Style="{StaticResource ProgressButtonInfo}" IsChecked="{Binding IsUploading,Mode=TwoWay}" Progress="{Binding Progress}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StrConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
|
||||
<controls:ProgressButton Style="{StaticResource ProgressButtonWarning}" IsChecked="{Binding IsUploading,Mode=TwoWay}" Progress="{Binding Progress}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StrConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
|
||||
<controls:ProgressButton Style="{StaticResource ProgressButtonDanger}" IsChecked="{Binding IsUploading,Mode=TwoWay}" Progress="{Binding Progress}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StrConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
|
||||
</StackPanel>
|
||||
</controls:TransitioningContentControl>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
{
|
||||
public partial class ProgressButtonDemoCtl
|
||||
{
|
||||
public static readonly DependencyProperty ProgressProperty = DependencyProperty.Register(
|
||||
"Progress", typeof(int), typeof(ProgressButtonDemoCtl), new PropertyMetadata(default(int)));
|
||||
|
||||
public int Progress
|
||||
{
|
||||
get => (int) GetValue(ProgressProperty);
|
||||
set => SetValue(ProgressProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty IsUploadingProperty = DependencyProperty.Register(
|
||||
"IsUploading", typeof(bool), typeof(ProgressButtonDemoCtl), new PropertyMetadata(default(bool)));
|
||||
|
||||
public bool IsUploading
|
||||
{
|
||||
get => (bool) GetValue(IsUploadingProperty);
|
||||
set => SetValue(IsUploadingProperty, value);
|
||||
}
|
||||
|
||||
private readonly DispatcherTimer _timer;
|
||||
|
||||
public ProgressButtonDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
DataContext = this;
|
||||
|
||||
_timer = new DispatcherTimer
|
||||
{
|
||||
Interval = TimeSpan.FromMilliseconds(200)
|
||||
};
|
||||
_timer.Tick += Timer_Tick;
|
||||
}
|
||||
|
||||
private void Timer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
Progress++;
|
||||
if (Progress == 100)
|
||||
{
|
||||
Progress = 0;
|
||||
_timer.Stop();
|
||||
IsUploading = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonProgress_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_timer.IsEnabled)
|
||||
{
|
||||
_timer.Stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
_timer.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<UserControl x:Class="HandyControlDemo.UserControl.TransferDemoCtl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Background="{DynamicResource RegionBrush}"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl">
|
||||
<controls:TransitioningContentControl>
|
||||
<controls:Transfer ItemsSource="{Binding DataList}" Margin="32" Height="300">
|
||||
<controls:Transfer.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Name}"/>
|
||||
</DataTemplate>
|
||||
</controls:Transfer.ItemTemplate>
|
||||
</controls:Transfer>
|
||||
</controls:TransitioningContentControl>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
{
|
||||
public partial class TransferDemoCtl
|
||||
{
|
||||
public TransferDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
|
||||
xmlns:interactivity="clr-namespace:HandyControl.Interactivity;assembly=HandyControl"
|
||||
Background="{DynamicResource RegionBrush}">
|
||||
<ContentControl>
|
||||
<controls:TransitioningContentControl>
|
||||
<Grid Margin="32">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
@@ -53,5 +53,5 @@
|
||||
</controls:ScrollViewer>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ContentControl>
|
||||
</UserControl>
|
||||
</controls:TransitioningContentControl>
|
||||
</UserControl>
|
||||
@@ -12,6 +12,7 @@
|
||||
<Button Command="{Binding OpenWindowCmd}" CommandParameter="{x:Static data:MessageToken.BlurWindow}" Content="{x:Static langs:Lang.OpenBlurWindow}"/>
|
||||
<Button Command="{Binding OpenWindowCmd}" CommandParameter="{x:Static data:MessageToken.CustomNonClientAreaWindow}" Content="{x:Static langs:Lang.OpenCustomNonClientAreaWindow}"/>
|
||||
<Button Click="ButtonMessage_OnClick" Content="{x:Static langs:Lang.OpenMessageWindow}"/>
|
||||
<Button Click="ButtonCustomMessage_OnClick" Content="{x:Static langs:Lang.OpenCustomMessageWindow}"/>
|
||||
<Button Click="ButtonCustomContent_OnClick" Content="{x:Static langs:Lang.OpenCustomContentWindow}"/>
|
||||
<Button Name="ButtonMouseFollow" Click="ButtonMouseFollow_OnClick" Content="{x:Static langs:Lang.OpenMouseFollowWindow}"/>
|
||||
<Button Command="{Binding OpenWindowCmd}" CommandParameter="{x:Static data:MessageToken.NoNonClientAreaDragableWindow}" Content="{x:Static langs:Lang.OpenNoNonClientAreaDragableWindow}"/>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Windows;
|
||||
using HandyControl.Controls;
|
||||
using HandyControl.Data;
|
||||
using HandyControl.Tools;
|
||||
using MessageBox = HandyControl.Controls.MessageBox;
|
||||
|
||||
@@ -18,6 +19,19 @@ namespace HandyControlDemo.UserControl
|
||||
MessageBox.Show(Properties.Langs.Lang.GrowlAsk, Properties.Langs.Lang.Title, MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||
}
|
||||
|
||||
private void ButtonCustomMessage_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageBox.Show(new MessageBoxInfo
|
||||
{
|
||||
MessageBoxText = Properties.Langs.Lang.GrowlAsk,
|
||||
Caption = Properties.Langs.Lang.Title,
|
||||
Button = MessageBoxButton.YesNo,
|
||||
IconBrushKey = ResourceToken.AccentBrush,
|
||||
IconKey = ResourceToken.AskGeometry,
|
||||
Style = ResourceHelper.GetResource<Style>("MessageBoxCustom")
|
||||
});
|
||||
}
|
||||
|
||||
private void ButtonMouseFollow_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var picker = SingleOpenHelper.CreateControl<ColorPicker>();
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
xmlns:userControl="clr-namespace:HandyControlDemo.UserControl"
|
||||
DataContext="{Binding ContributorsView,Source={StaticResource Locator}}"
|
||||
Background="{DynamicResource SecondaryRegionBrush}">
|
||||
<ListBox Background="{DynamicResource GitHubDrawingBrush}" ItemContainerStyle="{StaticResource ListBoxItemStyle}" BorderThickness="0" ItemsSource="{Binding DataList}" ItemsPanel="{StaticResource FluidMoveBehaviorWrapPanelItemsPanelTemplate}">
|
||||
<ListBox Background="{DynamicResource GitHubDrawingBrush}" ItemContainerStyle="{StaticResource ListBoxItemCustom}" BorderThickness="0" ItemsSource="{Binding DataList}" ItemsPanel="{StaticResource FluidMoveBehaviorWrapPanelItemsPanelTemplate}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<userControl:Avatar UserName="{Binding UserName}" Link="{Binding Link}" Source="{Binding AvatarUri}"/>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</UserControl>
|
||||
</UserControl>
|
||||
@@ -33,7 +33,7 @@
|
||||
<Border CornerRadius="4" Height="30" Width="30" BorderThickness="1" BorderBrush="{DynamicResource PrimaryBrush}"/>
|
||||
</controls:StatusSwitchElement.CheckedElement>
|
||||
</ToggleButton>
|
||||
<ListBox Name="listStyle" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" BorderThickness="0" SelectionMode="Single" Style="{StaticResource ListBoxTransparent}">
|
||||
<ListBox Name="ListBoxStyle" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" BorderThickness="0" SelectionMode="Single" Style="{StaticResource ListBoxTransparent}">
|
||||
<ListBoxItem Tag="{x:Static data:MessageToken.BrushDemoCtl}" Content="{x:Static langs:Lang.Brush}">
|
||||
<controls:EdgeElement.LeftContent>
|
||||
<Image Source="../../Resources/Img/LeftMainContent/Brush_16x.png"/>
|
||||
@@ -181,7 +181,17 @@
|
||||
<Border CornerRadius="4" Height="30" Width="30" BorderThickness="1" BorderBrush="{DynamicResource PrimaryBrush}"/>
|
||||
</controls:StatusSwitchElement.CheckedElement>
|
||||
</ToggleButton>
|
||||
<ListBox Name="listControl" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" BorderThickness="0" SelectionMode="Single" Style="{StaticResource ListBoxTransparent}">
|
||||
<ListBox Name="ListBoxControl" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" BorderThickness="0" SelectionMode="Single" Style="{StaticResource ListBoxTransparent}">
|
||||
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.ProgressButtonDemoCtl}" Content="{x:Static langs:Lang.ProgressButton}">
|
||||
<controls:EdgeElement.LeftContent>
|
||||
<Image Source="../../Resources/Img/LeftMainContent/ProgressButton_16x.png"/>
|
||||
</controls:EdgeElement.LeftContent>
|
||||
</ListBoxItem>
|
||||
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.ChatBubbleDemoCtl}" Content="{x:Static langs:Lang.ChatBubble}">
|
||||
<controls:EdgeElement.LeftContent>
|
||||
<Image Source="../../Resources/Img/LeftMainContent/Bubble_16xLG.png"/>
|
||||
</controls:EdgeElement.LeftContent>
|
||||
</ListBoxItem>
|
||||
<ListBoxItem Tag="{x:Static data:MessageToken.NumericUpDownDemoCtl}" Content="{x:Static langs:Lang.NumericUpDown}">
|
||||
<controls:EdgeElement.LeftContent>
|
||||
<Image Source="../../Resources/Img/LeftMainContent/NumericListBox_16x.png"/>
|
||||
@@ -227,17 +237,22 @@
|
||||
<Image Source="../../Resources/Img/LeftMainContent/DatePicker_16x.png"/>
|
||||
</controls:EdgeElement.LeftContent>
|
||||
</ListBoxItem>
|
||||
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.TransferDemoCtl}" Content="{x:Static langs:Lang.Transfer}">
|
||||
<controls:EdgeElement.LeftContent>
|
||||
<Image Source="../../Resources/Img/LeftMainContent/Transfer_16x.png"/>
|
||||
</controls:EdgeElement.LeftContent>
|
||||
</ListBoxItem>
|
||||
<ListBoxItem Tag="{x:Static data:MessageToken.FlipClockDemoCtl}" Content="{x:Static langs:Lang.FlipClock}">
|
||||
<controls:EdgeElement.LeftContent>
|
||||
<Image Source="../../Resources/Img/LeftMainContent/FlipVertical_16x.png"/>
|
||||
</controls:EdgeElement.LeftContent>
|
||||
</ListBoxItem>
|
||||
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.RateDemoCtl}" Content="{x:Static langs:Lang.Rate}">
|
||||
<ListBoxItem Tag="{x:Static data:MessageToken.RateDemoCtl}" Content="{x:Static langs:Lang.Rate}">
|
||||
<controls:EdgeElement.LeftContent>
|
||||
<Image Source="../../Resources/Img/LeftMainContent/Star.png"/>
|
||||
</controls:EdgeElement.LeftContent>
|
||||
</ListBoxItem>
|
||||
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.ShieldDemoCtl}" Content="{x:Static langs:Lang.Shield}">
|
||||
<ListBoxItem Tag="{x:Static data:MessageToken.ShieldDemoCtl}" Content="{x:Static langs:Lang.Shield}">
|
||||
<controls:EdgeElement.LeftContent>
|
||||
<Image Source="../../Resources/Img/LeftMainContent/Shield_16x.png"/>
|
||||
</controls:EdgeElement.LeftContent>
|
||||
@@ -267,7 +282,7 @@
|
||||
<Image Source="../../Resources/Img/LeftMainContent/ColorWheel_16x.png"/>
|
||||
</controls:EdgeElement.LeftContent>
|
||||
</ListBoxItem>
|
||||
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.WaterfallPanelDemoCtl}" Content="{x:Static langs:Lang.WaterfallPanel}">
|
||||
<ListBoxItem Tag="{x:Static data:MessageToken.WaterfallPanelDemoCtl}" Content="{x:Static langs:Lang.WaterfallPanel}">
|
||||
<controls:EdgeElement.LeftContent>
|
||||
<Image Source="../../Resources/Img/LeftMainContent/Panel_16x.png"/>
|
||||
</controls:EdgeElement.LeftContent>
|
||||
|
||||
@@ -36,11 +36,11 @@ namespace HandyControlDemo.UserControl
|
||||
{
|
||||
if (ButtonStyleAscending.IsChecked == true)
|
||||
{
|
||||
listStyle.Items.SortDescriptions.Add(new SortDescription("Content", ListSortDirection.Ascending));
|
||||
ListBoxStyle.Items.SortDescriptions.Add(new SortDescription("Content", ListSortDirection.Ascending));
|
||||
}
|
||||
else
|
||||
{
|
||||
listStyle.Items.SortDescriptions.Clear();
|
||||
ListBoxStyle.Items.SortDescriptions.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,11 +48,11 @@ namespace HandyControlDemo.UserControl
|
||||
{
|
||||
if (ButtonControlAscending.IsChecked == true)
|
||||
{
|
||||
listControl.Items.SortDescriptions.Add(new SortDescription("Content", ListSortDirection.Ascending));
|
||||
ListBoxControl.Items.SortDescriptions.Add(new SortDescription("Content", ListSortDirection.Ascending));
|
||||
}
|
||||
else
|
||||
{
|
||||
listControl.Items.SortDescriptions.Clear();
|
||||
ListBoxControl.Items.SortDescriptions.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace HandyControlDemo.UserControl
|
||||
{
|
||||
if (e.Info == null) return;
|
||||
|
||||
foreach (var listBoxItem in listStyle.Items.OfType<ListBoxItem>())
|
||||
foreach (var listBoxItem in ListBoxStyle.Items.OfType<ListBoxItem>())
|
||||
{
|
||||
listBoxItem.Show(listBoxItem.Content.ToString().ToLower().Contains(e.Info.ToLower()));
|
||||
}
|
||||
@@ -70,10 +70,10 @@ namespace HandyControlDemo.UserControl
|
||||
{
|
||||
if (e.Info == null) return;
|
||||
|
||||
foreach (var listBoxItem in listControl.Items.OfType<ListBoxItem>())
|
||||
foreach (var listBoxItem in ListBoxControl.Items.OfType<ListBoxItem>())
|
||||
{
|
||||
listBoxItem.Show(listBoxItem.Content.ToString().ToLower().Contains(e.Info.ToLower()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Media;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media.Imaging;
|
||||
using GalaSoft.MvvmLight;
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using HandyControl.Controls;
|
||||
using HandyControl.Data;
|
||||
using HandyControl.Tools;
|
||||
using HandyControlDemo.Data;
|
||||
using HandyControlDemo.Tools;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
{
|
||||
public class ChatBoxViewModel : ViewModelBase
|
||||
{
|
||||
private static readonly string AutioCachePath = $"{AppDomain.CurrentDomain.BaseDirectory}Cache";
|
||||
|
||||
private readonly string _id = Guid.NewGuid().ToString();
|
||||
|
||||
private readonly Stopwatch _stopwatch = new Lazy<Stopwatch>(() => new Stopwatch()).Value;
|
||||
|
||||
public ChatBoxViewModel()
|
||||
{
|
||||
Messenger.Default.Register<ChatInfoModel>(this, MessageToken.SendChatMessage, ReceiveMessage);
|
||||
}
|
||||
|
||||
private void ReceiveMessage(ChatInfoModel info)
|
||||
{
|
||||
if (_id.Equals(info.SenderId)) return;
|
||||
info.Role = ChatRoleType.Receiver;
|
||||
ChatInfos.Add(info);
|
||||
}
|
||||
|
||||
private string _chatString;
|
||||
|
||||
public string ChatString
|
||||
{
|
||||
get => _chatString;
|
||||
set => Set(nameof(ChatString), ref _chatString, value);
|
||||
}
|
||||
|
||||
public ObservableCollection<ChatInfoModel> ChatInfos { get; set; } = new ObservableCollection<ChatInfoModel>();
|
||||
|
||||
public RelayCommand<KeyEventArgs> SendStringCmd => new Lazy<RelayCommand<KeyEventArgs>>(() =>
|
||||
new RelayCommand<KeyEventArgs>(SendString)).Value;
|
||||
|
||||
private void SendString(KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
if (string.IsNullOrEmpty(ChatString)) return;
|
||||
var info = new ChatInfoModel
|
||||
{
|
||||
Message = ChatString,
|
||||
SenderId = _id,
|
||||
Type = ChatMessageType.String,
|
||||
Role = ChatRoleType.Sender
|
||||
};
|
||||
ChatInfos.Add(info);
|
||||
Messenger.Default.Send(info, MessageToken.SendChatMessage);
|
||||
ChatString = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public RelayCommand<RoutedEventArgs> ReadMessageCmd => new Lazy<RelayCommand<RoutedEventArgs>>(() =>
|
||||
new RelayCommand<RoutedEventArgs>(ReadMessage)).Value;
|
||||
|
||||
private void ReadMessage(RoutedEventArgs e)
|
||||
{
|
||||
if (e.OriginalSource is FrameworkElement element && element.Tag is ChatInfoModel info)
|
||||
{
|
||||
if (info.Type == ChatMessageType.Image)
|
||||
{
|
||||
new ImageBrowser(new Uri(info.Enclosure.ToString()))
|
||||
{
|
||||
Owner = VisualHelper.GetActiveWindow()
|
||||
}.Show();
|
||||
}
|
||||
else if (info.Type == ChatMessageType.Audio)
|
||||
{
|
||||
var player = new SoundPlayer(info.Enclosure.ToString());
|
||||
player.PlaySync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public RelayCommand StartRecordCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(StartRecord)).Value;
|
||||
|
||||
private void StartRecord()
|
||||
{
|
||||
ExternDllHelper.MciSendString("set wave bitpersample 8", "", 0, 0);
|
||||
ExternDllHelper.MciSendString("set wave samplespersec 20000", "", 0, 0);
|
||||
ExternDllHelper.MciSendString("set wave channels 2", "", 0, 0);
|
||||
ExternDllHelper.MciSendString("set wave format tag pcm", "", 0, 0);
|
||||
ExternDllHelper.MciSendString("open new type WAVEAudio alias movie", "", 0, 0);
|
||||
ExternDllHelper.MciSendString("record movie", "", 0, 0);
|
||||
|
||||
_stopwatch.Reset();
|
||||
_stopwatch.Start();
|
||||
}
|
||||
|
||||
public RelayCommand StopRecordCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(StopRecord)).Value;
|
||||
|
||||
private void StopRecord()
|
||||
{
|
||||
if (!Directory.Exists(AutioCachePath))
|
||||
{
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(AutioCachePath);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Growl.Error(e.Message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var cachePath = $"{AutioCachePath}\\{Guid.NewGuid().ToString()}";
|
||||
ExternDllHelper.MciSendString("stop movie", "", 0, 0);
|
||||
ExternDllHelper.MciSendString($"save movie {cachePath}", "", 0, 0);
|
||||
ExternDllHelper.MciSendString("close movie", "", 0, 0);
|
||||
|
||||
_stopwatch.Stop();
|
||||
|
||||
var info = new ChatInfoModel
|
||||
{
|
||||
Message = $"{_stopwatch.Elapsed.Seconds.ToString()} {Properties.Langs.Lang.Second}",
|
||||
SenderId = _id,
|
||||
Type = ChatMessageType.Audio,
|
||||
Role = ChatRoleType.Sender,
|
||||
Enclosure = cachePath
|
||||
};
|
||||
ChatInfos.Add(info);
|
||||
Messenger.Default.Send(info, MessageToken.SendChatMessage);
|
||||
}
|
||||
|
||||
public RelayCommand OpenImageCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(OpenImage)).Value;
|
||||
|
||||
private void OpenImage()
|
||||
{
|
||||
var dialog = new OpenFileDialog();
|
||||
if (dialog.ShowDialog() == true)
|
||||
{
|
||||
var fileName = dialog.FileName;
|
||||
if (File.Exists(fileName))
|
||||
{
|
||||
var info = new ChatInfoModel
|
||||
{
|
||||
Message = BitmapFrame.Create(new Uri(fileName)),
|
||||
SenderId = _id,
|
||||
Type = ChatMessageType.Image,
|
||||
Role = ChatRoleType.Sender,
|
||||
Enclosure = fileName
|
||||
};
|
||||
ChatInfos.Add(info);
|
||||
Messenger.Default.Send(info, MessageToken.SendChatMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -22,6 +22,7 @@ namespace HandyControlDemo.ViewModel
|
||||
SimpleIoc.Default.Register<ContributorsViewModel>();
|
||||
SimpleIoc.Default.Register<StepBarDemoViewModel>();
|
||||
SimpleIoc.Default.Register<PaginationDemoViewModel>();
|
||||
SimpleIoc.Default.Register<ChatBoxViewModel>();
|
||||
}
|
||||
|
||||
public static ViewModelLocator Instance => new Lazy<ViewModelLocator>(() =>
|
||||
@@ -45,6 +46,8 @@ namespace HandyControlDemo.ViewModel
|
||||
|
||||
public PaginationDemoViewModel PaginationDemo => ServiceLocator.Current.GetInstance<PaginationDemoViewModel>();
|
||||
|
||||
public ChatBoxViewModel ChatBox => new ChatBoxViewModel();
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using HandyControl.Data;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
|
||||
@@ -29,11 +29,38 @@ namespace HandyControl.Controls
|
||||
|
||||
if (_isMouseLeftButtonDown)
|
||||
{
|
||||
RaiseEvent(new RoutedEventArgs(SelectedEvent, this));
|
||||
if (SelfManage)
|
||||
{
|
||||
if (!IsSelected)
|
||||
{
|
||||
IsSelected = true;
|
||||
OnSelected(new RoutedEventArgs(SelectedEvent, this));
|
||||
}
|
||||
else if (CanDeselect)
|
||||
{
|
||||
IsSelected = false;
|
||||
OnSelected(new RoutedEventArgs(DeselectedEvent, this));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CanDeselect)
|
||||
{
|
||||
OnSelected(IsSelected
|
||||
? new RoutedEventArgs(DeselectedEvent, this)
|
||||
: new RoutedEventArgs(SelectedEvent, this));
|
||||
}
|
||||
else
|
||||
{
|
||||
OnSelected(new RoutedEventArgs(SelectedEvent, this));
|
||||
}
|
||||
}
|
||||
_isMouseLeftButtonDown = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnSelected(RoutedEventArgs e) => RaiseEvent(e);
|
||||
|
||||
public static readonly DependencyProperty IsSelectedProperty = DependencyProperty.Register(
|
||||
"IsSelected", typeof(bool), typeof(SelectableItem), new PropertyMetadata(ValueBoxes.FalseBox));
|
||||
|
||||
@@ -43,6 +70,24 @@ namespace HandyControl.Controls
|
||||
set => SetValue(IsSelectedProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty SelfManageProperty = DependencyProperty.Register(
|
||||
"SelfManage", typeof(bool), typeof(SelectableItem), new PropertyMetadata(ValueBoxes.FalseBox));
|
||||
|
||||
public bool SelfManage
|
||||
{
|
||||
get => (bool)GetValue(SelfManageProperty);
|
||||
set => SetValue(SelfManageProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty CanDeselectProperty = DependencyProperty.Register(
|
||||
"CanDeselect", typeof(bool), typeof(SelectableItem), new PropertyMetadata(ValueBoxes.FalseBox));
|
||||
|
||||
public bool CanDeselect
|
||||
{
|
||||
get => (bool)GetValue(CanDeselectProperty);
|
||||
set => SetValue(CanDeselectProperty, value);
|
||||
}
|
||||
|
||||
public static readonly RoutedEvent SelectedEvent =
|
||||
EventManager.RegisterRoutedEvent("Selected", RoutingStrategy.Bubble,
|
||||
typeof(RoutedEventHandler), typeof(SelectableItem));
|
||||
@@ -52,5 +97,15 @@ namespace HandyControl.Controls
|
||||
add => AddHandler(SelectedEvent, value);
|
||||
remove => RemoveHandler(SelectedEvent, value);
|
||||
}
|
||||
|
||||
public static readonly RoutedEvent DeselectedEvent =
|
||||
EventManager.RegisterRoutedEvent("Deselected", RoutingStrategy.Bubble,
|
||||
typeof(RoutedEventHandler), typeof(SelectableItem));
|
||||
|
||||
public event RoutedEventHandler Deselected
|
||||
{
|
||||
add => AddHandler(DeselectedEvent, value);
|
||||
remove => RemoveHandler(DeselectedEvent, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
@@ -25,25 +26,35 @@ namespace HandyControl.Controls
|
||||
"ItemContainerStyle", typeof(Style), typeof(SimpleItemsControl),
|
||||
new PropertyMetadata(default(Style), OnItemContainerStyleChanged));
|
||||
|
||||
public static readonly DependencyProperty ItemsSourceProperty = DependencyProperty.Register(
|
||||
"ItemsSource", typeof(IEnumerable), typeof(SimpleItemsControl),
|
||||
new PropertyMetadata(default(IEnumerable), OnItemsSourceChanged));
|
||||
|
||||
public SimpleItemsControl()
|
||||
{
|
||||
var items = new ObservableCollection<object>();
|
||||
items.CollectionChanged += OnItemsCollectionChanged;
|
||||
items.CollectionChanged += OnItemsChanged;
|
||||
Items = items;
|
||||
}
|
||||
|
||||
public IEnumerable ItemsSource
|
||||
{
|
||||
get => (IEnumerable)GetValue(ItemsSourceProperty);
|
||||
set => SetValue(ItemsSourceProperty, value);
|
||||
}
|
||||
|
||||
[Bindable(true)]
|
||||
[Category("Content")]
|
||||
public Style ItemContainerStyle
|
||||
{
|
||||
get => (Style) GetValue(ItemContainerStyleProperty);
|
||||
get => (Style)GetValue(ItemContainerStyleProperty);
|
||||
set => SetValue(ItemContainerStyleProperty, value);
|
||||
}
|
||||
|
||||
[Bindable(true)]
|
||||
public DataTemplate ItemTemplate
|
||||
{
|
||||
get => (DataTemplate) GetValue(ItemTemplateProperty);
|
||||
get => (DataTemplate)GetValue(ItemTemplateProperty);
|
||||
set => SetValue(ItemTemplateProperty, value);
|
||||
}
|
||||
|
||||
@@ -53,6 +64,15 @@ namespace HandyControl.Controls
|
||||
|
||||
internal Panel ItemsHost { get; set; }
|
||||
|
||||
private static void OnItemsSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
((SimpleItemsControl)d).OnItemsSourceChanged((IEnumerable)e.OldValue, (IEnumerable)e.NewValue);
|
||||
}
|
||||
|
||||
protected virtual void OnItemsSourceChanged(IEnumerable oldValue, IEnumerable newValue)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnApplyTemplate()
|
||||
{
|
||||
ItemsHost?.Children.Clear();
|
||||
@@ -63,7 +83,7 @@ namespace HandyControl.Controls
|
||||
Refresh();
|
||||
}
|
||||
|
||||
private void OnItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
protected virtual void OnItemsChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
Refresh();
|
||||
UpdateItems();
|
||||
@@ -89,16 +109,14 @@ namespace HandyControl.Controls
|
||||
}
|
||||
|
||||
private static void OnItemTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var target = d as SimpleItemsControl;
|
||||
target?.Refresh();
|
||||
}
|
||||
=> (d as SimpleItemsControl)?.OnItemTemplateChanged(e);
|
||||
|
||||
protected virtual void OnItemTemplateChanged(DependencyPropertyChangedEventArgs e) => Refresh();
|
||||
|
||||
private static void OnItemContainerStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var target = d as SimpleItemsControl;
|
||||
target?.Refresh();
|
||||
}
|
||||
=> (d as SimpleItemsControl)?.OnItemContainerStyleChanged(e);
|
||||
|
||||
protected virtual void OnItemContainerStyleChanged(DependencyPropertyChangedEventArgs e) => Refresh();
|
||||
|
||||
protected virtual void Refresh()
|
||||
{
|
||||
@@ -128,7 +146,6 @@ namespace HandyControl.Controls
|
||||
|
||||
protected virtual void UpdateItems()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using HandyControl.Data;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
public class ProgressButton : ToggleButton
|
||||
{
|
||||
public static readonly DependencyProperty ProgressStyleProperty = DependencyProperty.Register(
|
||||
"ProgressStyle", typeof(Style), typeof(ProgressButton), new PropertyMetadata(default(Style)));
|
||||
|
||||
public Style ProgressStyle
|
||||
{
|
||||
get => (Style) GetValue(ProgressStyleProperty);
|
||||
set => SetValue(ProgressStyleProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ProgressProperty = DependencyProperty.Register(
|
||||
"Progress", typeof(double), typeof(ProgressButton), new PropertyMetadata(ValueBoxes.Double0Box));
|
||||
|
||||
public double Progress
|
||||
{
|
||||
get => (double) GetValue(ProgressProperty);
|
||||
set => SetValue(ProgressProperty, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,305 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Media.Media3D;
|
||||
using HandyControl.Data;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// 封面流
|
||||
/// </summary>
|
||||
[TemplatePart(Name = ElementViewport3D, Type = typeof(Viewport3D))]
|
||||
[TemplatePart(Name = ElementCamera, Type = typeof(ProjectionCamera))]
|
||||
[TemplatePart(Name = ElementVisualParent, Type = typeof(ModelVisual3D))]
|
||||
public class CoverFlow : Control
|
||||
{
|
||||
private const string ElementViewport3D = "PART_Viewport3D";
|
||||
|
||||
private const string ElementCamera = "PART_Camera";
|
||||
|
||||
private const string ElementVisualParent = "PART_VisualParent";
|
||||
|
||||
/// <summary>
|
||||
/// 最大显示数量的一半
|
||||
/// </summary>
|
||||
private const int MaxShowCountHalf = 7;
|
||||
|
||||
/// <summary>
|
||||
/// 页码
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty PageIndexProperty = DependencyProperty.Register(
|
||||
"PageIndex", typeof(int), typeof(CoverFlow),
|
||||
new PropertyMetadata(ValueBoxes.Int0Box, OnPageIndexChanged, CoercePageIndex));
|
||||
|
||||
private static object CoercePageIndex(DependencyObject d, object baseValue)
|
||||
{
|
||||
var ctl = (CoverFlow)d;
|
||||
var v = (int)baseValue;
|
||||
|
||||
if (v < 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (v >= ctl._uriList.Count)
|
||||
{
|
||||
return ctl._uriList.Count - 1;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
private static void OnPageIndexChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var ctl = (CoverFlow)d;
|
||||
ctl.UpdateIndex((int)e.NewValue, (int)e.OldValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否循环
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty LoopProperty = DependencyProperty.Register(
|
||||
"Loop", typeof(bool), typeof(CoverFlow), new PropertyMetadata(ValueBoxes.FalseBox));
|
||||
|
||||
/// <summary>
|
||||
/// 存储所有的资源标识符
|
||||
/// </summary>
|
||||
private readonly Dictionary<int, Uri> _uriList = new Dictionary<int, Uri>();
|
||||
|
||||
/// <summary>
|
||||
/// 当前在显示范围内的项
|
||||
/// </summary>
|
||||
private readonly Dictionary<int, CoverFlowItem> _itemShowList = new Dictionary<int, CoverFlowItem>();
|
||||
|
||||
/// <summary>
|
||||
/// 相机
|
||||
/// </summary>
|
||||
private ProjectionCamera _camera;
|
||||
|
||||
/// <summary>
|
||||
/// 3d画布
|
||||
/// </summary>
|
||||
private Viewport3D _viewport3D;
|
||||
|
||||
/// <summary>
|
||||
/// 项容器
|
||||
/// </summary>
|
||||
private ModelVisual3D _visualParent;
|
||||
|
||||
/// <summary>
|
||||
/// 显示范围内第一个项的编号
|
||||
/// </summary>
|
||||
private int _firstShowIndex;
|
||||
|
||||
/// <summary>
|
||||
/// 显示范围内最后一个项的编号
|
||||
/// </summary>
|
||||
private int _lastShowIndex;
|
||||
|
||||
/// <summary>
|
||||
/// 跳转编号
|
||||
/// </summary>
|
||||
private int _jumpToIndex = -1;
|
||||
|
||||
/// <summary>
|
||||
/// 页码
|
||||
/// </summary>
|
||||
public int PageIndex
|
||||
{
|
||||
get => (int)GetValue(PageIndexProperty);
|
||||
internal set => SetValue(PageIndexProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否循环
|
||||
/// </summary>
|
||||
public bool Loop
|
||||
{
|
||||
get => (bool)GetValue(LoopProperty);
|
||||
set => SetValue(LoopProperty, value);
|
||||
}
|
||||
|
||||
public override void OnApplyTemplate()
|
||||
{
|
||||
if (_viewport3D != null)
|
||||
{
|
||||
_viewport3D.Children.Clear();
|
||||
_itemShowList.Clear();
|
||||
_viewport3D.MouseLeftButtonDown -= Viewport3D_MouseLeftButtonDown;
|
||||
}
|
||||
|
||||
base.OnApplyTemplate();
|
||||
|
||||
_viewport3D = GetTemplateChild(ElementViewport3D) as Viewport3D;
|
||||
if (_viewport3D != null)
|
||||
{
|
||||
_viewport3D.MouseLeftButtonDown += Viewport3D_MouseLeftButtonDown;
|
||||
}
|
||||
|
||||
_camera = GetTemplateChild(ElementCamera) as ProjectionCamera;
|
||||
_visualParent = GetTemplateChild(ElementVisualParent) as ModelVisual3D;
|
||||
|
||||
UpdateShowRange();
|
||||
if (_jumpToIndex > 0)
|
||||
{
|
||||
PageIndex = _jumpToIndex;
|
||||
_jumpToIndex = -1;
|
||||
}
|
||||
_camera.Position = new Point3D(CoverFlowItem.Interval * PageIndex, _camera.Position.Y, _camera.Position.Z);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量添加资源
|
||||
/// </summary>
|
||||
/// <param name="uriList"></param>
|
||||
public void AddRange(List<Uri> uriList)
|
||||
{
|
||||
foreach (var uri in uriList)
|
||||
{
|
||||
_uriList.Add(_uriList.Count, uri);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加一项资源
|
||||
/// </summary>
|
||||
/// <param name="uriString"></param>
|
||||
public void Add(string uriString) => _uriList.Add(_uriList.Count, new Uri(uriString));
|
||||
|
||||
/// <summary>
|
||||
/// 添加一项资源
|
||||
/// </summary>
|
||||
/// <param name="uri"></param>
|
||||
public void Add(Uri uri) => _uriList.Add(_uriList.Count, uri);
|
||||
|
||||
/// <summary>
|
||||
/// 跳转
|
||||
/// </summary>
|
||||
public void JumpTo(int index) => _jumpToIndex = index;
|
||||
|
||||
protected override void OnMouseWheel(MouseWheelEventArgs e)
|
||||
{
|
||||
base.OnMouseWheel(e);
|
||||
|
||||
if (e.Delta < 0)
|
||||
{
|
||||
var index = PageIndex + 1;
|
||||
PageIndex = index >= _uriList.Count ? (Loop ? 0 : _uriList.Count - 1) : index;
|
||||
}
|
||||
else
|
||||
{
|
||||
var index = PageIndex - 1;
|
||||
PageIndex = index < 0 ? (Loop ? _uriList.Count - 1 : 0) : index;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除指定位置的项
|
||||
/// </summary>
|
||||
/// <param name="pos"></param>
|
||||
private void Remove(int pos)
|
||||
{
|
||||
var item = _itemShowList[pos];
|
||||
_visualParent.Children.Remove(item);
|
||||
_itemShowList.Remove(pos);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移动项到指定的位置
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="animated"></param>
|
||||
private void Move(int index, bool animated) => _itemShowList[index].Move(PageIndex, animated);
|
||||
|
||||
private void Viewport3D_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
var result = (RayMeshGeometry3DHitTestResult)VisualTreeHelper.HitTest(_viewport3D, e.GetPosition(_viewport3D));
|
||||
if (result != null)
|
||||
{
|
||||
foreach (var item in _itemShowList.Values)
|
||||
{
|
||||
if (item.HitTest(result.MeshHit))
|
||||
{
|
||||
PageIndex = item.Index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新项的位置
|
||||
/// </summary>
|
||||
/// <param name="newIndex"></param>
|
||||
/// <param name="oldIndex"></param>
|
||||
private void UpdateIndex(int newIndex, int oldIndex)
|
||||
{
|
||||
var animate = Math.Abs(newIndex - oldIndex) < MaxShowCountHalf;
|
||||
UpdateShowRange();
|
||||
if (newIndex > oldIndex)
|
||||
{
|
||||
if (oldIndex < _firstShowIndex)
|
||||
{
|
||||
oldIndex = _firstShowIndex;
|
||||
}
|
||||
for (var i = oldIndex; i <= newIndex; i++)
|
||||
{
|
||||
Move(i, animate);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (oldIndex > _lastShowIndex)
|
||||
{
|
||||
oldIndex = _lastShowIndex;
|
||||
}
|
||||
for (var i = oldIndex; i >= newIndex; i--)
|
||||
{
|
||||
Move(i, animate);
|
||||
}
|
||||
}
|
||||
_camera.Position = new Point3D(CoverFlowItem.Interval * newIndex, _camera.Position.Y,
|
||||
_camera.Position.Z);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新显示范围
|
||||
/// </summary>
|
||||
private void UpdateShowRange()
|
||||
{
|
||||
var newFirstShowIndex = Math.Max(PageIndex - MaxShowCountHalf, 0);
|
||||
var newLastShowIndex = Math.Min(PageIndex + MaxShowCountHalf, _uriList.Count - 1);
|
||||
|
||||
if (_firstShowIndex < newFirstShowIndex)
|
||||
{
|
||||
for (var i = _firstShowIndex; i < newFirstShowIndex; i++)
|
||||
{
|
||||
Remove(i);
|
||||
}
|
||||
}
|
||||
else if (newLastShowIndex < _lastShowIndex)
|
||||
{
|
||||
for (var i = newLastShowIndex; i < _lastShowIndex; i++)
|
||||
{
|
||||
Remove(i);
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = newFirstShowIndex; i <= newLastShowIndex; i++)
|
||||
{
|
||||
if (!_itemShowList.ContainsKey(i))
|
||||
{
|
||||
var cover = new CoverFlowItem(i, PageIndex, BitmapFrame.Create(_uriList[i]));
|
||||
_itemShowList[i] = cover;
|
||||
_visualParent.Children.Add(cover);
|
||||
}
|
||||
}
|
||||
|
||||
_firstShowIndex = newFirstShowIndex;
|
||||
_lastShowIndex = newLastShowIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Media3D;
|
||||
using HandyControl.Tools;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
public class CoverFlowItem : ModelVisual3D
|
||||
{
|
||||
internal static readonly double Interval = .2;
|
||||
|
||||
internal static readonly double AnimationSpeed = 400;
|
||||
|
||||
private readonly AxisAngleRotation3D _rotation3D;
|
||||
|
||||
private readonly TranslateTransform3D _transform3D;
|
||||
|
||||
private readonly Model3DGroup _model3DGroup;
|
||||
|
||||
private readonly ImageSource _source;
|
||||
|
||||
internal int Index { get; set; }
|
||||
|
||||
public CoverFlowItem(int itemIndex, int currentIndex, ImageSource source)
|
||||
{
|
||||
Index = itemIndex;
|
||||
_source = source;
|
||||
|
||||
_rotation3D = new AxisAngleRotation3D(new Vector3D(0, 1, 0), GetAngleByPos(currentIndex));
|
||||
_transform3D = new TranslateTransform3D(GetXByPos(currentIndex), 0, GetZByPos(currentIndex));
|
||||
|
||||
var transformGroup = new Transform3DGroup();
|
||||
transformGroup.Children.Add(new RotateTransform3D(_rotation3D));
|
||||
transformGroup.Children.Add(_transform3D);
|
||||
|
||||
_model3DGroup = new Model3DGroup();
|
||||
_model3DGroup.Children.Add(new GeometryModel3D(CreateItemGeometry(), new DiffuseMaterial(new ImageBrush(_source))));
|
||||
_model3DGroup.Transform = transformGroup;
|
||||
|
||||
Content = _model3DGroup;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建网格形状
|
||||
/// </summary>
|
||||
/// <param name="p0"></param>
|
||||
/// <param name="p1"></param>
|
||||
/// <param name="p2"></param>
|
||||
/// <param name="p3"></param>
|
||||
/// <returns></returns>
|
||||
private static MeshGeometry3D CreateMeshGeometry(Point3D p0, Point3D p1, Point3D p2, Point3D p3)
|
||||
{
|
||||
var positions = new Point3DCollection
|
||||
{
|
||||
p0,
|
||||
p1,
|
||||
p2,
|
||||
p3
|
||||
};
|
||||
|
||||
var triangleIndices = new Int32Collection
|
||||
{
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
3,
|
||||
0
|
||||
};
|
||||
|
||||
var textureCoordinates = new PointCollection
|
||||
{
|
||||
new Point(0, 1),
|
||||
new Point(1, 1),
|
||||
new Point(1, 0),
|
||||
new Point(0, 0),
|
||||
new Point(1, 0),
|
||||
new Point(1, 1)
|
||||
};
|
||||
|
||||
var normals = new Vector3DCollection
|
||||
{
|
||||
ArithmeticHelper.CalNormal(p0, p1, p2),
|
||||
ArithmeticHelper.CalNormal(p2, p3, p0)
|
||||
};
|
||||
|
||||
var geometry3D = new MeshGeometry3D
|
||||
{
|
||||
Positions = positions,
|
||||
TriangleIndices = triangleIndices,
|
||||
TextureCoordinates = textureCoordinates,
|
||||
Normals = normals
|
||||
};
|
||||
|
||||
geometry3D.Freeze();
|
||||
return geometry3D;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建内容形状
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private Geometry3D CreateItemGeometry()
|
||||
{
|
||||
var sx = _source.Width > _source.Height ? 0 : 1 - _source.Width / _source.Height;
|
||||
var sy = _source.Width < _source.Height ? 0 : 1 - _source.Height / _source.Width;
|
||||
|
||||
var p0 = new Point3D(-1 + sx, -1 + sy, 0);
|
||||
var p1 = new Point3D(1 - sx, -1 + sy, 0);
|
||||
var p2 = new Point3D(1 - sx, 1 - sy, 0);
|
||||
var p3 = new Point3D(-1 + sx, 1 - sy, 0);
|
||||
|
||||
return CreateMeshGeometry(p0, p1, p2, p3);
|
||||
}
|
||||
|
||||
private double GetAngleByPos(int index) => Math.Sign(Index - index) * -90;
|
||||
|
||||
private double GetXByPos(int index) => Index * Interval + Math.Sign(Index - index) * 1.5;
|
||||
|
||||
private double GetZByPos(int index) => Index == index ? 1 : 0;
|
||||
|
||||
/// <summary>
|
||||
/// 移动
|
||||
/// </summary>
|
||||
internal void Move(int currentIndex, bool animated)
|
||||
{
|
||||
if (animated || _rotation3D.HasAnimatedProperties)
|
||||
{
|
||||
_rotation3D.BeginAnimation(AxisAngleRotation3D.AngleProperty,
|
||||
AnimationHelper.CreateAnimation(GetAngleByPos(currentIndex), AnimationSpeed));
|
||||
_transform3D.BeginAnimation(TranslateTransform3D.OffsetXProperty,
|
||||
AnimationHelper.CreateAnimation(GetXByPos(currentIndex), AnimationSpeed));
|
||||
_transform3D.BeginAnimation(TranslateTransform3D.OffsetZProperty,
|
||||
AnimationHelper.CreateAnimation(GetZByPos(currentIndex), AnimationSpeed));
|
||||
}
|
||||
else
|
||||
{
|
||||
_rotation3D.Angle = GetAngleByPos(currentIndex);
|
||||
_transform3D.OffsetX = GetXByPos(currentIndex);
|
||||
_transform3D.OffsetZ = GetZByPos(currentIndex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 命中测试
|
||||
/// </summary>
|
||||
/// <param name="mesh"></param>
|
||||
/// <returns></returns>
|
||||
internal bool HitTest(MeshGeometry3D mesh)
|
||||
{
|
||||
foreach (var item in _model3DGroup.Children)
|
||||
{
|
||||
if (item is GeometryModel3D geometryModel3D)
|
||||
{
|
||||
if (Equals(geometryModel3D.Geometry, mesh))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using HandyControl.Data;
|
||||
using HandyControl.Tools;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
public class CoverView : RegularItemsControl
|
||||
{
|
||||
private readonly CoverViewContent _viewContent;
|
||||
|
||||
private CoverViewItem _selectedItem;
|
||||
|
||||
public CoverView()
|
||||
{
|
||||
_viewContent = new CoverViewContent();
|
||||
|
||||
AddHandler(SelectableItem.SelectedEvent, new RoutedEventHandler(CoverViewItem_OnSelected));
|
||||
_viewContent.SetBinding(CoverViewContent.ContentHeightProperty, new Binding(ItemContentHeightProperty.Name) { Source = this });
|
||||
_viewContent.SetBinding(WidthProperty, new Binding(ActualWidthProperty.Name) { Source = this });
|
||||
}
|
||||
|
||||
private void CoverViewItem_OnSelected(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (e.OriginalSource is CoverViewItem item)
|
||||
{
|
||||
if (_selectedItem == null)
|
||||
{
|
||||
item.IsSelected = true;
|
||||
_selectedItem = item;
|
||||
if (_viewContent != null)
|
||||
{
|
||||
_viewContent.Content = item.Content;
|
||||
UpdateCoverViewContent(true);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Equals(_selectedItem, item))
|
||||
{
|
||||
_selectedItem.IsSelected = false;
|
||||
item.IsSelected = true;
|
||||
_selectedItem = item;
|
||||
if (_viewContent != null)
|
||||
{
|
||||
_viewContent.Content = item.Content;
|
||||
UpdateCoverViewContent(true);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (_viewContent != null)
|
||||
{
|
||||
_viewContent.Content = null;
|
||||
UpdateCoverViewContent(false);
|
||||
}
|
||||
_selectedItem.IsSelected = false;
|
||||
_selectedItem = null;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnApplyTemplate()
|
||||
{
|
||||
base.OnApplyTemplate();
|
||||
|
||||
if (_viewContent.Style == null)
|
||||
{
|
||||
_viewContent.Style = CoverViewContentStyle;
|
||||
}
|
||||
|
||||
if (_selectedItem != null)
|
||||
{
|
||||
UpdateCoverViewContent(_selectedItem != null);
|
||||
}
|
||||
}
|
||||
|
||||
protected override DependencyObject GetContainerForItemOverride() => new CoverViewItem();
|
||||
|
||||
protected override bool IsItemItsOwnContainerOverride(object item) => item is CoverViewItem;
|
||||
|
||||
public static readonly DependencyProperty CoverViewContentStyleProperty = DependencyProperty.Register(
|
||||
"CoverViewContentStyle", typeof(Style), typeof(CoverView), new PropertyMetadata(default(Style)));
|
||||
|
||||
public Style CoverViewContentStyle
|
||||
{
|
||||
get => (Style)GetValue(CoverViewContentStyleProperty);
|
||||
set => SetValue(CoverViewContentStyleProperty, value);
|
||||
}
|
||||
|
||||
internal static readonly DependencyProperty GroupsProperty = DependencyProperty.Register(
|
||||
"Groups", typeof(int), typeof(CoverView),
|
||||
new FrameworkPropertyMetadata(ValueBoxes.Int5Box, FrameworkPropertyMetadataOptions.AffectsMeasure,
|
||||
OnGroupsChanged), IsGroupsValid);
|
||||
|
||||
internal static void OnGroupsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is CoverView ctl)
|
||||
{
|
||||
ctl.UpdateCoverViewContent(ctl._viewContent.IsOpen);
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsGroupsValid(object value)
|
||||
{
|
||||
var v = (int)value;
|
||||
return v >= 1;
|
||||
}
|
||||
|
||||
public int Groups
|
||||
{
|
||||
get => (int)GetValue(GroupsProperty);
|
||||
set => SetValue(GroupsProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ItemContentHeightProperty = DependencyProperty.Register(
|
||||
"ItemContentHeight", typeof(double), typeof(CoverView), new PropertyMetadata(ValueBoxes.Double300Box),
|
||||
value => ValidateHelper.IsInRangeOfPosDouble(value, true));
|
||||
|
||||
public double ItemContentHeight
|
||||
{
|
||||
get => (double)GetValue(ItemContentHeightProperty);
|
||||
set => SetValue(ItemContentHeightProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ItemContentHeightFixedProperty = DependencyProperty.Register(
|
||||
"ItemContentHeightFixed", typeof(bool), typeof(CoverView), new PropertyMetadata(ValueBoxes.TrueBox));
|
||||
|
||||
public bool ItemContentHeightFixed
|
||||
{
|
||||
get => (bool)GetValue(ItemContentHeightFixedProperty);
|
||||
set => SetValue(ItemContentHeightFixedProperty, value);
|
||||
}
|
||||
|
||||
protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
|
||||
{
|
||||
base.OnRenderSizeChanged(sizeInfo);
|
||||
|
||||
Groups = (int)(sizeInfo.NewSize.Width / (ItemWidth + ItemMargin.Left + ItemMargin.Right));
|
||||
}
|
||||
|
||||
protected override void Refresh()
|
||||
{
|
||||
if (ItemsHost == null) return;
|
||||
|
||||
ItemsHost.Children.Clear();
|
||||
var index = 0;
|
||||
foreach (var item in Items)
|
||||
{
|
||||
DependencyObject container;
|
||||
if (IsItemItsOwnContainerOverride(item))
|
||||
{
|
||||
container = item as DependencyObject;
|
||||
}
|
||||
else
|
||||
{
|
||||
container = GetContainerForItemOverride();
|
||||
PrepareContainerForItemOverride(container, item);
|
||||
}
|
||||
|
||||
if (container is CoverViewItem element)
|
||||
{
|
||||
element.Index = index++;
|
||||
element.Style = ItemContainerStyle;
|
||||
ItemsHost.Children.Add(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新内容视图
|
||||
/// </summary>
|
||||
private void UpdateCoverViewContent(bool isOpen)
|
||||
{
|
||||
if (_selectedItem == null) return;
|
||||
|
||||
ItemsHost.Children.Remove(_viewContent);
|
||||
|
||||
if (!ItemContentHeightFixed)
|
||||
{
|
||||
_viewContent.ManualHeight = 0;
|
||||
if (_viewContent.Content is FrameworkElement element)
|
||||
{
|
||||
element.Arrange(new Rect(new Size(double.MaxValue, double.MaxValue)));
|
||||
_viewContent.ManualHeight = element.ActualHeight;
|
||||
}
|
||||
}
|
||||
|
||||
var total = Items.Count + 1;
|
||||
var totalRow = total / Groups + (total % Groups > 0 ? 1 : 0);
|
||||
if (total <= Groups)
|
||||
{
|
||||
ItemsHost.Children.Add(_viewContent);
|
||||
}
|
||||
else
|
||||
{
|
||||
var row = _selectedItem.Index / Groups + 1;
|
||||
if (row == totalRow)
|
||||
{
|
||||
ItemsHost.Children.Add(_viewContent);
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemsHost.Children.Insert(row * Groups, _viewContent);
|
||||
}
|
||||
}
|
||||
|
||||
_viewContent.UpdatePosition(_selectedItem.Index, Groups, _selectedItem.DesiredSize.Width);
|
||||
if (_viewContent.CanSwitch)
|
||||
{
|
||||
_viewContent.IsOpen = isOpen;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using HandyControl.Data;
|
||||
using HandyControl.Expression.Drawing;
|
||||
using HandyControl.Tools;
|
||||
using HandyControl.Tools.Extension;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
[TemplatePart(Name = ElementTriangle, Type = typeof(FrameworkElement))]
|
||||
[TemplatePart(Name = ElementContent, Type = typeof(FrameworkElement))]
|
||||
internal class CoverViewContent : ContentControl
|
||||
{
|
||||
private const string ElementTriangle = "PART_Triangle";
|
||||
|
||||
private const string ElementContent = "PART_Content";
|
||||
|
||||
private FrameworkElement _triangle;
|
||||
|
||||
private FrameworkElement _content;
|
||||
|
||||
internal bool WaitForUpdate { get; set; }
|
||||
|
||||
private int _index;
|
||||
|
||||
private int _groups;
|
||||
|
||||
private double _itemWidth;
|
||||
|
||||
internal bool CanSwitch { get; set; } = true;
|
||||
|
||||
private bool _isOpen;
|
||||
|
||||
internal bool IsOpen
|
||||
{
|
||||
get => _isOpen;
|
||||
set
|
||||
{
|
||||
if (_isOpen == value) return;
|
||||
_isOpen = value;
|
||||
OpenSwitch(value);
|
||||
}
|
||||
}
|
||||
|
||||
internal static readonly DependencyProperty ManualHeightProperty = DependencyProperty.Register(
|
||||
"ManualHeight", typeof(double), typeof(CoverViewContent), new PropertyMetadata(default(double)), value => ValidateHelper.IsInRangeOfPosDouble(value, true));
|
||||
|
||||
internal double ManualHeight
|
||||
{
|
||||
get => (double)GetValue(ManualHeightProperty);
|
||||
set => SetValue(ManualHeightProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ContentHeightProperty = DependencyProperty.Register(
|
||||
"ContentHeight", typeof(double), typeof(CoverViewContent), new PropertyMetadata(ValueBoxes.Double300Box),
|
||||
value => ValidateHelper.IsInRangeOfPosDouble(value, true));
|
||||
|
||||
public double ContentHeight
|
||||
{
|
||||
get => (double)GetValue(ContentHeightProperty);
|
||||
set => SetValue(ContentHeightProperty, value);
|
||||
}
|
||||
|
||||
public override void OnApplyTemplate()
|
||||
{
|
||||
base.OnApplyTemplate();
|
||||
|
||||
_triangle = GetTemplateChild(ElementTriangle) as FrameworkElement;
|
||||
_content = GetTemplateChild(ElementContent) as FrameworkElement;
|
||||
|
||||
if (WaitForUpdate)
|
||||
{
|
||||
_triangle.BeginAnimation(MarginProperty, AnimationHelper.CreateAnimation(new Thickness((_index % _groups + .5) * _itemWidth - _triangle.Width / 2, 0, 0, 0)));
|
||||
OpenSwitch(_isOpen);
|
||||
WaitForUpdate = false;
|
||||
}
|
||||
}
|
||||
|
||||
internal void UpdatePosition(int index, int groups, double itemWidth)
|
||||
{
|
||||
if (_triangle == null)
|
||||
{
|
||||
_index = index;
|
||||
_groups = groups;
|
||||
_itemWidth = itemWidth;
|
||||
WaitForUpdate = true;
|
||||
return;
|
||||
}
|
||||
_triangle.BeginAnimation(MarginProperty, AnimationHelper.CreateAnimation(new Thickness((index % groups + .5) * itemWidth - _triangle.Width / 2, 0, 0, 0)));
|
||||
if (IsOpen)
|
||||
{
|
||||
if (ManualHeight > 0 && !MathHelper.AreClose(ManualHeight, ContentHeight))
|
||||
{
|
||||
_content.BeginAnimation(HeightProperty, AnimationHelper.CreateAnimation(ManualHeight));
|
||||
}
|
||||
else
|
||||
{
|
||||
_content.BeginAnimation(HeightProperty, AnimationHelper.CreateAnimation(ContentHeight));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OpenSwitch(bool isOpen)
|
||||
{
|
||||
if (_content == null) return;
|
||||
var animation = AnimationHelper.CreateAnimation(isOpen ? ManualHeight > 0 ? ManualHeight : ContentHeight : 0);
|
||||
_triangle.Show(false);
|
||||
this.Show(true);
|
||||
animation.Completed += (s, e) =>
|
||||
{
|
||||
CanSwitch = true;
|
||||
this.Show(IsOpen);
|
||||
if (IsOpen)
|
||||
{
|
||||
_triangle.Show(true);
|
||||
}
|
||||
};
|
||||
CanSwitch = false;
|
||||
_content.BeginAnimation(HeightProperty, animation);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
public class CoverViewItem : HeaderedSelectableItem
|
||||
{
|
||||
internal int Index { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,7 @@ namespace HandyControl.Controls
|
||||
if (_textBox != null)
|
||||
{
|
||||
_textBox.TextChanged -= TextBox_TextChanged;
|
||||
_textBox.KeyDown -= TextBox_KeyDown;
|
||||
}
|
||||
|
||||
base.OnApplyTemplate();
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using HandyControl.Data;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
public class ChatBubble : SelectableItem
|
||||
{
|
||||
public static readonly DependencyProperty RoleProperty = DependencyProperty.Register(
|
||||
"Role", typeof(ChatRoleType), typeof(ChatBubble), new PropertyMetadata(default(ChatRoleType)));
|
||||
|
||||
public ChatRoleType Role
|
||||
{
|
||||
get => (ChatRoleType)GetValue(RoleProperty);
|
||||
set => SetValue(RoleProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty TypeProperty = DependencyProperty.Register(
|
||||
"Type", typeof(ChatMessageType), typeof(ChatBubble), new PropertyMetadata(default(ChatMessageType)));
|
||||
|
||||
public ChatMessageType Type
|
||||
{
|
||||
get => (ChatMessageType)GetValue(TypeProperty);
|
||||
set => SetValue(TypeProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty IsReadProperty = DependencyProperty.Register(
|
||||
"IsRead", typeof(bool), typeof(ChatBubble), new PropertyMetadata(ValueBoxes.FalseBox));
|
||||
|
||||
public bool IsRead
|
||||
{
|
||||
get => (bool)GetValue(IsReadProperty);
|
||||
set => SetValue(IsReadProperty, value);
|
||||
}
|
||||
|
||||
public static void SetMaxWidth(DependencyObject element, double value)
|
||||
=> element.SetValue(MaxWidthProperty, value);
|
||||
|
||||
public static double GetMaxWidth(DependencyObject element)
|
||||
=> (double)element.GetValue(MaxWidthProperty);
|
||||
|
||||
public Action<object> ReadAction { get; set; }
|
||||
|
||||
protected override void OnSelected(RoutedEventArgs e)
|
||||
{
|
||||
base.OnSelected(e);
|
||||
|
||||
IsRead = true;
|
||||
ReadAction?.Invoke(Content);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using HandyControl.Interactivity;
|
||||
using HandyControl.Tools.Extension;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// 穿梭框
|
||||
/// </summary>
|
||||
[TemplatePart(Name = ElementItemsOrigin, Type = typeof(SimpleItemsControl))]
|
||||
[TemplatePart(Name = ElementItemsSelected, Type = typeof(SimpleItemsControl))]
|
||||
public class Transfer : SimpleItemsControl
|
||||
{
|
||||
private const string ElementItemsOrigin = "PART_ItemsOrigin";
|
||||
|
||||
private const string ElementItemsSelected = "PART_ItemsSelected";
|
||||
|
||||
private readonly Dictionary<object, TransferEntry> _entryDic = new Dictionary<object, TransferEntry>();
|
||||
|
||||
private SimpleItemsControl _itemsOrigin;
|
||||
|
||||
private SimpleItemsControl _itemsSelected;
|
||||
|
||||
private IEnumerable _itemsSourceInternal;
|
||||
|
||||
public static readonly RoutedEvent SelectionChangedEvent =
|
||||
EventManager.RegisterRoutedEvent("SelectionChanged", RoutingStrategy.Bubble,
|
||||
typeof(SelectionChangedEventHandler), typeof(Transfer));
|
||||
|
||||
public event SelectionChangedEventHandler SelectionChanged
|
||||
{
|
||||
add => AddHandler(SelectionChangedEvent, value);
|
||||
remove => RemoveHandler(SelectionChangedEvent, value);
|
||||
}
|
||||
|
||||
private static readonly DependencyPropertyKey SelectedItemsPropertyKey =
|
||||
DependencyProperty.RegisterReadOnly(
|
||||
"SelectedItems",
|
||||
typeof(IList),
|
||||
typeof(Transfer),
|
||||
new FrameworkPropertyMetadata(default(IList)));
|
||||
|
||||
public static readonly DependencyProperty SelectedItemsProperty = SelectedItemsPropertyKey.DependencyProperty;
|
||||
|
||||
public IList SelectedItems
|
||||
{
|
||||
get => (IList)GetValue(SelectedItemsProperty);
|
||||
set => SetValue(SelectedItemsProperty, value);
|
||||
}
|
||||
|
||||
public Transfer()
|
||||
{
|
||||
CommandBindings.Add(new CommandBinding(ControlCommands.Selected, SelectItems));
|
||||
CommandBindings.Add(new CommandBinding(ControlCommands.Cancel, DeselectItems));
|
||||
|
||||
SetValue(SelectedItemsPropertyKey, new ObservableCollection<object>());
|
||||
}
|
||||
|
||||
public override void OnApplyTemplate()
|
||||
{
|
||||
_itemsOrigin?.ItemsHost.Children.Clear();
|
||||
_itemsSelected?.ItemsHost.Children.Clear();
|
||||
|
||||
_itemsOrigin = GetTemplateChild(ElementItemsOrigin) as SimpleItemsControl;
|
||||
_itemsSelected = GetTemplateChild(ElementItemsSelected) as SimpleItemsControl;
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
private void AddItem(object item)
|
||||
{
|
||||
var origin = new TransferItem
|
||||
{
|
||||
Content = item
|
||||
};
|
||||
var selected = new TransferItem
|
||||
{
|
||||
Content = item,
|
||||
IsOrigin = false
|
||||
};
|
||||
var entry = new TransferEntry
|
||||
{
|
||||
OriginItem = origin,
|
||||
SelectedItem = selected
|
||||
};
|
||||
_entryDic.Add(item, entry);
|
||||
_itemsOrigin.Items.Add(origin);
|
||||
_itemsSelected.Items.Add(selected);
|
||||
}
|
||||
|
||||
private void RemoveItem(object item)
|
||||
{
|
||||
if (_entryDic.TryGetValue(item, out var entry))
|
||||
{
|
||||
_itemsOrigin.Items.Remove(entry.OriginItem);
|
||||
_itemsSelected.Items.Remove(entry.SelectedItem);
|
||||
_entryDic.Remove(item);
|
||||
}
|
||||
}
|
||||
|
||||
private void ClearItems()
|
||||
{
|
||||
_entryDic.Clear();
|
||||
_itemsOrigin.Items.Clear();
|
||||
_itemsSelected.Items.Clear();
|
||||
}
|
||||
|
||||
protected override void OnItemsSourceChanged(IEnumerable oldValue, IEnumerable newValue)
|
||||
{
|
||||
if (_itemsSourceInternal != null)
|
||||
{
|
||||
if (_itemsSourceInternal is INotifyCollectionChanged s)
|
||||
{
|
||||
s.CollectionChanged -= InternalCollectionChanged;
|
||||
}
|
||||
|
||||
ClearItems();
|
||||
}
|
||||
_itemsSourceInternal = newValue;
|
||||
if (_itemsSourceInternal != null)
|
||||
{
|
||||
if (_itemsSourceInternal is INotifyCollectionChanged s)
|
||||
{
|
||||
s.CollectionChanged += InternalCollectionChanged;
|
||||
}
|
||||
foreach (var item in _itemsSourceInternal)
|
||||
{
|
||||
AddItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void InternalCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
if (e.OldItems != null)
|
||||
{
|
||||
foreach (var item in e.OldItems)
|
||||
{
|
||||
RemoveItem(item);
|
||||
}
|
||||
}
|
||||
if (e.NewItems != null)
|
||||
{
|
||||
foreach (var item in e.NewItems)
|
||||
{
|
||||
AddItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override DependencyObject GetContainerForItemOverride() => new TransferItem();
|
||||
|
||||
protected override bool IsItemItsOwnContainerOverride(object item) => item is TransferItem;
|
||||
|
||||
private void SelectItems(object sender, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
var list = _entryDic.Where(item => item.Value.OriginItem.IsSelected).ToList();
|
||||
list.Do(item => item.Value.StatusSwitch(true)).Do(item => SelectedItems.Add(item.Key));
|
||||
RaiseEvent(new SelectionChangedEventArgs(SelectionChangedEvent, new List<object>(), list));
|
||||
}
|
||||
|
||||
private void DeselectItems(object sender, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
var list = _entryDic.Where(item => item.Value.SelectedItem.IsSelected).ToList();
|
||||
list.Do(item => item.Value.StatusSwitch(false)).Do(item => SelectedItems.Remove(item.Key));
|
||||
RaiseEvent(new SelectionChangedEventArgs(SelectionChangedEvent, list, new List<object>()));
|
||||
}
|
||||
|
||||
protected override void OnItemsChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void OnItemTemplateChanged(DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void OnItemContainerStyleChanged(DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void Refresh()
|
||||
{
|
||||
if (_entryDic.Count > 0)
|
||||
{
|
||||
_entryDic.Select(item => item.Value.OriginItem).Do(item => _itemsOrigin.Items.Add(item));
|
||||
_entryDic.Select(item => item.Value.SelectedItem).Do(item => _itemsSelected.Items.Add(item));
|
||||
}
|
||||
}
|
||||
|
||||
private struct TransferEntry
|
||||
{
|
||||
public TransferItem OriginItem { get; set; }
|
||||
|
||||
public TransferItem SelectedItem { get; set; }
|
||||
|
||||
public void StatusSwitch(bool isTransferred)
|
||||
{
|
||||
if (isTransferred)
|
||||
{
|
||||
OriginItem.IsTransferred = true;
|
||||
SelectedItem.IsTransferred = true;
|
||||
OriginItem.IsSelected = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
OriginItem.IsTransferred = false;
|
||||
SelectedItem.IsTransferred = false;
|
||||
SelectedItem.IsSelected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using System.Collections.Specialized;
|
||||
using System.Windows;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
public class TransferGroup : SimpleItemsControl
|
||||
{
|
||||
protected override void Refresh()
|
||||
{
|
||||
if (Items.Count > 0)
|
||||
{
|
||||
foreach (FrameworkElement item in Items)
|
||||
{
|
||||
item.Style = ItemContainerStyle;
|
||||
ItemsHost.Children.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnItemTemplateChanged(DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void OnItemContainerStyleChanged(DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override DependencyObject GetContainerForItemOverride() => new TransferItem();
|
||||
|
||||
protected override bool IsItemItsOwnContainerOverride(object item) => item is TransferItem;
|
||||
|
||||
protected override void OnItemsChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
if (ItemsHost == null) return;
|
||||
if (e.OldItems != null)
|
||||
{
|
||||
foreach (FrameworkElement item in e.OldItems)
|
||||
{
|
||||
ItemsHost.Children.Remove(item);
|
||||
}
|
||||
}
|
||||
if (e.NewItems != null)
|
||||
{
|
||||
foreach (FrameworkElement item in e.NewItems)
|
||||
{
|
||||
item.Style = ItemContainerStyle;
|
||||
ItemsHost.Children.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System.Windows;
|
||||
using HandyControl.Data;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
public class TransferItem : SelectableItem
|
||||
{
|
||||
public static readonly DependencyProperty IsTransferredProperty = DependencyProperty.Register(
|
||||
"IsTransferred", typeof(bool), typeof(TransferItem), new PropertyMetadata(ValueBoxes.FalseBox));
|
||||
|
||||
public bool IsTransferred
|
||||
{
|
||||
get => (bool)GetValue(IsTransferredProperty);
|
||||
set => SetValue(IsTransferredProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty IsOriginProperty = DependencyProperty.Register(
|
||||
"IsOrigin", typeof(bool), typeof(TransferItem), new PropertyMetadata(ValueBoxes.TrueBox));
|
||||
|
||||
public bool IsOrigin
|
||||
{
|
||||
get => (bool)GetValue(IsOriginProperty);
|
||||
internal set => SetValue(IsOriginProperty, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
@@ -28,7 +27,7 @@ namespace HandyControl.Controls
|
||||
|
||||
private MessageBoxResult _messageBoxResult = MessageBoxResult.Cancel;
|
||||
|
||||
private bool _showOK;
|
||||
private bool _showOk;
|
||||
|
||||
private bool _showCancel;
|
||||
|
||||
@@ -50,7 +49,7 @@ namespace HandyControl.Controls
|
||||
{
|
||||
_messageBoxResult = MessageBoxResult.OK;
|
||||
Close();
|
||||
}, (s, e) => e.CanExecute = _showOK));
|
||||
}, (s, e) => e.CanExecute = _showOk));
|
||||
CommandBindings.Add(new CommandBinding(ControlCommands.Cancel, (s, e) =>
|
||||
{
|
||||
_messageBoxResult = MessageBoxResult.Cancel;
|
||||
@@ -92,12 +91,16 @@ namespace HandyControl.Controls
|
||||
/// <param name="caption"></param>
|
||||
public static MessageBoxResult Success(string messageBoxText, string caption = null)
|
||||
{
|
||||
var messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.OK);
|
||||
SetButtonStatus(messageBox, MessageBoxButton.OK);
|
||||
messageBox._showImage = true;
|
||||
messageBox._image = ResourceHelper.GetResource<Geometry>(ResourceToken.SuccessGeometry);
|
||||
messageBox._imageBrush = ResourceHelper.GetResource<Brush>(ResourceToken.SuccessBrush);
|
||||
messageBox.ShowDialog();
|
||||
MessageBox messageBox = null;
|
||||
Application.Current.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.OK);
|
||||
SetButtonStatus(messageBox, MessageBoxButton.OK);
|
||||
messageBox._showImage = true;
|
||||
messageBox._image = ResourceHelper.GetResource<Geometry>(ResourceToken.SuccessGeometry);
|
||||
messageBox._imageBrush = ResourceHelper.GetResource<Brush>(ResourceToken.SuccessBrush);
|
||||
messageBox.ShowDialog();
|
||||
}));
|
||||
|
||||
return messageBox._messageBoxResult;
|
||||
}
|
||||
@@ -109,10 +112,14 @@ namespace HandyControl.Controls
|
||||
/// <param name="caption"></param>
|
||||
public static MessageBoxResult Info(string messageBoxText, string caption = null)
|
||||
{
|
||||
var messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
|
||||
SetButtonStatus(messageBox, MessageBoxButton.OK);
|
||||
SetImage(messageBox, MessageBoxImage.Information);
|
||||
messageBox.ShowDialog();
|
||||
MessageBox messageBox = null;
|
||||
Application.Current.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
|
||||
SetButtonStatus(messageBox, MessageBoxButton.OK);
|
||||
SetImage(messageBox, MessageBoxImage.Information);
|
||||
messageBox.ShowDialog();
|
||||
}));
|
||||
|
||||
return messageBox._messageBoxResult;
|
||||
}
|
||||
@@ -124,10 +131,14 @@ namespace HandyControl.Controls
|
||||
/// <param name="caption"></param>
|
||||
public static MessageBoxResult Warning(string messageBoxText, string caption = null)
|
||||
{
|
||||
var messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK);
|
||||
SetButtonStatus(messageBox, MessageBoxButton.OK);
|
||||
SetImage(messageBox, MessageBoxImage.Warning);
|
||||
messageBox.ShowDialog();
|
||||
MessageBox messageBox = null;
|
||||
Application.Current.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK);
|
||||
SetButtonStatus(messageBox, MessageBoxButton.OK);
|
||||
SetImage(messageBox, MessageBoxImage.Warning);
|
||||
messageBox.ShowDialog();
|
||||
}));
|
||||
|
||||
return messageBox._messageBoxResult;
|
||||
}
|
||||
@@ -139,10 +150,14 @@ namespace HandyControl.Controls
|
||||
/// <param name="caption"></param>
|
||||
public static MessageBoxResult Error(string messageBoxText, string caption = null)
|
||||
{
|
||||
var messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
|
||||
SetButtonStatus(messageBox, MessageBoxButton.OK);
|
||||
SetImage(messageBox, MessageBoxImage.Error);
|
||||
messageBox.ShowDialog();
|
||||
MessageBox messageBox = null;
|
||||
Application.Current.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
|
||||
SetButtonStatus(messageBox, MessageBoxButton.OK);
|
||||
SetImage(messageBox, MessageBoxImage.Error);
|
||||
messageBox.ShowDialog();
|
||||
}));
|
||||
|
||||
return messageBox._messageBoxResult;
|
||||
}
|
||||
@@ -154,12 +169,16 @@ namespace HandyControl.Controls
|
||||
/// <param name="caption"></param>
|
||||
public static MessageBoxResult Fatal(string messageBoxText, string caption = null)
|
||||
{
|
||||
var messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.OK);
|
||||
SetButtonStatus(messageBox, MessageBoxButton.OK);
|
||||
messageBox._showImage = true;
|
||||
messageBox._image = ResourceHelper.GetResource<Geometry>(ResourceToken.FatalGeometry);
|
||||
messageBox._imageBrush = ResourceHelper.GetResource<Brush>(ResourceToken.PrimaryTextBrush);
|
||||
messageBox.ShowDialog();
|
||||
MessageBox messageBox = null;
|
||||
Application.Current.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.OK);
|
||||
SetButtonStatus(messageBox, MessageBoxButton.OK);
|
||||
messageBox._showImage = true;
|
||||
messageBox._image = ResourceHelper.GetResource<Geometry>(ResourceToken.FatalGeometry);
|
||||
messageBox._imageBrush = ResourceHelper.GetResource<Brush>(ResourceToken.PrimaryTextBrush);
|
||||
messageBox.ShowDialog();
|
||||
}));
|
||||
|
||||
return messageBox._messageBoxResult;
|
||||
}
|
||||
@@ -171,36 +190,79 @@ namespace HandyControl.Controls
|
||||
/// <param name="caption"></param>
|
||||
public static MessageBoxResult Ask(string messageBoxText, string caption = null)
|
||||
{
|
||||
var messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.Cancel);
|
||||
SetButtonStatus(messageBox, MessageBoxButton.OKCancel);
|
||||
SetImage(messageBox, MessageBoxImage.Question);
|
||||
messageBox.ShowDialog();
|
||||
MessageBox messageBox = null;
|
||||
Application.Current.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.Cancel);
|
||||
SetButtonStatus(messageBox, MessageBoxButton.OKCancel);
|
||||
SetImage(messageBox, MessageBoxImage.Question);
|
||||
messageBox.ShowDialog();
|
||||
}));
|
||||
|
||||
return messageBox._messageBoxResult;
|
||||
}
|
||||
|
||||
public static MessageBoxResult CustomShow(string messageBoxText, string caption = null, MessageBoxButton button = MessageBoxButton.OK, string iconKey = "", string iconBrushKey = "", MessageBoxResult defaultResult = MessageBoxResult.None)
|
||||
/// <summary>
|
||||
/// 自定义信息展示
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
/// <returns></returns>
|
||||
public static MessageBoxResult Show(MessageBoxInfo info)
|
||||
{
|
||||
var messageBox = CreateMessageBox(null, messageBoxText, caption, button, MessageBoxImage.None, defaultResult);
|
||||
messageBox._showImage = true;
|
||||
messageBox._image = ResourceHelper.GetResource<Geometry>(iconKey);
|
||||
messageBox._imageBrush = ResourceHelper.GetResource<Brush>(iconBrushKey);
|
||||
messageBox.ShowDialog();
|
||||
MessageBox messageBox = null;
|
||||
Application.Current.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
messageBox = CreateMessageBox(null, info.MessageBoxText, info.Caption, info.Button, MessageBoxImage.None, info.DefaultResult);
|
||||
SetButtonStatus(messageBox, info.Button);
|
||||
|
||||
if (!string.IsNullOrEmpty(info.IconKey))
|
||||
{
|
||||
messageBox._showImage = true;
|
||||
messageBox._image = ResourceHelper.GetResource<Geometry>(info.IconKey);
|
||||
messageBox._imageBrush = ResourceHelper.GetResource<Brush>(info.IconBrushKey);
|
||||
}
|
||||
|
||||
messageBox.Style = info.Style;
|
||||
messageBox.ShowDialog();
|
||||
}));
|
||||
|
||||
return messageBox._messageBoxResult;
|
||||
}
|
||||
|
||||
public static MessageBoxResult Show(string messageBoxText, string caption = null, MessageBoxButton button = MessageBoxButton.OK, MessageBoxImage icon = MessageBoxImage.None, MessageBoxResult defaultResult = MessageBoxResult.None)
|
||||
{
|
||||
return Show(null, messageBoxText, caption, button, icon, defaultResult);
|
||||
}
|
||||
/// <summary>
|
||||
/// 信息展示
|
||||
/// </summary>
|
||||
/// <param name="messageBoxText"></param>
|
||||
/// <param name="caption"></param>
|
||||
/// <param name="button"></param>
|
||||
/// <param name="icon"></param>
|
||||
/// <param name="defaultResult"></param>
|
||||
/// <returns></returns>
|
||||
public static MessageBoxResult Show(string messageBoxText, string caption = null,
|
||||
MessageBoxButton button = MessageBoxButton.OK, MessageBoxImage icon = MessageBoxImage.None,
|
||||
MessageBoxResult defaultResult = MessageBoxResult.None) =>
|
||||
Show(null, messageBoxText, caption, button, icon, defaultResult);
|
||||
|
||||
/// <summary>
|
||||
/// 信息展示
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="messageBoxText"></param>
|
||||
/// <param name="caption"></param>
|
||||
/// <param name="button"></param>
|
||||
/// <param name="icon"></param>
|
||||
/// <param name="defaultResult"></param>
|
||||
/// <returns></returns>
|
||||
public static MessageBoxResult Show(System.Windows.Window owner, string messageBoxText, string caption = null, MessageBoxButton button = MessageBoxButton.OK, MessageBoxImage icon = MessageBoxImage.None, MessageBoxResult defaultResult = MessageBoxResult.None)
|
||||
{
|
||||
var messageBox = CreateMessageBox(owner, messageBoxText, caption, button, icon, defaultResult);
|
||||
SetButtonStatus(messageBox, button);
|
||||
SetImage(messageBox, icon);
|
||||
messageBox.ShowDialog();
|
||||
MessageBox messageBox = null;
|
||||
Application.Current.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
messageBox = CreateMessageBox(owner, messageBoxText, caption, button, icon, defaultResult);
|
||||
SetButtonStatus(messageBox, button);
|
||||
SetImage(messageBox, icon);
|
||||
messageBox.ShowDialog();
|
||||
}));
|
||||
|
||||
return messageBox._messageBoxResult;
|
||||
}
|
||||
@@ -226,7 +288,7 @@ namespace HandyControl.Controls
|
||||
throw new InvalidEnumArgumentException(nameof(defaultResult), (int)defaultResult, typeof(MessageBoxResult));
|
||||
}
|
||||
|
||||
var ownerWindow = owner ?? Application.Current.Windows.OfType<Window>().SingleOrDefault(x => x.IsActive);
|
||||
var ownerWindow = owner ?? VisualHelper.GetActiveWindow();
|
||||
var ownerIsNull = ownerWindow is null;
|
||||
|
||||
return new MessageBox
|
||||
@@ -246,10 +308,10 @@ namespace HandyControl.Controls
|
||||
switch (messageBoxButton)
|
||||
{
|
||||
case MessageBoxButton.OK:
|
||||
messageBox._showOK = true;
|
||||
messageBox._showOk = true;
|
||||
break;
|
||||
case MessageBoxButton.OKCancel:
|
||||
messageBox._showOK = true;
|
||||
messageBox._showOk = true;
|
||||
messageBox._showCancel = true;
|
||||
break;
|
||||
case MessageBoxButton.YesNo:
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace HandyControl.Data
|
||||
{
|
||||
public enum ChatMessageType
|
||||
{
|
||||
String,
|
||||
Image,
|
||||
Audio,
|
||||
Custom
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace HandyControl.Data
|
||||
{
|
||||
public enum ChatRoleType
|
||||
{
|
||||
Sender,
|
||||
Receiver
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace HandyControl.Data
|
||||
{
|
||||
public class MessageBoxInfo
|
||||
{
|
||||
public string MessageBoxText { get; set; }
|
||||
|
||||
public string Caption { get; set; }
|
||||
|
||||
public MessageBoxButton Button { get; set; } = MessageBoxButton.OK;
|
||||
|
||||
public string IconKey { get; set; }
|
||||
|
||||
public string IconBrushKey { get; set; }
|
||||
|
||||
public MessageBoxResult DefaultResult { get; set; } = MessageBoxResult.None;
|
||||
|
||||
public Style Style { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,68 +1,68 @@
|
||||
namespace HandyControl.Data
|
||||
{
|
||||
internal class ResourceToken
|
||||
public class ResourceToken
|
||||
{
|
||||
public static readonly string SuccessGeometry = nameof(SuccessGeometry);
|
||||
public const string SuccessGeometry = nameof(SuccessGeometry);
|
||||
|
||||
public static readonly string InfoGeometry = nameof(InfoGeometry);
|
||||
public const string InfoGeometry = nameof(InfoGeometry);
|
||||
|
||||
public static readonly string ErrorGeometry = nameof(ErrorGeometry);
|
||||
public const string ErrorGeometry = nameof(ErrorGeometry);
|
||||
|
||||
public static readonly string WarningGeometry = nameof(WarningGeometry);
|
||||
public const string WarningGeometry = nameof(WarningGeometry);
|
||||
|
||||
public static readonly string AskGeometry = nameof(AskGeometry);
|
||||
public const string AskGeometry = nameof(AskGeometry);
|
||||
|
||||
public static readonly string FatalGeometry = nameof(FatalGeometry);
|
||||
public const string FatalGeometry = nameof(FatalGeometry);
|
||||
|
||||
public static readonly string PrimaryBrush = nameof(PrimaryBrush);
|
||||
public const string PrimaryBrush = nameof(PrimaryBrush);
|
||||
|
||||
public static readonly string SuccessBrush = nameof(SuccessBrush);
|
||||
public const string SuccessBrush = nameof(SuccessBrush);
|
||||
|
||||
public static readonly string InfoBrush = nameof(InfoBrush);
|
||||
public const string InfoBrush = nameof(InfoBrush);
|
||||
|
||||
public static readonly string DangerBrush = nameof(DangerBrush);
|
||||
public const string DangerBrush = nameof(DangerBrush);
|
||||
|
||||
public static readonly string WarningBrush = nameof(WarningBrush);
|
||||
public const string WarningBrush = nameof(WarningBrush);
|
||||
|
||||
public static readonly string AccentBrush = nameof(AccentBrush);
|
||||
public const string AccentBrush = nameof(AccentBrush);
|
||||
|
||||
public static readonly string PrimaryTextBrush = nameof(PrimaryTextBrush);
|
||||
public const string PrimaryTextBrush = nameof(PrimaryTextBrush);
|
||||
|
||||
public static readonly string ThirdlyTextBrush = nameof(ThirdlyTextBrush);
|
||||
public const string ThirdlyTextBrush = nameof(ThirdlyTextBrush);
|
||||
|
||||
public static readonly string BlurGradientValue = nameof(BlurGradientValue);
|
||||
internal const string BlurGradientValue = nameof(BlurGradientValue);
|
||||
|
||||
public static readonly string ButtonCustom = nameof(ButtonCustom);
|
||||
internal const string ButtonCustom = nameof(ButtonCustom);
|
||||
|
||||
public static readonly string PaginationButtonStyle = nameof(PaginationButtonStyle);
|
||||
internal const string PaginationButtonStyle = nameof(PaginationButtonStyle);
|
||||
|
||||
public static readonly string WindowWin10 = nameof(WindowWin10);
|
||||
internal const string WindowWin10 = nameof(WindowWin10);
|
||||
|
||||
public static readonly string AddTagButtonStyle = nameof(AddTagButtonStyle);
|
||||
internal const string AddTagButtonStyle = nameof(AddTagButtonStyle);
|
||||
|
||||
public static readonly string RadioGroupItemDefault = nameof(RadioGroupItemDefault);
|
||||
internal const string RadioGroupItemDefault = nameof(RadioGroupItemDefault);
|
||||
|
||||
public static readonly string RadioGroupItemSingle = nameof(RadioGroupItemSingle);
|
||||
internal const string RadioGroupItemSingle = nameof(RadioGroupItemSingle);
|
||||
|
||||
public static readonly string RadioGroupItemHorizontalFirst = nameof(RadioGroupItemHorizontalFirst);
|
||||
internal const string RadioGroupItemHorizontalFirst = nameof(RadioGroupItemHorizontalFirst);
|
||||
|
||||
public static readonly string RadioGroupItemHorizontalLast = nameof(RadioGroupItemHorizontalLast);
|
||||
internal const string RadioGroupItemHorizontalLast = nameof(RadioGroupItemHorizontalLast);
|
||||
|
||||
public static readonly string RadioGroupItemVerticalFirst = nameof(RadioGroupItemVerticalFirst);
|
||||
internal const string RadioGroupItemVerticalFirst = nameof(RadioGroupItemVerticalFirst);
|
||||
|
||||
public static readonly string RadioGroupItemVerticalLast = nameof(RadioGroupItemVerticalLast);
|
||||
internal const string RadioGroupItemVerticalLast = nameof(RadioGroupItemVerticalLast);
|
||||
|
||||
public static readonly string TabItemCapsuleDefault = nameof(TabItemCapsuleDefault);
|
||||
internal const string TabItemCapsuleDefault = nameof(TabItemCapsuleDefault);
|
||||
|
||||
public static readonly string TabItemCapsuleSingle = nameof(TabItemCapsuleSingle);
|
||||
internal const string TabItemCapsuleSingle = nameof(TabItemCapsuleSingle);
|
||||
|
||||
public static readonly string TabItemCapsuleHorizontalFirst = nameof(TabItemCapsuleHorizontalFirst);
|
||||
internal const string TabItemCapsuleHorizontalFirst = nameof(TabItemCapsuleHorizontalFirst);
|
||||
|
||||
public static readonly string TabItemCapsuleHorizontalLast = nameof(TabItemCapsuleHorizontalLast);
|
||||
internal const string TabItemCapsuleHorizontalLast = nameof(TabItemCapsuleHorizontalLast);
|
||||
|
||||
public static readonly string TabItemCapsuleVerticalFirst = nameof(TabItemCapsuleVerticalFirst);
|
||||
internal const string TabItemCapsuleVerticalFirst = nameof(TabItemCapsuleVerticalFirst);
|
||||
|
||||
public static readonly string TabItemCapsuleVerticalLast = nameof(TabItemCapsuleVerticalLast);
|
||||
internal const string TabItemCapsuleVerticalLast = nameof(TabItemCapsuleVerticalLast);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
<#@ template debug="false" hostspecific="false" language="C#" #>
|
||||
<#@ import namespace="System.Collections.Generic"#>
|
||||
<#@ output extension=".cs" #>
|
||||
<#
|
||||
var geometryList = new List<string>
|
||||
{
|
||||
"SuccessGeometry",
|
||||
"InfoGeometry",
|
||||
"ErrorGeometry",
|
||||
"WarningGeometry",
|
||||
"AskGeometry",
|
||||
"FatalGeometry",
|
||||
"PrimaryBrush"
|
||||
};
|
||||
var brushList = new List<string>
|
||||
{
|
||||
"SuccessBrush",
|
||||
"InfoBrush",
|
||||
"DangerBrush",
|
||||
"WarningBrush",
|
||||
"AccentBrush",
|
||||
"PrimaryTextBrush",
|
||||
"ThirdlyTextBrush",
|
||||
"BlurGradientValue"
|
||||
};
|
||||
var styleList = new List<string>
|
||||
{
|
||||
"ButtonCustom",
|
||||
"PaginationButtonStyle",
|
||||
"WindowWin10",
|
||||
"AddTagButtonStyle",
|
||||
"RadioGroupItemDefault",
|
||||
"RadioGroupItemSingle",
|
||||
"RadioGroupItemHorizontalFirst",
|
||||
"RadioGroupItemHorizontalLast",
|
||||
"RadioGroupItemVerticalFirst",
|
||||
"RadioGroupItemVerticalLast",
|
||||
"TabItemCapsuleDefault",
|
||||
"TabItemCapsuleSingle",
|
||||
"TabItemCapsuleHorizontalFirst",
|
||||
"TabItemCapsuleHorizontalLast",
|
||||
"TabItemCapsuleVerticalFirst",
|
||||
"TabItemCapsuleVerticalLast"
|
||||
};
|
||||
#>
|
||||
namespace HandyControl.Data
|
||||
{
|
||||
internal class ResourceToken
|
||||
{
|
||||
<#foreach(var item in geometryList){#>
|
||||
public static readonly string <#=item#> = nameof(<#=item#>);
|
||||
|
||||
<#}#>
|
||||
<#foreach(var item in brushList){#>
|
||||
public static readonly string <#=item#> = nameof(<#=item#>);
|
||||
|
||||
<#}#>
|
||||
<#foreach(var item in styleList){#>
|
||||
public static readonly string <#=item#> = nameof(<#=item#>);
|
||||
|
||||
<#}#>
|
||||
}
|
||||
}
|
||||
@@ -44,10 +44,11 @@
|
||||
<Compile Include="Controls\Base\RegularItemsControl.cs" />
|
||||
<Compile Include="Controls\Base\SelectableItem.cs" />
|
||||
<Compile Include="Controls\Base\SimpleItemsControl.cs" />
|
||||
<Compile Include="Controls\CoverFlow\CoverFlow.cs" />
|
||||
<Compile Include="Controls\CoverFlow\CoverFlowItem.cs" />
|
||||
<Compile Include="Controls\CoverView\CoverViewContent.cs" />
|
||||
<Compile Include="Controls\CoverView\CoverViewItem.cs" />
|
||||
<Compile Include="Controls\Button\ProgressButton.cs" />
|
||||
<Compile Include="Controls\Cover\CoverFlow\CoverFlow.cs" />
|
||||
<Compile Include="Controls\Cover\CoverFlow\CoverFlowItem.cs" />
|
||||
<Compile Include="Controls\Cover\CoverView\CoverViewContent.cs" />
|
||||
<Compile Include="Controls\Cover\CoverView\CoverViewItem.cs" />
|
||||
<Compile Include="Controls\Other\AnimationPath.cs" />
|
||||
<Compile Include="Controls\Attach\BackgroundSwitchElement.cs" />
|
||||
<Compile Include="Controls\Attach\BorderElement.cs" />
|
||||
@@ -62,7 +63,8 @@
|
||||
<Compile Include="Controls\Button\ContextMenuButton.cs" />
|
||||
<Compile Include="Controls\Button\ContextMenuToggleButton.cs" />
|
||||
<Compile Include="Controls\Other\Carousel.cs" />
|
||||
<Compile Include="Controls\CoverView\CoverView.cs" />
|
||||
<Compile Include="Controls\Cover\CoverView\CoverView.cs" />
|
||||
<Compile Include="Controls\Other\ChatBubble.cs" />
|
||||
<Compile Include="Controls\Panel\CirclePanel.cs" />
|
||||
<Compile Include="Controls\Other\CircleProgressBar.cs" />
|
||||
<Compile Include="Controls\Other\RadioGroup.cs" />
|
||||
@@ -103,9 +105,14 @@
|
||||
<Compile Include="Controls\StepBar\StepBarItem.cs" />
|
||||
<Compile Include="Controls\Time\FlipClock\FlipClock.cs" />
|
||||
<Compile Include="Controls\Time\FlipClock\FlipNumber.cs" />
|
||||
<Compile Include="Controls\Transfer\Transfer.cs" />
|
||||
<Compile Include="Controls\Transfer\TransferGroup.cs" />
|
||||
<Compile Include="Controls\Transfer\TransferItem.cs" />
|
||||
<Compile Include="Controls\Window\BlurWindow.cs" />
|
||||
<Compile Include="Controls\Window\MessageBox.cs" />
|
||||
<Compile Include="Data\Args\CancelRoutedEventArgs.cs" />
|
||||
<Compile Include="Data\Enum\ChatMessageType.cs" />
|
||||
<Compile Include="Data\Enum\ChatRoleType.cs" />
|
||||
<Compile Include="Data\Enum\InfoType.cs" />
|
||||
<Compile Include="Data\Enum\ResultType.cs" />
|
||||
<Compile Include="Data\Enum\SkinType.cs" />
|
||||
@@ -116,19 +123,17 @@
|
||||
<Compile Include="Data\Gif\GifPropertyItem.cs" />
|
||||
<Compile Include="Data\Gif\GifPropertyItemInternal.cs" />
|
||||
<Compile Include="Data\Gif\GPStream.cs" />
|
||||
<Compile Include="Data\MessageBoxInfo.cs" />
|
||||
<Compile Include="Data\ResourceToken.cs" />
|
||||
<Compile Include="Data\SystemVersionInfo.cs" />
|
||||
<Compile Include="Tools\Converter\Boolean2StrConverter.cs" />
|
||||
<Compile Include="Tools\Converter\Int2StrConverter.cs" />
|
||||
<Compile Include="Tools\Extension\EnumerableExtension.cs" />
|
||||
<Compile Include="Tools\Helper\ColorHelper.cs" />
|
||||
<Compile Include="Tools\GifImageAnimator.cs" />
|
||||
<Compile Include="Data\GrowlInfo.cs" />
|
||||
<Compile Include="Data\Operation\OperationResult!1.cs" />
|
||||
<Compile Include="Data\Operation\OperationResult.cs" />
|
||||
<Compile Include="Data\ResourceToken.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>ResourceToken.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Expression\Drawing\BezierCurveFlattener.cs" />
|
||||
<Compile Include="Expression\Drawing\CommonExtensions.cs" />
|
||||
<Compile Include="Expression\Drawing\ExceptionStringTable.cs" />
|
||||
@@ -304,6 +309,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\Base\ChatBubbleBaseStyle.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\Base\CheckBoxBaseStyle.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -324,6 +333,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\Base\ProgressButtonBaseStyle.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\Base\RadioGroupBaseStyle.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -344,10 +357,18 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\Base\TransferBaseStyle.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\Base\TreeViewBaseStyle.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\ChatBubble.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\CoverFlow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -564,6 +585,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\ProgressButton.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\RadioButton.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -644,6 +669,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\Transfer.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\TransitioningContentControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -695,12 +724,6 @@
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Data\ResourceToken.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>ResourceToken.cs</LastGenOutput>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
<Geometry x:Key="WindowMinGeometry">M0,4 L10,4 L10,5 L0,5 z</Geometry>
|
||||
<Geometry x:Key="WindowRestoreGeometry">M1,3 L1,9 L7,9 L7,3 z M3,1 L3,2 L8,2 L8,7 L9,7 L9,1 z M2,0 L10,0 L10,8 L8,8 L8,10 L0,10 L0,2 L2,2 z</Geometry>
|
||||
<Geometry x:Key="WindowMaxGeometry">M1,1 L1,9 L9,9 L9,1 z M0,0 L10,0 L10,10 L0,10 z</Geometry>
|
||||
<Geometry x:Key="AudioGeometry">M627.52666696 962L550.66666696 890.47999971c116.82-92.99999971 191.09999971-230.94 191.09999971-385.2 0-146.99999971-67.61999971-279-174.96-371.57999942L643.84666667 62C770.86666638 172.99999971 850.66666667 330.2 850.66666667 505.09999971c0 182.27999971-86.58 345.42-223.13999971 456.90000029zM405.64666638 782l-76.32-77.22a227.88 227.88 0 0 0 116.40000058-199.26A228.06 228.06 0 0 0 347.86666638 317.84000029L422.86666696 242A334.37999971 334.37999971 0 0 1 550.66666696 505.52 334.62 334.62 0 0 1 405.64666638 782zM205.66666638 596.6C164.26666638 596.6 130.66666667 562.51999971 130.66666667 520.64 130.66666667 478.76000029 164.26666638 444.79999971 205.66666638 444.79999971s74.99999971 33.95999971 75.00000058 75.90000058c0 41.87999971-33.59999971 75.84000029-75.00000058 75.83999942z</Geometry>
|
||||
<Geometry x:Key="BubbleTailGeometry">M0,0L28,0 28,14.0000006258488 28,15.0010000765324 28.0151405334473,15.0010000765324 28.0455417633057,15.8010965883732C28.4084091186524,22.9596563875675,30.92209815979,29.5507589876652,34.9532623291016,34.9410597383976L34.9984359741211,34.9999815523624 34.0966339111328,34.9885679781437C15.1841707229614,34.5094191133976,2.0535663480814E-07,19.0279375612736,0,0z</Geometry>
|
||||
<Geometry x:Key="StarGeometry">M535.9 165.2l96.5 195.4c3.9 7.9 11.4 13.3 20.1 14.6l215.7 31.3c21.9 3.2 30.6 30 14.8 45.5L726.8 604.1c-6.3 6.1-9.1 14.9-7.7 23.6L756 842.5c3.7 21.8-19.1 38.4-38.7 28.1L524.4 769.2c-7.8-4.1-17-4.1-24.8 0L306.7 870.6c-19.6 10.3-42.4-6.3-38.7-28.1l36.8-214.8c1.5-8.6-1.4-17.5-7.7-23.6L141.1 452c-15.8-15.4-7.1-42.3 14.8-45.5l215.7-31.3c8.7-1.3 16.2-6.7 20.1-14.6l96.5-195.4c9.7-19.9 37.9-19.9 47.7 0z</Geometry>
|
||||
<Geometry x:Key="AddGeometry">M938.666667 426.666667h-341.333334V85.333333c0-46.933333-38.4-85.333333-85.333333-85.333333s-85.333333 38.4-85.333333 85.333333v341.333334H85.333333c-46.933333 0-85.333333 38.4-85.333333 85.333333s38.4 85.333333 85.333333 85.333333h341.333334v341.333334c0 46.933333 38.4 85.333333 85.333333 85.333333s85.333333-38.4 85.333333-85.333333v-341.333334h341.333334c46.933333 0 85.333333-38.4 85.333333-85.333333s-38.4-85.333333-85.333333-85.333333z</Geometry>
|
||||
<Geometry x:Key="SubGeometry">M62.5797 488.9508c0.2632 42.5185 34.985 77.2116 77.5035 77.5035l743.0216-0.6728c42.5185 0.3215 76.7437-33.9333 76.4518-76.4805l0 0c-0.2918-42.5175-34.985-77.2106-77.5045-77.5035l-743.0216-0.087C96.513 411.4473 62.2879 446.4323 62.5797 488.9508L62.5797 488.9508z</Geometry>
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../Basic/Converters.xaml"/>
|
||||
<ResourceDictionary Source="../../Basic/Geometries.xaml"/>
|
||||
<ResourceDictionary Source="../../Basic/Sizes.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<ControlTemplate x:Key="ChatBubbleStringBaseTemplate" TargetType="controls:ChatBubble">
|
||||
<Grid>
|
||||
<Path Name="Tail" Data="{StaticResource BubbleTailGeometry}" Fill="{TemplateBinding Background}" HorizontalAlignment="Right" Stretch="Uniform" VerticalAlignment="Bottom" Width="15" Height="15" RenderTransformOrigin="0.5,0.5"/>
|
||||
<Border Name="Body" Background="{TemplateBinding Background}" CornerRadius="15" Margin="0,0,3,0">
|
||||
<TextBlock TextWrapping="Wrap" Text="{TemplateBinding Content}" VerticalAlignment="Center" Margin="{TemplateBinding Padding}"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="Role" Value="Receiver">
|
||||
<Setter TargetName="Tail" Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter TargetName="Tail" Property="RenderTransform">
|
||||
<Setter.Value>
|
||||
<TransformGroup>
|
||||
<ScaleTransform ScaleY="1" ScaleX="-1"/>
|
||||
</TransformGroup>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter TargetName="Body" Property="Margin" Value="3,0,0,0"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
<ControlTemplate x:Key="ChatBubbleImageBaseTemplate" TargetType="controls:ChatBubble">
|
||||
<Grid>
|
||||
<Path Name="Tail" Data="{StaticResource BubbleTailGeometry}" Fill="{TemplateBinding Background}" HorizontalAlignment="Right" Stretch="Uniform" VerticalAlignment="Bottom" Width="15" Height="15" RenderTransformOrigin="0.5,0.5"/>
|
||||
<Border Name="Body" Background="{TemplateBinding Background}" CornerRadius="15" Margin="0,0,3,0">
|
||||
<Grid>
|
||||
<Image Margin="{TemplateBinding Padding}" VerticalAlignment="Center" Source="{TemplateBinding Content}"/>
|
||||
<Border BorderThickness="{TemplateBinding Padding}" BorderBrush="{TemplateBinding Background}" Background="{x:Null}" CornerRadius="15"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="Role" Value="Receiver">
|
||||
<Setter TargetName="Tail" Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter TargetName="Tail" Property="RenderTransform">
|
||||
<Setter.Value>
|
||||
<TransformGroup>
|
||||
<ScaleTransform ScaleY="1" ScaleX="-1"/>
|
||||
</TransformGroup>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter TargetName="Body" Property="Margin" Value="3,0,0,0"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
<ControlTemplate x:Key="ChatBubbleAudioBaseTemplate" TargetType="controls:ChatBubble">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="12" Name="Definition1"/>
|
||||
<ColumnDefinition Name="Definition2"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Ellipse Name="Dot" VerticalAlignment="Top" Fill="{DynamicResource DangerBrush}" Width="6" Height="6" Visibility="{TemplateBinding IsRead,Converter={StaticResource Boolean2BooleanReConverter}}" Margin="0,0,6,0"/>
|
||||
<Path Name="Tail" Grid.Column="1" Data="{StaticResource BubbleTailGeometry}" Fill="{TemplateBinding Background}" HorizontalAlignment="Right" Stretch="Uniform" VerticalAlignment="Bottom" Width="15" Height="15" RenderTransformOrigin="0.5,0.5"/>
|
||||
<Border Name="Body" Grid.Column="1" Background="{TemplateBinding Background}" CornerRadius="15" Margin="0,0,3,0">
|
||||
<Grid VerticalAlignment="Center" Margin="{TemplateBinding Padding}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ContentPresenter Name="Presenter" VerticalAlignment="Center"/>
|
||||
<Path Name="Audio" Grid.Column="1" Data="{StaticResource AudioGeometry}" Fill="{TemplateBinding Foreground}" Width="16" Height="16" Margin="6,0,0,0" RenderTransformOrigin="0.5,0.5">
|
||||
<Path.RenderTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform ScaleY="1" ScaleX="-1"/>
|
||||
</TransformGroup>
|
||||
</Path.RenderTransform>
|
||||
</Path>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="Role" Value="Receiver">
|
||||
<Setter TargetName="Tail" Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter TargetName="Tail" Property="RenderTransform">
|
||||
<Setter.Value>
|
||||
<TransformGroup>
|
||||
<ScaleTransform ScaleY="1" ScaleX="-1"/>
|
||||
</TransformGroup>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter TargetName="Tail" Property="Grid.Column" Value="0"/>
|
||||
<Setter TargetName="Dot" Property="Grid.Column" Value="1"/>
|
||||
<Setter TargetName="Dot" Property="Margin" Value="6,0,0,0"/>
|
||||
<Setter TargetName="Body" Property="Margin" Value="3,0,0,0"/>
|
||||
<Setter TargetName="Body" Property="Grid.Column" Value="0"/>
|
||||
<Setter TargetName="Definition1" Property="Width" Value="Auto"/>
|
||||
<Setter TargetName="Definition2" Property="Width" Value="12"/>
|
||||
<Setter TargetName="Audio" Property="Grid.Column" Value="0"/>
|
||||
<Setter TargetName="Audio" Property="Margin" Value="0,0,6,0"/>
|
||||
<Setter TargetName="Audio" Property="RenderTransform">
|
||||
<Setter.Value>
|
||||
<TransformGroup>
|
||||
<ScaleTransform ScaleY="1" ScaleX="1"/>
|
||||
</TransformGroup>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter TargetName="Presenter" Property="Grid.Column" Value="1"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
<ControlTemplate x:Key="ChatBubbleCustomBaseTemplate" TargetType="controls:ChatBubble">
|
||||
<Grid>
|
||||
<Path Name="Tail" Data="{StaticResource BubbleTailGeometry}" Fill="{TemplateBinding Background}" HorizontalAlignment="Right" Stretch="Uniform" VerticalAlignment="Bottom" Width="15" Height="15" RenderTransformOrigin="0.5,0.5"/>
|
||||
<Border Name="Body" Background="{TemplateBinding Background}" CornerRadius="15" Margin="0,0,3,0">
|
||||
<ContentPresenter VerticalAlignment="Center" Margin="{TemplateBinding Padding}"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="Role" Value="Receiver">
|
||||
<Setter TargetName="Tail" Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter TargetName="Tail" Property="RenderTransform">
|
||||
<Setter.Value>
|
||||
<TransformGroup>
|
||||
<ScaleTransform ScaleY="1" ScaleX="-1"/>
|
||||
</TransformGroup>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter TargetName="Body" Property="Margin" Value="3,0,0,0"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
<Style x:Key="ChatBubbleBaseStyle" TargetType="controls:ChatBubble">
|
||||
<Setter Property="HorizontalAlignment" Value="Right"/>
|
||||
<Setter Property="Background" Value="{DynamicResource DarkPrimaryBrush}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/>
|
||||
<Setter Property="Padding" Value="10"/>
|
||||
<Setter Property="Margin" Value="10"/>
|
||||
<Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}"/>
|
||||
<Setter Property="Template" Value="{StaticResource ChatBubbleStringBaseTemplate}"/>
|
||||
<Setter Property="IsRead" Value="{Binding IsSelected,RelativeSource={RelativeSource Self}}"/>
|
||||
<Setter Property="MaxWidth" Value="280"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="Role" Value="Receiver">
|
||||
<Setter Property="Background" Value="{DynamicResource BorderBrush}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
</Trigger>
|
||||
<Trigger Property="Type" Value="Image">
|
||||
<Setter Property="Template" Value="{StaticResource ChatBubbleImageBaseTemplate}"/>
|
||||
<Setter Property="MaxHeight" Value="280"/>
|
||||
</Trigger>
|
||||
<Trigger Property="Type" Value="Audio">
|
||||
<Setter Property="Template" Value="{StaticResource ChatBubbleAudioBaseTemplate}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="Type" Value="Custom">
|
||||
<Setter Property="Template" Value="{StaticResource ChatBubbleCustomBaseTemplate}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -76,7 +76,7 @@
|
||||
<Setter Property="Height" Value="100"/>
|
||||
<Setter Property="Width" Value="100"/>
|
||||
<Setter Property="ArcThickness" Value="4"/>
|
||||
<Setter Property="Text" Value="{Binding Value,RelativeSource={RelativeSource Self},StringFormat={}{0} %}"></Setter>
|
||||
<Setter Property="Text" Value="{Binding Value,RelativeSource={RelativeSource Self},StringFormat={}{0} %}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="controls:CircleProgressBar">
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="ToggleButtonBaseStyle.xaml"/>
|
||||
<ResourceDictionary Source="ProgressBarBaseStyle.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style x:Key="ProgressBarFlat4ProgressButton" TargetType="ProgressBar">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="4"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource DarkMaskBrush}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ProgressBar">
|
||||
<Border x:Name="PART_Track">
|
||||
<Decorator x:Name="PART_Indicator" HorizontalAlignment="Left">
|
||||
<Border CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" x:Name="Indicator" Background="{TemplateBinding Foreground}"/>
|
||||
</Decorator>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ProgressButtonBaseStyle" BasedOn="{StaticResource ToggleButtonBaseStyle}" TargetType="controls:ProgressButton">
|
||||
<Setter Property="ProgressStyle" Value="{StaticResource ProgressBarFlat4ProgressButton}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="controls:ProgressButton">
|
||||
<Border x:Name="Chrome" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
|
||||
<Grid>
|
||||
<ProgressBar x:Name="ProgressBar" Height="{x:Static system:Double.NaN}" Value="{TemplateBinding Progress}" Maximum="100" Visibility="Collapsed" Style="{TemplateBinding ProgressStyle}"/>
|
||||
<ContentPresenter Name="UnCheckedElement" Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
<ContentPresenter Name="CheckedElement" Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Visibility="Collapsed" Content="{Binding Path=(controls:StatusSwitchElement.CheckedElement),RelativeSource={RelativeSource TemplatedParent}}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Opacity" Value=".9"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Opacity" Value=".6"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter Property="Visibility" Value="Visible" TargetName="ProgressBar"/>
|
||||
<Setter Property="Visibility" Value="Visible" TargetName="CheckedElement"/>
|
||||
</Trigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="controls:StatusSwitchElement.HiddenElement" Value="True"/>
|
||||
<Condition Property="IsChecked" Value="True"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter Property="Visibility" Value="Collapsed" TargetName="UnCheckedElement"/>
|
||||
</MultiTrigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Opacity" Value="0.4"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,115 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls"
|
||||
xmlns:interactivity="clr-namespace:HandyControl.Interactivity">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../Basic/Geometries.xaml"/>
|
||||
<ResourceDictionary Source="../../Basic/Behaviors.xaml"/>
|
||||
<ResourceDictionary Source="../../Basic/Sizes.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style x:Key="TransferItemBaseStyle" TargetType="controls:TransferItem">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="CanDeselect" Value="True"/>
|
||||
<Setter Property="SelfManage" Value="True"/>
|
||||
<Setter Property="Padding" Value="10, 0"/>
|
||||
<Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}"/>
|
||||
<Setter Property="Margin" Value="5,0,5,5"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="controls:TransferItem">
|
||||
<Border x:Name="BorderRoot" Background="{DynamicResource RegionBrush}" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}">
|
||||
<ContentPresenter x:Name="ContentPresenter" VerticalAlignment="Center" Margin="{TemplateBinding Padding}" ContentTemplate="{Binding ItemTemplate,RelativeSource={RelativeSource AncestorType=controls:TransferGroup}}"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter TargetName="BorderRoot" Property="Background" Value="{DynamicResource PrimaryBrush}"/>
|
||||
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource TextIconBrush}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsOrigin" Value="True"/>
|
||||
<Condition Property="IsTransferred" Value="False"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
</MultiTrigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsOrigin" Value="True"/>
|
||||
<Condition Property="IsTransferred" Value="True"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
</MultiTrigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsOrigin" Value="False"/>
|
||||
<Condition Property="IsTransferred" Value="True"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
</MultiTrigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsOrigin" Value="False"/>
|
||||
<Condition Property="IsTransferred" Value="False"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
</MultiTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="TransferGroupBaseStyle" TargetType="controls:TransferGroup">
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Background" Value="{DynamicResource DarkDefaultBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="controls:TransferGroup">
|
||||
<Border Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
|
||||
<ScrollViewer Margin="0,5">
|
||||
<StackPanel x:Name="PART_Panel"/>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="TransferBaseStyle" TargetType="controls:Transfer">
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="4"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource TransferItemBaseStyle}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="controls:Transfer">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition MinWidth="200"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition MinWidth="200"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<controls:TransferGroup x:Name="PART_ItemsOrigin" Style="{StaticResource TransferGroupBaseStyle}" Grid.RowSpan="4" ItemTemplate="{TemplateBinding ItemTemplate}" ItemContainerStyle="{TemplateBinding ItemContainerStyle}"/>
|
||||
<StackPanel Margin="32,0" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Row="0" Grid.RowSpan="4" Grid.Column="1">
|
||||
<Button controls:IconElement.Geometry="{StaticResource LeftGeometry}" Command="interactivity:ControlCommands.Cancel"/>
|
||||
<Button controls:IconElement.Geometry="{StaticResource RightGeometry}" Margin="0,10,0,0" Command="interactivity:ControlCommands.Selected"/>
|
||||
</StackPanel>
|
||||
<controls:TransferGroup x:Name="PART_ItemsSelected" Style="{StaticResource TransferGroupBaseStyle}" Grid.Row="0" Grid.RowSpan="4" Grid.Column="2" ItemTemplate="{TemplateBinding ItemTemplate}" ItemContainerStyle="{TemplateBinding ItemContainerStyle}"/>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -9,7 +9,22 @@
|
||||
<ResourceDictionary Source="ListBox.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style TargetType="controls:Carousel" BasedOn="{StaticResource StackPanelListBox}">
|
||||
<Style x:Key="CarouselListBoxItemStyle" BasedOn="{StaticResource ListBoxItemCustom}" TargetType="ListBoxItem">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="Height" Value="{Binding ActualHeight, RelativeSource={RelativeSource AncestorType=ItemsControl}}"/>
|
||||
</Style>
|
||||
|
||||
<ItemsPanelTemplate x:Key="CarouselListBoxItemPanelTemplate">
|
||||
<StackPanel FocusVisualStyle="{x:Null}" Orientation="Horizontal" HorizontalAlignment="Left"/>
|
||||
</ItemsPanelTemplate>
|
||||
|
||||
<Style x:Key="CarouselListBox" BasedOn="{StaticResource ListBoxBaseStyle}" TargetType="ListBox">
|
||||
<Setter Property="ItemsPanel" Value="{StaticResource CarouselListBoxItemPanelTemplate}"/>
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource CarouselListBoxItemStyle}"/>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="controls:Carousel" BasedOn="{StaticResource CarouselListBox}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="controls:Carousel">
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Base/ChatBubbleBaseStyle.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style BasedOn="{StaticResource ChatBubbleBaseStyle}" TargetType="controls:ChatBubble"/>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -8,7 +8,7 @@
|
||||
<!--默认样式-->
|
||||
<Style BasedOn="{StaticResource ListBoxBaseStyle}" TargetType="ListBox"/>
|
||||
|
||||
<Style x:Key="ListBoxItemStyle" TargetType="ListBoxItem">
|
||||
<Style x:Key="ListBoxItemCustom" TargetType="ListBoxItem">
|
||||
<Setter Property="SnapsToDevicePixels" Value="True"/>
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
@@ -26,28 +26,41 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ListBoxItemFullStyle" BasedOn="{StaticResource ListBoxItemStyle}" TargetType="ListBoxItem">
|
||||
<Style x:Key="ListBoxCustom" TargetType="ListBox">
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource ListBoxItemCustom}"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="Height" Value="{Binding ActualHeight, RelativeSource={RelativeSource AncestorType=ItemsControl}}"/>
|
||||
</Style>
|
||||
|
||||
<ItemsPanelTemplate x:Key="WrapPanelItemsPanelTemplate">
|
||||
<ItemsPanelTemplate x:Key="WrapPanelHorizontalItemsPanelTemplate">
|
||||
<WrapPanel FocusVisualStyle="{x:Null}"/>
|
||||
</ItemsPanelTemplate>
|
||||
|
||||
<Style x:Key="WrapPanelListBox" BasedOn="{StaticResource ListBoxBaseStyle}" TargetType="ListBox">
|
||||
<Setter Property="ItemsPanel" Value="{StaticResource WrapPanelItemsPanelTemplate}"/>
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource ListBoxItemStyle}"/>
|
||||
<Style x:Key="WrapPanelHorizontalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox">
|
||||
<Setter Property="ItemsPanel" Value="{StaticResource WrapPanelHorizontalItemsPanelTemplate}"/>
|
||||
</Style>
|
||||
|
||||
<ItemsPanelTemplate x:Key="StackPanelItemsPanelTemplate">
|
||||
<StackPanel FocusVisualStyle="{x:Null}" Orientation="Horizontal" HorizontalAlignment="Left"/>
|
||||
<ItemsPanelTemplate x:Key="WrapPanelVerticalItemsPanelTemplate">
|
||||
<WrapPanel FocusVisualStyle="{x:Null}" Orientation="Vertical"/>
|
||||
</ItemsPanelTemplate>
|
||||
|
||||
<Style x:Key="StackPanelListBox" BasedOn="{StaticResource ListBoxBaseStyle}" TargetType="ListBox">
|
||||
<Setter Property="ItemsPanel" Value="{StaticResource StackPanelItemsPanelTemplate}"/>
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource ListBoxItemFullStyle}"/>
|
||||
<Style x:Key="WrapPanelVerticalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox">
|
||||
<Setter Property="ItemsPanel" Value="{StaticResource WrapPanelVerticalItemsPanelTemplate}"/>
|
||||
</Style>
|
||||
|
||||
<ItemsPanelTemplate x:Key="StackPanelHorizontalItemsPanelTemplate">
|
||||
<StackPanel FocusVisualStyle="{x:Null}" Orientation="Horizontal"/>
|
||||
</ItemsPanelTemplate>
|
||||
|
||||
<Style x:Key="StackPanelHorizontalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox">
|
||||
<Setter Property="ItemsPanel" Value="{StaticResource StackPanelHorizontalItemsPanelTemplate}"/>
|
||||
</Style>
|
||||
|
||||
<ItemsPanelTemplate x:Key="StackPanelVerticalItemsPanelTemplate">
|
||||
<StackPanel FocusVisualStyle="{x:Null}" HorizontalAlignment="Stretch"/>
|
||||
</ItemsPanelTemplate>
|
||||
|
||||
<Style x:Key="StackPanelVerticalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox">
|
||||
<Setter Property="ItemsPanel" Value="{StaticResource StackPanelVerticalItemsPanelTemplate}"/>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,43 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Base/ProgressButtonBaseStyle.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style BasedOn="{StaticResource ProgressButtonBaseStyle}" TargetType="controls:ProgressButton">
|
||||
<Setter Property="Background" Value="{DynamicResource DefaultBrush}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource DarkDefaultBrush}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource BorderBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ProgressButtonPrimary" BasedOn="{StaticResource ProgressButtonBaseStyle}" TargetType="controls:ProgressButton">
|
||||
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ProgressButtonSuccess" BasedOn="{StaticResource ProgressButtonBaseStyle}" TargetType="controls:ProgressButton">
|
||||
<Setter Property="Background" Value="{DynamicResource SuccessBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ProgressButtonInfo" BasedOn="{StaticResource ProgressButtonBaseStyle}" TargetType="controls:ProgressButton">
|
||||
<Setter Property="Background" Value="{DynamicResource InfoBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ProgressButtonWarning" BasedOn="{StaticResource ProgressButtonBaseStyle}" TargetType="controls:ProgressButton">
|
||||
<Setter Property="Background" Value="{DynamicResource WarningBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ProgressButtonDanger" BasedOn="{StaticResource ProgressButtonBaseStyle}" TargetType="controls:ProgressButton">
|
||||
<Setter Property="Background" Value="{DynamicResource DangerBrush}"/>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -54,6 +54,9 @@
|
||||
<ResourceDictionary Source="Shield.xaml"/>
|
||||
<ResourceDictionary Source="CoverView.xaml"/>
|
||||
<ResourceDictionary Source="CoverFlow.xaml"/>
|
||||
<ResourceDictionary Source="ProgressButton.xaml"/>
|
||||
<ResourceDictionary Source="Transfer.xaml"/>
|
||||
<ResourceDictionary Source="ChatBubble.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,10 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Base/TransferBaseStyle.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style BasedOn="{StaticResource TransferBaseStyle}" TargetType="controls:Transfer"/>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -56,14 +56,16 @@
|
||||
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
<Setter Property="UseLayoutRounding" Value="True"/>
|
||||
<Setter Property="NonClientAreaBackground" Value="{DynamicResource TitleBrush}"/>
|
||||
<Setter Property="NonClientAreaForeground" Value="White"/>
|
||||
<Setter Property="CloseButtonHoverBackground" Value="#e71123"/>
|
||||
<Setter Property="CloseButtonHoverForeground" Value="White"/>
|
||||
<Setter Property="NonClientAreaBackground" Value="White"/>
|
||||
<Setter Property="NonClientAreaForeground" Value="{DynamicResource ReverseTextBrush}"/>
|
||||
<Setter Property="CloseButtonBackground" Value="Transparent"/>
|
||||
<Setter Property="OtherButtonHoverBackground" Value="{DynamicResource DarkPrimaryBrush}"/>
|
||||
<Setter Property="OtherButtonHoverForeground" Value="White"/>
|
||||
<Setter Property="CloseButtonForeground" Value="{DynamicResource ReverseTextBrush}"/>
|
||||
<Setter Property="CloseButtonHoverBackground" Value="#e81123"/>
|
||||
<Setter Property="CloseButtonHoverForeground" Value="White"/>
|
||||
<Setter Property="OtherButtonBackground" Value="Transparent"/>
|
||||
<Setter Property="OtherButtonForeground" Value="{DynamicResource ReverseTextBrush}"/>
|
||||
<Setter Property="OtherButtonHoverBackground" Value="#e5e5e5"/>
|
||||
<Setter Property="OtherButtonHoverForeground" Value="{DynamicResource ReverseTextBrush}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="controls:Window">
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace HandyControl.Tools.Extension
|
||||
{
|
||||
public static class EnumerableExtension
|
||||
{
|
||||
public static IEnumerable<TSource> Do<TSource>(this IEnumerable<TSource> source, Action<TSource> predicate)
|
||||
{
|
||||
var enumerable = source as IList<TSource> ?? source.ToList();
|
||||
foreach (var item in enumerable)
|
||||
{
|
||||
predicate.Invoke(item);
|
||||
}
|
||||
|
||||
return enumerable;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,17 +3,41 @@
|
||||
/// <summary>
|
||||
/// 验证帮助类
|
||||
/// </summary>
|
||||
internal class ValidateHelper
|
||||
public class ValidateHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否在浮点数范围内
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
internal static bool IsInRangeOfDouble(object value)
|
||||
public static bool IsInRangeOfDouble(object value)
|
||||
{
|
||||
var v = (double)value;
|
||||
return !(double.IsNaN(v) || double.IsInfinity(v));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否在正浮点数范围内
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="includeZero"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsInRangeOfPosDouble(object value, bool includeZero = false)
|
||||
{
|
||||
var v = (double)value;
|
||||
return !(double.IsNaN(v) || double.IsInfinity(v)) && (includeZero ? v >= 0 : v > 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否在正浮点数范围内
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="includeZero"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsInRangeOfNegDouble(object value, bool includeZero = false)
|
||||
{
|
||||
var v = (double)value;
|
||||
return !(double.IsNaN(v) || double.IsInfinity(v)) && (includeZero ? v <= 0 : v < 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,9 +4,9 @@ using System.Windows.Media;
|
||||
|
||||
namespace HandyControl.Tools
|
||||
{
|
||||
internal class VisualHelper
|
||||
public class VisualHelper
|
||||
{
|
||||
public static VisualStateGroup TryGetVisualStateGroup(DependencyObject dependencyObject, string groupName)
|
||||
internal static VisualStateGroup TryGetVisualStateGroup(DependencyObject dependencyObject, string groupName)
|
||||
{
|
||||
var root = GetImplementationRoot(dependencyObject);
|
||||
if (root == null)
|
||||
@@ -20,11 +20,13 @@ namespace HandyControl.Tools
|
||||
.FirstOrDefault(group => string.CompareOrdinal(groupName, group.Name) == 0);
|
||||
}
|
||||
|
||||
public static FrameworkElement GetImplementationRoot(DependencyObject dependencyObject)
|
||||
internal static FrameworkElement GetImplementationRoot(DependencyObject dependencyObject)
|
||||
{
|
||||
return 1 == VisualTreeHelper.GetChildrenCount(dependencyObject)
|
||||
? VisualTreeHelper.GetChild(dependencyObject, 0) as FrameworkElement
|
||||
: null;
|
||||
}
|
||||
|
||||
public static Window GetActiveWindow() => Application.Current.Windows.OfType<Window>().SingleOrDefault(x => x.IsActive);
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||

|
||||
|
||||
   [](https://www.nuget.org/packages/HandyControl) [](https://ci.appveyor.com/project/NaBian/handycontrol) [](https://gitter.im/HandyControl/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [](//shang.qq.com/wpa/qunwpa?idkey=a571e5553c9d41e49c4f22f3a8b2865451497a795ff281fedf3285def247efc1)
|
||||

|
||||
|
||||
# Discussion
|
||||
|
||||

|
||||
[](https://github.com/ghost1372/HandyControl/wiki)
|
||||
|
||||
# Welcome to HandyControl
|
||||
|
||||
# Usage
|
||||
## We're all here
|
||||
|
||||

|
||||
|
||||
## Usage
|
||||
|
||||
Step 1:Add a reference to HandyControl or search for HandyControl on the nuget;
|
||||
|
||||
@@ -52,6 +52,10 @@ Step 3:enjoy coding
|
||||
|
||||
## History publication
|
||||
|
||||
### MessageBox
|
||||
|
||||

|
||||
|
||||
### WaterfallPanel
|
||||
|
||||

|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 9.5 KiB |
Reference in new issue
Block a user