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

+10
View File
@@ -12,9 +12,11 @@ Global
Debug|Any CPU = Debug|Any CPU
Debug-Net40|Any CPU = Debug-Net40|Any CPU
Debug-Net45|Any CPU = Debug-Net45|Any CPU
Debug-Net47|Any CPU = Debug-Net47|Any CPU
Release|Any CPU = Release|Any CPU
Release-Net40|Any CPU = Release-Net40|Any CPU
Release-Net45|Any CPU = Release-Net45|Any CPU
Release-Net47|Any CPU = Release-Net47|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -23,24 +25,32 @@ Global
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Debug-Net40|Any CPU.Build.0 = Debug-Net40|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Debug-Net45|Any CPU.ActiveCfg = Debug-Net45|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Debug-Net45|Any CPU.Build.0 = Debug-Net45|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Debug-Net47|Any CPU.ActiveCfg = Debug-Net47|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Debug-Net47|Any CPU.Build.0 = Debug-Net47|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Release|Any CPU.Build.0 = Release|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Release-Net40|Any CPU.ActiveCfg = Release-Net40|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Release-Net40|Any CPU.Build.0 = Release-Net40|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Release-Net45|Any CPU.ActiveCfg = Release-Net45|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Release-Net45|Any CPU.Build.0 = Release-Net45|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Release-Net47|Any CPU.ActiveCfg = Release-Net47|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Release-Net47|Any CPU.Build.0 = Release-Net47|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net40|Any CPU.ActiveCfg = Debug|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net40|Any CPU.Build.0 = Debug|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net45|Any CPU.ActiveCfg = Debug|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net45|Any CPU.Build.0 = Debug|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net47|Any CPU.ActiveCfg = Debug|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net47|Any CPU.Build.0 = Debug|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release|Any CPU.Build.0 = Release|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release-Net40|Any CPU.ActiveCfg = Release|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release-Net40|Any CPU.Build.0 = Release|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release-Net45|Any CPU.ActiveCfg = Release|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release-Net45|Any CPU.Build.0 = Release|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release-Net47|Any CPU.ActiveCfg = Release-Net47|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release-Net47|Any CPU.Build.0 = Release-Net47|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -10,15 +10,6 @@ namespace HandyControl.Controls
protected override bool IsItemItsOwnContainerOverride(object item) => item is RadioButton;
//public static readonly DependencyProperty GroupNameProperty = DependencyProperty.Register(
// "GroupName", typeof(string), typeof(RadioGroup), new PropertyMetadata(default(string)));
//public string GroupName
//{
// get => (string) GetValue(GroupNameProperty);
// set => SetValue(GroupNameProperty, value);
//}
public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register(
"Orientation", typeof(Orientation), typeof(RadioGroup), new PropertyMetadata(default(Orientation)));
+1 -1
View File
@@ -52,7 +52,7 @@ namespace HandyControl.Controls
Loaded += (s, e) =>
{
if (DesignerHelper.IsInDesignMode()) return;
if (DesignerHelper.IsInDesignMode) return;
if (_isLoaded) return;
_isLoaded = true;
if (Value <= 0)
+1 -1
View File
@@ -153,7 +153,7 @@ namespace HandyControl.Controls
return;
}
#if net45 || net40
#if netle45
_formattedText = new FormattedText(
Text,
CultureInfo.CurrentUICulture,
+1 -1
View File
@@ -6,7 +6,7 @@ using System.Windows.Input;
using System.Windows.Media;
using HandyControl.Data;
using HandyControl.Tools;
#if net40
#if netle40
using Microsoft.Windows.Shell;
#else
using System.Windows.Shell;
+29 -10
View File
@@ -26,12 +26,23 @@
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<netVersion>netgt40</netVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug-Net47|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<netVersion>netgt40</netVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug-Net45|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;net45</DefineConstants>
<DefineConstants>DEBUG;TRACE;netle45</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
@@ -42,7 +53,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;net40</DefineConstants>
<DefineConstants>DEBUG;TRACE;netle45;netle40</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
@@ -59,11 +70,22 @@
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<netVersion>netgt40</netVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release-Net47|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\HandyControl.xml</DocumentationFile>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<netVersion>netgt40</netVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release-Net45|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;net45</DefineConstants>
<DefineConstants>TRACE;netle45</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\HandyControl.xml</DocumentationFile>
@@ -74,7 +96,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;net40</DefineConstants>
<DefineConstants>TRACE;netle45;netle40</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\HandyControl.xml</DocumentationFile>
@@ -108,14 +130,14 @@
<Compile Include="Controls\Button\ContextMenuButton.cs" />
<Compile Include="Controls\Button\ContextMenuToggleButton.cs" />
<Compile Include="Controls\Other\Carousel.cs" />
<Compile Include="Controls\Other\CirclePanel.cs" />
<Compile Include="Controls\Panel\CirclePanel.cs" />
<Compile Include="Controls\Other\CircleProgressBar.cs" />
<Compile Include="Controls\Other\RadioGroup.cs" />
<Compile Include="Controls\Other\Shield.cs" />
<Compile Include="Controls\Rate\Rate.cs" />
<Compile Include="Controls\Rate\RateItem.cs" />
<Compile Include="Controls\Text\OutlineText.cs" />
<Compile Include="Controls\Other\GifImage.cs" />
<Compile Include="Controls\Image\GifImage.cs" />
<Compile Include="Controls\Input\SearchBar.cs" />
<Compile Include="Controls\Tag\TagPanel.cs" />
<Compile Include="Controls\Tag\Tag.cs" />
@@ -123,7 +145,7 @@
<Compile Include="Controls\Time\Clock\Clock.cs" />
<Compile Include="Controls\Time\Clock\ClockRadioButton.cs" />
<Compile Include="Controls\Other\Growl.cs" />
<Compile Include="Controls\Other\ImageViewer.cs" />
<Compile Include="Controls\Image\ImageViewer.cs" />
<Compile Include="Controls\Input\ComboBox.cs" />
<Compile Include="Controls\Input\DatePicker.cs" />
<Compile Include="Controls\Input\DateTimePicker.cs" />
@@ -721,9 +743,6 @@
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
+10 -49
View File
@@ -1,60 +1,21 @@
using System;
using System.Linq;
using System.Reflection;
using System.ComponentModel;
using System.Windows;
namespace HandyControl.Tools
{
public class DesignerHelper
{
public static bool IsInDesignMode()
private static bool? _isInDesignMode;
public static bool IsInDesignMode
{
try
get
{
var type1 = Type.GetType(
"System.ComponentModel.DesignerProperties, PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
if (type1 == null)
return false;
var obj1 = type1.GetTypeInfo().GetDeclaredField("IsInDesignModeProperty").GetValue(null);
var type2 = Type.GetType(
"System.ComponentModel.DependencyPropertyDescriptor, WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
var type3 = Type.GetType(
"System.Windows.FrameworkElement, PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
if (type2 == null || type3 == null)
return false;
var list = type2.GetTypeInfo().GetDeclaredMethods("FromProperty").ToList();
if (list.Count == 0)
return false;
var methodInfo = list.FirstOrDefault(mi =>
if (!_isInDesignMode.HasValue)
{
if (mi.IsPublic && mi.IsStatic)
return mi.GetParameters().Length == 2;
return false;
});
if (methodInfo == null)
return false;
var obj2 = methodInfo.Invoke(null, new[]
{
obj1,
type3
});
if (obj2 == null)
return false;
var declaredProperty1 = type2.GetTypeInfo().GetDeclaredProperty("Metadata");
if (declaredProperty1 == null)
return false;
var obj3 = declaredProperty1.GetValue(obj2, null);
var type4 = Type.GetType(
"System.Windows.PropertyMetadata, WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
if (obj3 == null || type4 == null)
return false;
var declaredProperty2 = type4.GetTypeInfo().GetDeclaredProperty("DefaultValue");
if (declaredProperty2 == null)
return false;
return (bool) declaredProperty2.GetValue(obj3, null);
}
catch
{
return false;
_isInDesignMode = (bool)DependencyPropertyDescriptor.FromProperty(DesignerProperties.IsInDesignModeProperty, typeof(FrameworkElement)).Metadata.DefaultValue;
}
return _isInDesignMode.Value;
}
}
}
+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);
}
}
}