Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Commit

Permalink
Search scale
Browse files Browse the repository at this point in the history
Completed task
  • Loading branch information
hailstorm75 committed Jan 8, 2017
1 parent bb897cf commit 899ecbf
Show file tree
Hide file tree
Showing 16 changed files with 109 additions and 32 deletions.
Binary file modified .vs/guitarToolsForm/v15/.suo
Binary file not shown.
Binary file modified guitarTools/Data.mdf
Binary file not shown.
Binary file modified guitarTools/Data_log.ldf
Binary file not shown.
4 changes: 2 additions & 2 deletions guitarTools/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Make sure the application is in the same folder as the data file.
}

#region ComboBoxes
private void cbRoot_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
public void cbRoot_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
if (fretboard.Root != cbRoot.SelectedIndex)
fretboard.UpdateRoot(cbRoot.SelectedIndex);
Expand All @@ -70,7 +70,7 @@ private void cbTuning_SelectionChanged(object sender, System.Windows.Controls.Se
fretboard.UpdateTuning(cbTuning.SelectedValue.ToString());
}

private void cbScale_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
public void cbScale_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
if (fretboard.Scale != cbScale.SelectedValue.ToString())
fretboard.UpdateScale(cbScale.SelectedValue.ToString());
Expand Down
5 changes: 3 additions & 2 deletions guitarTools/ScaleSearchWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</DockPanel>
</Grid>
</Border>
<Grid Width="200">
<Grid Name="MenuGrid" Width="200">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
Expand Down Expand Up @@ -58,7 +58,8 @@
</ComboBox>
</StackPanel>
</Grid>
<Button Content="Search" Margin="0, 10, 0,0" IsEnabled="False" Name="btnSearch" HorizontalAlignment="Center" Click="btnSearch_Click"/>
<Button Content="Search" Margin="0, 10, 0,15" IsEnabled="False" Name="btnSearch" HorizontalAlignment="Center" Click="btnSearch_Click"/>
<ListBox Name="lbResults" Height="100" Width="{Binding ActualWidth, ElementName=MenuGrid, Mode=OneWay}" SelectionChanged="lbResults_SelectionChanged" />
</StackPanel>
</Border>

Expand Down
44 changes: 32 additions & 12 deletions guitarTools/ScaleSearchWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ namespace guitarTools
/// </summary>
public partial class ScaleSearchWindow : Window
{
#region
public bool init = false;
public string[] MusicKeys = { "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" };
public ComboBox[,] Menu;
public int Active = 2;
#endregion

public ScaleSearchWindow()
{
Expand Down Expand Up @@ -146,6 +148,8 @@ private void SelectionChanged(object sender, SelectionChangedEventArgs e)

private void btnSearch_Click(object sender, RoutedEventArgs e)
{
lbResults.Items.Clear();

List<int> chordNotes = new List<int>();

int pointA = Array.IndexOf(MusicKeys, tbOne.SelectedItem);
Expand All @@ -168,22 +172,38 @@ private void btnSearch_Click(object sender, RoutedEventArgs e)

chordNotes.Sort();

string a = "";

foreach (var item in chordNotes)
{
a += item;
a += " ";
}
string[] scales = SQLCommands.FetchList<string>("SELECT Interval FROM tableScales").ToArray();

a.TrimEnd();

string[] scales = SQLCommands.FetchList<string>("SELECT Name FROM tableScales WHERE Interval LIKE '0 2'").ToArray();
List<string> found = new List<string>();

foreach (var item in scales)
{
MessageBox.Show(item);
for (int note = 0; note < chordNotes.Count; note++)
{
if (item.IndexOf(note.ToString()) != -1)
{
if (note == chordNotes.Count - 1)
{
found.Add(item);
}
}
else break;
}
}

if (found.Count > 0)
foreach (var item in found)
lbResults.Items.Add(SQLCommands.FetchList<string>("SELECT Name FROM tableScales WHERE Interval = '" + item + "'")[0]);
else lbResults.Items.Add("Unknown scale");
}

private void lbResults_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
((MainWindow)Application.Current.MainWindow).cbScale.SelectedValue = lbResults.SelectedValue;
((MainWindow)Application.Current.MainWindow).cbRoot.SelectedIndex = Array.IndexOf(MusicKeys, tbOne.SelectedValue);
((MainWindow)Application.Current.MainWindow).cbRoot_SelectionChanged(((MainWindow)Application.Current.MainWindow).cbRoot, null);
((MainWindow)Application.Current.MainWindow).cbScale_SelectionChanged(((MainWindow)Application.Current.MainWindow).cbScale, null);
Close();
}
}
}
}
Binary file modified guitarTools/bin/Debug/Data.mdf
Binary file not shown.
Binary file modified guitarTools/bin/Debug/Data_log.ldf
Binary file not shown.
Binary file modified guitarTools/bin/Debug/guitarTools.exe
Binary file not shown.
Binary file modified guitarTools/bin/Debug/guitarTools.pdb
Binary file not shown.
Binary file modified guitarTools/obj/Debug/ScaleSearchWindow.baml
Binary file not shown.
44 changes: 36 additions & 8 deletions guitarTools/obj/Debug/ScaleSearchWindow.g.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma checksum "..\..\ScaleSearchWindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "E70DC738C4CD87CB3993647E92328D08"
#pragma checksum "..\..\ScaleSearchWindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "C42F68D4A2D9AD69A4740A7B696EC4DB"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
Expand Down Expand Up @@ -73,6 +73,14 @@ public partial class ScaleSearchWindow : System.Windows.Window, System.Windows.M
#line hidden


