Display version number in application title.

This commit is contained in:
Tichau committed 2015-04-06 23:33:21 +02:00
1 parent db955d01d0
commit 0e471b0456
5 files changed
+47 -5

No files matched your search

@@ -18,10 +18,17 @@ namespace FileConverter
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
public partial class Application : System.Windows.Application
{
public static readonly Version Version = new Version()
{
Major = 0,
Minor = 1,
};
private readonly List<ConversionJob> conversionJobs = new List<ConversionJob>();
private bool debugMode;
@@ -215,10 +222,7 @@ namespace FileConverter
{
System.Threading.Thread.Sleep(3000);
Dispatcher.BeginInvoke((Action)delegate
{
Application.Current.Shutdown();
});
Dispatcher.BeginInvoke((Action)(() => Application.Current.Shutdown()));
}
#endif
}
@@ -68,6 +68,7 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Version.cs" />
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
+1 -1
View File
@@ -3,7 +3,7 @@
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" mc:Ignorable="d" x:Class="FileConverter.MainWindow"
xmlns:local="clr-namespace:FileConverter"
x:Name="FileConverterMainWindow" Title="File Converter" Height="500" Width="950" MinHeight="250" MinWidth="450" WindowStartupLocation="CenterScreen">
x:Name="FileConverterMainWindow" Title="{Binding ApplicationName, ElementName=FileConverterMainWindow, Mode=OneWay}" Height="500" Width="950" MinHeight="250" MinWidth="450" WindowStartupLocation="CenterScreen">
<Window.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
<local:ConversionStateToBrush x:Key="ConversionStateToColor" />
@@ -12,10 +12,14 @@ namespace FileConverter
{
private bool verboseMode;
private string applicationName;
public MainWindow()
{
this.InitializeComponent();
this.ApplicationName = string.Format("File Converter v{0}", Application.Version.ToString());
Application application = Application.Current as Application;
this.ConverterJobsList.ItemsSource = application.ConvertionJobs;
@@ -24,6 +28,20 @@ namespace FileConverter
public event PropertyChangedEventHandler PropertyChanged;
public string ApplicationName
{
get
{
return this.applicationName;
}
private set
{
this.applicationName = value;
this.OnPropertyChanged();
}
}
public bool VerboseMode
{
get
+19
View File
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FileConverter
{
public struct Version
{
public int Major;
public int Minor;
public override string ToString()
{
return string.Format("{0}.{1}", this.Major, this.Minor);
}
}
}