-
-
Notifications
You must be signed in to change notification settings - Fork 278
/
PromptForm.cs
68 lines (61 loc) · 2.13 KB
/
PromptForm.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
60
61
62
63
64
65
66
67
68
//
// Copyright (c) 2010-2011 Yves Langisch. All rights reserved.
// http://cyberduck.ch/
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// Bug fixes, suggestions and comments should be sent to:
// yves@cyberduck.ch
//
using System;
using System.Drawing;
using System.Media;
using System.Windows.Forms;
using Ch.Cyberduck.Ui.Controller;
namespace Ch.Cyberduck.Ui.Winforms
{
public partial class PromptForm : BaseForm, IPromptView
{
public PromptForm()
{
InitializeComponent();
FormClosing += delegate(object sender, FormClosingEventArgs args)
{
bool cancel = DialogResult != DialogResult.Cancel && !ValidateInput();
if (cancel)
{
args.Cancel = true;
SystemSounds.Beep.Play();
}
};
MinimumSize = new Size(400, 150);
}
public override string[] BundleNames
{
get { return new[] {"Folder"}; }
}
public string InputText
{
get { return inputTextBox.Text; }
set { inputTextBox.Text = value; }
}
public Bitmap IconView
{
set { pictureBox.Image = value; }
}
public event ValidateInputHandler ValidateInput;
private void PromptForm_Shown(object sender, EventArgs e)
{
inputTextBox.Focus();
inputTextBox.SelectAll();
}
}
}