#line 32 "..\..\ScaleSearchWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Grid MenuGrid;

#line default
#line hidden


#line 39 "..\..\ScaleSearchWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.ComboBox tbOne;
Expand Down Expand Up @@ -128,6 +136,14 @@ public partial class ScaleSearchWindow : System.Windows.Window, System.Windows.M
#line default
#line hidden


#line 62 "..\..\ScaleSearchWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.ListBox lbResults;

#line default
#line hidden

private bool _contentLoaded;

/// <summary>
Expand Down Expand Up @@ -183,6 +199,9 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object
#line hidden
return;
case 5:
this.MenuGrid = ((System.Windows.Controls.Grid)(target));
return;
case 6:
this.tbOne = ((System.Windows.Controls.ComboBox)(target));

#line 39 "..\..\ScaleSearchWindow.xaml"
Expand All @@ -191,7 +210,7 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object
#line default
#line hidden
return;
case 6:
case 7:
this.tbTwo = ((System.Windows.Controls.ComboBox)(target));

#line 42 "..\..\ScaleSearchWindow.xaml"
Expand All @@ -200,7 +219,7 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object
#line default
#line hidden
return;
case 7:
case 8:
this.tbThree = ((System.Windows.Controls.ComboBox)(target));

#line 45 "..\..\ScaleSearchWindow.xaml"
Expand All @@ -209,7 +228,7 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object
#line default
#line hidden
return;
case 8:
case 9:
this.cbOne = ((System.Windows.Controls.ComboBox)(target));

#line 50 "..\..\ScaleSearchWindow.xaml"
Expand All @@ -218,7 +237,7 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object
#line default
#line hidden
return;
case 9:
case 10:
this.cbTwo = ((System.Windows.Controls.ComboBox)(target));

#line 53 "..\..\ScaleSearchWindow.xaml"
Expand All @@ -227,7 +246,7 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object
#line default
#line hidden
return;
case 10:
case 11:
this.cbThree = ((System.Windows.Controls.ComboBox)(target));

#line 56 "..\..\ScaleSearchWindow.xaml"
Expand All @@ -236,11 +255,20 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object
#line default
#line hidden
return;
case 11:
case 12:
this.btnSearch = ((System.Windows.Controls.Button)(target));

#line 61 "..\..\ScaleSearchWindow.xaml"
this.btnSearch.Click += new System.Windows.RoutedEventHandler(this.btnSearch_click);
this.btnSearch.Click += new System.Windows.RoutedEventHandler(this.btnSearch_Click);

