Skip to content

Commit

Permalink
Update Piano Sheet after changing Keyboard Layout
Browse files Browse the repository at this point in the history
  • Loading branch information
sabihoshi committed Jun 5, 2021
1 parent 235a808 commit 41e5d60
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion GenshinLyreMidiPlayer.WPF/GenshinLyreMidiPlayer.WPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<UseWPF>true</UseWPF>
<StartupObject>GenshinLyreMidiPlayer.WPF.App</StartupObject>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Version>2.2.0.1</Version>
<Version>2.2.1</Version>
<ApplicationIcon>item_windsong_lyre.ico</ApplicationIcon>
<Nullable>enable</Nullable>
<RepositoryUrl>https://github.com/sabihoshi/GenshinLyreMidiPlayer</RepositoryUrl>
Expand Down
8 changes: 8 additions & 0 deletions GenshinLyreMidiPlayer.WPF/ViewModels/PianoSheetViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GenshinLyreMidiPlayer.WPF.Core;
Expand Down Expand Up @@ -50,6 +51,13 @@ public uint Shorten
set => SetAndNotify(ref _shorten, Math.Max(value, 1));
}

[OnChangedMethod(nameof(Update))]
public KeyValuePair<Keyboard.Layout, string> SelectedLayout
{
get => SettingsPage.SelectedLayout;
set => SettingsPage.SelectedLayout = value;
}

protected override void OnActivate() { Update(); }

public void Update()
Expand Down
2 changes: 1 addition & 1 deletion GenshinLyreMidiPlayer.WPF/Views/PianoSheetView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<GroupBox Header="Layout">
<ComboBox
ItemsSource="{x:Static core:Keyboard.LayoutNames}"
SelectedItem="{Binding SettingsPage.SelectedLayout}"
SelectedItem="{Binding SelectedLayout}"
SelectedIndex="{Binding Default.SelectedLayout, Source={StaticResource Settings}}"
DisplayMemberPath="Value" />
</GroupBox>
Expand Down

0 comments on commit 41e5d60

Please sign in to comment.