Merge pull request #2 from wymillerlinux/test

Pull in changes from test to master
This commit is contained in:
Wyatt J. Miller 2018-12-09 14:56:03 -05:00 committed by GitHub
commit 07dbb422c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 804 additions and 270 deletions

Binary file not shown.

BIN
ClassDiagram.pdf Normal file

Binary file not shown.

View File

@ -5,19 +5,13 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:DeskHubSharp" xmlns:local="clr-namespace:DeskHubSharp"
mc:Ignorable="d" mc:Ignorable="d"
Title="About - DeskHubSharp" Height="450" Width="400" ResizeMode="NoResize"> Title="About - DeskHubSharp" Height="300" Width="400" ResizeMode="NoResize">
<Grid> <Grid>
<Label x:Name="lbl_title" Content="DeskHubSharp" HorizontalAlignment="Left" Margin="2,10,10,0" VerticalAlignment="Top" FontSize="24" Width="372"/> <Label x:Name="lbl_title" Content="DeskHubSharp" HorizontalAlignment="Left" Margin="2,10,10,0" VerticalAlignment="Top" FontSize="24" Width="372"/>
<Button x:Name="btn_close" Content="Close" HorizontalAlignment="Left" Margin="307,389,0,0" VerticalAlignment="Top" Width="75" Click="btn_close_Click" Background="#FFFFBABA"/> <Button x:Name="btn_close" Content="Close" HorizontalAlignment="Left" Margin="309,241,0,0" VerticalAlignment="Top" Width="75" Click="btn_close_Click" Background="#FFFFBABA"/>
<TextBlock x:Name="txtblk_about1" HorizontalAlignment="Left" Margin="10,57,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="64" Width="372"><Run Text="Written and developed by Wyatt J. Miller"/><LineBreak/><Run Text="Copyright 2018, All rights reserved"/><LineBreak/><Run Text="Licensed under the MIT license"/></TextBlock> <TextBlock x:Name="txtblk_about1" HorizontalAlignment="Left" Margin="10,81,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="64" Width="372"><Run Text="Written and developed by Wyatt J. Miller"/><LineBreak/><Run Text="Copyright 2018, All rights reserved"/><LineBreak/><Run Text="Licensed under the MIT license"/></TextBlock>
<TextBlock x:Name="txtblk_about2" HorizontalAlignment="Left" Margin="10,121,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="36" Width="372"><Run Text="Using technologies including but not limited to Visual Studio, .NET, Newtonsoft, RestSharp, MailKit/Mimekit and WPF."/><LineBreak/><Run/></TextBlock> <TextBlock x:Name="txtblk_about2" HorizontalAlignment="Left" Margin="10,139,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="36" Width="372"><Run Text="Using technologies including but not limited to Visual Studio, .NET, Newtonsoft, RestSharp, MailKit/Mimekit and WPF."/><LineBreak/><Run/></TextBlock>
<TextBlock HorizontalAlignment="Left" Margin="10,363,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="21" Width="372"> <TextBlock HorizontalAlignment="Left" Margin="10,180,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="44" Width="364">
<!--The following came from the link: https://stackoverflow.com/questions/10238694/example-using-hyperlink-in-wpf-->
<Hyperlink NavigateUri="http://github.com/wymillerlinux/DeskhubSharp" RequestNavigate="Hyperlink_RequestNavigate_4" >
Want to help with development?
</Hyperlink>
</TextBlock>
<TextBlock HorizontalAlignment="Left" Margin="10,162,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="44" Width="364">
This project cannot be done without the help of This project cannot be done without the help of
<Hyperlink NavigateUri="https://github.com/johnvelis" RequestNavigate="Hyperlink_RequestNavigate"> <Hyperlink NavigateUri="https://github.com/johnvelis" RequestNavigate="Hyperlink_RequestNavigate">
johnvelis johnvelis
@ -35,5 +29,6 @@
tarkowr. tarkowr.
</Hyperlink> </Hyperlink>
</TextBlock> </TextBlock>
<TextBlock HorizontalAlignment="Left" Margin="10,57,0,0" TextWrapping="Wrap" Text="A desktop GitHub application developed in three weeks." VerticalAlignment="Top" Height="19" Width="364"/>
</Grid> </Grid>
</Window> </Window>

View File

