forked from TeslaFly01/SmartSqlT
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
zfluok
committed
Apr 28, 2023
1 parent
d60953e
commit 4675ab1
Showing
3 changed files
with
203 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
<Window | ||
x:Class="SmartSQL.UserControl.Dialog.About" | ||
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:emoji="clr-namespace:Emoji.Wpf;assembly=Emoji.Wpf" | ||
xmlns:hc="https://handyorg.github.io/handycontrol" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:svgc="http://sharpvectors.codeplex.com/svgc/" | ||
Title="关于SmartSQL" | ||
Width="460" | ||
Height="320" | ||
AllowsTransparency="True" | ||
Background="Transparent" | ||
BorderThickness="0" | ||
Effect="{StaticResource EffectShadow3}" | ||
Icon="{x:Null}" | ||
ShowInTaskbar="False" | ||
WindowStartupLocation="CenterScreen" | ||
WindowStyle="None"> | ||
<Border | ||
Margin="10" | ||
Background="#ffffff" | ||
CornerRadius="10"> | ||
<Grid> | ||
<hc:SimplePanel> | ||
<svgc:SvgViewbox | ||
Name="SvgViewboxForkMe" | ||
Width="80" | ||
HorizontalAlignment="Right" | ||
VerticalAlignment="Top" | ||
Cursor="Hand" | ||
MouseLeftButtonUp="SvgViewboxForkMe_OnMouseLeftButtonUp" | ||
Source="../../Resources/svg/forkme.svg" /> | ||
<Border | ||
Width="60" | ||
Height="60" | ||
Margin="0,25,0,0" | ||
VerticalAlignment="Top" | ||
Background="#ffffff" | ||
BorderThickness="1" | ||
CornerRadius="8" | ||
Effect="{StaticResource EffectShadow1}"> | ||
<Image | ||
Width="40" | ||
Height="40" | ||
VerticalAlignment="Center" | ||
Source="../../favicon.ico" | ||
Stretch="Uniform" /> | ||
</Border> | ||
<StackPanel | ||
Margin="0,100,0,0" | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Top"> | ||
<TextBlock | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Top" | ||
FontFamily="Microsoft YaHei" | ||
FontSize="30" | ||
FontWeight="DemiBold" | ||
Foreground="#1890ff" | ||
Text="SmartSQL" /> | ||
<TextBlock | ||
Margin="0,15,0,0" | ||
HorizontalAlignment="Center" | ||
FontWeight="Bold" | ||
Foreground="#1890ff" | ||
Text="{Binding Description}" /> | ||
</StackPanel> | ||
<WrapPanel | ||
Margin="0,0,0,50" | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Bottom"> | ||
<hc:Shield | ||
Margin="5" | ||
Status="zfluok" | ||
Subject="author" | ||
Color="#4eb899" /> | ||
<hc:Shield | ||
Margin="5" | ||
Status="apache" | ||
Subject="license" | ||
Color="#d8624c" /> | ||
<hc:Shield | ||
Margin="5" | ||
Status="{Binding Version}" | ||
Subject="version" | ||
Color="#1192d1" /> | ||
</WrapPanel> | ||
<TextBlock | ||
Margin="0,0,0,8" | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Bottom" | ||
Foreground="{StaticResource ThirdlyTextBrush}" | ||
Text="{Binding CopyRight}" /> | ||
</hc:SimplePanel> | ||
<Button | ||
x:Name="BtnClose" | ||
Width="12" | ||
Height="12" | ||
Margin="0,10,10,0" | ||
Padding="0" | ||
HorizontalAlignment="Right" | ||
VerticalAlignment="Top" | ||
hc:IconElement.Geometry="{StaticResource CloseGeometry}" | ||
Click="BtnClose_OnClick" | ||
Cursor="Hand" | ||
Foreground="#9e9e9e" | ||
Style="{StaticResource ButtonIcon}" /> | ||
</Grid> | ||
</Border> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.Reflection; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
|
||
namespace SmartSQL.UserControl.Dialog | ||
{ | ||
public partial class About | ||
{ | ||
public About() | ||
{ | ||
InitializeComponent(); | ||
|
||
var assemblyDescription = typeof(About).Assembly.GetCustomAttributes(typeof(AssemblyDescriptionAttribute), true)[0] as AssemblyDescriptionAttribute; | ||
|
||
var version = Assembly.GetExecutingAssembly().GetName().Version; | ||
DataContext = this; | ||
Description = assemblyDescription.Description; | ||
CopyRight = DateTime.Now.Year == 2021 ? $"Copyright ©{DateTime.Now.Year} zfluok" : $"Copyright ©2021-{DateTime.Now.Year} zfluok"; | ||
Version = $"v{version.ToString()}"; | ||
} | ||
|
||
#region Description | ||
public static readonly DependencyProperty DescriptionProperty = DependencyProperty.Register( | ||
"Description", typeof(string), typeof(About), new PropertyMetadata(default(string))); | ||
/// <summary> | ||
/// 版权信息 | ||
/// </summary> | ||
public string Description | ||
{ | ||
get => (string)GetValue(DescriptionProperty); | ||
set => SetValue(DescriptionProperty, value); | ||
} | ||
#endregion | ||
|
||
#region CopyRight | ||
public static readonly DependencyProperty CopyRightProperty = DependencyProperty.Register( | ||
"CopyRight", typeof(string), typeof(About), new PropertyMetadata(default(string))); | ||
/// <summary> | ||
/// 版权信息 | ||
/// </summary> | ||
public string CopyRight | ||
{ | ||
get => (string)GetValue(CopyRightProperty); | ||
set => SetValue(CopyRightProperty, value); | ||
} | ||
#endregion | ||
|
||
#region Version | ||
public static readonly DependencyProperty VersionProperty = DependencyProperty.Register( | ||
"Version", typeof(string), typeof(About), new PropertyMetadata(default(string))); | ||
/// <summary> | ||
/// 版本号信息 | ||
/// </summary> | ||
public string Version | ||
{ | ||
get => (string)GetValue(VersionProperty); | ||
set => SetValue(VersionProperty, value); | ||
} | ||
#endregion | ||
|
||
private void SvgViewboxForkMe_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e) | ||
{ | ||
Hyperlink link = sender as Hyperlink; | ||
Process.Start(new ProcessStartInfo("https://gitee.com/izhaofu/SmartSQL")); | ||
} | ||
|
||
/// <summary> | ||
/// 关闭 | ||
/// </summary> | ||
/// <param name="sender"></param> | ||
/// <param name="e"></param> | ||
private void BtnClose_OnClick(object sender, RoutedEventArgs e) | ||
{ //容器Grid | ||
Grid grid = this.Owner.Content as Grid; | ||
//父级窗体原来的内容 | ||
UIElement original = VisualTreeHelper.GetChild(grid, 0) as UIElement; | ||
//将父级窗体原来的内容在容器Grid中移除 | ||
grid.Children.Remove(original); | ||
//赋给父级窗体 | ||
this.Owner.Content = original; | ||
Close(); | ||
} | ||
} | ||
} |