add versioninfo in nonclientarea
This commit is contained in:
1 parent
5e31009dcf
commit
19be9982c2
11 files changed
+76
-40
No files matched your search
@@ -3,7 +3,7 @@
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AssemblyName>HandyControlDemo</AssemblyName>
|
||||
<RootNamespace>HandyControlDemo</RootNamespace>
|
||||
<TargetFrameworks>netcoreapp3.0;netcoreapp3.1;net45;net462;net47;net48;net5.0</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp3.0;netcoreapp3.1;net45;net462;net47;net48;net5.0-windows</TargetFrameworks>
|
||||
<ApplicationIcon>..\..\Shared\HandyControlDemo_Shared\Resources\Img\icon.ico</ApplicationIcon>
|
||||
<NoWarn>0108</NoWarn>
|
||||
<UseWPF>true</UseWPF>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<PropertyGroup>
|
||||
<AssemblyName>HandyControl</AssemblyName>
|
||||
<RootNamespace>HandyControl</RootNamespace>
|
||||
<TargetFrameworks>netcoreapp3.0;netcoreapp3.1;net45;net462;net47;net48;net5.0</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp3.0;netcoreapp3.1;net45;net462;net47;net48;net5.0-windows</TargetFrameworks>
|
||||
<Description>Contains some commonly used simple WPF controls</Description>
|
||||
<PackageId>HandyControl</PackageId>
|
||||
<IncludeSymbols>true</IncludeSymbols>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<UseWPF>true</UseWPF>
|
||||
<AssemblyName>HandyControlDemoCode</AssemblyName>
|
||||
<RootNamespace>HandyControlDemoCode</RootNamespace>
|
||||
<TargetFrameworks>netcoreapp3.0;netcoreapp3.1;net40;net45;net462;net47;net48;net5.0</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp3.0;netcoreapp3.1;net40;net45;net462;net47;net48;net5.0-windows</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Window\AboutWindow.xaml">
|
||||
@@ -888,7 +888,7 @@
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\ViewModel\Main\MainViewModel.cs">
|
||||
<Link>ViewModel\MainViewModel.cs</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\ViewModel\Main\NoUserViewModel.cs">
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\ViewModel\Main\NonClientAreaViewModel.cs">
|
||||
<Link>ViewModel\NoUserViewModel.cs</Link>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\StringRepeatConverter.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Extension\LangExtension.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\AssemblyHelper.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\VersionHelper.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\Win32Helper.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Basic\Avatar.xaml.cs">
|
||||
<DependentUpon>Avatar.xaml</DependentUpon>
|
||||
@@ -268,8 +269,8 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Main\MainWindowContent.xaml.cs">
|
||||
<DependentUpon>MainWindowContent.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Main\NoUserContent.xaml.cs">
|
||||
<DependentUpon>NoUserContent.xaml</DependentUpon>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Main\NonClientAreaContent.cs">
|
||||
<DependentUpon>NonClientAreaContent.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Main\ProjectsView.xaml.cs">
|
||||
<DependentUpon>ProjectsView.xaml</DependentUpon>
|
||||
@@ -422,7 +423,7 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\DemoViewModelBase!1.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\Main\NonClientAreaViewModel.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\ViewModelLocator.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Window\AboutWindow.xaml.cs">
|
||||
<DependentUpon>AboutWindow.xaml</DependentUpon>
|
||||
@@ -811,7 +812,7 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)UserControl\Main\NoUserContent.xaml">
|
||||
<Page Include="$(MSBuildThisFileDirectory)UserControl\Main\NonClientAreaContent.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace HandyControlDemo
|
||||
base.OnContentRendered(e);
|
||||
|
||||
DataContext = ViewModelLocator.Instance.Main;
|
||||
NonClientAreaContent = new NoUserContent();
|
||||
NonClientAreaContent = new NonClientAreaContent();
|
||||
ControlMain.Content = new MainWindowContent();
|
||||
|
||||
GlobalShortcut.Init(new List<KeyBinding>
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
|
||||
namespace HandyControlDemo.Tools
|
||||
{
|
||||
internal class VersionHelper
|
||||
{
|
||||
internal static string GetVersion()
|
||||
{
|
||||
var versionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location);
|
||||
#if NET40
|
||||
var netVersion = "NET 40";
|
||||
#elif NET45
|
||||
var netVersion = "NET 45";
|
||||
#elif NET462
|
||||
var netVersion = "NET 462";
|
||||
#elif NET47
|
||||
var netVersion = "NET 47";
|
||||
#elif NET48
|
||||
var netVersion = "NET 48";
|
||||
#elif NET5_0
|
||||
var netVersion = "NET 50";
|
||||
#elif NETCOREAPP3_0
|
||||
var netVersion = "CORE 30";
|
||||
#elif NETCOREAPP3_1
|
||||
var netVersion = "CORE 31";
|
||||
#endif
|
||||
return $"v {versionInfo.FileVersion} {netVersion}";
|
||||
}
|
||||
|
||||
internal static string GetCopyright() =>
|
||||
FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location).LegalCopyright;
|
||||
}
|
||||
}
|
||||
+4
-3
@@ -1,4 +1,5 @@
|
||||
using System.Globalization;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
@@ -10,9 +11,9 @@ using HandyControlDemo.Window;
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
{
|
||||
public partial class NoUserContent
|
||||
public partial class NonClientAreaContent
|
||||
{
|
||||
public NoUserContent()
|
||||
public NonClientAreaContent()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
+4
-1
@@ -1,4 +1,4 @@
|
||||
<Grid x:Class="HandyControlDemo.UserControl.NoUserContent"
|
||||
<Grid x:Class="HandyControlDemo.UserControl.NonClientAreaContent"
|
||||
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"
|
||||
@@ -110,6 +110,9 @@
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
<Border Margin="10,0,0,0" VerticalAlignment="Center" CornerRadius="2" Padding="10,4" Background="{DynamicResource SecondaryRegionBrush}">
|
||||
<TextBlock FontWeight="Bold" Text="{Binding VersionInfo}" VerticalAlignment="Center" Foreground="{DynamicResource PrimaryTextBrush}"/>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<Button Grid.Column="1" Click="ButtonConfig_OnClick" Name="ButtonConfig" Style="{StaticResource ButtonIcon}" Foreground="{DynamicResource PrimaryTextBrush}" hc:IconElement.Geometry="{StaticResource ConfigGeometry}"/>
|
||||
<Popup AllowsTransparency="True" Grid.Column="1" PlacementTarget="{Binding ElementName=ButtonConfig}" HorizontalOffset="-28" Name="PopupConfig" VerticalOffset="6" StaysOpen="False">
|
||||
+18
-1
@@ -7,8 +7,13 @@ using HandyControlDemo.Tools;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
{
|
||||
public class NoUserViewModel : ViewModelBase
|
||||
public class NonClientAreaViewModel : ViewModelBase
|
||||
{
|
||||
public NonClientAreaViewModel()
|
||||
{
|
||||
VersionInfo = VersionHelper.GetVersion();
|
||||
}
|
||||
|
||||
public RelayCommand<string> OpenViewCmd => new Lazy<RelayCommand<string>>(() =>
|
||||
new RelayCommand<string>(OpenView)).Value;
|
||||
|
||||
@@ -18,5 +23,17 @@ namespace HandyControlDemo.ViewModel
|
||||
Messenger.Default.Send(true, MessageToken.FullSwitch);
|
||||
Messenger.Default.Send(AssemblyHelper.CreateInternalInstance($"UserControl.{viewName}"), MessageToken.LoadShowContent);
|
||||
}
|
||||
|
||||
private string _versionInfo;
|
||||
|
||||
public string VersionInfo
|
||||
{
|
||||
get => _versionInfo;
|
||||
#if NET40
|
||||
set => Set(nameof(VersionInfo), ref _versionInfo, value);
|
||||
#else
|
||||
set => Set(ref _versionInfo, value);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ namespace HandyControlDemo.ViewModel
|
||||
SimpleIoc.Default.Register<BadgeDemoViewModel>();
|
||||
SimpleIoc.Default.Register<SideMenuDemoViewModel>();
|
||||
SimpleIoc.Default.Register<TabControlDemoViewModel>();
|
||||
SimpleIoc.Default.Register<NoUserViewModel>();
|
||||
SimpleIoc.Default.Register<NonClientAreaViewModel>();
|
||||
SimpleIoc.Default.Register<CardDemoViewModel>();
|
||||
SimpleIoc.Default.Register<SpriteDemoViewModel>();
|
||||
SimpleIoc.Default.Register<NotificationDemoViewModel>();
|
||||
@@ -87,7 +87,7 @@ namespace HandyControlDemo.ViewModel
|
||||
|
||||
public TabControlDemoViewModel TabControlDemo => new TabControlDemoViewModel(SimpleIoc.Default.GetInstance<DataService>());
|
||||
|
||||
public NoUserViewModel NoUser => SimpleIoc.Default.GetInstance<NoUserViewModel>();
|
||||
public NonClientAreaViewModel NoUser => SimpleIoc.Default.GetInstance<NonClientAreaViewModel>();
|
||||
|
||||
public CardDemoViewModel CardDemo => new CardDemoViewModel(SimpleIoc.Default.GetInstance<DataService>());
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using System.Windows;
|
||||
using HandyControlDemo.Tools;
|
||||
|
||||
namespace HandyControlDemo.Window
|
||||
{
|
||||
@@ -11,27 +10,8 @@ namespace HandyControlDemo.Window
|
||||
InitializeComponent();
|
||||
|
||||
DataContext = this;
|
||||
|
||||
var versionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location);
|
||||
CopyRight = versionInfo.LegalCopyright;
|
||||
#if NET40
|
||||
var netVersion = "NET 40";
|
||||
#elif NET45
|
||||
var netVersion = "NET 45";
|
||||
#elif NET462
|
||||
var netVersion = "NET 462";
|
||||
#elif NET47
|
||||
var netVersion = "NET 47";
|
||||
#elif NET48
|
||||
var netVersion = "NET 48";
|
||||
#elif NET5_0
|
||||
var netVersion = "NET 50";
|
||||
#elif NETCOREAPP3_0
|
||||
var netVersion = "CORE 30";
|
||||
#elif NETCOREAPP3_1
|
||||
var netVersion = "CORE 31";
|
||||
#endif
|
||||
Version = $"v {versionInfo.FileVersion} {netVersion}";
|
||||
CopyRight = VersionHelper.GetCopyright();
|
||||
Version = VersionHelper.GetVersion();
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty CopyRightProperty = DependencyProperty.Register(
|
||||
|
||||
Reference in new issue
Block a user