Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Users/andreas/fix keyboard 11 #12

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -196,17 +196,38 @@ private void OptimizeKeyboard_Click(object sender, RoutedEventArgs e)

this.Lanes.Children.Clear();

var keyboardKeys = new VirtualKey[]
{
VirtualKey.Number1,
VirtualKey.Number2,
VirtualKey.Number3,
VirtualKey.Number4,
VirtualKey.Number5,
VirtualKey.Number6,
VirtualKey.Number7,
};

this.SelectedPitchCount.Maximum = Math.Max(keyboardKeys.Length, this.notes.Count);

var notes = new string[] { "C", "D", "E", "F", "G", "A", "B" };

var currentSymbol = '\uF146';
for (var currentAdd = 0; currentAdd < this.notes.Count; currentAdd++)
for (var currentAdd = 0; currentAdd < keyboardKeys.Length; currentAdd++)
{
#pragma warning disable CA2000 // Dispose objects before losing scope
var lane = new LaneSetupControl(this.AvailableSymbols, this.AvailableNotes, this.AvailableKeys);
#pragma warning restore CA2000 // Dispose objects before losing scope
lane.PropertyChanged += this.Lane_PropertyChanged;
this.Lanes.Children.Add(lane);
lane.SelectedNotes.Add(this.AvailableNotes[0]);
lane.SelectedKeys.Add(this.AvailableKeys.First(key => string.Equals(key.Value, $"Number{(currentAdd + 1).ToString(CultureInfo.InvariantCulture)}", StringComparison.Ordinal)));
lane.SelectedSymbol = this.AvailableSymbols.First(symbol => string.Equals(symbol.Value, currentSymbol.ToString(CultureInfo.InvariantCulture), StringComparison.Ordinal));

foreach (var note in this.AvailableNotes.Where(note => note.Value.StartsWith(notes[currentAdd], StringComparison.OrdinalIgnoreCase)))
{
lane.SelectedNotes.Add(note);
}

lane.SelectedKeys.Add(this.AvailableKeys.First(key => string.Equals(key.Value, keyboardKeys[currentAdd].ToString(), StringComparison.Ordinal)));

lane.SelectedSymbol = this.AvailableSymbols.First(symbol => string.Equals(symbol.Value, currentSymbol.ToString(), StringComparison.Ordinal));
lane.PitchBackground = new SolidColorBrush(RetrieveColor());

if (currentSymbol != '\uF155')
Expand All @@ -215,7 +236,7 @@ private void OptimizeKeyboard_Click(object sender, RoutedEventArgs e)
}
}

this.SelectedPitchCount.Value = this.notes.Count;
this.SelectedPitchCount.Value = keyboardKeys.Length;
}

private void OptimizeXbox_Click(object sender, RoutedEventArgs e)
Expand Down