add Recommendation
This commit is contained in:
1 parent
ee4125e2bf
commit
cf5f84869d
33 files changed
+320
-141
No files matched your search
@@ -3,7 +3,9 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
|
||||
Height="29"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol">
|
||||
DataContext="{Binding NoUser,Source={StaticResource Locator}}"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:data="clr-namespace:HandyControlDemo.Data">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
@@ -20,36 +22,41 @@
|
||||
</hc:Interaction.Triggers>
|
||||
<Path Height="16" Fill="White" Stretch="Uniform" Data="{StaticResource LogoGeometry}"/>
|
||||
</Button>
|
||||
<Menu MenuItem.Click="MenuItemLinks_OnClick" Margin="10,0,0,0" Background="Transparent">
|
||||
<Menu Margin="10,0,0,0" Background="Transparent">
|
||||
<MenuItem Foreground="White" Header="{x:Static langs:Lang.Repository}">
|
||||
<MenuItem Tag="https://github.com/NaBian/HandyControl" Header="GitHub">
|
||||
<MenuItem Command="hc:ControlCommands.OpenLink" CommandParameter="https://github.com/NaBian/HandyControl" Header="GitHub">
|
||||
<MenuItem.Icon>
|
||||
<Path Data="{StaticResource GithubGeometry}" Fill="{DynamicResource PrimaryTextBrush}"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Tag="https://www.nuget.org/packages/HandyControl" Header="NuGet">
|
||||
<MenuItem Command="hc:ControlCommands.OpenLink" CommandParameter="https://www.nuget.org/packages/HandyControl" Header="NuGet">
|
||||
<MenuItem.Icon>
|
||||
<Path Data="{StaticResource NugetGeometry}" Fill="#30a5dd"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
<MenuItem Foreground="White" Header="{x:Static langs:Lang.About}">
|
||||
<MenuItem Click="MenuItemQQGroup_OnClick" Header="{x:Static langs:Lang.QQGroup}">
|
||||
<MenuItem Command="{Binding OpenViewCmd}" CommandParameter="{x:Static data:MessageToken.ContributorsView}" Header="{x:Static langs:Lang.Contributors}">
|
||||
<MenuItem.Icon>
|
||||
<Path Data="{StaticResource ContributorsGeometry}" Fill="#ef6c00"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Command="{Binding OpenViewCmd}" CommandParameter="{x:Static data:MessageToken.QQGroupView}" Header="{x:Static langs:Lang.QQGroup}">
|
||||
<MenuItem.Icon>
|
||||
<Path Data="{StaticResource QqGeometry}" Fill="{DynamicResource PrimaryBrush}"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Tag="mailto:836904362@qq.com" Header="{x:Static langs:Lang.Email}">
|
||||
<MenuItem Command="hc:ControlCommands.OpenLink" CommandParameter="mailto:836904362@qq.com" Header="{x:Static langs:Lang.Email}">
|
||||
<MenuItem.Icon>
|
||||
<Path Data="{StaticResource EmailGeometry}" Fill="{DynamicResource WarningBrush}"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Tag="https://gitter.im/HandyControl/Lobby" Header="{x:Static langs:Lang.Chatroom}">
|
||||
<MenuItem Command="hc:ControlCommands.OpenLink" CommandParameter="https://gitter.im/HandyControl/Lobby" Header="{x:Static langs:Lang.Chatroom}">
|
||||
<MenuItem.Icon>
|
||||
<Path Data="{StaticResource GitterGeometry}" Fill="#e52e64"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Tag="https://www.cnblogs.com/nabian" Header="{x:Static langs:Lang.Blog}">
|
||||
<MenuItem Command="hc:ControlCommands.OpenLink" CommandParameter="https://www.cnblogs.com/nabian" Header="{x:Static langs:Lang.Blog}">
|
||||
<MenuItem.Icon>
|
||||
<Path Data="{StaticResource CnblogsGeometry}" Fill="{DynamicResource PrimaryTextBrush}"/>
|
||||
</MenuItem.Icon>
|
||||
@@ -60,10 +67,17 @@
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
<MenuItem Click="MenuItemContributors_OnClick" Foreground="White" Header="{x:Static langs:Lang.Contributors}">
|
||||
<MenuItem.Icon>
|
||||
<Path Data="{StaticResource ContributorsGeometry}" Fill="#ef6c00"/>
|
||||
</MenuItem.Icon>
|
||||
<MenuItem Foreground="White" Header="{x:Static langs:Lang.Recommendation}">
|
||||
<MenuItem Header="{x:Static langs:Lang.Project}" Command="{Binding OpenViewCmd}" CommandParameter="{x:Static data:MessageToken.ProjectsView}" >
|
||||
<MenuItem.Icon>
|
||||
<Path Data="{StaticResource ProjectGeometry}" Fill="{DynamicResource PrimaryTextBrush}"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="{x:Static langs:Lang.Blog}" Command="{Binding OpenViewCmd}" CommandParameter="{x:Static data:MessageToken.BlogsView}" >
|
||||
<MenuItem.Icon>
|
||||
<Path Data="{StaticResource BlogGeometry}" Fill="{DynamicResource PrimaryBrush}"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
</StackPanel>
|
||||
|
||||
@@ -5,10 +5,8 @@ using GalaSoft.MvvmLight.Messaging;
|
||||
using HandyControl.Controls;
|
||||
using HandyControl.Data;
|
||||
using HandyControlDemo.Data;
|
||||
using HandyControlDemo.Tools;
|
||||
using HandyControlDemo.Window;
|
||||
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
{
|
||||
public partial class NoUserContent
|
||||
@@ -29,7 +27,9 @@ namespace HandyControlDemo.UserControl
|
||||
if (!b) return true;
|
||||
GlobalData.Config.Lang = tag;
|
||||
GlobalData.Save();
|
||||
Process.Start(Process.GetCurrentProcess().MainModule.FileName);
|
||||
var processModule = Process.GetCurrentProcess().MainModule;
|
||||
if (processModule != null)
|
||||
Process.Start(processModule.FileName);
|
||||
Application.Current.Shutdown();
|
||||
return true;
|
||||
});
|
||||
@@ -50,28 +50,6 @@ namespace HandyControlDemo.UserControl
|
||||
}
|
||||
}
|
||||
|
||||
private void MenuItemLinks_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (e.OriginalSource is MenuItem menuItem && menuItem.Tag is string tag)
|
||||
{
|
||||
Process.Start(tag);
|
||||
}
|
||||
}
|
||||
|
||||
private void MenuItemQQGroup_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Messenger.Default.Send<object>(null, MessageToken.ClearLeftSelected);
|
||||
Messenger.Default.Send(true, MessageToken.FullSwitch);
|
||||
Messenger.Default.Send(AssemblyHelper.CreateInternalInstance($"UserControl.{MessageToken.QQGroupView}"), MessageToken.LoadShowContent);
|
||||
}
|
||||
|
||||
private void MenuItemContributors_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Messenger.Default.Send<object>(null, MessageToken.ClearLeftSelected);
|
||||
Messenger.Default.Send(true, MessageToken.FullSwitch);
|
||||
Messenger.Default.Send(AssemblyHelper.CreateInternalInstance($"UserControl.{MessageToken.ContributorsView}"), MessageToken.LoadShowContent);
|
||||
}
|
||||
|
||||
private void MenuAbout_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
new AboutWindow
|
||||
|
||||
@@ -46,6 +46,10 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="Window">
|
||||
<Setter Property="UseLayoutRounding" Value="True"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="WindowDefault" TargetType="Window">
|
||||
<Setter Property="Background" Value="{DynamicResource BackgroundBrush}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
|
||||
@@ -174,5 +174,9 @@
|
||||
|
||||
public static readonly string OverView = nameof(OverView);
|
||||
|
||||
public static readonly string ProjectsView = nameof(ProjectsView);
|
||||
|
||||
public static readonly string BlogsView = nameof(BlogsView);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -98,7 +98,9 @@ var messageList = new List<string>
|
||||
"GrowlDemoPanel",
|
||||
"DialogDemoWindow",
|
||||
"MainWindow",
|
||||
"OverView"
|
||||
"OverView",
|
||||
"ProjectsView",
|
||||
"BlogsView"
|
||||
};
|
||||
#>
|
||||
namespace HandyControlDemo.Data
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
|
||||
namespace HandyControlDemo.Data
|
||||
{
|
||||
public class ContributorModel
|
||||
public class AvatarModel
|
||||
{
|
||||
public string UserName { get; set; }
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
public string Link { get; set; }
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\DemoType.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Data\GlobalData.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Data\Model\ChatInfoModel.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Data\Model\ContributorModel.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Data\Model\AvatarModel.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Data\Model\CoverViewDemoModel.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Data\Model\DemoDataModel.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Data\Model\StepBarDemoModel.cs" />
|
||||
@@ -180,6 +180,12 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\WindowDemoCtl.xaml.cs">
|
||||
<DependentUpon>WindowDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Main\BlogsView.xaml.cs">
|
||||
<DependentUpon>BlogsView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Main\ProjectsView.xaml.cs">
|
||||
<DependentUpon>ProjectsView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Main\OverView.xaml.cs">
|
||||
<DependentUpon>OverView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -295,8 +301,9 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\TabControlDemoViewModel.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\WindowDemoViewModel.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\DemoViewModelBase!1.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Main\ContributorsViewModel.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Main\ItemsDisplayViewModel.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Main\MainViewModel.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Main\NoUserViewModel.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\ViewModelLocator.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Window\AboutWindow.xaml.cs">
|
||||
<DependentUpon>AboutWindow.xaml</DependentUpon>
|
||||
@@ -565,6 +572,14 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)UserControl\Main\BlogsView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)UserControl\Main\ProjectsView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)UserControl\Main\OverView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -1041,6 +1041,15 @@ namespace HandyControlDemo.Properties.Langs {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 项目 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string Project {
|
||||
get {
|
||||
return ResourceManager.GetString("Project", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 按住说话 的本地化字符串。
|
||||
/// </summary>
|
||||
@@ -1077,6 +1086,15 @@ namespace HandyControlDemo.Properties.Langs {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 推荐 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string Recommendation {
|
||||
get {
|
||||
return ResourceManager.GetString("Recommendation", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 注册 的本地化字符串。
|
||||
/// </summary>
|
||||
|
||||
@@ -600,4 +600,10 @@
|
||||
<data name="Border" xml:space="preserve">
|
||||
<value>Border</value>
|
||||
</data>
|
||||
<data name="Recommendation" xml:space="preserve">
|
||||
<value>Recommendation</value>
|
||||
</data>
|
||||
<data name="Project" xml:space="preserve">
|
||||
<value>Project</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -600,4 +600,10 @@
|
||||
<data name="ResponsiveLayout" xml:space="preserve">
|
||||
<value>响应式布局</value>
|
||||
</data>
|
||||
<data name="Recommendation" xml:space="preserve">
|
||||
<value>推荐</value>
|
||||
</data>
|
||||
<data name="Project" xml:space="preserve">
|
||||
<value>项目</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -46,6 +46,54 @@
|
||||
</DrawingBrush.Drawing>
|
||||
</DrawingBrush>
|
||||
|
||||
<DrawingBrush x:Key="BlogDrawingBrush" RenderOptions.CachingHint="Cache" Viewport="0,0,120,100" ViewportUnits="Absolute" Stretch="Uniform" TileMode="Tile">
|
||||
<DrawingBrush.Transform>
|
||||
<TransformGroup>
|
||||
<RotateTransform Angle="20"/>
|
||||
</TransformGroup>
|
||||
</DrawingBrush.Transform>
|
||||
<DrawingBrush.Drawing>
|
||||
<GeometryDrawing>
|
||||
<GeometryDrawing.Geometry>
|
||||
<RectangleGeometry Rect="0,0,120,100"></RectangleGeometry>
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Brush>
|
||||
<VisualBrush>
|
||||
<VisualBrush.Visual>
|
||||
<StackPanel>
|
||||
<TextBlock Text="Blog" Foreground="{DynamicResource DarkMaskBrush}"/>
|
||||
</StackPanel>
|
||||
</VisualBrush.Visual>
|
||||
</VisualBrush>
|
||||
</GeometryDrawing.Brush>
|
||||
</GeometryDrawing>
|
||||
</DrawingBrush.Drawing>
|
||||
</DrawingBrush>
|
||||
|
||||
<DrawingBrush x:Key="ProjectDrawingBrush" RenderOptions.CachingHint="Cache" Viewport="0,0,200,100" ViewportUnits="Absolute" Stretch="Uniform" TileMode="Tile">
|
||||
<DrawingBrush.Transform>
|
||||
<TransformGroup>
|
||||
<RotateTransform Angle="20"/>
|
||||
</TransformGroup>
|
||||
</DrawingBrush.Transform>
|
||||
<DrawingBrush.Drawing>
|
||||
<GeometryDrawing>
|
||||
<GeometryDrawing.Geometry>
|
||||
<RectangleGeometry Rect="0,0,200,100"></RectangleGeometry>
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Brush>
|
||||
<VisualBrush>
|
||||
<VisualBrush.Visual>
|
||||
<StackPanel>
|
||||
<TextBlock Text="Project" Foreground="{DynamicResource DarkMaskBrush}"/>
|
||||
</StackPanel>
|
||||
</VisualBrush.Visual>
|
||||
</VisualBrush>
|
||||
</GeometryDrawing.Brush>
|
||||
</GeometryDrawing>
|
||||
</DrawingBrush.Drawing>
|
||||
</DrawingBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="MenuButtonBorderBrush" EndPoint="0.5,1" StartPoint="0.5,0">
|
||||
<GradientStop Color="White" Offset="0"/>
|
||||
<GradientStop Color="#F2F2F2" Offset="1"/>
|
||||
|
||||
@@ -17,5 +17,7 @@
|
||||
<Geometry x:Key="ContributorsGeometry">M657.486769 287.744c5.671385 0 11.264-5.671385 16.935385-5.671385l186.289231-124.140307c5.592615-5.592615 16.935385-16.935385 16.935384-28.199385V73.334154A74.673231 74.673231 0 0 0 804.233846 0H606.680615v220.002462c0 22.606769-16.935385 33.870769-39.463384 33.870769H454.262154c-22.528 0-39.463385-16.935385-39.463385-33.870769V5.671385H222.838154c-45.134769 0-79.005538 33.870769-79.005539 73.255384v56.477539c0 11.264 5.671385 22.528 16.935385 28.199384l186.289231 124.140308h16.935384C200.310154 349.735385 98.697846 507.746462 121.304615 693.878154c22.528 169.275077 169.353846 310.350769 344.221539 327.207384 237.095385 28.199385 440.32-152.339692 440.32-377.934769 0-158.011077-101.612308-299.008-248.359385-355.406769z m-146.747077 671.271385C335.793231 959.015385 189.046154 818.018462 189.046154 643.150769c0-174.867692 146.747077-310.350769 321.693538-310.350769 174.946462 0 321.693538 141.075692 321.693539 315.943385s-146.747077 310.350769-321.693539 310.350769zM670.798769 572.967385l-68.371692-11.185231a31.507692 31.507692 0 0 1-28.514462-16.777846l-28.514461-55.926154c-17.092923-27.963077-51.278769-27.963077-68.371692 0l-28.514462 55.926154a31.507692 31.507692 0 0 1-28.514462 16.777846l-68.371692 11.185231c-28.514462 5.592615-39.936 39.148308-17.092923 61.44l45.528615 39.227077c5.750154 11.185231 17.171692 22.370462 11.421539 33.555692l-11.421539 67.111384c-5.671385 27.963077 28.514462 50.333538 51.357539 33.555693l62.700308-27.963077a37.021538 37.021538 0 0 1 34.185846 0l62.700307 33.555692c28.514462 16.777846 57.028923-5.592615 51.27877-33.555692l-11.421539-67.111385c0-16.777846 5.750154-27.963077 11.421539-33.555692l51.278769-44.740923a38.596923 38.596923 0 0 0-22.843077-61.518769z</Geometry>
|
||||
<Geometry x:Key="GitHubStrGeometry">M1185.92 769.92h-1.28c0.576 0 0.96 0.64 1.536 0.704h0.384l-0.64-0.64z m0.256 0.704c-5.952 0.064-20.928 3.2-36.736 3.2-49.92 0-67.2-23.04-67.2-53.12V520.32h101.76c5.76 0 10.24-5.12 10.24-12.16v-108.8c0-5.76-5.12-10.88-10.24-10.88h-101.76V253.44c0-5.12-3.2-8.32-8.96-8.32h-138.24c-5.76 0-8.96 3.2-8.96 8.32v138.88s-69.76 17.28-74.24 17.92c-5.12 1.28-8.32 5.76-8.32 10.88v87.04c0 7.04 5.12 12.16 10.88 12.16h71.04v209.92c0 156.16 108.8 172.16 183.04 172.16 33.92 0 74.88-10.88 81.28-14.08 3.84-1.28 5.76-5.76 5.76-10.24v-96a11.328 11.328 0 0 0-9.344-11.52z m1516.544-140.8c0-115.84-46.72-131.2-96-126.08-38.4 2.56-69.12 21.76-69.12 21.76v225.28s31.36 21.76 78.08 23.04c65.92 1.92 87.04-21.76 87.04-144z m155.52-10.24c0 219.52-71.04 282.24-195.2 282.24-104.96 0-161.28-53.12-161.28-53.12s-2.56 29.44-5.76 33.28c-1.92 3.84-5.12 5.12-8.96 5.12h-94.72c-6.4 0-12.16-5.12-12.16-10.88l1.28-711.04c0-5.76 5.12-10.88 10.88-10.88h136.32c5.76 0 10.88 5.12 10.88 10.88v241.28s52.48-33.92 129.28-33.92l-0.64-1.28c76.8 0 190.08 28.8 190.08 248.32z m-558.08-231.04H2165.76c-7.04 0-10.88 5.12-10.88 12.16v348.16s-35.2 24.96-83.2 24.96-62.08-21.76-62.08-69.76V400c0-5.76-5.12-10.88-10.88-10.88h-136.96c-5.76 0-10.88 5.12-10.88 10.88v327.04c0 140.8 78.72 176 186.88 176 88.96 0 161.28-49.28 161.28-49.28s3.2 24.96 5.12 28.8c1.28 3.2 5.76 5.76 10.24 5.76h85.76c7.04 0 10.88-5.12 10.88-10.88l1.28-478.08c0-5.76-5.12-10.88-12.16-10.88z m-1516.8-0.64h-136.32c-5.76 0-10.88 5.76-10.88 12.8v469.76c0 12.8 8.32 17.28 19.2 17.28h122.88c12.8 0 16-5.76 16-17.28V398.72c0-5.76-5.12-10.88-10.88-10.88z m-67.2-216.32c-49.28 0-88.32 39.04-88.32 88.32 0 49.28 39.04 88.32 88.32 88.32 48 0 87.04-39.04 87.04-88.32 0-49.28-39.04-88.32-87.04-88.32z m1055.36-16h-135.04c-5.76 0-10.88 5.12-10.88 10.88v261.76h-211.84V166.4c0-5.76-5.12-10.88-10.88-10.88h-136.32c-5.76 0-10.88 5.12-10.88 10.88v711.04c0 5.76 5.76 10.88 10.88 10.88h136.32c5.76 0 10.88-5.12 10.88-10.88V573.44h211.84l-1.28 304c0 5.76 5.12 10.88 10.88 10.88h136.32c5.76 0 10.88-5.12 10.88-10.88V166.4c0-5.76-5.12-10.88-10.88-10.88zM563.84 470.4v367.36c0 2.56-0.64 7.04-3.84 8.32 0 0-80 56.96-211.84 56.96-159.36 0-348.16-49.92-348.16-378.88S165.12 127.36 326.4 128c139.52 0 195.84 31.36 204.8 37.12 2.56 3.2 3.84 5.76 3.84 8.96L508.16 288c0 5.76-5.76 12.8-12.8 10.88-23.04-7.04-57.6-21.12-138.88-21.12-94.08 0-195.2 26.88-195.2 238.72s96 236.8 165.12 236.8c58.88 0 80-7.04 80-7.04v-147.2H312.32c-7.04 0-12.16-5.12-12.16-10.88V470.4c0-5.76 5.12-10.88 12.16-10.88h239.36c7.04 0 12.16 5.12 12.16 10.88z</Geometry>
|
||||
<Geometry x:Key="QqGeometry">M936.194300839506 691.6934192494618c-5.891587367822223-94.26540047423211-70.69904970840491-170.8560375504593-106.04857520987652-212.09715041975304 5.891587367822223-11.783174735644446 17.674762103466666-79.53643140740742-29.457938133649378-126.66913164452346V349.981342854005c0-182.63921228610366-129.61492468116543-315.1999312984493-294.57937486380246-315.1999312984493s-294.57937615834066 132.5607190123457-294.57937615834066 315.1999312984493v2.9457943311802466c-47.132700237116055 47.132700237116055-35.349525501471604 114.885956908879-29.45793683911111 126.66913164452346-35.349525501471604 41.24111286929382-100.15698784205432 117.83174994552098-106.04857520987652 212.09715041975304 0 23.56634947128889 2.9457943311802466 58.91587497276049 14.728969066824689 76.59063707622718 14.728969066824689 20.62055643464691 55.97008193611851-2.9457943311802466 82.48222444404936-64.80746234058272 8.837381699002469 29.457938133649378 26.51214380246913 73.64484403958517 67.75325667176295 126.66913164452346-70.69904970840491 14.728969066824689-88.37381310640988 85.42801877522965-64.80746234058272 123.72333731334321 17.674762103466666 26.51214380246913 53.02428760493826 47.132700237116055 120.77754298216297 47.132700237116055 114.885956908879 0 167.9102445138173-32.40373117029136 191.4765952796444-53.02428760493826 5.891587367822223-5.891587367822223 11.783174735644446-5.891587367822223 20.620555140108642-5.891587367822223 8.837381699002469 0 14.728969066824689 2.9457943311802466 20.62055643464691 5.891587367822223 23.56634947128889 20.62055643464691 73.64484403958517 53.02428760493826 191.4765939851062 53.02428760493826 64.80746234058272 0 103.10278087869627-20.62055643464691 120.77754427670124-47.132700237116055 23.56634947128889-38.29531853811359 2.9457943311802466-106.04857520987652-64.80746234058272-123.72333731334321 41.24111286929382-55.97008193611851 58.91587497276049-100.15698784205432 67.75325667176295-126.66913164452346 29.457938133649378 61.86166930394074 67.75325667176295 85.42801877522965 82.48222444404936 64.80746234058272 5.891587367822223-17.674762103466666 11.783174735644446-53.02428760493826 8.837381699002469-76.59063707622718z m0 0</Geometry>
|
||||
<Geometry x:Key="ProjectGeometry">M838.4 325.12 554.24 479.36C528 493.44 512 521.6 512 552.96l0 298.24c0 32 31.36 53.12 57.6 38.4l284.16-154.24c25.6-14.08 42.24-42.24 42.24-73.6L896 364.16C896 331.52 864.64 311.04 838.4 325.12zM405.76 478.72 121.6 325.12C95.36 311.04 64 331.52 64 363.52l0 299.52c0 31.36 16 59.52 42.24 73.6l284.16 153.6C416.64 904.32 448 883.2 448 851.2L448 552.32C448 520.96 432 492.8 405.76 478.72zM812.16 255.36c13.44-7.04 19.84-19.2 18.56-30.72 1.28-12.16-5.12-23.68-18.56-30.72L522.88 42.88c-12.8-7.04-28.16-10.24-43.52-10.24-15.36 0-30.72 3.2-43.52 10.24L146.56 193.28C133.12 200.32 127.36 212.48 128 224 127.36 236.16 133.12 248.32 146.56 255.36l289.28 150.4c12.8 7.04 28.16 10.24 43.52 10.24 15.36 0 30.72-3.2 43.52-10.24L812.16 255.36z</Geometry>
|
||||
<Geometry x:Key="BlogGeometry">M1137.575865 0l0 795.939663-267.130435 228.060337-870.44543 0 0-1024 1137.575865 0zM795.939663 682.363798l-626.030169 0 0 113.575865 626.030169 0 0-113.575865zM966.757764 455.212067l-796.84827 0 0 113.575865 796.84827 0 0-113.575865zM966.757764 227.15173l-796.84827 0 0 114.484472 796.84827 0 0-114.484472z</Geometry>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -78,18 +78,18 @@ namespace HandyControlDemo.Service
|
||||
return list;
|
||||
}
|
||||
|
||||
internal List<ContributorModel> GetContributorDataList()
|
||||
internal List<AvatarModel> GetContributorDataList()
|
||||
{
|
||||
var client = new WebClient();
|
||||
client.Headers.Add("User-Agent", "request");
|
||||
var list = new List<ContributorModel>();
|
||||
var list = new List<AvatarModel>();
|
||||
try
|
||||
{
|
||||
var json = client.DownloadString(new Uri("https://api.github.com/repos/nabian/handycontrol/contributors"));
|
||||
var objList = JsonConvert.DeserializeObject<List<dynamic>>(json);
|
||||
list.AddRange(objList.Select(item => new ContributorModel
|
||||
list.AddRange(objList.Select(item => new AvatarModel
|
||||
{
|
||||
UserName = item.login,
|
||||
DisplayName = item.login,
|
||||
AvatarUri = item.avatar_url,
|
||||
Link = item.html_url
|
||||
}));
|
||||
@@ -101,6 +101,44 @@ namespace HandyControlDemo.Service
|
||||
return list;
|
||||
}
|
||||
|
||||
internal List<AvatarModel> GetBlogDataList()
|
||||
{
|
||||
return new List<AvatarModel>
|
||||
{
|
||||
new AvatarModel
|
||||
{
|
||||
DisplayName = "林德熙",
|
||||
AvatarUri = "https://avatars3.githubusercontent.com/u/16054566?s=400&v=4",
|
||||
Link = "https://blog.lindexi.com/"
|
||||
},
|
||||
new AvatarModel
|
||||
{
|
||||
DisplayName = "吕毅",
|
||||
AvatarUri = "https://avatars2.githubusercontent.com/u/9959623?s=400&v=4",
|
||||
Link = "https://blog.walterlv.com/"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
internal List<AvatarModel> GetProjectDataList()
|
||||
{
|
||||
return new List<AvatarModel>
|
||||
{
|
||||
new AvatarModel
|
||||
{
|
||||
DisplayName = "phpEnv",
|
||||
AvatarUri = "https://cdn.phpenv.cn:444/logo.png",
|
||||
Link = "https://www.phpenv.cn/"
|
||||
},
|
||||
new AvatarModel
|
||||
{
|
||||
DisplayName = "AutumnBox",
|
||||
AvatarUri = "https://www.atmb.top/images/leaves.png",
|
||||
Link = "https://github.com/zsh2401/AutumnBox"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
internal List<StepBarDemoModel> GetStepBarDemoDataList()
|
||||
{
|
||||
return new List<StepBarDemoModel>
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
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:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
Margin="16"
|
||||
Effect="{StaticResource EffectShadow5}"
|
||||
Cursor="Hand"
|
||||
mc:Ignorable="d">
|
||||
<Button Style="{StaticResource ButtonCustom}" Click="ButtonAvatar_OnClick">
|
||||
<Button Style="{StaticResource ButtonCustom}" Command="hc:ControlCommands.OpenLink" CommandParameter="{Binding Link,RelativeSource={RelativeSource AncestorType=UserControl}}" >
|
||||
<Border Background="{DynamicResource SecondaryRegionBrush}" CornerRadius="10">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
@@ -15,7 +16,7 @@
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Image Source="{Binding Source,RelativeSource={RelativeSource AncestorType=UserControl}}" Height="120" Width="120" Stretch="Uniform" Margin="10"/>
|
||||
<TextBlock TextTrimming="CharacterEllipsis" TextWrapping="NoWrap" Margin="0,0,0,10" Grid.Row="1" Style="{StaticResource TextBlockDefault}" Text="{Binding UserName,RelativeSource={RelativeSource AncestorType=UserControl}}"></TextBlock>
|
||||
<TextBlock TextTrimming="CharacterEllipsis" TextWrapping="NoWrap" Margin="0,0,0,10" Grid.Row="1" Style="{StaticResource TextBlockDefault}" Text="{Binding DisplayName,RelativeSource={RelativeSource AncestorType=UserControl}}"></TextBlock>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Button>
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
{
|
||||
public partial class Avatar
|
||||
@@ -22,9 +20,9 @@ namespace HandyControlDemo.UserControl
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty UserNameProperty = DependencyProperty.Register(
|
||||
"UserName", typeof(string), typeof(Avatar), new PropertyMetadata(default(string)));
|
||||
"DisplayName", typeof(string), typeof(Avatar), new PropertyMetadata(default(string)));
|
||||
|
||||
public string UserName
|
||||
public string DisplayName
|
||||
{
|
||||
get => (string) GetValue(UserNameProperty);
|
||||
set => SetValue(UserNameProperty, value);
|
||||
@@ -38,7 +36,5 @@ namespace HandyControlDemo.UserControl
|
||||
get => (string) GetValue(LinkProperty);
|
||||
set => SetValue(LinkProperty, value);
|
||||
}
|
||||
|
||||
private void ButtonAvatar_OnClick(object sender, RoutedEventArgs e) => Process.Start(Link);
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -1,5 +1,4 @@
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl
|
||||
{
|
||||
public partial class AnimationPathDemoCtl
|
||||
{
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
<hc:Shield Subject=".net" Status=">=4.0" Color="#1182c3"/>
|
||||
<hc:Shield Subject="c#" Status="7.0" Margin="4,0,0,0" Color="#1182c3"/>
|
||||
<hc:Shield Subject="IDE" Status="2017" Margin="4,0,0,0" Color="#1182c3"/>
|
||||
<hc:Shield Subject="chat" Status="on gitter" Margin="4,0,0,0" Color="#4eb899" Command="hc:ControlCommands.OpenLink" hc:LinkElement.Link="https://gitter.im/HandyControl/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"/>
|
||||
<hc:Shield Subject="qq" Status="714704041" Margin="4,0,0,0" Color="#d8624c" Command="hc:ControlCommands.OpenLink" hc:LinkElement.Link="http://shang.qq.com/wpa/qunwpa?idkey=a571e5553c9d41e49c4f22f3a8b2865451497a795ff281fedf3285def247efc1"/>
|
||||
<hc:Shield Subject="chat" Status="on gitter" Margin="4,0,0,0" Color="#4eb899" Command="hc:ControlCommands.OpenLink" CommandParameter="https://gitter.im/HandyControl/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"/>
|
||||
<hc:Shield Subject="qq" Status="714704041" Margin="4,0,0,0" Color="#d8624c" Command="hc:ControlCommands.OpenLink" CommandParameter="http://shang.qq.com/wpa/qunwpa?idkey=a571e5553c9d41e49c4f22f3a8b2865451497a795ff281fedf3285def247efc1"/>
|
||||
</StackPanel>
|
||||
</hc:TransitioningContentControl>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,14 @@
|
||||
<UserControl x:Class="HandyControlDemo.UserControl.BlogsView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:userControl="clr-namespace:HandyControlDemo.UserControl"
|
||||
DataContext="{Binding BlogsView,Source={StaticResource Locator}}"
|
||||
Background="{DynamicResource SecondaryRegionBrush}">
|
||||
<ListBox Background="{DynamicResource BlogDrawingBrush}" ItemContainerStyle="{StaticResource ListBoxItemCustom}" BorderThickness="0" ItemsSource="{Binding DataList}" ItemsPanel="{StaticResource FluidMoveBehaviorWrapPanelItemsPanelTemplate}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<userControl:Avatar DisplayName="{Binding DisplayName}" Link="{Binding Link}" Source="{Binding AvatarUri}"/>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
{
|
||||
public partial class BlogsView
|
||||
{
|
||||
public BlogsView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
<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}"/>
|
||||
<userControl:Avatar DisplayName="{Binding DisplayName}" Link="{Binding Link}" Source="{Binding AvatarUri}"/>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
@@ -316,8 +316,8 @@
|
||||
</Border>
|
||||
<Border Visibility="Visible" BorderThickness="0" Padding="16" Style="{StaticResource BorderRegion}" CornerRadius="4" Canvas.Left="128" Canvas.Top="310" Width="162" Height="84">
|
||||
<WrapPanel VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
<hc:Shield Subject="chat" Status="on gitter" Margin="0,0,0,0" Color="#4eb899" Command="hc:ControlCommands.OpenLink" hc:LinkElement.Link="https://gitter.im/HandyControl/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"/>
|
||||
<hc:Shield Subject="qq" Status="714704041" Margin="0,4,0,0" Color="#d8624c" Command="hc:ControlCommands.OpenLink" hc:LinkElement.Link="http://shang.qq.com/wpa/qunwpa?idkey=a571e5553c9d41e49c4f22f3a8b2865451497a795ff281fedf3285def247efc1"/>
|
||||
<hc:Shield Subject="chat" Status="on gitter" Margin="0,0,0,0" Color="#4eb899" Command="hc:ControlCommands.OpenLink" CommandParameter="https://gitter.im/HandyControl/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"/>
|
||||
<hc:Shield Subject="qq" Status="714704041" Margin="0,4,0,0" Color="#d8624c" Command="hc:ControlCommands.OpenLink" CommandParameter="http://shang.qq.com/wpa/qunwpa?idkey=a571e5553c9d41e49c4f22f3a8b2865451497a795ff281fedf3285def247efc1"/>
|
||||
</WrapPanel>
|
||||
</Border>
|
||||
<Border Visibility="Visible" BorderThickness="0" Padding="16" Style="{StaticResource BorderRegion}" CornerRadius="4" Canvas.Left="128" Canvas.Top="408">
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<UserControl x:Class="HandyControlDemo.UserControl.ProjectsView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:userControl="clr-namespace:HandyControlDemo.UserControl"
|
||||
DataContext="{Binding ProjectsView,Source={StaticResource Locator}}"
|
||||
Background="{DynamicResource SecondaryRegionBrush}">
|
||||
<ListBox Background="{DynamicResource ProjectDrawingBrush}" ItemContainerStyle="{StaticResource ListBoxItemCustom}" BorderThickness="0" ItemsSource="{Binding DataList}" ItemsPanel="{StaticResource FluidMoveBehaviorWrapPanelItemsPanelTemplate}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<userControl:Avatar DisplayName="{Binding DisplayName}" Link="{Binding Link}" Source="{Binding AvatarUri}"/>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
{
|
||||
public partial class ProjectsView
|
||||
{
|
||||
public ProjectsView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using System.Threading.Tasks;
|
||||
using HandyControlDemo.Data;
|
||||
using HandyControlDemo.Service;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
{
|
||||
public class ContributorsViewModel : DemoViewModelBase<ContributorModel>
|
||||
{
|
||||
public ContributorsViewModel(DataService dataService)
|
||||
{
|
||||
#if netle40
|
||||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
DataList = dataService.GetContributorDataList();
|
||||
});
|
||||
#else
|
||||
Task.Run(() =>
|
||||
{
|
||||
DataList = dataService.GetContributorDataList();
|
||||
});
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using HandyControlDemo.Data;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
{
|
||||
public class ItemsDisplayViewModel : DemoViewModelBase<AvatarModel>
|
||||
{
|
||||
public ItemsDisplayViewModel(Func<List<AvatarModel>> getDatAction)
|
||||
{
|
||||
#if netle40
|
||||
Task.Factory.StartNew(() => DataList = getDatAction?.Invoke());
|
||||
#else
|
||||
Task.Run(() => DataList = getDatAction?.Invoke());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using GalaSoft.MvvmLight;
|
||||
using GalaSoft.MvvmLight.CommandWpf;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using HandyControlDemo.Data;
|
||||
using HandyControlDemo.Tools;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
{
|
||||
public class NoUserViewModel : ViewModelBase
|
||||
{
|
||||
public RelayCommand<string> OpenViewCmd => new Lazy<RelayCommand<string>>(() =>
|
||||
new RelayCommand<string>(OpenView)).Value;
|
||||
|
||||
private void OpenView(string viewName)
|
||||
{
|
||||
Messenger.Default.Send<object>(null, MessageToken.ClearLeftSelected);
|
||||
Messenger.Default.Send(true, MessageToken.FullSwitch);
|
||||
Messenger.Default.Send(AssemblyHelper.CreateInternalInstance($"UserControl.{viewName}"), MessageToken.LoadShowContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,9 @@ namespace HandyControlDemo.ViewModel
|
||||
SimpleIoc.Default.Register<ImageBrowserDemoViewModel>();
|
||||
SimpleIoc.Default.Register<ComboBoxDemoViewModel>();
|
||||
SimpleIoc.Default.Register<WindowDemoViewModel>();
|
||||
SimpleIoc.Default.Register<ContributorsViewModel>();
|
||||
SimpleIoc.Default.Register(() => new ItemsDisplayViewModel(ServiceLocator.Current.GetInstance<DataService>().GetContributorDataList), "Contributors");
|
||||
SimpleIoc.Default.Register(() => new ItemsDisplayViewModel(ServiceLocator.Current.GetInstance<DataService>().GetBlogDataList), "Blogs");
|
||||
SimpleIoc.Default.Register(() => new ItemsDisplayViewModel(ServiceLocator.Current.GetInstance<DataService>().GetProjectDataList), "Projects");
|
||||
SimpleIoc.Default.Register<StepBarDemoViewModel>();
|
||||
SimpleIoc.Default.Register<PaginationDemoViewModel>();
|
||||
SimpleIoc.Default.Register<ChatBoxViewModel>();
|
||||
@@ -35,6 +37,7 @@ namespace HandyControlDemo.ViewModel
|
||||
SimpleIoc.Default.Register<BadgeDemoViewModel>();
|
||||
SimpleIoc.Default.Register<SideMenuDemoViewModel>();
|
||||
SimpleIoc.Default.Register<TabControlDemoViewModel>();
|
||||
SimpleIoc.Default.Register<NoUserViewModel>();
|
||||
}
|
||||
|
||||
public static ViewModelLocator Instance => new Lazy<ViewModelLocator>(() =>
|
||||
@@ -54,7 +57,11 @@ namespace HandyControlDemo.ViewModel
|
||||
|
||||
public WindowDemoViewModel WindowDemo => ServiceLocator.Current.GetInstance<WindowDemoViewModel>();
|
||||
|
||||
public ContributorsViewModel ContributorsView => ServiceLocator.Current.GetInstance<ContributorsViewModel>();
|
||||
public ItemsDisplayViewModel ContributorsView => ServiceLocator.Current.GetInstance<ItemsDisplayViewModel>("Contributors");
|
||||
|
||||
public ItemsDisplayViewModel BlogsView => ServiceLocator.Current.GetInstance<ItemsDisplayViewModel>("Blogs");
|
||||
|
||||
public ItemsDisplayViewModel ProjectsView => ServiceLocator.Current.GetInstance<ItemsDisplayViewModel>("Projects");
|
||||
|
||||
public StepBarDemoViewModel StepBarDemo => ServiceLocator.Current.GetInstance<StepBarDemoViewModel>();
|
||||
|
||||
@@ -78,6 +85,8 @@ namespace HandyControlDemo.ViewModel
|
||||
|
||||
public TabControlDemoViewModel TabControlDemo => ServiceLocator.Current.GetInstance<TabControlDemoViewModel>();
|
||||
|
||||
public NoUserViewModel NoUser => ServiceLocator.Current.GetInstance<NoUserViewModel>();
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using HandyControl.Interactivity;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
public class LinkElement
|
||||
{
|
||||
public static readonly DependencyProperty LinkProperty = DependencyProperty.RegisterAttached(
|
||||
"Link", typeof(string), typeof(LinkElement), new PropertyMetadata(default(string), OnLinkChanged));
|
||||
|
||||
private static void OnLinkChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is UIElement element)
|
||||
{
|
||||
CreateTrigger(element, (string) e.NewValue);
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly DependencyProperty CommandBindingProperty = DependencyProperty.RegisterAttached(
|
||||
"CommandBinding", typeof(CommandBinding), typeof(LinkElement), new PropertyMetadata(default(CommandBinding)));
|
||||
|
||||
private static void SetCommandBinding(DependencyObject element, CommandBinding value)
|
||||
=> element.SetValue(CommandBindingProperty, value);
|
||||
|
||||
private static CommandBinding GetCommandBinding(DependencyObject element)
|
||||
=> (CommandBinding) element.GetValue(CommandBindingProperty);
|
||||
|
||||
private static void CreateTrigger(UIElement element, string link)
|
||||
{
|
||||
element.CommandBindings.Remove(GetCommandBinding(element));
|
||||
element.SetCurrentValue(CommandBindingProperty, DependencyProperty.UnsetValue);
|
||||
|
||||
if (string.IsNullOrEmpty(link)) return;
|
||||
var commandBinding = new CommandBinding(ControlCommands.OpenLink, (sender, args) => Process.Start(link));
|
||||
SetCommandBinding(element, commandBinding);
|
||||
element.CommandBindings.Add(commandBinding);
|
||||
}
|
||||
|
||||
public static void SetLink(DependencyObject element, string value)
|
||||
=> element.SetValue(LinkProperty, value);
|
||||
|
||||
public static string GetLink(DependencyObject element)
|
||||
=> (string) element.GetValue(LinkProperty);
|
||||
}
|
||||
}
|
||||
@@ -16,9 +16,9 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\IconElement.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\IconSwitchElement.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\InfoElement.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\LinkElement.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\PanelElement.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\PasswordBoxMonitor.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Commands\OpenLinkCommand.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\GlobalShortcut.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\StatusSwitchElement.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\TipElement.cs" />
|
||||
@@ -182,7 +182,7 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Behavior!1.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Behavior.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\BehaviorCollection.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\ControlCommands.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Commands\ControlCommands.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\DefaultTriggerAttribute.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\EventToCommand.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\EventTrigger.cs" />
|
||||
@@ -201,9 +201,9 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\NameResolvedEventArgs.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\NameResolver.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\PreviewInvokeEventArgs.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\PushMainWindow2TopCommand.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Commands\PushMainWindow2TopCommand.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\RoutedEventTrigger.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\ShutdownAppCommand.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Commands\ShutdownAppCommand.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\TagType.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\TransitionEffect.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\TriggerAction!1.cs" />
|
||||
|
||||
+1
-1
@@ -145,7 +145,7 @@ namespace HandyControl.Interactivity
|
||||
/// <summary>
|
||||
/// 打开链接
|
||||
/// </summary>
|
||||
public static RoutedCommand OpenLink { get; } = new RoutedCommand(nameof(OpenLink), typeof(ControlCommands));
|
||||
public static OpenLinkCommand OpenLink { get; } = new OpenLinkCommand();
|
||||
|
||||
/// <summary>
|
||||
/// 关闭程序
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace HandyControl.Interactivity
|
||||
{
|
||||
public class OpenLinkCommand : ICommand
|
||||
{
|
||||
public bool CanExecute(object parameter) => true;
|
||||
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
if (parameter is string link)
|
||||
{
|
||||
Process.Start(link);
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler CanExecuteChanged;
|
||||
}
|
||||
}
|
||||
File renamed without changes.
Reference in new issue
Block a user