add AboutWindow

This commit is contained in:
NaBian committed 2018-12-27 17:05:05 +08:00
1 parent bb94944991
commit bce4cacf11
16 files changed
+151 -71

No files matched your search

+18
View File
@@ -37,6 +37,16 @@
<WarningLevel>4</WarningLevel>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release-Net47|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Resources\Img\icon.ico</ApplicationIcon>
</PropertyGroup>
@@ -297,6 +307,9 @@
<Compile Include="ViewModel\StepBarDemoViewModel.cs" />
<Compile Include="ViewModel\ViewModelLocator.cs" />
<Compile Include="ViewModel\WindowDemoViewModel.cs" />
<Compile Include="Window\AboutWindow.xaml.cs">
<DependentUpon>AboutWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Window\BlurWindow.xaml.cs">
<DependentUpon>BlurWindow.xaml</DependentUpon>
</Compile>
@@ -614,6 +627,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Window\AboutWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Window\BlurWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -718,6 +735,7 @@
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
@@ -56,6 +56,7 @@
<Path Data="{StaticResource CnblogsGeometry}" Fill="{DynamicResource PrimaryTextBrush}"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="{x:Static langs:Lang.About}" Click="MenuAbout_OnClick"/>
</MenuItem>
<MenuItem Click="MenuItemContributors_OnClick" Foreground="White" Header="{x:Static langs:Lang.Contributors}">
<MenuItem.Icon>
@@ -8,6 +8,7 @@ using HandyControl.Controls;
using HandyControl.Data;
using HandyControlDemo.Data;
using HandyControlDemo.Tools;
using HandyControlDemo.Window;
// ReSharper disable once CheckNamespace
namespace HandyControlDemo.UserControl
@@ -72,5 +73,13 @@ namespace HandyControlDemo.UserControl
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
{
Owner = Application.Current.MainWindow
}.ShowDialog();
}
}
}
@@ -1,4 +1,5 @@
using System;
using System.Windows;
using GalaSoft.MvvmLight.CommandWpf;
using HandyControlDemo.Tools;
@@ -12,6 +13,7 @@ namespace HandyControlDemo.ViewModel
{
if (AssemblyHelper.CreateInternalInstance($"Window.{windowTag}") is System.Windows.Window window)
{
window.Owner = Application.Current.MainWindow;
window.ShowDialog();
}
}
+31
View File
@@ -0,0 +1,31 @@
<controls:Window x:Class="HandyControlDemo.Window.AboutWindow"
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"
mc:Ignorable="d"
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
Title="{x:Static langs:Lang.About}"
ShowTitle="True"
BorderThickness="1"
BorderBrush="#262e2f"
NonClientAreaBackground="White"
NonClientAreaForeground="{StaticResource PrimaryTextBrush}"
CloseButtonForeground="{StaticResource PrimaryTextBrush}"
OtherButtonForeground="{StaticResource PrimaryTextBrush}"
OtherButtonHoverBackground="#e5e5e5"
Style="{StaticResource WindowWin10}"
ResizeMode="NoResize"
ShowInTaskbar="False"
WindowStartupLocation="CenterOwner"
Width="340"
Height="220">
<Grid>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,30,0,0">
<TextBlock Text="HandyControl" FontSize="30" Foreground="{StaticResource PrimaryBrush}" VerticalAlignment="Top" HorizontalAlignment="Center"/>
<TextBlock Text="{Binding Version}" HorizontalAlignment="Center" Margin="0,10,0,0" Foreground="{StaticResource PrimaryBrush}"/>
</StackPanel>
<TextBlock Text="{Binding CopyRight}" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0,14" Foreground="{StaticResource ThirdlyTextBrush}"/>
</Grid>
</controls:Window>
@@ -0,0 +1,38 @@
using System.Diagnostics;
using System.Reflection;
using System.Windows;
namespace HandyControlDemo.Window
{
public partial class AboutWindow
{
public AboutWindow()
{
InitializeComponent();
DataContext = this;
var versionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location);
CopyRight = versionInfo.LegalCopyright;
Version = $"v {versionInfo.FileVersion}";
}
public static readonly DependencyProperty CopyRightProperty = DependencyProperty.Register(
"CopyRight", typeof(string), typeof(AboutWindow), new PropertyMetadata(default(string)));
public string CopyRight
{
get => (string) GetValue(CopyRightProperty);
set => SetValue(CopyRightProperty, value);
}
public static readonly DependencyProperty VersionProperty = DependencyProperty.Register(
"Version", typeof(string), typeof(AboutWindow), new PropertyMetadata(default(string)));
public string Version
{
get => (string) GetValue(VersionProperty);
set => SetValue(VersionProperty, value);
}
}
}