-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathShelveDialog.cs
49 lines (40 loc) · 1.46 KB
/
ShelveDialog.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
using GitUIPluginInterfaces;
using System;
using System.Windows.Forms;
namespace GitTfs.GitExtensions.Plugin
{
public partial class ShelveDialog : Form
{
private readonly IGitUICommands _commands;
private readonly ShelveSettingsContainer _settings;
public ShelveDialog(IGitUICommands commands, ShelveSettingsContainer settings)
{
_commands = commands;
_settings = settings;
InitializeComponent();
InitializeFromSettings();
}
private void InitializeFromSettings()
{
NameTextBox.Text = _settings.Name;
OverwriteCheckBox.Checked = _settings.Overwrite;
SetShelveButtonEnabledState();
}
private void NameTextBoxTextChanged(object sender, EventArgs e)
{
SetShelveButtonEnabledState();
}
private void SetShelveButtonEnabledState()
{
ShelveButton.Enabled = !string.IsNullOrEmpty(NameTextBox.Text);
}
private void ShelveButtonClick(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(NameTextBox.Text)) return;
_settings.Name = NameTextBox.Text;
_settings.Overwrite = OverwriteCheckBox.Checked;
_commands.StartGitTfsCommandProcessDialog("shelve", OverwriteCheckBox.Checked ? "-f " : "", NameTextBox.Text);
Close();
}
}
}