@ -13,9 +13,6 @@ namespace DeskHubSharp
{ {
class EmailBLL class EmailBLL
{ {
// TODO: finish this class
// TODO: debug feedback form
private string _name; private string _name;
private string _message; private string _message;
private string _emailText; private string _emailText;
@ -27,6 +24,10 @@ namespace DeskHubSharp
_emailText = emailText; _emailText = emailText;
} }
/// <summary>
/// Checks to see if Email is valid to send
/// </summary>
/// <returns></returns>
private bool IsValidated() private bool IsValidated()
{ {
if (_name == "") if (_name == "")
@ -45,10 +46,21 @@ namespace DeskHubSharp
err.ShowDialog(); err.ShowDialog();
return false; return false;
} }
if (_emailText == "")
{
ErrorWindow err = new ErrorWindow();
err.lbl_title.Content = "Oops.";
err.txtblk_error.Text = "Please fill in your email.";
err.ShowDialog();
return false;
}
return true; return true;
} }
/// <summary>
/// Creates message for user to send
/// </summary>
public void CreateMessage() public void CreateMessage()
{ {
if (IsValidated()) if (IsValidated())
@ -64,13 +76,12 @@ namespace DeskHubSharp
message.Subject = $"{_name} requires your attention!"; message.Subject = $"{_name} requires your attention!";
message.Body = new TextPart("plain") message.Body = new TextPart("plain")
{ {
Text = _message + _emailText Text = _message + " " + _emailText
}; };
using (var client = new SmtpClient()) using (var client = new SmtpClient())
{ {
client.Connect("smtp.gmail.com", 465, SecureSocketOptions.SslOnConnect); client.Connect("smtp.gmail.com", 465, SecureSocketOptions.SslOnConnect);
// change credentials
client.Authenticate(email.FromEmail, email.Password); client.Authenticate(email.FromEmail, email.Password);
client.Send(message); client.Send(message);
client.Disconnect(true); client.Disconnect(true);

View File

@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeskHubSharp
{
class RepoInfo
{
public RepoInfo()
{
}
/// <summary>
/// Return a list for the list box
/// </summary>
/// <returns></returns>
public List<string> GetRepoInfoList()
{
List<string> stuff = new List<string>();
try
{
stuff = RequestList.repoDetail.Select(x => x.full_name).ToList();
}
catch (Exception)
{
ErrorWindow err = new ErrorWindow();
err.txtblk_error.Text = "We couldn't gather any data. Does the user exist?";
err.ShowDialog();
}
return stuff;
}
/// <summary>
/// Return a list for the combo box
/// </summary>
/// <returns></returns>
public List<string> GetBranchNameComboBox()
{
List<string> stuff = RequestList.branchDetail.Select(x => x.name).ToList();
return stuff;
}
}
}

View File

@ -1,110 +1,73 @@
using RestSharp; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net;
using System.Net.Mail;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Newtonsoft.Json;
using System.Collections.ObjectModel;
namespace DeskHubSharp namespace DeskHubSharp
{ {
class Request public class Request
{ {
// TODO: this is rudimentary, fix it private ApiDataService _api;
// i.e. try catch statements\
// TODO: find how to access a list index
// TODO: find how to access the deserialized
private string _apiEndpoint = "https://api.github.com/";
private string _query; private string _query;
public List<RepoDetail> RepoDetail { get; set; } /// <summary>
/// Override constructor for the class
/// </summary>
/// <param name="query"></param>
public Request(string query) public Request(string query)
{ {
_query = query; _query = query;
_api = new ApiDataService(_query);
} }
//public Request(string query, Object function) /// <summary>
//{ /// Constructor for the class
// _query = query; /// </summary>
//} public Request()
{
}
/// <summary> /// <summary>
/// Calls API for repo and user data an stores it in RepoList /// Performs the search request
/// </summary>
public void PerformSearchRequest()
{
_api.SearchRequest();
}
/// <summary>
/// Performs the user request
/// </summary>
public void PerformUserRequest()
{
_api.UserRequest();
}
/// <summary>
/// Performs the branch request
/// </summary>
public void PerformBranchRequest()
{
_api.BranchRequest();
}
/// <summary>
/// Performs the local owner request
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public void SearchRequest() public Owner GetUserData()
{ {
try Owner owner = new Owner();
{ return owner;
var client = new RestClient(_apiEndpoint);
RestRequest requestRepo = new RestRequest($"users/{_query}/repos", Method.GET);
var response = client.Execute(requestRepo);
var x = response.Content;
var deserialized = JsonConvert.DeserializeObject<ObservableCollection<RepoDetail>>(x);
//ObservableCollection<RepoDetail> test = new ObservableCollection<RepoDetail>()
//{
// new RepoDetail()
// {
// Login = "John",
// Password = "pw"
// }
//};
if (deserialized.Count() == 0)
{
throw new Exception();
}
else
{
RepoList.repoDetail = deserialized;
}
}
catch (Exception)
{
ErrorWindow err = new ErrorWindow();
err.txtblk_error.Text = "We couldn't gather repository data. Please try again";
}
} }
public List<string> PerformGetSort()
/// <summary>
/// Calls API for detailed user data
/// </summary>
public void UserRequest()
{ {
try Sort sort = new Sort();
{ var sortTerms = sort.GetSortTerms();
var client = new RestClient(_apiEndpoint); return sortTerms;
RestRequest requestUser = new RestRequest($"users/{_query}", Method.GET);
var response = client.Execute(requestUser);
string x = response.Content;
var deserailized = JsonConvert.DeserializeObject<User>(x);
if (deserailized == null)
{
throw new Exception();
}
else
{
RepoList.userDetail = deserailized;
}
}
catch (Exception)
{
ErrorWindow err = new ErrorWindow();
err.txtblk_error.Text = "We couldn't gather user data. Please try again.";
}
} }
} }

View File

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="utf-8"?>
<ClassDiagram MajorVersion="1" MinorVersion="1">
<Class Name="DeskHubSharp.AboutWindow">
<Position X="2.25" Y="0.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAABAAAAAQAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>AboutWindow.xaml.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="DeskHubSharp.DetailWindow">
<Position X="0.5" Y="2.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAIhAAAAAQAQAAAQAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>DetailWindow.xaml.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="DeskHubSharp.ErrorWindow">
<Position X="2.25" Y="3.25" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>ErrorWindow.xaml.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="DeskHubSharp.FeedbackWindow">
<Position X="0.5" Y="0.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAEA=</HashCode>
<FileName>FeedbackWindow.xaml.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="DeskHubSharp.HelpWindow">
<Position X="2.25" Y="7.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>HelpWindow.xaml.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="DeskHubSharp.MainWindow">
<Position X="0.5" Y="5.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAhAAAAAAAAAAAQCAQAAAAAAQAAgAAAIAwBEAAAAA=</HashCode>
<FileName>MainWindow.xaml.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="DeskHubSharp.SearchWindow">
<Position X="2.25" Y="5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAQAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAA=</HashCode>
<FileName>SearchWindow.xaml.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="DeskHubSharp.ApiDataService">
<Position X="9.25" Y="0.5" Width="1.5" />
<TypeIdentifier>
<HashCode>gAAAAgAAAAAEAAAgAAAAAAAAAAAAAAAAAAAAAEAAAAA=</HashCode>
<FileName>DAL\ApiDataService.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.1" />
</Class>
<Class Name="DeskHubSharp.Branch">
<Position X="4" Y="0.5" Width="1.5" />
<Compartments>
<Compartment Name="Nested Types" Collapsed="false" />
</Compartments>
<NestedTypes>
<Class Name="DeskHubSharp.Branch.Commit">
<TypeIdentifier>
<NewMemberFileName>Models\Branch.cs</NewMemberFileName>
</TypeIdentifier>
</Class>
</NestedTypes>
<TypeIdentifier>
<HashCode>QAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAA=</HashCode>
<FileName>Models\Branch.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="DeskHubSharp.EmailBLL">
<Position X="5.75" Y="0.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAIAAAAAAAAAAAAAIAAIAAAAAAAACAEAAAAAAAAAA=</HashCode>
<FileName>BusinessLayer\EmailBLL.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="DeskHubSharp.License">
<Position X="7.5" Y="2.25" Width="1.5" />
<TypeIdentifier>
<HashCode>ACAAAAAAAAAAAAAAAAAEAAAAAAAcAAAAAAAAAAAAAAA=</HashCode>
<FileName>Models\License.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="DeskHubSharp.Owner">
<Position X="5.75" Y="3" Width="1.5" />
<TypeIdentifier>
<HashCode>BGAAAAAAAAAAoAAQAAAAIAAAgAAJAAIUAgAAAAgAMgA=</HashCode>
<FileName>Models\Owner.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="DeskHubSharp.RepoDetail" Collapsed="true">
<Position X="7.5" Y="6" Width="1.5" />
<TypeIdentifier>
<HashCode>BCIwgQSAIRCAkB8B4OwJIEAEyiANIQFYKRKI4AgFngw=</HashCode>
<FileName>Models\RepoDetail.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="DeskHubSharp.RepoInfo">
<Position X="7.5" Y="4.25" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>BusinessLayer\RepoList.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="DeskHubSharp.Request">
<Position X="4" Y="3.75" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAgAAAAgAAAgAgAAAAAACADAAAAAAAAAAAAAAAA=</HashCode>
<FileName>BusinessLayer\Request.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="DeskHubSharp.RequestList">
<Position X="9.25" Y="3.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAQAAAAAIAAAAA=</HashCode>
<FileName>Models\RequestList.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="DeskHubSharp.Sort">
<Position X="9.25" Y="5.25" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAA=</HashCode>
<FileName>Models\Sort.cs</FileName>
</TypeIdentifier>
</Class>
<Interface Name="DeskHubSharp.IDataService">
<Position X="7.5" Y="0.5" Width="1.5" />
<TypeIdentifier>
<HashCode>gAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAA=</HashCode>
<FileName>DAL\IDataService.cs</FileName>
</TypeIdentifier>
</Interface>
<Font Name="Segoe UI" Size="9" />
</ClassDiagram>

View File

@ -0,0 +1,126 @@
using RestSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Mail;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using System.Collections.ObjectModel;
namespace DeskHubSharp
{
class ApiDataService : IDataService
{
// TODO: this is rudimentary, fix it
// i.e. try catch statements\
// TODO: Add BranchRequest function
private string _apiEndpoint;
private string _query;
public List<RepoDetail> RepoDetail { get; set; }
public ApiDataService(string query)
{
_query = query;
_apiEndpoint = DataConfig.dataConfString;
}
//public Request(string query, Object function)
//{
// _query = query;
//}
/// <summary>
/// Calls API for repo and basic user data
/// </summary>
/// <returns></returns>
public void SearchRequest()
{
try
{
var client = new RestClient(_apiEndpoint);
RestRequest requestRepo = new RestRequest($"users/{_query}/repos", Method.GET);
var response = client.Execute(requestRepo);
var x = response.Content;
var deserialized = JsonConvert.DeserializeObject<ObservableCollection<RepoDetail>>(x);
if (deserialized.Count == 0)
{
throw new Exception();
}
else
{
RequestList.repoDetail = deserialized;
}
}
catch (Exception)
{
ErrorWindow err = new ErrorWindow();
err.txtblk_error.Text = "We couldn't gather repository data. Please try again";
}
}
/// <summary>
/// Calls API for detailed user data
/// </summary>
public void UserRequest()
{
try
{
var client = new RestClient(_apiEndpoint);
RestRequest requestUser = new RestRequest($"users/{_query}", Method.GET);
var response = client.Execute(requestUser);
string x = response.Content;
var deserailized = JsonConvert.DeserializeObject<User>(x);
if (deserailized == null)
{
throw new Exception();
}
else
{
RequestList.userDetail = deserailized;
}
}
catch (NullReferenceException)
{
ErrorWindow err = new ErrorWindow();
err.txtblk_error.Text = "We couldn't gather user data. Please try again.";
}
}
/// <summary>
/// Calls API for detailed branch data
/// </summary>
public void BranchRequest()
{
try
{
var client = new RestClient(_apiEndpoint);
RestRequest requestUser = new RestRequest($"/repos/{RequestList.userDetail.login}/{_query}/branches", Method.GET);
var response = client.Execute(requestUser);
string x = response.Content;
var deserailized = JsonConvert.DeserializeObject<ObservableCollection<Branch>>(x);
RequestList.branchDetail = deserailized;
}
catch (NullReferenceException)
{
ErrorWindow err = new ErrorWindow();
err.txtblk_error.Text = "We couldn't gather user data. Please try again.";
}
}
}
}

View File

@ -8,7 +8,11 @@ namespace DeskHubSharp
{ {
public interface IDataService public interface IDataService
{ {
List<Search> ReadAll(); //List<Search> ReadAll();
void WriteAll(List<Search> user); //void WriteAll(List<Search> user);
void SearchRequest();
void UserRequest();
void BranchRequest();
} }
} }

View File

@ -1,66 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
using System.IO;
namespace DeskHubSharp
{
class XmlDataService
{
private readonly string _dataFilePath;
public List<User> ReadAll()
{
List<User> Users = new List<User>();
XmlSerializer serializer = new XmlSerializer(typeof(List<User>), new XmlRootAttribute("Users"));
try
{
StreamReader reader = new StreamReader(_dataFilePath);
using (reader)
{
Users = (List<User>)serializer.Deserialize(reader);
}
}
catch (Exception)
{
throw;
}
return Users;
}
public void WriteAll(List<User> Users)
{
XmlSerializer serializer = new XmlSerializer(typeof(List<User>), new XmlRootAttribute("Users"));
try
{
StreamWriter writer = new StreamWriter(_dataFilePath);
using (writer)
{
serializer.Serialize(writer, Users);
}
}
catch (Exception)
{
throw;
}
}
public XmlDataService()
{
}
public XmlDataService(string datafile)
{
_dataFilePath = datafile;
}
}
}

View File

@ -8,6 +8,6 @@ namespace DeskHubSharp
{ {
class DataConfig class DataConfig
{ {
public string dataConfString = ""; public static string dataConfString = "https://api.github.com/";
} }
} }

View File

@ -71,11 +71,14 @@
<ApplicationDefinition Include="App.xaml"> <ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</ApplicationDefinition> </ApplicationDefinition>
<Compile Include="BusinessLayer\Request.cs" />
<Compile Include="DAL\JsonDataService.cs" /> <Compile Include="DAL\JsonDataService.cs" />
<Compile Include="Models\Branch.cs" />
<Compile Include="Models\Email.cs" /> <Compile Include="Models\Email.cs" />
<Compile Include="Models\License.cs" /> <Compile Include="Models\License.cs" />
<Compile Include="Models\Owner.cs" /> <Compile Include="Models\Owner.cs" />
<Compile Include="Models\RepoInfo.cs" /> <Compile Include="BusinessLayer\RepoList.cs" />
<Compile Include="Models\Sort.cs" />
<Compile Include="SearchWindow.xaml.cs"> <Compile Include="SearchWindow.xaml.cs">
<DependentUpon>SearchWindow.xaml</DependentUpon> <DependentUpon>SearchWindow.xaml</DependentUpon>
</Compile> </Compile>
@ -106,9 +109,8 @@
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="BusinessLayer\EmailBLL.cs" /> <Compile Include="BusinessLayer\EmailBLL.cs" />
<Compile Include="BusinessLayer\Request.cs" /> <Compile Include="DAL\ApiDataService.cs" />
<Compile Include="DAL\IDataService.cs" /> <Compile Include="DAL\IDataService.cs" />
<Compile Include="DAL\XmlDataService.cs" />
<Compile Include="Data\DataConfig.cs" /> <Compile Include="Data\DataConfig.cs" />
<Compile Include="DetailWindow.xaml.cs"> <Compile Include="DetailWindow.xaml.cs">
<DependentUpon>DetailWindow.xaml</DependentUpon> <DependentUpon>DetailWindow.xaml</DependentUpon>
@ -132,7 +134,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Models\RepoDetail.cs" /> <Compile Include="Models\RepoDetail.cs" />
<Compile Include="Models\RepoList.cs" /> <Compile Include="Models\RequestList.cs" />
<Compile Include="Models\Search.cs" /> <Compile Include="Models\Search.cs" />
<Compile Include="Models\User.cs" /> <Compile Include="Models\User.cs" />
<Compile Include="Properties\AssemblyInfo.cs"> <Compile Include="Properties\AssemblyInfo.cs">
@ -153,6 +155,7 @@
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource> </EmbeddedResource>
<None Include="build.cake" /> <None Include="build.cake" />
<None Include="ClassDiagram1.cd" />
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>

View File

@ -5,12 +5,18 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:DeskHubSharp" xmlns:local="clr-namespace:DeskHubSharp"
mc:Ignorable="d" mc:Ignorable="d"
Title="Detail - DeskHubSharp" Height="450" Width="800" ResizeMode="NoResize"> Title="Detail - DeskHubSharp" Height="450" Width="400" ResizeMode="NoResize">
<Grid> <Grid>
<Label x:Name="lbl_reponame" Content="Repository Name" HorizontalAlignment="Left" Margin="10,47,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.603,-0.2" Width="225" FontSize="16"/> <Label x:Name="lbl_reponame" Content="Repository Name" HorizontalAlignment="Left" Margin="10,57,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.603,-0.2" Width="374" FontSize="20"/>
<Label x:Name="lbl_title" Content="Details" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="171" FontSize="20"/> <Label x:Name="lbl_title" Content="Details" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="81" FontSize="24"/>
<Button x:Name="btn_close" Content="Close" HorizontalAlignment="Left" Margin="707,389,0,0" VerticalAlignment="Top" Width="75" Background="#FFFFABAB" Click="btn_close_Click"/> <Button x:Name="btn_close" Content="Close" HorizontalAlignment="Left" Margin="309,389,0,0" VerticalAlignment="Top" Width="75" Background="#FFFFABAB" Click="btn_close_Click"/>
<Button x:Name="btn_clone" Content="Clone" HorizontalAlignment="Left" Margin="240,54,0,0" VerticalAlignment="Top" Width="75" /> <TextBlock x:Name="txtblk_language" HorizontalAlignment="Left" Margin="13,120,0,0" TextWrapping="Wrap" Text="This repo is mostly some code." VerticalAlignment="Top" Height="25" Width="223" FontSize="14"/>
<TextBlock x:Name="txtblk_stargazers" HorizontalAlignment="Left" Margin="13,150,0,0" TextWrapping="Wrap" Text="This repo has 0 stargazers." VerticalAlignment="Top" Height="24" Width="186" FontSize="14"/>
<ComboBox x:Name="cmbbox_branches" HorizontalAlignment="Left" Margin="13,389,0,0" VerticalAlignment="Top" Width="120" Height="19"/>
<Label x:Name="lbl_branch" Content="What branch do you want to download?" HorizontalAlignment="Left" Margin="13,358,0,0" VerticalAlignment="Top" Width="223" Padding="1,5,5,5" RenderTransformOrigin="0.537,0.517"/>
<TextBlock x:Name="txtblk_watchers" HorizontalAlignment="Left" Margin="13,179,0,0" TextWrapping="Wrap" Text="This repo has 0 watchers." VerticalAlignment="Top" Width="209" FontSize="14" Height="24"/>
<TextBlock x:Name="txtblk_forks" HorizontalAlignment="Left" Margin="13,208,0,0" TextWrapping="Wrap" Text="This repo has 0 forks." VerticalAlignment="Top" FontSize="14" Height="20" Width="223"/>
<Button x:Name="btn_page" Content="GitHub Page" HorizontalAlignment="Left" Margin="13,333,0,0" VerticalAlignment="Top" Width="88" RenderTransformOrigin="0.29,1.69" Click="btn_page_Click"/>
<Button x:Name="btn_clone" Content="Clone" HorizontalAlignment="Left" Margin="147,388,0,0" VerticalAlignment="Top" Width="75" Click="btn_clone_Click"/>
</Grid> </Grid>
</Window> </Window>

View File

@ -4,6 +4,7 @@ using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Diagnostics;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data; using System.Windows.Data;
@ -21,12 +22,36 @@ namespace DeskHubSharp
public partial class DetailWindow : Window public partial class DetailWindow : Window
{ {
private RepoDetail _repoDetail; private RepoDetail _repoDetail;
private Request _request;
private Owner _owner;
public DetailWindow(RepoDetail repoDetail) public DetailWindow(RepoDetail repoDetail)
{ {
InitializeComponent(); InitializeComponent();
_repoDetail = repoDetail; _repoDetail = repoDetail;
_request = new Request(_repoDetail.name);
RepoInfo info = new RepoInfo();
_request.PerformBranchRequest();
var stuff = info.GetBranchNameComboBox();
cmbbox_branches.ItemsSource = 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.";
}
lbl_reponame.Content = _repoDetail.full_name; 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.";
} }
@ -34,5 +59,27 @@ namespace DeskHubSharp
{ {
this.Close(); this.Close();
} }
private void btn_clone_Click(object sender, RoutedEventArgs e)
{
if (cmbbox_branches.Text == "")
{
ErrorWindow err = new ErrorWindow();
err.txtblk_error.Text = "Please select a branch to clone.";
}
else
{
_owner = new Owner();
string link = "https://github.com/" + _repoDetail.owner.login + "/" + _repoDetail.name + "/archive/" + cmbbox_branches.Text + ".zip";
Process.Start(link);
}
}
private void btn_page_Click(object sender, RoutedEventArgs e)
{
Process.Start($"{_repoDetail.html_url}");
}
} }
} }

View File

@ -10,7 +10,7 @@
<Grid> <Grid>
<Button x:Name="btn_close" Content="Close" HorizontalAlignment="Left" Margin="307,389,0,0" VerticalAlignment="Top" Width="75" Background="#FFFFBDBD" Click="btn_close_Click"/> <Button x:Name="btn_close" Content="Close" HorizontalAlignment="Left" Margin="307,389,0,0" VerticalAlignment="Top" Width="75" Background="#FFFFBDBD" Click="btn_close_Click"/>
<Label x:Name="lbl_title" Content="Need some help?" HorizontalAlignment="Left" Margin="3,10,0,0" VerticalAlignment="Top" FontSize="20"/> <Label x:Name="lbl_title" Content="Need some help?" HorizontalAlignment="Left" Margin="3,10,0,0" VerticalAlignment="Top" FontSize="20"/>
<TextBlock HorizontalAlignment="Left" Margin="10,52,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="332" Width="372"><Run Text="No worries friend! We have you covered!"/><LineBreak/><Run/><LineBreak/><Run Text="If you have a blank data grid when you first start the program, that's normal! You just have to search for somebody."/><LineBreak/><Run/><LineBreak/><Run Text="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."/><LineBreak/><Run/><LineBreak/><Run Text="If the search finds a user, the data grid will populate. Click on a repository of interest and click on the Detail button to view it in action."/><LineBreak/><Run/><LineBreak/><Run Text="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."/><LineBreak/><LineBreak/><Run Text="Want to know more about this program? Click on the About program to view stuff."/></TextBlock> <TextBlock HorizontalAlignment="Left" Margin="10,52,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="332" Width="372"><Run Text="No worries friend! We have you covered!"/><LineBreak/><Run/><LineBreak/><Run Text="If you have a blank list when you first start the program, that's normal! You just have to search for somebody."/><LineBreak/><Run/><LineBreak/><Run Text="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."/><LineBreak/><Run/><LineBreak/><Run Text="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."/><LineBreak/><Run/><LineBreak/><Run Text="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."/><LineBreak/><LineBreak/><Run Text="Want to know more about this program? Click on the About program to view stuff."/></TextBlock>
</Grid> </Grid>
</Window> </Window>

View File

@ -7,7 +7,7 @@
mc:Ignorable="d" mc:Ignorable="d"
Title="DeskHubSharp" Height="450" Width="805" ResizeMode="NoResize"> Title="DeskHubSharp" Height="450" Width="805" ResizeMode="NoResize">
<Grid> <Grid>
<Button x:Name="btn_search" Content="Search" HorizontalAlignment="Left" Margin="10,389,0,0" VerticalAlignment="Top" Width="75" Background="#FFA1C8FF" Click="btn_search_Click"/> <Button x:Name="btn_searchuser" Content="Search User" HorizontalAlignment="Left" Margin="10,389,0,0" VerticalAlignment="Top" Width="75" Background="#FFA1C8FF" Click="btn_search_Click"/>
<Button x:Name="btn_detail" Content="Detail" HorizontalAlignment="Left" Margin="90,389,0,0" VerticalAlignment="Top" Width="75" Background="#FFA1C8FF" Click="btn_detail_Click"/> <Button x:Name="btn_detail" Content="Detail" HorizontalAlignment="Left" Margin="90,389,0,0" VerticalAlignment="Top" Width="75" Background="#FFA1C8FF" Click="btn_detail_Click"/>
<Button x:Name="btn_feedback" Content="Feedback" HorizontalAlignment="Left" Margin="170,389,0,0" VerticalAlignment="Top" Width="75" Background="#FFD9A1FF" Click="btn_feedback_Click"/> <Button x:Name="btn_feedback" Content="Feedback" HorizontalAlignment="Left" Margin="170,389,0,0" VerticalAlignment="Top" Width="75" Background="#FFD9A1FF" Click="btn_feedback_Click"/>
<Button x:Name="btn_help" Content="Help" HorizontalAlignment="Left" Margin="250,389,0,0" VerticalAlignment="Top" Width="75" Background="#FFFFFF9D" Click="btn_help_Click"/> <Button x:Name="btn_help" Content="Help" HorizontalAlignment="Left" Margin="250,389,0,0" VerticalAlignment="Top" Width="75" Background="#FFFFFF9D" Click="btn_help_Click"/>
@ -25,7 +25,11 @@
<Label x:Name="lbl_email" Content="Email:" HorizontalAlignment="Left" Margin="563,192,0,0" VerticalAlignment="Top" Padding="2,5,5,5" FontSize="11"/> <Label x:Name="lbl_email" Content="Email:" HorizontalAlignment="Left" Margin="563,192,0,0" VerticalAlignment="Top" Padding="2,5,5,5" FontSize="11"/>
<Label x:Name="lbl_bio" Content="Bio:" HorizontalAlignment="Left" Margin="563,249,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.079,0.397" Padding="2,5,5,5"/> <Label x:Name="lbl_bio" Content="Bio:" HorizontalAlignment="Left" Margin="563,249,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.079,0.397" Padding="2,5,5,5"/>
<ListBox x:Name="ListBox" HorizontalAlignment="Left" Height="265" Margin="10,10,0,0" VerticalAlignment="Top" Width="519"/> <ListBox x:Name="ListBox" HorizontalAlignment="Left" Height="265" Margin="10,10,0,0" VerticalAlignment="Top" Width="519"/>
<TextBlock x:Name="txtblk_repocount" HorizontalAlignment="Left" Margin="10,280,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="65" Width="519" RenderTransformOrigin="0.496,0.482"/> <TextBlock x:Name="txtblk_repocount" HorizontalAlignment="Left" Margin="10,280,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="65" Width="235" RenderTransformOrigin="0.496,0.482"/>
<ComboBox x:Name="cmbbox_sort" HorizontalAlignment="Left" Margin="330,280,0,0" VerticalAlignment="Top" Width="199"/>
<Button x:Name="btn_sort" Content="Sort" HorizontalAlignment="Left" Margin="250,280,0,0" VerticalAlignment="Top" Width="75" Click="btn_sort_Click" Height="22"/>
<Button x:Name="btn_searchrepo" Content="Search Repository" HorizontalAlignment="Left" Margin="250,307,0,0" VerticalAlignment="Top" Width="109" Click="btn_searchrepo_Click"/>
<TextBox x:Name="txtbox_searchbox" HorizontalAlignment="Left" Height="20" Margin="364,307,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="165" RenderTransformOrigin="0.131,-0.913"/>
</Grid> </Grid>
</Window> </Window>

View File

@ -22,23 +22,43 @@ namespace DeskHubSharp
public partial class MainWindow : Window public partial class MainWindow : Window
{ {
private ObservableCollection<RepoDetail> _repoDetail; private ObservableCollection<RepoDetail> _repoDetail;
private User _userDetail;
private Request _request;
public MainWindow() public MainWindow()
{ {
InitializeComponent(); InitializeComponent();
//ShowDataGridItems(); _request = new Request();
cmbbox_sort.ItemsSource = _request.PerformGetSort();
} }
private void btn_detail_Click(object sender, RoutedEventArgs e) private void btn_detail_Click(object sender, RoutedEventArgs e)
{
try
{ {
RepoDetail repo = _repoDetail[ListBox.SelectedIndex]; RepoDetail repo = _repoDetail[ListBox.SelectedIndex];
DetailWindow detail = new DetailWindow(repo); DetailWindow detail = new DetailWindow(repo);
detail.ShowDialog(); detail.Show();
}
catch (IndexOutOfRangeException)
{
ShowErrorMessage("Please pick a repository!");
}
catch (NullReferenceException)
{
ShowErrorMessage("Please search for a user with the Search button!");
}
catch (ArgumentOutOfRangeException)
{
ShowErrorMessage("MEME REVIEW!");
}
} }
private void btn_exit_Click(object sender, RoutedEventArgs e) private void btn_exit_Click(object sender, RoutedEventArgs e)
{ {
this.Close(); this.Close();
Environment.Exit(0);
} }
private void btn_about_Click(object sender, RoutedEventArgs e) private void btn_about_Click(object sender, RoutedEventArgs e)
@ -62,30 +82,88 @@ namespace DeskHubSharp
private void btn_search_Click(object sender, RoutedEventArgs e) private void btn_search_Click(object sender, RoutedEventArgs e)
{ {
SearchWindow search = new SearchWindow(); SearchWindow search = new SearchWindow();
RepoInfo info = new RepoInfo();
Owner owner = new Owner();
search.ShowDialog(); search.ShowDialog();
var stuff = info.GetRepoInfoDataGrid(); RepoInfo info = new RepoInfo();
_repoDetail = RepoList.repoDetail; _repoDetail = RequestList.repoDetail;
ListBox.ItemsSource = stuff;
txtblk_username.Text = RepoList.userDetail.login;
txtblk_url.Text = RepoList.userDetail.html_url;
txtblk_bio.Text = RepoList.userDetail.bio;
txtblk_email.Text = RepoList.userDetail.blog;
txtblk_realname.Text = RepoList.userDetail.name;
txtblk_repocount.Text = $"{RepoList.userDetail.login} has {RepoList.userDetail.public_repos} public repositories.";
//img_avatar.Source = RepoList.repoDetail[0].owner.avatar_url;
}
private void DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) var stuff = info.GetRepoInfoList();
if (stuff.Count == 0)
{ {
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
{
_userDetail = RequestList.userDetail;
ListBox.ItemsSource = stuff;
txtblk_username.Text = _userDetail.login;
txtblk_url.Text = _userDetail.html_url;
txtblk_bio.Text = _userDetail.bio;
txtblk_email.Text = _userDetail.blog;
txtblk_realname.Text = _userDetail.name;
txtblk_repocount.Text = $"{_userDetail.login} has {_userDetail.public_repos} public repositories.";
}
} }
//public void ShowDataGridItems() public void ShowErrorMessage(string message)
//{ {
// DataGrid.ItemsSource = RepoList.repoDetail; ErrorWindow err = new ErrorWindow();
//} err.txtblk_error.Text = message;
err.ShowDialog();
}
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")
{
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.");
}
}
} }
} }

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeskHubSharp
{
public class Branch
{
public string name { get; set; }
public Commit commit { get; set; }
public class Commit
{
public string sha { get; set; }
public string url { get; set; }
}
}
}

