-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cloned AboutDialog to be re-skinned as OpenKh
- Loading branch information
Showing
14 changed files
with
261 additions
and
22 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
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,136 @@ | ||
<Window x:Class="OpenKh.Tools.Common.Dialogs.AboutDialog" | ||
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:local="clr-namespace:OpenKh.Tools.Common" | ||
xmlns:ext="clr-namespace:Xe.Tools.Wpf.Extensions;assembly=Xe.Tools.Wpf" | ||
xmlns:system="clr-namespace:System;assembly=mscorlib" | ||
mc:Ignorable="d" | ||
Title="{Binding ToolName, StringFormat=About {0}}" Height="Auto" Width="Auto" | ||
Background="#2d2d30" ResizeMode="NoResize" | ||
SizeToContent="WidthAndHeight" AllowsTransparency="True" | ||
WindowStartupLocation="CenterScreen" WindowStyle="None" | ||
Loaded="Window_Loaded"> | ||
<Window.Resources> | ||
<system:Double x:Key="textHeaderSize">24.0</system:Double> | ||
<system:Double x:Key="textSize">18.0</system:Double> | ||
<SolidColorBrush x:Key="textForeground" Color="#F1F1F1" /> | ||
<SolidColorBrush x:Key="textHyperlink" Color="#569CD6" /> | ||
|
||
<Style TargetType="{x:Type TextBlock}"> | ||
<Setter Property="FontSize" Value="{DynamicResource textSize}" /> | ||
<Setter Property="Foreground" Value="{DynamicResource textForeground}" /> | ||
</Style> | ||
|
||
<Style TargetType="{x:Type Button}"> | ||
<Setter Property="Foreground" Value="{DynamicResource textForeground}" /> | ||
</Style> | ||
|
||
</Window.Resources> | ||
|
||
<Grid> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="*"/> | ||
<ColumnDefinition Width="24"/> | ||
</Grid.ColumnDefinitions> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="*"/> | ||
<RowDefinition Height="16"/> | ||
</Grid.RowDefinitions> | ||
|
||
<DockPanel Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="0"> | ||
<Canvas DockPanel.Dock="Bottom" | ||
HorizontalAlignment="Right" | ||
VerticalAlignment="Bottom"> | ||
<Rectangle RenderTransformOrigin="0.5, 0.5" | ||
Fill="#FF4C4C4F" | ||
Canvas.Left="-56" Canvas.Top="-40" | ||
Width="88" Height="80"> | ||
|
||
<Rectangle.RenderTransform> | ||
<RotateTransform/> | ||
</Rectangle.RenderTransform> | ||
<Rectangle.Triggers> | ||
<EventTrigger RoutedEvent="Loaded"> | ||
<BeginStoryboard> | ||
<Storyboard> | ||
<DoubleAnimation | ||
Storyboard.TargetProperty="(Rectangle.RenderTransform).(RotateTransform.Angle)" | ||
To="360" Duration="0:0:30" RepeatBehavior="Forever"/> | ||
</Storyboard> | ||
</BeginStoryboard> | ||
</EventTrigger> | ||
</Rectangle.Triggers> | ||
</Rectangle> | ||
</Canvas> | ||
</DockPanel> | ||
|
||
<Button Grid.Column="1" Height="24" VerticalAlignment="Top" | ||
Background="#FFD85050" BorderBrush="#FFD85050" | ||
FontFamily="Segoe MDL2 Assets" Content="" | ||
IsCancel="True"/> | ||
|
||
<StackPanel Margin="20 20 20 10" Grid.Column="0" Grid.ColumnSpan="2"> | ||
<StackPanel> | ||
<StackPanel.RenderTransform> | ||
<TranslateTransform/> | ||
</StackPanel.RenderTransform> | ||
<StackPanel.Triggers> | ||
<EventTrigger RoutedEvent="Loaded"> | ||
<BeginStoryboard> | ||
<Storyboard> | ||
<DoubleAnimation | ||
Storyboard.TargetProperty="(RenderTransform).(TranslateTransform.X)" | ||
From="-10" To="0" Duration="0:0:0.5" DecelerationRatio="0.5"/> | ||
<DoubleAnimation | ||
Storyboard.TargetProperty="Opacity" | ||
From="-1" To="1" Duration="0:0:0.5" DecelerationRatio="0.5"/> | ||
</Storyboard> | ||
</BeginStoryboard> | ||
</EventTrigger> | ||
</StackPanel.Triggers> | ||
|
||
<TextBlock Text="{Binding ToolName}" FontWeight="Bold" Margin="0 0 0 5" | ||
FontSize="{DynamicResource textHeaderSize}"/> | ||
<TextBlock Text="{Binding Version, StringFormat=Version {0}}" Margin="0 0 0 5"/> | ||
<TextBlock Margin="0 0 0 5"> | ||
<Hyperlink NavigateUri="{Binding Website}" ext:HyperlinkExtensions.IsExternal="True" TextDecorations="{x:Null}"> | ||
<TextBlock Text="{Binding Website}" Foreground="{DynamicResource textHyperlink}"/> | ||
</Hyperlink> | ||
</TextBlock> | ||
</StackPanel> | ||
<Rectangle Margin="0 10 0 10" Fill="#FF4C4C4F" Height="4"/> | ||
<StackPanel> | ||
<StackPanel.RenderTransform> | ||
<TranslateTransform/> | ||
</StackPanel.RenderTransform> | ||
<StackPanel.Triggers> | ||
<EventTrigger RoutedEvent="Loaded"> | ||
<BeginStoryboard> | ||
<Storyboard> | ||
<DoubleAnimation | ||
Storyboard.TargetProperty="(RenderTransform).(TranslateTransform.X)" | ||
From="-15" To="0" Duration="0:0:0.75" DecelerationRatio="0.5"/> | ||
<DoubleAnimation | ||
Storyboard.TargetProperty="Opacity" | ||
From="-0.5" To="1" Duration="0:0:0.75" DecelerationRatio="0.5"/> | ||
</Storyboard> | ||
</BeginStoryboard> | ||
</EventTrigger> | ||
</StackPanel.Triggers> | ||
|
||
<TextBlock Text="{Binding Author, StringFormat=Developed by {0}}" Margin="0 0 0 5"/> | ||
<TextBlock Text="{Binding PoweredBy, StringFormat=Powered by {0}}" Margin="0 0 0 5"/> | ||
<TextBlock Margin="0 0 0 5"> | ||
<Hyperlink NavigateUri="{Binding AuthorWebsite}" | ||
ext:HyperlinkExtensions.IsExternal="true" TextDecorations="{x:Null}"> | ||
<TextBlock Text="{Binding AuthorWebsite}" Foreground="{DynamicResource textHyperlink}"/> | ||
</Hyperlink> | ||
</TextBlock> | ||
</StackPanel> | ||
</StackPanel> | ||
|
||
<Rectangle Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Fill="#FF4C4C4F"/> | ||
</Grid> | ||
</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,102 @@ | ||
using System; | ||
using System.ComponentModel; | ||
using System.Diagnostics; | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Windows; | ||
using System.Windows.Input; | ||
using System.Windows.Media.Animation; | ||
|
||
namespace OpenKh.Tools.Common.Dialogs | ||
{ | ||
/// <summary> | ||
/// Interaction logic for AboutDialog.xaml | ||
/// </summary> | ||
public partial class AboutDialog : Window, INotifyPropertyChanged | ||
{ | ||
private string name; | ||
private string version; | ||
private string website; | ||
private string author; | ||
private string powered; | ||
private string authorwebsite; | ||
|
||
public AboutDialog(Assembly assembly = null) | ||
{ | ||
InitializeComponent(); | ||
|
||
assembly = assembly ?? Assembly.GetExecutingAssembly(); | ||
var assemblyName = assembly.GetName(); | ||
var fvi = FileVersionInfo.GetVersionInfo(assembly.Location); | ||
|
||
name = fvi.ProductName; | ||
website = fvi.Comments; | ||
version = $"compiled date time or git hash and branch?"; | ||
author = "OpenKh blabla"; | ||
powered = "blablablabla"; | ||
authorwebsite = "https://openkh.dev"; | ||
|
||
DataContext = this; | ||
MouseDown += (o, e) => | ||
{ | ||
if (e.ChangedButton == MouseButton.Left) | ||
DragMove(); | ||
}; | ||
} | ||
|
||
public event PropertyChangedEventHandler PropertyChanged; | ||
|
||
public string ToolName | ||
{ | ||
get => name; | ||
set => name = OnPropertyChanged(value); | ||
} | ||
|
||
public string Version | ||
{ | ||
get => version; | ||
set => version = OnPropertyChanged(value); | ||
} | ||
|
||
public string Website | ||
{ | ||
get => website; | ||
set => website = OnPropertyChanged(value); | ||
} | ||
|
||
public string Author | ||
{ | ||
get => author; | ||
set => author = OnPropertyChanged(value); | ||
} | ||
|
||
public string PoweredBy | ||
{ | ||
get => powered; | ||
set => powered = OnPropertyChanged(value); | ||
} | ||
|
||
public string AuthorWebsite | ||
{ | ||
get => authorwebsite; | ||
set => authorwebsite = OnPropertyChanged(value); | ||
} | ||
|
||
private T OnPropertyChanged<T>(T obj, [CallerMemberName] string propertyName = null) | ||
{ | ||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); | ||
return obj; | ||
} | ||
|
||
private void Window_Loaded(object sender, RoutedEventArgs e) | ||
{ | ||
BeginAnimation(OpacityProperty, new DoubleAnimation() | ||
{ | ||
From = 0.0, | ||
To = 1.0, | ||
EasingFunction = new CubicEase(), | ||
Duration = new Duration(TimeSpan.FromSeconds(0.5)) | ||
}); | ||
} | ||
} | ||
} |
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
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
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
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
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