Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
Add version label to the settings window
Browse files Browse the repository at this point in the history
  • Loading branch information
Milkenm committed Mar 31, 2021
1 parent 15a07c1 commit 3fb33a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions GMG WPF/SettingsWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,6 @@
</TabItem>
</TabControl>
<Button Name="button_save" Content="Save" Margin="712,414,0,0" Background="#3FDDDDDD" Foreground="#FFC7C7C7" BorderBrush="#19383838" FontFamily="Arial" Click="button_save_Click" Height="26" VerticalAlignment="Top" HorizontalAlignment="Left" Width="78" />
<Label Name="label_version" Content="v0.0.0" Foreground="#FF2E2E2E" FontFamily="Arial" Height="24" VerticalAlignment="Top" HorizontalAlignment="Left" Width="176" Margin="10,416,0,0" />
</Grid>
</Window>
8 changes: 8 additions & 0 deletions GMG WPF/SettingsWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
Expand All @@ -18,6 +20,7 @@ public partial class SettingsWindow : Window
{
private readonly string MinningCoresLabelPlaceholder = "best: x{0} cores";
private readonly string AfkMinningCoresLabelPlaceholder = "best: x{0} cores";
private readonly string VersionLabelPlaceholder = "v{0}";

private readonly SolidColorBrush UnselectedBrush = new SolidColorBrush(Color.FromRgb(255, 255, 255));
private readonly SolidColorBrush SelectedBrush = new SolidColorBrush(Color.FromRgb(50, 50, 50));
Expand All @@ -43,6 +46,11 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
}
textBlock_recommendedMiningCores.Text = string.Format(MinningCoresLabelPlaceholder, recommendedCoreCount);
textBlock_recommendedAfkMiningCores.Text = string.Format(AfkMinningCoresLabelPlaceholder, recommendedCoreCount);

Assembly assembly = Assembly.GetExecutingAssembly();
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
string version = fvi.FileVersion;
label_version.Content = string.Format(VersionLabelPlaceholder, fvi.FileVersion);
}

private void LoadSettings()
Expand Down

0 comments on commit 3fb33a9

Please sign in to comment.