Skip to content

Commit

Permalink
Log the version on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
jskeet committed Sep 27, 2019
1 parent 666c1f0 commit 201cac7
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions Drums/VDrumExplorer.Wpf/ModuleLoader.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Collections.Concurrent;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows;
using VDrumExplorer.Data;
Expand All @@ -26,13 +27,27 @@ public ModuleLoader()
{
InitializeComponent();
logger = new TextBlockLogger(logPanel);
LogVersion();
Loaded += OnLoaded;
Loaded += LoadSchemaRegistry;
Closed += OnClosed;
// We can't attach this event handler in XAML, as only instance members of the current class are allowed.
loadKitFromDeviceKitNumber.PreviewTextInput += KitInputValidation.CheckDigits;
}

private void LogVersion()
{
var version = typeof(ModuleLoader).Assembly.GetCustomAttributes().OfType<AssemblyInformationalVersionAttribute>().FirstOrDefault();
if (version != null)
{
logger.Log($"V-Drum Explorer version {version.InformationalVersion}");
}
else
{
logger.Log($"Version attribute not found.");
}
}

private async void OnLoaded(object sender, RoutedEventArgs e)
{
var midiDevice = await DetectMidiDeviceAsync();
Expand Down Expand Up @@ -167,7 +182,7 @@ private void LoadFile(object sender, RoutedEventArgs e)
new KitExplorer(logger, kit, client, dialog.FileName).Show();
break;
}
case Module module:
case Data.Module module:
{
Validate(module.Validate);
var client = detectedMidi?.schema == module.Schema ? detectedMidi?.client : null;
Expand Down Expand Up @@ -208,7 +223,7 @@ private void LoadModuleFromDevice(object sender, RoutedEventArgs e)
var result = dialog.ShowDialog();
if (result == true)
{
new ModuleExplorer(logger, new Module(schema, dialog.Data), midi.client, fileName: null).Show();
new ModuleExplorer(logger, new Data.Module(schema, dialog.Data), midi.client, fileName: null).Show();
}
}
finally
Expand Down

0 comments on commit 201cac7

Please sign in to comment.