2 using System
.Collections
.Generic
;
3 using System
.ComponentModel
;
7 using System
.Windows
.Forms
;
11 public partial class RepoManager
: Form
13 internal Prefs m_prefs
;
14 protected List
<string> m_paths
;
16 internal RepoManager(Prefs prefs
)
18 InitializeComponent();
20 m_paths
= new List
<string>();
21 foreach (string path
in m_prefs
.Repos
)
26 m_pathsList
.Items
.AddRange(m_paths
.ToArray());
29 private void button1_Click(object sender
, EventArgs e
)
31 DialogResult r
= m_folderChooser
.ShowDialog();
32 if (r
== DialogResult
.OK
)
34 if (!Git
.Repo
.ValidateRepo(m_folderChooser
.SelectedPath
))
36 MessageBox
.Show("The location does not appear to be a git repository.", "Error", MessageBoxButtons
.OK
, MessageBoxIcon
.Error
);
38 else if (m_paths
.Contains(m_folderChooser
.SelectedPath
))
40 MessageBox
.Show("You have already added " + m_folderChooser
.SelectedPath
+ " to your repositories list",
41 "Error", MessageBoxButtons
.OK
, MessageBoxIcon
.Error
);
45 m_paths
.Add(m_folderChooser
.SelectedPath
);
46 m_prefs
.Repos
.Clear();
47 foreach (string s
in m_paths
)
52 m_pathsList
.Items
.Clear();
53 m_pathsList
.Items
.AddRange(m_paths
.ToArray());
58 private void button2_Click(object sender
, EventArgs e
)
60 if (m_pathsList
.SelectedIndex
> -1)
62 m_paths
.Remove(m_pathsList
.SelectedItem
.ToString());
63 m_prefs
.Repos
.Remove(m_pathsList
.SelectedItem
.ToString());
65 m_pathsList
.Items
.Remove(m_pathsList
.SelectedItem
);
69 private void button3_Click(object sender
, EventArgs e
)