mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Add Close() after each DialogResult because otherwise form won't close if Show() used instead of ShowDialog()
This commit is contained in:
parent
a60f961cce
commit
228622a64e
16 changed files with 47 additions and 14 deletions
|
@ -156,11 +156,13 @@ private void lvGradientPoints_MouseDoubleClick(object sender, MouseEventArgs e)
|
|||
private void btnOK_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -55,12 +55,15 @@ private void InputBox_Shown(object sender, EventArgs e)
|
|||
private void btnOK_Click(object sender, EventArgs e)
|
||||
{
|
||||
InputText = txtInputText.Text;
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
||||
public static string GetInputText(string title = null, string inputText = null)
|
||||
|
|
|
@ -85,6 +85,7 @@ private void LoadSettings()
|
|||
private void btnPrint_Click(object sender, EventArgs e)
|
||||
{
|
||||
printHelper.Print();
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
|
|
@ -75,6 +75,7 @@ private void LoadSettings()
|
|||
private void btnPrint_Click(object sender, EventArgs e)
|
||||
{
|
||||
printHelper.Print();
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ You should have received a copy of the GNU General Public License
|
|||
#endregion License Information (GPL v3)
|
||||
|
||||
using ShareX.HelpersLib.Properties;
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ShareX.HelpersLib
|
||||
|
@ -89,7 +90,7 @@ public static DialogResult Start(UpdateChecker updateChecker, bool activateWindo
|
|||
|
||||
protected override bool ShowWithoutActivation => !ActivateWindow;
|
||||
|
||||
private void UpdateMessageBox_Shown(object sender, System.EventArgs e)
|
||||
private void UpdateMessageBox_Shown(object sender, EventArgs e)
|
||||
{
|
||||
if (ActivateWindow)
|
||||
{
|
||||
|
@ -105,12 +106,12 @@ private void UpdateMessageBox_FormClosing(object sender, FormClosingEventArgs e)
|
|||
}
|
||||
}
|
||||
|
||||
private void cbDontShow_CheckedChanged(object sender, System.EventArgs e)
|
||||
private void cbDontShow_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
DontShow = cbDontShow.Checked;
|
||||
}
|
||||
|
||||
private void lblViewChangelog_Click(object sender, System.EventArgs e)
|
||||
private void lblViewChangelog_Click(object sender, EventArgs e)
|
||||
{
|
||||
URLHelpers.OpenURL(Links.URL_CHANGELOG);
|
||||
}
|
||||
|
@ -118,11 +119,13 @@ private void lblViewChangelog_Click(object sender, System.EventArgs e)
|
|||
private void btnYes_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Yes;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void btnNo_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.No;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -415,6 +415,7 @@ private void pbResult_DragDrop(object sender, DragEventArgs e)
|
|||
private void btnOK_Click(object sender, EventArgs e)
|
||||
{
|
||||
Effects = GetImageEffects();
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
|
|
@ -125,6 +125,7 @@ private void RectangleLight_KeyUp(object sender, KeyEventArgs e)
|
|||
if (e.KeyCode == Keys.Escape)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,13 +146,14 @@ private void RectangleLight_MouseUp(object sender, MouseEventArgs e)
|
|||
{
|
||||
LastSelectionRectangle0Based = SelectionRectangle0Based;
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
isMouseDown = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (e.Button == MouseButtons.Right)
|
||||
{
|
||||
if (isMouseDown)
|
||||
{
|
||||
|
@ -161,6 +163,7 @@ private void RectangleLight_MouseUp(object sender, MouseEventArgs e)
|
|||
else
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,10 +83,10 @@ public RectangleRegionTransparentForm()
|
|||
Bounds = ScreenRectangle;
|
||||
Text = "ShareX - " + Resources.RectangleTransparent_RectangleTransparent_Rectangle_capture_transparent;
|
||||
|
||||
Shown += RectangleLight_Shown;
|
||||
KeyUp += RectangleLight_KeyUp;
|
||||
MouseDown += RectangleLight_MouseDown;
|
||||
MouseUp += RectangleLight_MouseUp;
|
||||
Shown += RectangleTransparent_Shown;
|
||||
KeyUp += RectangleTransparent_KeyUp;
|
||||
MouseDown += RectangleTransparent_MouseDown;
|
||||
MouseUp += RectangleTransparent_MouseUp;
|
||||
|
||||
using (MemoryStream cursorStream = new MemoryStream(Resources.Crosshair))
|
||||
{
|
||||
|
@ -110,20 +110,21 @@ protected override void Dispose(bool disposing)
|
|||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
private void RectangleLight_Shown(object sender, EventArgs e)
|
||||
private void RectangleTransparent_Shown(object sender, EventArgs e)
|
||||
{
|
||||
this.ForceActivate();
|
||||
}
|
||||
|
||||
private void RectangleLight_KeyUp(object sender, KeyEventArgs e)
|
||||
private void RectangleTransparent_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Escape)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void RectangleLight_MouseDown(object sender, MouseEventArgs e)
|
||||
private void RectangleTransparent_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
|
@ -132,7 +133,7 @@ private void RectangleLight_MouseDown(object sender, MouseEventArgs e)
|
|||
}
|
||||
}
|
||||
|
||||
private void RectangleLight_MouseUp(object sender, MouseEventArgs e)
|
||||
private void RectangleTransparent_MouseUp(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
|
@ -140,13 +141,14 @@ private void RectangleLight_MouseUp(object sender, MouseEventArgs e)
|
|||
{
|
||||
LastSelectionRectangle0Based = SelectionRectangle0Based;
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
isMouseDown = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (e.Button == MouseButtons.Right)
|
||||
{
|
||||
if (isMouseDown)
|
||||
{
|
||||
|
@ -155,6 +157,7 @@ private void RectangleLight_MouseUp(object sender, MouseEventArgs e)
|
|||
else
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -189,4 +189,4 @@ public override string ToString()
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -145,6 +145,7 @@ private void lvDropboxFiles_MouseDoubleClick(object sender, MouseEventArgs e)
|
|||
private void tsbSelectFolder_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void tsmiCopyPublicLink_Click(object sender, EventArgs e)
|
||||
|
|
|
@ -58,12 +58,15 @@ private void btnSend_Click(object sender, EventArgs e)
|
|||
ToEmail = txtToEmail.Text;
|
||||
Subject = txtSubject.Text;
|
||||
Body = txtMessage.Text;
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -69,6 +69,7 @@ private void CheckCallback(string url)
|
|||
if (!string.IsNullOrEmpty(Code))
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,12 +78,15 @@ private void btnOK_Click(object sender, EventArgs e)
|
|||
FileAction.Extensions = txtExtensions.Text;
|
||||
FileAction.OutputExtension = txtOutputExtension.Text;
|
||||
FileAction.HiddenWindow = cbHiddenWindow.Checked;
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -56,12 +56,15 @@ private void btnOK_Click(object sender, EventArgs e)
|
|||
{
|
||||
ClipboardFormat.Description = txtDescription.Text;
|
||||
ClipboardFormat.Format = txtFormat.Text;
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -74,11 +74,13 @@ private void btnOK_Click(object sender, EventArgs e)
|
|||
encoder.OutputExtension = txtExtension.Text;
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -58,12 +58,15 @@ private void btnOK_Click(object sender, EventArgs e)
|
|||
WatchFolder.FolderPath = txtFolderPath.Text;
|
||||
WatchFolder.Filter = txtFilter.Text;
|
||||
WatchFolder.IncludeSubdirectories = cbIncludeSubdirectories.Checked;
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue