Skip to content

Commit 409c755

Browse files
committed
* Binding settings
* Bumped version number * Minor design changes * Added a message in case the product key could not be retrieved * Border thickness changes can now be previewed
1 parent 25f2980 commit 409c755

File tree

13 files changed

+103
-51
lines changed

13 files changed

+103
-51
lines changed

PK Finder/App.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<value>True</value>
3030
</setting>
3131
<setting name="WindowOpacity" serializeAs="String">
32-
<value>1</value>
32+
<value>100</value>
3333
</setting>
3434
<setting name="WindowResizeBorder" serializeAs="String">
3535
<value>3</value>

PK Finder/Classes/KeyManager.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ private static string DecodeProductKeyWin8AndUp(IList<byte> digitalProductId)
4848
digitalProductId[66] = (byte)((digitalProductId[66] & 0xf7) | (isWin8 & 2) * 4);
4949

5050
const string digits = "BCDFGHJKMPQRTVWXY2346789";
51+
const string insert = "N";
52+
5153
int last = 0;
5254
for (int i = 24; i >= 0; i--)
5355
{
@@ -63,7 +65,6 @@ private static string DecodeProductKeyWin8AndUp(IList<byte> digitalProductId)
6365
key = digits[current] + key;
6466
}
6567
string keyPart = key.Substring(1, last);
66-
const string insert = "N";
6768
key = key.Substring(1).Replace(keyPart, keyPart + insert);
6869
if (last == 0) key = insert + key;
6970
for (int i = 5; i < key.Length; i += 6)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System.Windows.Data;
2+
3+
namespace PK_Finder.Classes
4+
{
5+
/// <inheritdoc />
6+
/// <summary>
7+
/// Internal logic for binding settings to controls
8+
/// </summary>
9+
internal sealed class SettingsBinder : Binding
10+
{
11+
12+
/// <inheritdoc />
13+
/// <summary>
14+
/// Initialize a new SettingsBinder
15+
/// </summary>
16+
/// <param name="path">The path that can be used to bind</param>
17+
public SettingsBinder(string path): base(path)
18+
{
19+
Initialize();
20+
}
21+
22+
/// <summary>
23+
/// Initialize the SettingsBinder by applying a binding source and binding mode
24+
/// </summary>
25+
public void Initialize()
26+
{
27+
Source = Properties.Settings.Default;
28+
Mode = BindingMode.TwoWay;
29+
}
30+
}
31+
}

PK Finder/Classes/StyleManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ internal static void ChangeStyle(DependencyObject o)
2323
if (!(o is ChromelessWindow window)) return;
2424
window.BorderThickness = new Thickness(Properties.Settings.Default.BorderThickness);
2525
window.CornerRadius = new CornerRadius(0, 0, 0, 0);
26-
window.Opacity = Properties.Settings.Default.WindowOpacity;
26+
window.Opacity = Properties.Settings.Default.WindowOpacity / 100;
2727
window.ResizeBorderThickness = new Thickness(Properties.Settings.Default.WindowResizeBorder);
2828
}
2929
catch (Exception ex)

PK Finder/PK Finder.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
<Compile Include="Classes\ExportManager.cs" />
7474
<Compile Include="Classes\KeyInfo.cs" />
7575
<Compile Include="Classes\KeyManager.cs" />
76+
<Compile Include="Classes\SettingsBinder.cs" />
7677
<Compile Include="Classes\StyleManager.cs" />
7778
<Compile Include="Windows\AboutWindow.xaml.cs">
7879
<DependentUpon>AboutWindow.xaml</DependentUpon>

PK Finder/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
using System.Reflection;
2-
using System.Resources;
3-
using System.Runtime.CompilerServices;
42
using System.Runtime.InteropServices;
53
using System.Windows;
64

@@ -12,7 +10,7 @@
1210
[assembly: AssemblyConfiguration("")]
1311
[assembly: AssemblyCompany("CodeDead")]
1412
[assembly: AssemblyProduct("PK Finder")]
15-
[assembly: AssemblyCopyright("Copyright © CodeDead 2018")]
13+
[assembly: AssemblyCopyright("Copyright © CodeDead 2019")]
1614
[assembly: AssemblyTrademark("")]
1715
[assembly: AssemblyCulture("")]
1816

@@ -51,5 +49,5 @@
5149
// You can specify all the values or you can default the Build and Revision Numbers
5250
// by using the '*' as shown below:
5351
// [assembly: AssemblyVersion("1.0.*")]
54-
[assembly: AssemblyVersion("1.5.0.0")]
55-
[assembly: AssemblyFileVersion("1.5.0.0")]
52+
[assembly: AssemblyVersion("1.5.1.0")]
53+
[assembly: AssemblyFileVersion("1.5.1.0")]

PK Finder/Properties/Settings.Designer.cs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PK Finder/Properties/Settings.settings

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<Value Profile="(Default)">True</Value>
2222
</Setting>
2323
<Setting Name="WindowOpacity" Type="System.Double" Scope="User">
24-
<Value Profile="(Default)">1</Value>
24+
<Value Profile="(Default)">100</Value>
2525
</Setting>
2626
<Setting Name="WindowResizeBorder" Type="System.Double" Scope="User">
2727
<Value Profile="(Default)">3</Value>

PK Finder/Windows/AboutWindow.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
66
xmlns:syncfusion="http://schemas.syncfusion.com/wpf" x:Class="PK_Finder.Windows.AboutWindow"
77
UseLayoutRounding="True" UseNativeChrome="True"
8-
mc:Ignorable="d" AllowsTransparency="True" Width="300" Height="200" TitleTextAlignment="Center"
8+
mc:Ignorable="d" AllowsTransparency="True" Width="350" Height="250" TitleTextAlignment="Center"
99
Title="PK Finder - About" WindowStartupLocation="CenterScreen" Icon="/PK Finder;component/pkfinder.ico">
1010

1111
<Grid VerticalAlignment="Center" HorizontalAlignment="Center">
@@ -26,9 +26,9 @@ PK Finder was created by DeadLine.<LineBreak></LineBreak>
2626
<LineBreak></LineBreak>
2727
Images: small-n-flat by paomedia<LineBreak></LineBreak>
2828
Theme: Syncfusion<LineBreak></LineBreak>
29-
Version: 1.5.0.0<LineBreak></LineBreak>
29+
Version: 1.5.1.0<LineBreak></LineBreak>
3030
<LineBreak></LineBreak>
31-
Copyright © CodeDead 2018
31+
Copyright © CodeDead 2019
3232
</TextBlock>
3333
</Grid>
3434
<Grid Grid.Row="1">

PK Finder/Windows/MainWindow.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
<ColumnDefinition Width="Auto" />
9696
</Grid.ColumnDefinitions>
9797
<Label Margin="2" Content="Product key:" />
98-
<TextBox Margin="2" x:Name="TxtProductKey" Grid.Row="0" Grid.Column="1" IsReadOnly="True" MouseDoubleClick="TxtProductKey_MouseDoubleClick"></TextBox>
98+
<TextBox Margin="2" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" x:Name="TxtProductKey" Grid.Row="0" Grid.Column="1" IsReadOnly="True" MouseDoubleClick="TxtProductKey_MouseDoubleClick"></TextBox>
9999
<Button Margin="2" Grid.Column="2" Click="BtnCopy_OnClick">
100100
<Button.ToolTip>
101101
<ToolTip Content="Copy product key to clipboard." />

0 commit comments

Comments
 (0)