View File

@ -4,7 +4,7 @@ namespace DeskHubSharp
{ {
private string _toEmail = "wjmiller2016@gmail.com"; private string _toEmail = "wjmiller2016@gmail.com";
private string _fromEmail = "wjmiller2016@gmail.com"; private string _fromEmail = "wjmiller2016@gmail.com";
private string _passwordEmail = "password"; private string _passwordEmail = "IhaveanAMDRX580";
public string Password public string Password
{ {
@ -24,6 +24,9 @@ namespace DeskHubSharp
set { _toEmail = value; } set { _toEmail = value; }
} }
/// <summary>
/// Constructor for the Email class
/// </summary>
public Email() public Email()
{ {

View File

@ -6,6 +6,9 @@ using System.Threading.Tasks;
namespace DeskHubSharp namespace DeskHubSharp
{ {
/// <summary>
/// Class from a JSON to a C# converter
/// </summary>
public class License public class License
{ {
/// <summary> /// <summary>

View File

@ -6,6 +6,9 @@ using System.Threading.Tasks;
namespace DeskHubSharp namespace DeskHubSharp
{ {
/// <summary>
/// Class from a JSON to a C# converter
/// </summary>
public class Owner public class Owner
{ {
/// <summary> /// <summary>

View File

@ -2,6 +2,9 @@ using DeskHubSharp;
namespace DeskHubSharp namespace DeskHubSharp
{ {
// TODO: The RepoDetail class is called from the code behind, fix it
public class RepoDetail public class RepoDetail
{ {
public Owner Owner { get; set; } public Owner Owner { get; set; }

View File

@ -1,25 +0,0 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeskHubSharp
{
class RepoInfo
{
public RepoInfo()
{
}
public List<string> GetRepoInfoDataGrid()
{
List<string> stuff = RepoList.repoDetail.Select(x => x.full_name).ToList();
//stuff =+ RepoList.repoDetail.Select(x => x.name).ToList();
return stuff;
}
}
}

View File

@ -1,22 +0,0 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeskHubSharp
{
class RepoList
{
private static ObservableCollection<RepoDetail> _repoDetail;
public static User userDetail { get; set; }
public static ObservableCollection<RepoDetail> repoDetail
{
get { return _repoDetail; }
set { _repoDetail = value; }
}
}
}

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeskHubSharp
{
public class RequestList
{
/// <summary>
/// Stores everything in User, typically from the request
/// </summary>
public static User userDetail { get; set; }
/// <summary>
/// Stores everything sent in Branch, typically from request
/// </summary>
public static ObservableCollection<Branch> branchDetail { get; set; }
/// <summary>
/// Stores everything sent in RepoDetail, typically from request
/// </summary>
public static ObservableCollection<RepoDetail> repoDetail { get; set; }
}
}

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeskHubSharp
{
public class Sort
{
public Sort()
{
}
public List<string> GetSortTerms()
{
List<string> sortTerms = new List<string>();
sortTerms.Add("A - Z");
sortTerms.Add("Least to most Stars");
sortTerms.Add("Least to most Forks");
sortTerms.Add("Least to most Watchers");
return sortTerms;
}
}
}

View File

@ -2,6 +2,8 @@ using System.Collections.Generic;
namespace DeskHubSharp namespace DeskHubSharp
{ {
// The User class is called from the code behind, fix it
public class User public class User
{ {
public string login { get; set; } public string login { get; set; }

View File

@ -19,6 +19,9 @@ namespace DeskHubSharp
/// </summary> /// </summary>
public partial class SearchWindow : Window public partial class SearchWindow : Window
{ {
private Request _request;
public SearchWindow() public SearchWindow()
{ {
InitializeComponent(); InitializeComponent();
@ -31,12 +34,20 @@ namespace DeskHubSharp
private void btn_search_Click(object sender, RoutedEventArgs e) private void btn_search_Click(object sender, RoutedEventArgs e)
{ {
Request request = new Request(txtbox_query.Text); if (txtbox_query.Text == "")
request.SearchRequest(); {
request.UserRequest(); ErrorWindow err = new ErrorWindow();
//MainWindow main = new MainWindow(); err.txtblk_error.Text = "Please enter a username!";
//main.ShowDialog(); err.ShowDialog();
}
else
{
_request = new Request(txtbox_query.Text);
_request.PerformSearchRequest();
_request.PerformUserRequest();
this.Close(); this.Close();
} }
}
} }
} }

View File

@ -1 +1 @@
5719003caa9368fdbade249bbbe98f747b8af257 f6a02c2d6dac7b2ec0bdf4f3374969b628104441

View File

@ -12,7 +12,7 @@ DEBUG;TRACE
C:\Users\Wyatt\Desktop\Source\DeskHubSharp\DeskHubSharp\App.xaml C:\Users\Wyatt\Desktop\Source\DeskHubSharp\DeskHubSharp\App.xaml
7-86569338 7-86569338
25696652050 27-1010967837
20415715258 20415715258
AboutWindow.xaml;DetailWindow.xaml;ErrorWindow.xaml;FeedbackWindow.xaml;HelpWindow.xaml;MainWindow.xaml;SearchWindow.xaml; AboutWindow.xaml;DetailWindow.xaml;ErrorWindow.xaml;FeedbackWindow.xaml;HelpWindow.xaml;MainWindow.xaml;SearchWindow.xaml;

View File

@ -12,9 +12,9 @@ DEBUG;TRACE
C:\Users\Wyatt\Desktop\Source\DeskHubSharp\DeskHubSharp\App.xaml C:\Users\Wyatt\Desktop\Source\DeskHubSharp\DeskHubSharp\App.xaml
7-86569338 7-86569338
29498133693 31-1209486194
20415715258 20415715258
AboutWindow.xaml;DetailWindow.xaml;ErrorWindow.xaml;FeedbackWindow.xaml;HelpWindow.xaml;MainWindow.xaml;SearchWindow.xaml; AboutWindow.xaml;DetailWindow.xaml;ErrorWindow.xaml;FeedbackWindow.xaml;HelpWindow.xaml;MainWindow.xaml;SearchWindow.xaml;
False True

View File

@ -1,4 +1,4 @@
#pragma checksum "..\..\MainWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "0EAA4E5953DD54A83EF84C8979256F95CA55AC47" #pragma checksum "..\..\MainWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "B63AC266B8736D857C4AD5FFCF2522AB3A32FFD8"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
@ -51,7 +51,7 @@ namespace DeskHubSharp {
#line 10 "..\..\MainWindow.xaml" #line 10 "..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Button btn_search; internal System.Windows.Controls.Button btn_searchuser;
#line default #line default
#line hidden #line hidden
@ -192,6 +192,38 @@ namespace DeskHubSharp {
#line default #line default
#line hidden #line hidden
#line 29 "..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.ComboBox cmbbox_sort;
#line default
#line hidden
#line 30 "..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Button btn_sort;
#line default
#line hidden
#line 31 "..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Button btn_searchrepo;
#line default
#line hidden
#line 32 "..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.TextBox txtbox_searchbox;
#line default
#line hidden
private bool _contentLoaded; private bool _contentLoaded;
/// <summary> /// <summary>
@ -226,10 +258,10 @@ namespace DeskHubSharp {
this.window_main = ((DeskHubSharp.MainWindow)(target)); this.window_main = ((DeskHubSharp.MainWindow)(target));
return; return;
case 2: case 2:
this.btn_search = ((System.Windows.Controls.Button)(target)); this.btn_searchuser = ((System.Windows.Controls.Button)(target));
#line 10 "..\..\MainWindow.xaml" #line 10 "..\..\MainWindow.xaml"
this.btn_search.Click += new System.Windows.RoutedEventHandler(this.btn_search_Click); this.btn_searchuser.Click += new System.Windows.RoutedEventHandler(this.btn_search_Click);
#line default #line default
#line hidden #line hidden
@ -315,6 +347,30 @@ namespace DeskHubSharp {
case 19: case 19:
this.txtblk_repocount = ((System.Windows.Controls.TextBlock)(target)); this.txtblk_repocount = ((System.Windows.Controls.TextBlock)(target));
return; return;
case 20:
this.cmbbox_sort = ((System.Windows.Controls.ComboBox)(target));
return;
case 21:
this.btn_sort = ((System.Windows.Controls.Button)(target));
#line 30 "..\..\MainWindow.xaml"
this.btn_sort.Click += new System.Windows.RoutedEventHandler(this.btn_sort_Click);
#line default
#line hidden
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));
return;
} }
this._contentLoaded = true; this._contentLoaded = true;
} }

View File

@ -1,4 +1,4 @@
#pragma checksum "..\..\MainWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "0EAA4E5953DD54A83EF84C8979256F95CA55AC47" #pragma checksum "..\..\MainWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "B63AC266B8736D857C4AD5FFCF2522AB3A32FFD8"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
@ -51,7 +51,7 @@ namespace DeskHubSharp {
#line 10 "..\..\MainWindow.xaml" #line 10 "..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Button btn_search; internal System.Windows.Controls.Button btn_searchuser;
#line default #line default
#line hidden #line hidden
@ -192,6 +192,38 @@ namespace DeskHubSharp {
#line default #line default
#line hidden #line hidden
#line 29 "..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.ComboBox cmbbox_sort;
#line default
#line hidden
#line 30 "..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Button btn_sort;
#line default
#line hidden
#line 31 "..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Button btn_searchrepo;
#line default
#line hidden
#line 32 "..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.TextBox txtbox_searchbox;
#line default
#line hidden
private bool _contentLoaded; private bool _contentLoaded;
/// <summary> /// <summary>
@ -226,10 +258,10 @@ namespace DeskHubSharp {
this.window_main = ((DeskHubSharp.MainWindow)(target)); this.window_main = ((DeskHubSharp.MainWindow)(target));
return; return;
case 2: case 2:
this.btn_search = ((System.Windows.Controls.Button)(target)); this.btn_searchuser = ((System.Windows.Controls.Button)(target));
#line 10 "..\..\MainWindow.xaml" #line 10 "..\..\MainWindow.xaml"
this.btn_search.Click += new System.Windows.RoutedEventHandler(this.btn_search_Click); this.btn_searchuser.Click += new System.Windows.RoutedEventHandler(this.btn_search_Click);
#line default #line default
#line hidden #line hidden
@ -315,6 +347,30 @@ namespace DeskHubSharp {
case 19: case 19:
this.txtblk_repocount = ((System.Windows.Controls.TextBlock)(target)); this.txtblk_repocount = ((System.Windows.Controls.TextBlock)(target));
return; return;
case 20:
this.cmbbox_sort = ((System.Windows.Controls.ComboBox)(target));
return;
case 21:
this.btn_sort = ((System.Windows.Controls.Button)(target));
#line 30 "..\..\MainWindow.xaml"
this.btn_sort.Click += new System.Windows.RoutedEventHandler(this.btn_sort_Click);
#line default
#line hidden
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));
return;
} }
this._contentLoaded = true; this._contentLoaded = true;
} }