-
Notifications
You must be signed in to change notification settings - Fork 0
/
Releases.cs
59 lines (51 loc) · 1.73 KB
/
Releases.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Octokit;
namespace OctoNet_GUI
{
public partial class Releases : Form
{
public string authToken = Form1.auth;
public GitHubClient client = Form1.client;
public User user = Form1.user;
public Releases()
{
InitializeComponent();
}
private void lb_repositories_SelectedIndexChanged(object sender, EventArgs e)
{
var selected = lb_repositories.SelectedItem.ToString();
var selectedRepo = client.Repository.GetAllForCurrent().Result.Where(x => x.Name == selected).First();
//Check if something has been selected
if (lb_repositories.SelectedItem != null)
{
//Get the releases of the selected repository
var releases = client.Repository.Release.GetAll(selectedRepo.Owner.Login, selectedRepo.Name).Result;
//Clear the listbox
lb_releases.Items.Clear();
//Add the releases to the listbox
foreach (var release in releases)
{
lb_releases.Items.Add(release.TagName.ToString());
}
}
}
private void lb_releases_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void Releases_Load(object sender, EventArgs e)
{
foreach (var repo in client.Repository.GetAllForCurrent().Result)
{
lb_repositories.Items.Add(repo.Name);
}
}
}
}