diff --git a/.vs/DeskHubSharp/v15/.suo b/.vs/DeskHubSharp/v15/.suo
index 48d2187..14e42e6 100644
Binary files a/.vs/DeskHubSharp/v15/.suo and b/.vs/DeskHubSharp/v15/.suo differ
diff --git a/.vs/DeskHubSharp/v15/Server/sqlite3/storage.ide b/.vs/DeskHubSharp/v15/Server/sqlite3/storage.ide
index cf4c5ed..dada7b2 100644
Binary files a/.vs/DeskHubSharp/v15/Server/sqlite3/storage.ide and b/.vs/DeskHubSharp/v15/Server/sqlite3/storage.ide differ
diff --git a/DeskHubSharp/BusinessLayer/Request.cs b/DeskHubSharp/BusinessLayer/Request.cs
index dd918a2..fb77c74 100644
--- a/DeskHubSharp/BusinessLayer/Request.cs
+++ b/DeskHubSharp/BusinessLayer/Request.cs
@@ -12,7 +12,7 @@ namespace DeskHubSharp
private string _query;
///
- /// Constructor for the class
+ /// Override constructor for the class
///
///
public Request(string query)
@@ -21,6 +21,14 @@ namespace DeskHubSharp
_api = new ApiDataService(_query);
}
+ ///
+ /// Constructor for the class
+ ///
+ public Request()
+ {
+
+ }
+
///
/// Performs the search request
///
@@ -55,5 +63,12 @@ namespace DeskHubSharp
return owner;
}
+ public List PerformGetSort()
+ {
+ Sort sort = new Sort();
+ var sortTerms = sort.GetSortTerms();
+ return sortTerms;
+ }
+
}
}
diff --git a/DeskHubSharp/MainWindow.xaml b/DeskHubSharp/MainWindow.xaml
index 7aa347b..02f4f32 100644
--- a/DeskHubSharp/MainWindow.xaml
+++ b/DeskHubSharp/MainWindow.xaml
@@ -28,7 +28,7 @@
-
+
diff --git a/DeskHubSharp/MainWindow.xaml.cs b/DeskHubSharp/MainWindow.xaml.cs
index d0a5e73..9c9955b 100644
--- a/DeskHubSharp/MainWindow.xaml.cs
+++ b/DeskHubSharp/MainWindow.xaml.cs
@@ -25,17 +25,18 @@ namespace DeskHubSharp
private User _userDetail;
private Request _request;
private RepoInfo _repoInfo;
+
public MainWindow()
{
InitializeComponent();
- //ShowDataGridItems();
+ _request = new Request();
+ cmbbox_sort.ItemsSource = _request.PerformGetSort();
}
private void btn_detail_Click(object sender, RoutedEventArgs e)
{
try
{
- _repoDetail = RequestList.repoDetail;
RepoDetail repo = _repoDetail[ListBox.SelectedIndex];
DetailWindow detail = new DetailWindow(repo);
detail.Show();
@@ -84,7 +85,8 @@ namespace DeskHubSharp
SearchWindow search = new SearchWindow();
search.ShowDialog();
RepoInfo info = new RepoInfo();
-
+ _repoDetail = RequestList.repoDetail;
+
var stuff = info.GetRepoInfoList();
if (stuff.Count == 0)
@@ -117,6 +119,54 @@ namespace DeskHubSharp
private void btn_sort_Click(object sender, RoutedEventArgs e)
{
+ try
+ {
+ string sortTerm = cmbbox_sort.Text;
+
+ if (sortTerm == "A - Z")
+ {
+ var sortedList = _repoDetail.OrderBy(x => x.full_name).ToList();
+ ListBox.ItemsSource = sortedList.Select(x => x.full_name);
+ }
+ if (sortTerm == "Least to most Stars")
+ {
+ // TODO: There's a bug in here
+ var sortedList = _repoDetail.OrderBy(c => c.stargazers_count).ToList();
+ ListBox.ItemsSource = sortedList.Select(x => x.full_name);
+ }
+ if (sortTerm == "Least to most Forks")
+ {
+ var sortedList = _repoDetail.OrderBy(c => c.forks_count).ToList();
+ ListBox.ItemsSource = sortedList.Select(x => x.full_name);
+ }
+ if (sortTerm == "Least to most Watchers")
+ {
+ var sortedList = _repoDetail.OrderBy(c => c.watchers_count).ToList();
+ ListBox.ItemsSource = sortedList.Select(x => x.full_name);
+ }
+ }
+ catch (ArgumentNullException)
+ {
+ ShowErrorMessage("A user has not been searched. Please try again.");
+ }
+
+
+
+ }
+
+ private void btn_searchrepo_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ string searchTerm = txtbox_searchbox.Text;
+ var searchedList = _repoDetail.Where(c => c.full_name.ToUpper().Contains(searchTerm.ToUpper())).ToList();
+
+ ListBox.ItemsSource = searchedList.Select(x => x.full_name);
+ }
+ catch (ArgumentNullException)
+ {
+ ShowErrorMessage("A user has not been searched. Please try again.");
+ }
}
}
diff --git a/DeskHubSharp/Models/Sort.cs b/DeskHubSharp/Models/Sort.cs
index 4ae1b86..aff2434 100644
--- a/DeskHubSharp/Models/Sort.cs
+++ b/DeskHubSharp/Models/Sort.cs
@@ -6,14 +6,22 @@ using System.Threading.Tasks;
namespace DeskHubSharp
{
- public static class Sort
+ public class Sort
{
- public enum SortBox
+ public Sort()
{
- Alphabettically,
- MostStars,
- MostForks,
- MostWatchers
+
+ }
+
+ public List GetSortTerms()
+ {
+ List sortTerms = new List();
+ sortTerms.Add("A - Z");
+ sortTerms.Add("Least to most Stars");
+ sortTerms.Add("Least to most Forks");
+ sortTerms.Add("Least to most Watchers");
+
+ return sortTerms;
}
}
}
diff --git a/DeskHubSharp/obj/Debug/App.g.cs b/DeskHubSharp/obj/Debug/App.g.cs
index 82e1d5e..ba9120c 100644
--- a/DeskHubSharp/obj/Debug/App.g.cs
+++ b/DeskHubSharp/obj/Debug/App.g.cs
@@ -1,4 +1,4 @@
-#pragma checksum "..\..\App.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "5E7C2DBB667F025FC5CA90C6A4E4064F"
+#pragma checksum "..\..\App.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "8924CF88FE4A7948C7314277251E7D79D8D8F350"
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
diff --git a/DeskHubSharp/obj/Debug/App.g.i.cs b/DeskHubSharp/obj/Debug/App.g.i.cs
index 82e1d5e..ba9120c 100644
--- a/DeskHubSharp/obj/Debug/App.g.i.cs
+++ b/DeskHubSharp/obj/Debug/App.g.i.cs
@@ -1,4 +1,4 @@
-#pragma checksum "..\..\App.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "5E7C2DBB667F025FC5CA90C6A4E4064F"
+#pragma checksum "..\..\App.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "8924CF88FE4A7948C7314277251E7D79D8D8F350"
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
diff --git a/DeskHubSharp/obj/Debug/DeskHubSharp.csproj.CoreCompileInputs.cache b/DeskHubSharp/obj/Debug/DeskHubSharp.csproj.CoreCompileInputs.cache
index 37936f7..3866400 100644
--- a/DeskHubSharp/obj/Debug/DeskHubSharp.csproj.CoreCompileInputs.cache
+++ b/DeskHubSharp/obj/Debug/DeskHubSharp.csproj.CoreCompileInputs.cache
@@ -1 +1 @@
-17ecdc8fee3d6393cca5a22f6abf5748d0b3401c
+f6a02c2d6dac7b2ec0bdf4f3374969b628104441
diff --git a/DeskHubSharp/obj/Debug/DeskHubSharp_MarkupCompile.cache b/DeskHubSharp/obj/Debug/DeskHubSharp_MarkupCompile.cache
index 26f6ed2..5c29b6e 100644
--- a/DeskHubSharp/obj/Debug/DeskHubSharp_MarkupCompile.cache
+++ b/DeskHubSharp/obj/Debug/DeskHubSharp_MarkupCompile.cache
@@ -4,16 +4,16 @@
winexe
C#
.cs
-C:\Users\mill1159\Desktop\DeskHubSharp\DeskHubSharp\obj\Debug\
+C:\Users\Wyatt\Desktop\Source\DeskHubSharp\DeskHubSharp\obj\Debug\
DeskHubSharp
none
false
DEBUG;TRACE
-C:\Users\mill1159\Desktop\DeskHubSharp\DeskHubSharp\App.xaml
+C:\Users\Wyatt\Desktop\Source\DeskHubSharp\DeskHubSharp\App.xaml
7-86569338
27-1010967837
-20-856998346
+20415715258
AboutWindow.xaml;DetailWindow.xaml;ErrorWindow.xaml;FeedbackWindow.xaml;HelpWindow.xaml;MainWindow.xaml;SearchWindow.xaml;
False
diff --git a/DeskHubSharp/obj/Debug/DeskHubSharp_MarkupCompile.lref b/DeskHubSharp/obj/Debug/DeskHubSharp_MarkupCompile.lref
index 6ef43cb..9ca99a8 100644
--- a/DeskHubSharp/obj/Debug/DeskHubSharp_MarkupCompile.lref
+++ b/DeskHubSharp/obj/Debug/DeskHubSharp_MarkupCompile.lref
@@ -1,10 +1,10 @@
-FC:\Users\mill1159\Desktop\DeskHubSharp\DeskHubSharp\AboutWindow.xaml;;
-FC:\Users\mill1159\Desktop\DeskHubSharp\DeskHubSharp\DetailWindow.xaml;;
-FC:\Users\mill1159\Desktop\DeskHubSharp\DeskHubSharp\ErrorWindow.xaml;;
-FC:\Users\mill1159\Desktop\DeskHubSharp\DeskHubSharp\FeedbackWindow.xaml;;
-FC:\Users\mill1159\Desktop\DeskHubSharp\DeskHubSharp\HelpWindow.xaml;;
-FC:\Users\mill1159\Desktop\DeskHubSharp\DeskHubSharp\MainWindow.xaml;;
-FC:\Users\mill1159\Desktop\DeskHubSharp\DeskHubSharp\SearchWindow.xaml;;
+FC:\Users\Wyatt\Desktop\Source\DeskHubSharp\DeskHubSharp\AboutWindow.xaml;;
+FC:\Users\Wyatt\Desktop\Source\DeskHubSharp\DeskHubSharp\DetailWindow.xaml;;
+FC:\Users\Wyatt\Desktop\Source\DeskHubSharp\DeskHubSharp\ErrorWindow.xaml;;
+FC:\Users\Wyatt\Desktop\Source\DeskHubSharp\DeskHubSharp\FeedbackWindow.xaml;;
+FC:\Users\Wyatt\Desktop\Source\DeskHubSharp\DeskHubSharp\HelpWindow.xaml;;
+FC:\Users\Wyatt\Desktop\Source\DeskHubSharp\DeskHubSharp\MainWindow.xaml;;
+FC:\Users\Wyatt\Desktop\Source\DeskHubSharp\DeskHubSharp\SearchWindow.xaml;;
diff --git a/DeskHubSharp/obj/Debug/MainWindow.g.cs b/DeskHubSharp/obj/Debug/MainWindow.g.cs
index 07c59db..b16f54c 100644
--- a/DeskHubSharp/obj/Debug/MainWindow.g.cs
+++ b/DeskHubSharp/obj/Debug/MainWindow.g.cs
@@ -1,4 +1,4 @@
-#pragma checksum "..\..\MainWindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "1E01AC040AC8F24B3F0ED293B159302B"
+#pragma checksum "..\..\MainWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "B63AC266B8736D857C4AD5FFCF2522AB3A32FFD8"
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
@@ -361,6 +361,12 @@ namespace DeskHubSharp {
return;
case 22:
this.btn_searchrepo = ((System.Windows.Controls.Button)(target));
+
+ #line 31 "..\..\MainWindow.xaml"
+ this.btn_searchrepo.Click += new System.Windows.RoutedEventHandler(this.btn_searchrepo_Click);
+
+ #line default
+ #line hidden
return;
case 23:
this.txtbox_searchbox = ((System.Windows.Controls.TextBox)(target));
diff --git a/DeskHubSharp/obj/Debug/MainWindow.g.i.cs b/DeskHubSharp/obj/Debug/MainWindow.g.i.cs
index 07c59db..b16f54c 100644
--- a/DeskHubSharp/obj/Debug/MainWindow.g.i.cs
+++ b/DeskHubSharp/obj/Debug/MainWindow.g.i.cs
@@ -1,4 +1,4 @@
-#pragma checksum "..\..\MainWindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "1E01AC040AC8F24B3F0ED293B159302B"
+#pragma checksum "..\..\MainWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "B63AC266B8736D857C4AD5FFCF2522AB3A32FFD8"
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
@@ -361,6 +361,12 @@ namespace DeskHubSharp {
return;
case 22:
this.btn_searchrepo = ((System.Windows.Controls.Button)(target));
+
+ #line 31 "..\..\MainWindow.xaml"
+ this.btn_searchrepo.Click += new System.Windows.RoutedEventHandler(this.btn_searchrepo_Click);
+
+ #line default
+ #line hidden
return;
case 23:
this.txtbox_searchbox = ((System.Windows.Controls.TextBox)(target));