diff --git a/DeskHubSharpRevised/AboutWindow.axaml b/DeskHubSharpRevised/AboutWindow.axaml
index 0b1d7fd..877a686 100644
--- a/DeskHubSharpRevised/AboutWindow.axaml
+++ b/DeskHubSharpRevised/AboutWindow.axaml
@@ -2,8 +2,23 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
+ xmlns:unicode="clr-namespace:Avalonia.Media.TextFormatting.Unicode;assembly=Avalonia.Visuals"
+ mc:Ignorable="d"
x:Class="DeskHubSharpRevised.AboutWindow"
- Title="AboutWindow">
- Welcome to Avalonia!
+ Title="About - DeskHubSharp" Height="300" Width="450" CanResize="False">
+
+
+
+
+ Written and developed by Wyatt J. Miller
+ Copyright 2018, All rights reserved
+ Licensed under the MIT license
+
+
+ Using technologies including but not limited to Avalonia, .NET 6, Newtonsoft, RestSharp, and MailKit/MimeKit.
+
+
+
+
diff --git a/DeskHubSharpRevised/AboutWindow.axaml.cs b/DeskHubSharpRevised/AboutWindow.axaml.cs
index 50da178..7781b43 100644
--- a/DeskHubSharpRevised/AboutWindow.axaml.cs
+++ b/DeskHubSharpRevised/AboutWindow.axaml.cs
@@ -1,22 +1,34 @@
-$HEADER$using Avalonia;
+using System;
+using System.Diagnostics;
+using Avalonia;
using Avalonia.Controls;
+using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
-namespace $NAMESPACE$
-{
- public partial class $CLASS$ : Window
- {
- public $CLASS$()
- {
- InitializeComponent();
-#if DEBUG
- this.AttachDevTools();
-#endif
- }
+namespace DeskHubSharpRevised;
- private void InitializeComponent()
- {
- AvaloniaXamlLoader.Load(this);
- }
+public partial class AboutWindow : Window
+{
+ public AboutWindow()
+ {
+ InitializeComponent();
+#if DEBUG
+ this.AttachDevTools();
+#endif
}
-}
+
+ private void InitializeComponent()
+ {
+ AvaloniaXamlLoader.Load(this);
+ }
+
+ private void btn_close_Click(object sender, RoutedEventArgs e)
+ {
+ this.Close();
+ }
+
+ private void OnOpened(object sender, EventArgs e)
+ {
+ base.OnOpened(e);
+ }
+}
\ No newline at end of file
diff --git a/DeskHubSharpRevised/App.axaml b/DeskHubSharpRevised/App.axaml
index 8501f1b..ee7a5af 100644
--- a/DeskHubSharpRevised/App.axaml
+++ b/DeskHubSharpRevised/App.axaml
@@ -1,7 +1,10 @@
+
-
+
+
diff --git a/DeskHubSharpRevised/DetailWindow.axaml b/DeskHubSharpRevised/DetailWindow.axaml
index a9dfe20..3b8f4e1 100644
--- a/DeskHubSharpRevised/DetailWindow.axaml
+++ b/DeskHubSharpRevised/DetailWindow.axaml
@@ -4,6 +4,18 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="DeskHubSharpRevised.DetailWindow"
- Title="DetailWindow">
- Welcome to Avalonia!
+ Title="Detail - DeskHubSharp" Height="450" Width="400" CanResize="False">
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DeskHubSharpRevised/DetailWindow.axaml.cs b/DeskHubSharpRevised/DetailWindow.axaml.cs
index 50da178..6981ece 100644
--- a/DeskHubSharpRevised/DetailWindow.axaml.cs
+++ b/DeskHubSharpRevised/DetailWindow.axaml.cs
@@ -1,22 +1,85 @@
-$HEADER$using Avalonia;
+using System.Diagnostics;
+using Avalonia;
using Avalonia.Controls;
+using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
+using DeskHubSharpRevised.BLL;
+using DeskHubSharpRevised.Models;
-namespace $NAMESPACE$
+namespace DeskHubSharpRevised;
+
+public partial class DetailWindow : Window
{
- public partial class $CLASS$ : Window
+ public DetailWindow()
{
- public $CLASS$()
- {
- InitializeComponent();
+ InitializeComponent();
#if DEBUG
- this.AttachDevTools();
+ this.AttachDevTools();
#endif
+ }
+
+ private void InitializeComponent()
+ {
+ AvaloniaXamlLoader.Load(this);
+ }
+
+ private RepoDetail _repoDetail;
+ private Request _request;
+ private Owner _owner;
+
+ public DetailWindow(RepoDetail repoDetail)
+ {
+ InitializeComponent();
+
+ _repoDetail = repoDetail;
+ _request = new Request(_repoDetail.name);
+ RepoInfo info = new RepoInfo();
+
+ _request.PerformBranchRequest();
+ var stuff = info.GetBranchNameComboBox();
+
+ cmbbox_branches.Items= stuff;
+
+ if (_repoDetail.language != null)
+ {
+ txtblk_language.Text = $"This repo is mostly {_repoDetail.language} code.";
+ }
+ else
+ {
+ txtblk_language.Text = "This repo doesn't have any code.";
}
- private void InitializeComponent()
- {
- AvaloniaXamlLoader.Load(this);
- }
+ lbl_reponame.Content = _repoDetail.full_name;
+ txtblk_stargazers.Text = $"This repo has {_repoDetail.stargazers_count} stargazers.";
+ txtblk_watchers.Text = $"This repo has {_repoDetail.watchers_count} watchers.";
+ txtblk_forks.Text = $"This repo has {_repoDetail.forks_count} forks.";
}
-}
+
+ private void btn_close_Click(object sender, RoutedEventArgs e)
+ {
+ this.Close();
+ }
+
+ private void btn_clone_Click(object sender, RoutedEventArgs e)
+ {
+ if (cmbbox_branches.SelectedItem.ToString() == "")
+ {
+ ErrorWindow err = new ErrorWindow();
+ err.txtblk_error.Text = "Please select a branch to clone.";
+ err.Show();
+ }
+ else
+ {
+ _owner = new Owner();
+ string link = "https://github.com/" + _repoDetail.owner.login + "/" + _repoDetail.name + "/archive/" + cmbbox_branches.SelectedItem + ".zip";
+
+ Process.Start(link);
+ }
+
+ }
+
+ private void btn_page_Click(object sender, RoutedEventArgs e)
+ {
+ Process.Start($"{_repoDetail.html_url}");
+ }
+}
\ No newline at end of file
diff --git a/DeskHubSharpRevised/ErrorWindow.axaml b/DeskHubSharpRevised/ErrorWindow.axaml
index 5e742aa..09ff227 100644
--- a/DeskHubSharpRevised/ErrorWindow.axaml
+++ b/DeskHubSharpRevised/ErrorWindow.axaml
@@ -2,8 +2,12 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
+ mc:Ignorable="d"
x:Class="DeskHubSharpRevised.ErrorWindow"
- Title="ErrorWindow">
- Welcome to Avalonia!
+ Title="Response - DeskHubSharp" Height="200" Width="300" CanResize="False">
+
+
+
+
+
diff --git a/DeskHubSharpRevised/ErrorWindow.axaml.cs b/DeskHubSharpRevised/ErrorWindow.axaml.cs
index 50da178..26407bd 100644
--- a/DeskHubSharpRevised/ErrorWindow.axaml.cs
+++ b/DeskHubSharpRevised/ErrorWindow.axaml.cs
@@ -1,22 +1,27 @@
-$HEADER$using Avalonia;
+using Avalonia;
using Avalonia.Controls;
+using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
-namespace $NAMESPACE$
-{
- public partial class $CLASS$ : Window
- {
- public $CLASS$()
- {
- InitializeComponent();
-#if DEBUG
- this.AttachDevTools();
-#endif
- }
+namespace DeskHubSharpRevised;
- private void InitializeComponent()
- {
- AvaloniaXamlLoader.Load(this);
- }
+public partial class ErrorWindow : Window
+{
+ public ErrorWindow()
+ {
+ InitializeComponent();
+#if DEBUG
+ this.AttachDevTools();
+#endif
}
-}
+
+ private void InitializeComponent()
+ {
+ AvaloniaXamlLoader.Load(this);
+ }
+
+ private void Button_Click(object sender, RoutedEventArgs e)
+ {
+ this.Close();
+ }
+}
\ No newline at end of file
diff --git a/DeskHubSharpRevised/FeedbackWindow.axaml b/DeskHubSharpRevised/FeedbackWindow.axaml
index c86950f..daa0e76 100644
--- a/DeskHubSharpRevised/FeedbackWindow.axaml
+++ b/DeskHubSharpRevised/FeedbackWindow.axaml
@@ -5,5 +5,21 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="DeskHubSharpRevised.FeedbackWindow"
Title="FeedbackWindow">
- Welcome to Avalonia!
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DeskHubSharpRevised/FeedbackWindow.axaml.cs b/DeskHubSharpRevised/FeedbackWindow.axaml.cs
index 50da178..57a7834 100644
--- a/DeskHubSharpRevised/FeedbackWindow.axaml.cs
+++ b/DeskHubSharpRevised/FeedbackWindow.axaml.cs
@@ -1,22 +1,34 @@
-$HEADER$using Avalonia;
+using Avalonia;
using Avalonia.Controls;
+using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
+using DeskHubSharpRevised.BLL;
-namespace $NAMESPACE$
+namespace DeskHubSharpRevised;
+
+public partial class FeedbackWindow : Window
{
- public partial class $CLASS$ : Window
+ public FeedbackWindow()
{
- public $CLASS$()
- {
- InitializeComponent();
+ InitializeComponent();
#if DEBUG
- this.AttachDevTools();
+ this.AttachDevTools();
#endif
- }
-
- private void InitializeComponent()
- {
- AvaloniaXamlLoader.Load(this);
- }
}
-}
+
+ private void InitializeComponent()
+ {
+ AvaloniaXamlLoader.Load(this);
+ }
+
+ private void btn_discard_Click(object sender, RoutedEventArgs e)
+ {
+ this.Close();
+ }
+
+ private void btn_send_Click(object sender, RoutedEventArgs e)
+ {
+ EmailBLL email = new EmailBLL(txtbox_name.Text, txtbox_feedbackmessage.Text, txtbox_email.Text);
+ email.CreateMessage();
+ }
+}
\ No newline at end of file
diff --git a/DeskHubSharpRevised/HelpWindow.axaml b/DeskHubSharpRevised/HelpWindow.axaml
index 8a2a726..8d63324 100644
--- a/DeskHubSharpRevised/HelpWindow.axaml
+++ b/DeskHubSharpRevised/HelpWindow.axaml
@@ -2,8 +2,20 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:unicode="clr-namespace:Avalonia.Media.TextFormatting.Unicode;assembly=Avalonia.Visuals"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="DeskHubSharpRevised.HelpWindow"
Title="HelpWindow">
- Welcome to Avalonia!
+
+
+
+
+ No worries friend! We have you covered!
+ If you have a blank list when you first start the program, that's normal! You just have to search for somebody.
+ Click on the Search button and type away in the name field! If you get an error in response to your search query, that means that user doesn't exist.
+ If the search finds a user, the list will populate. Click on a repository of interest and click on the Detail button to view it in action.
+ You found a problem with the program? Great! Click on the Feedback button to send an email to me and I will respond to said email as soon as possible.
+ Want to know more about this program? Click on the About button to view credits.
+
+
diff --git a/DeskHubSharpRevised/HelpWindow.axaml.cs b/DeskHubSharpRevised/HelpWindow.axaml.cs
index 50da178..dcc7f31 100644
--- a/DeskHubSharpRevised/HelpWindow.axaml.cs
+++ b/DeskHubSharpRevised/HelpWindow.axaml.cs
@@ -1,22 +1,27 @@
-$HEADER$using Avalonia;
+using Avalonia;
using Avalonia.Controls;
+using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
-namespace $NAMESPACE$
-{
- public partial class $CLASS$ : Window
- {
- public $CLASS$()
- {
- InitializeComponent();
-#if DEBUG
- this.AttachDevTools();
-#endif
- }
+namespace DeskHubSharpRevised;
- private void InitializeComponent()
- {
- AvaloniaXamlLoader.Load(this);
- }
+public partial class HelpWindow : Window
+{
+ public HelpWindow()
+ {
+ InitializeComponent();
+#if DEBUG
+ this.AttachDevTools();
+#endif
}
-}
+
+ private void InitializeComponent()
+ {
+ AvaloniaXamlLoader.Load(this);
+ }
+
+ private void btn_close_Click(object sender, RoutedEventArgs e)
+ {
+ this.Close();
+ }
+}
\ No newline at end of file
diff --git a/DeskHubSharpRevised/MainWindow.axaml b/DeskHubSharpRevised/MainWindow.axaml
index f1509ae..2d7b877 100644
--- a/DeskHubSharpRevised/MainWindow.axaml
+++ b/DeskHubSharpRevised/MainWindow.axaml
@@ -2,8 +2,34 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
+ mc:Ignorable="d"
x:Class="DeskHubSharpRevised.MainWindow"
- Title="DeskHubSharpRevised">
- Welcome to Avalonia!
+ Title="DeskHubSharp" Height="450" Width="805" CanResize="False"
+ TransparencyLevelHint="AcrylicBlur"
+ Background="Transparent">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DeskHubSharpRevised/MainWindow.axaml.cs b/DeskHubSharpRevised/MainWindow.axaml.cs
index 829a862..8c4a5f1 100644
--- a/DeskHubSharpRevised/MainWindow.axaml.cs
+++ b/DeskHubSharpRevised/MainWindow.axaml.cs
@@ -1,12 +1,165 @@
+using System;
+using System.Collections.ObjectModel;
+using System.Linq;
using Avalonia.Controls;
+using Avalonia.Interactivity;
+using DeskHubSharpRevised.BLL;
+using DeskHubSharpRevised.Models;
namespace DeskHubSharpRevised
{
public partial class MainWindow : Window
{
+ private ObservableCollection _repoDetail;
+ private User _user;
+ private Request _request;
+
public MainWindow()
{
InitializeComponent();
}
+
+ private void btn_detail_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ RepoDetail repo = _repoDetail[ListBox.SelectedIndex];
+ DetailWindow detail = new DetailWindow(repo);
+ detail.Show();
+ }
+ catch (IndexOutOfRangeException)
+ {
+ ShowErrorMessage("Please pick a repository!");
+ }
+ catch (NullReferenceException)
+ {
+ ShowErrorMessage("Please search for a user with the Search button!");
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ ShowErrorMessage("Please search for a user with the Search button!");
+ }
+
+ }
+
+ private void btn_exit_Click(object sender, RoutedEventArgs e)
+ {
+ this.Close();
+ Environment.Exit(0);
+ }
+
+ private void btn_about_Click(object sender, RoutedEventArgs e)
+ {
+ AboutWindow about = new AboutWindow();
+ about.Show();
+ }
+
+ private void btn_feedback_Click(object sender, RoutedEventArgs e)
+ {
+ FeedbackWindow feedback = new FeedbackWindow();
+ feedback.Show();
+ }
+
+ private void btn_help_Click(object sender, RoutedEventArgs e)
+ {
+ HelpWindow help = new HelpWindow();
+ help.Show();
+ }
+
+ private async void btn_search_Click(object sender, RoutedEventArgs e)
+ {
+ SearchWindow search = new SearchWindow();
+ await search.ShowDialog(this);
+ _repoDetail = RequestList.repoDetail;
+ RepoInfo info = new RepoInfo();
+ var stuff = info.GetRepoInfoList();
+
+ if (stuff == null)
+ {
+ txtblk_username.Text = txtblk_username.Text;
+ txtblk_url.Text = txtblk_url.Text;
+ txtblk_bio.Text = txtblk_bio.Text;
+ txtblk_email.Text = txtblk_email.Text;
+ txtblk_realname.Text = txtblk_realname.Text;
+ }
+ else
+ {
+ _user = RequestList.userDetail;
+ ListBox.Items = stuff;
+ txtblk_username.Text = _user.login;
+ txtblk_url.Text = _user.html_url;
+ txtblk_bio.Text = _user.bio;
+ txtblk_email.Text = _user.blog;
+ txtblk_realname.Text = _user.name;
+ txtblk_repocount.Text = $"{_user.login} has {_user.public_repos} public repositories.";
+ }
+ }
+
+ public void ShowErrorMessage(string message)
+ {
+ ErrorWindow err = new ErrorWindow();
+ try
+ {
+ err.lbl_title.Content = "Oops!";
+ err.txtblk_error.Text = message;
+ }
+ catch (NullReferenceException e)
+ {
+ err.lbl_title.Content = "Oops!";
+ err.txtblk_error.Text = message;
+ }
+
+ err.Show();
+ }
+
+ private void btn_sort_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ string sortTerm = cmbbox_sort.SelectedItem.ToString();
+
+ if (sortTerm == "A - Z")
+ {
+ var sortedList = _repoDetail.OrderBy(x => x.full_name).ToList();
+ ListBox.Items = sortedList.Select(x => x.full_name);
+ }
+ if (sortTerm == "Least to most Stars")
+ {
+ var sortedList = _repoDetail.OrderBy(c => c.stargazers_count).ToList();
+ ListBox.Items = sortedList.Select(x => x.full_name);
+
+ }
+ if (sortTerm == "Least to most Forks")
+ {
+ var sortedList = _repoDetail.OrderBy(c => c.forks_count).ToList();
+ ListBox.Items = sortedList.Select(x => x.full_name);
+ }
+ if (sortTerm == "Least to most Watchers")
+ {
+ var sortedList = _repoDetail.OrderBy(c => c.watchers_count).ToList();
+ ListBox.Items = sortedList.Select(x => x.full_name);
+ }
+ }
+ catch (NullReferenceException)
+ {
+ 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.Items = searchedList.Select(x => x.full_name);
+ }
+ catch (ArgumentNullException)
+ {
+ ShowErrorMessage("A user has not been searched. Please try again.");
+ }
+
+ }
}
}
\ No newline at end of file
diff --git a/DeskHubSharpRevised/SearchWindow.axaml b/DeskHubSharpRevised/SearchWindow.axaml
index 05b94ec..775282e 100644
--- a/DeskHubSharpRevised/SearchWindow.axaml
+++ b/DeskHubSharpRevised/SearchWindow.axaml
@@ -4,6 +4,12 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="DeskHubSharpRevised.SearchWindow"
- Title="SearchWindow">
- Welcome to Avalonia!
+ Title="Search - DeskHubSharp" Height="200" Width="500" CanResize="False">
+
+
+
+
+
+
+
diff --git a/DeskHubSharpRevised/SearchWindow.axaml.cs b/DeskHubSharpRevised/SearchWindow.axaml.cs
index 50da178..9a18724 100644
--- a/DeskHubSharpRevised/SearchWindow.axaml.cs
+++ b/DeskHubSharpRevised/SearchWindow.axaml.cs
@@ -1,22 +1,52 @@
-$HEADER$using Avalonia;
+using System.Collections.ObjectModel;
+using Avalonia;
using Avalonia.Controls;
+using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
+using DeskHubSharpRevised.BLL;
+using DeskHubSharpRevised.Models;
-namespace $NAMESPACE$
+namespace DeskHubSharpRevised;
+
+public partial class SearchWindow : Window
{
- public partial class $CLASS$ : Window
+ private Request _request;
+ private ObservableCollection _repoDetail;
+
+ public SearchWindow()
{
- public $CLASS$()
- {
- InitializeComponent();
+ InitializeComponent();
#if DEBUG
- this.AttachDevTools();
+ this.AttachDevTools();
#endif
- }
-
- private void InitializeComponent()
- {
- AvaloniaXamlLoader.Load(this);
- }
}
-}
+
+ private void InitializeComponent()
+ {
+ AvaloniaXamlLoader.Load(this);
+ }
+
+ private void btn_close_Click(object sender, RoutedEventArgs e)
+ {
+ this.Close();
+ }
+
+ private void btn_search_Click(object sender, RoutedEventArgs e)
+ {
+ if (string.IsNullOrEmpty(txtbox_query.Text))
+ {
+ var parentWindow = this;
+ ErrorWindow err = new ErrorWindow();
+ err.txtblk_error.Text = "Please enter a username!";
+ err.ShowDialog(parentWindow);
+ }
+ else
+ {
+ _request = new Request(txtbox_query.Text);
+ _request.PerformSearchRequest();
+ _request.PerformUserRequest();
+ this.Close();
+ }
+
+ }
+}
\ No newline at end of file