-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRepoManager.cs
More file actions
55 lines (43 loc) · 1.52 KB
/
RepoManager.cs
File metadata and controls
55 lines (43 loc) · 1.52 KB
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
using LibGit2Sharp;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Note_Taker2._0
{
public partial class RepoManager : UserControl
{
internal static string RepoPath { get; private set; }
Repository repo;
public RepoManager()
{
InitializeComponent();
}
private void RepoManager_Load(object sender, EventArgs e)
{
if (System.ComponentModel.LicenseManager.UsageMode == System.ComponentModel.LicenseUsageMode.Designtime)
return;
if (string.IsNullOrEmpty(RepoPath))
return;
lbl_reponame.Text = Path.GetDirectoryName(RepoPath);
repo = new(RepoPath);
if (repo.RetrieveStatus().Equals(FileStatus.Nonexistent))
{
MessageBox.Show("The specified path does not contain a git repository.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
this.Hide();
}
list_branches.Items.Clear();
list_commits.Items.Clear();
list_status.Items.Clear();
list_branches.Items.AddRange(repo.Branches.ToArray());
list_commits.Items.AddRange(repo.Commits.ToArray());
list_status.Items.AddRange(repo.RetrieveStatus().ToArray());
}
}
}