Browse Source

Fixed SD2-1171 - Cancelling the Add File to Project dialog opens the New File Dialog. Modified the custom dialog so the escape key closes it if no cancel button has been defined.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1944 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Matt Ward 20 years ago
parent
commit
b496daa5e1
  1. 13
      src/Main/Base/Project/Src/Commands/FileCommands.cs
  2. 8
      src/Main/Core/Project/Src/Services/MessageService/CustomDialog.cs

13
src/Main/Base/Project/Src/Commands/FileCommands.cs

@ -26,14 +26,15 @@ namespace ICSharpCode.SharpDevelop.Commands @@ -26,14 +26,15 @@ namespace ICSharpCode.SharpDevelop.Commands
public override void Run()
{
if (ProjectBrowserPad.Instance.CurrentProject != null) {
if (MessageService.ShowCustomDialog("${res:Dialog.NewFile.AddToProjectQuestionTitle}",
"${res:Dialog.NewFile.AddToProjectQuestion}",
"${res:Dialog.NewFile.AddToProjectQuestionProject}",
"${res:Dialog.NewFile.AddToProjectQuestionStandalone}")
== 0)
{
int result = MessageService.ShowCustomDialog("${res:Dialog.NewFile.AddToProjectQuestionTitle}",
"${res:Dialog.NewFile.AddToProjectQuestion}",
"${res:Dialog.NewFile.AddToProjectQuestionProject}",
"${res:Dialog.NewFile.AddToProjectQuestionStandalone}");
if (result == 0) {
ProjectBrowserPad.Instance.CurrentProject.AddNewItemsToProject();
return;
} else if (result == -1) {
return;
}
}
using (NewFileDialog nfd = new NewFileDialog(null)) {

8
src/Main/Core/Project/Src/Services/MessageService/CustomDialog.cs

@ -87,6 +87,13 @@ namespace ICSharpCode.Core @@ -87,6 +87,13 @@ namespace ICSharpCode.Core
this.ResumeLayout(false);
}
protected override void OnKeyDown(KeyEventArgs e)
{
if (cancelButton == -1 && e.KeyCode == Keys.Escape) {
this.Close();
}
}
void ButtonClick(object sender, EventArgs e)
{
result = (int)((Control)sender).Tag;
@ -133,6 +140,7 @@ namespace ICSharpCode.Core @@ -133,6 +140,7 @@ namespace ICSharpCode.Core
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "CustomDialog";
this.KeyPreview = true;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "CustomDialog";
}

Loading…
Cancel
Save