#line default
#line hidden
return;
case 13:
this.lbResults = ((System.Windows.Controls.ListBox)(target));

#line 62 "..\..\ScaleSearchWindow.xaml"
this.lbResults.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.lbResults_SelectionChanged);

#line default
#line hidden
Expand Down
44 changes: 36 additions & 8 deletions guitarTools/obj/Debug/ScaleSearchWindow.g.i.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma checksum "..\..\ScaleSearchWindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "E70DC738C4CD87CB3993647E92328D08"
#pragma checksum "..\..\ScaleSearchWindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "C42F68D4A2D9AD69A4740A7B696EC4DB"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
Expand Down Expand Up @@ -73,6 +73,14 @@ public partial class ScaleSearchWindow : System.Windows.Window, System.Windows.M
#line hidden


#line 32 "..\..\ScaleSearchWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Grid MenuGrid;

#line default
#line hidden


#line 39 "..\..\ScaleSearchWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.ComboBox tbOne;
Expand Down Expand Up @@ -128,6 +136,14 @@ public partial class ScaleSearchWindow : System.Windows.Window, System.Windows.M
#line default
#line hidden


#line 62 "..\..\ScaleSearchWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.ListBox lbResults;

#line default
#line hidden

private bool _contentLoaded;

/// <summary>
Expand Down Expand Up @@ -183,6 +199,9 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object
#line hidden
return;
case 5:
this.MenuGrid = ((System.Windows.Controls.Grid)(target));
return;
case 6:
this.tbOne = ((System.Windows.Controls.ComboBox)(target));

#line 39 "..\..\ScaleSearchWindow.xaml"
Expand All @@ -191,7 +210,7 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object
#line default
#line hidden
return;
case 6:
case 7:
this.tbTwo = ((System.Windows.Controls.ComboBox)(target));

#line 42 "..\..\ScaleSearchWindow.xaml"
Expand All @@ -200,7 +219,7 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object
#line default
#line hidden
return;
case 7:
case 8:
this.tbThree = ((System.Windows.Controls.ComboBox)(target));

#line 45 "..\..\ScaleSearchWindow.xaml"
Expand All @@ -209,7 +228,7 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object
#line default
#line hidden
return;
case 8:
case 9:
this.cbOne = ((System.Windows.Controls.ComboBox)(target));

#line 50 "..\..\ScaleSearchWindow.xaml"
Expand All @@ -218,7 +237,7 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object
#line default
#line hidden
return;
case 9:
case 10:
this.cbTwo = ((System.Windows.Controls.ComboBox)(target));

#line 53 "..\..\ScaleSearchWindow.xaml"
Expand All @@ -227,7 +246,7 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object
#line default
#line hidden
return;
case 10:
case 11:
this.cbThree = ((System.Windows.Controls.ComboBox)(target));

#line 56 "..\..\ScaleSearchWindow.xaml"
Expand All @@ -236,11 +255,20 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object
#line default
#line hidden
return;
case 11:
case 12:
this.btnSearch = ((System.Windows.Controls.Button)(target));

#line 61 "..\..\ScaleSearchWindow.xaml"
this.btnSearch.Click += new System.Windows.RoutedEventHandler(this.btnSearch_click);
this.btnSearch.Click += new System.Windows.RoutedEventHandler(this.btnSearch_Click);

#line default
#line hidden
return;
case 13:
this.lbResults = ((System.Windows.Controls.ListBox)(target));

#line 62 "..\..\ScaleSearchWindow.xaml"
this.lbResults.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.lbResults_SelectionChanged);

#line default
#line hidden
Expand Down
Binary file modified guitarTools/obj/Debug/guitarTools.exe
Binary file not shown.
Binary file modified guitarTools/obj/Debug/guitarTools.g.resources
Binary file not shown.
Binary file modified guitarTools/obj/Debug/guitarTools.pdb
Binary file not shown.

0 comments on commit 899ecbf

Please sign in to comment.