made a few tweaks, filled out detail
This commit is contained in:
parent
894d6c02dc
commit
d6054b7745
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -15,8 +15,7 @@ namespace DeskHubSharp
|
|||||||
{
|
{
|
||||||
// TODO: this is rudimentary, fix it
|
// TODO: this is rudimentary, fix it
|
||||||
// i.e. try catch statements\
|
// i.e. try catch statements\
|
||||||
// TODO: find how to access a list index
|
// TODO: Add BranchRequest function
|
||||||
// TODO: find how to access the deserialized
|
|
||||||
|
|
||||||
private string _apiEndpoint = "https://api.github.com/";
|
private string _apiEndpoint = "https://api.github.com/";
|
||||||
private string _query;
|
private string _query;
|
||||||
@ -34,7 +33,7 @@ namespace DeskHubSharp
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Calls API for repo and user data an stores it in RepoList
|
/// Calls API for repo and basic user data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public void SearchRequest()
|
public void SearchRequest()
|
||||||
@ -63,7 +62,7 @@ namespace DeskHubSharp
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RepoList.repoDetail = deserialized;
|
RequestList.repoDetail = deserialized;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
@ -95,7 +94,7 @@ namespace DeskHubSharp
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RepoList.userDetail = deserailized;
|
RequestList.userDetail = deserailized;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -107,5 +106,29 @@ namespace DeskHubSharp
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <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 (Exception)
|
||||||
|
{
|
||||||
|
ErrorWindow err = new ErrorWindow();
|
||||||
|
err.txtblk_error.Text = "We couldn't gather user data. Please try again.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,6 +72,7 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</ApplicationDefinition>
|
</ApplicationDefinition>
|
||||||
<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" />
|
||||||
@ -132,7 +133,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">
|
||||||
|
@ -5,12 +5,24 @@
|
|||||||
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_clonelnk" Margin="147,377,195,12" FontSize="20" RenderTransformOrigin="0.238,1.236">
|
||||||
|
<Hyperlink NavigateUri="{Binding}" RequestNavigate="Hyperlink_RequestNavigate">
|
||||||
|
Clone
|
||||||
|
</Hyperlink>
|
||||||
|
</TextBlock>
|
||||||
|
<TextBlock Margin="204,386,118,17">
|
||||||
|
<Hyperlink NavigateUri="{Binding}" RequestNavigate="Hyperlink_RequestNavigate_1">
|
||||||
|
GitHub Page
|
||||||
|
</Hyperlink>
|
||||||
|
</TextBlock>
|
||||||
|
<TextBlock x:Name="txtblk_language" HorizontalAlignment="Left" Margin="13,99,0,0" TextWrapping="Wrap" Text="This repo is mostly crappy code!" VerticalAlignment="Top" Height="25" Width="223" FontSize="14"/>
|
||||||
|
<TextBlock x:Name="txtblk_stargazers" HorizontalAlignment="Left" Margin="13,129,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,377,0,0" VerticalAlignment="Top" Width="120" Height="32"/>
|
||||||
|
<Label x:Name="lbl_branch" Content="What branch do you want to download?" HorizontalAlignment="Left" Margin="13,346,0,0" VerticalAlignment="Top" Width="223"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
@ -25,14 +25,34 @@ namespace DeskHubSharp
|
|||||||
public DetailWindow(RepoDetail repoDetail)
|
public DetailWindow(RepoDetail repoDetail)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_repoDetail = repoDetail;
|
|
||||||
lbl_reponame.Content = _repoDetail.full_name;
|
|
||||||
|
|
||||||
|
_repoDetail = repoDetail;
|
||||||
|
|
||||||
|
Request request = new Request(_repoDetail.name);
|
||||||
|
RepoInfo info = new RepoInfo();
|
||||||
|
request.BranchRequest();
|
||||||
|
var stuff = info.GetBranchNameComboBox();
|
||||||
|
|
||||||
|
cmbbox_branches.ItemsSource = stuff;
|
||||||
|
|
||||||
|
lbl_reponame.Content = _repoDetail.full_name;
|
||||||
|
txtblk_language.Text = $"This repo is mostly {_repoDetail.language} code.";
|
||||||
|
txtblk_stargazers.Text = $"This repo has {_repoDetail.stargazers_count} stargazers.";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btn_close_Click(object sender, RoutedEventArgs e)
|
private void btn_close_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Hyperlink_RequestNavigate_1(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,14 +66,14 @@ namespace DeskHubSharp
|
|||||||
Owner owner = new Owner();
|
Owner owner = new Owner();
|
||||||
search.ShowDialog();
|
search.ShowDialog();
|
||||||
var stuff = info.GetRepoInfoDataGrid();
|
var stuff = info.GetRepoInfoDataGrid();
|
||||||
_repoDetail = RepoList.repoDetail;
|
_repoDetail = RequestList.repoDetail;
|
||||||
ListBox.ItemsSource = stuff;
|
ListBox.ItemsSource = stuff;
|
||||||
txtblk_username.Text = RepoList.userDetail.login;
|
txtblk_username.Text = RequestList.userDetail.login;
|
||||||
txtblk_url.Text = RepoList.userDetail.html_url;
|
txtblk_url.Text = RequestList.userDetail.html_url;
|
||||||
txtblk_bio.Text = RepoList.userDetail.bio;
|
txtblk_bio.Text = RequestList.userDetail.bio;
|
||||||
txtblk_email.Text = RepoList.userDetail.blog;
|
txtblk_email.Text = RequestList.userDetail.blog;
|
||||||
txtblk_realname.Text = RepoList.userDetail.name;
|
txtblk_realname.Text = RequestList.userDetail.name;
|
||||||
txtblk_repocount.Text = $"{RepoList.userDetail.login} has {RepoList.userDetail.public_repos} public repositories.";
|
txtblk_repocount.Text = $"{RequestList.userDetail.login} has {RequestList.userDetail.public_repos} public repositories.";
|
||||||
//img_avatar.Source = RepoList.repoDetail[0].owner.avatar_url;
|
//img_avatar.Source = RepoList.repoDetail[0].owner.avatar_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
22
DeskHubSharp/Models/Branch.cs
Normal file
22
DeskHubSharp/Models/Branch.cs
Normal 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; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -9,6 +9,8 @@ namespace DeskHubSharp
|
|||||||
{
|
{
|
||||||
class RepoInfo
|
class RepoInfo
|
||||||
{
|
{
|
||||||
|
// TODO: Rename this to something more generic
|
||||||
|
|
||||||
public RepoInfo()
|
public RepoInfo()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -16,10 +18,16 @@ namespace DeskHubSharp
|
|||||||
|
|
||||||
public List<string> GetRepoInfoDataGrid()
|
public List<string> GetRepoInfoDataGrid()
|
||||||
{
|
{
|
||||||
List<string> stuff = RepoList.repoDetail.Select(x => x.full_name).ToList();
|
List<string> stuff = RequestList.repoDetail.Select(x => x.full_name).ToList();
|
||||||
//stuff =+ RepoList.repoDetail.Select(x => x.name).ToList();
|
//stuff =+ RepoList.repoDetail.Select(x => x.name).ToList();
|
||||||
return stuff;
|
return stuff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// validation
|
||||||
|
public List<string> GetBranchNameComboBox()
|
||||||
|
{
|
||||||
|
List<string> stuff = RequestList.branchDetail.Select(x => x.name).ToList();
|
||||||
|
return stuff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,16 +7,12 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace DeskHubSharp
|
namespace DeskHubSharp
|
||||||
{
|
{
|
||||||
class RepoList
|
class RequestList
|
||||||
{
|
{
|
||||||
private static ObservableCollection<RepoDetail> _repoDetail;
|
|
||||||
|
|
||||||
public static User userDetail { get; set; }
|
public static User userDetail { get; set; }
|
||||||
|
|
||||||
public static ObservableCollection<RepoDetail> repoDetail
|
public static ObservableCollection<Branch> branchDetail { get; set; }
|
||||||
{
|
|
||||||
get { return _repoDetail; }
|
public static ObservableCollection<RepoDetail> repoDetail { get; set; }
|
||||||
set { _repoDetail = value; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1 +1 @@
|
|||||||
5719003caa9368fdbade249bbbe98f747b8af257
|
2c7ff99ba6851f1d8f8b2fc7b402b53f44c00e4f
|
||||||
|
@ -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
|
2688390562
|
||||||
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;
|
||||||
|
|
||||||
|
@ -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
|
30-110127795
|
||||||
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
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user