mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-29 17:02:05 +13:00
Only continue countdown if window is active
This commit is contained in:
parent
138e7f25b3
commit
24e581403c
5 changed files with 23 additions and 16 deletions
|
@ -364,6 +364,11 @@ public static bool IsWindowCloaked(IntPtr handle)
|
|||
return false;
|
||||
}
|
||||
|
||||
public static bool IsActive(IntPtr handle)
|
||||
{
|
||||
return GetForegroundWindow() == handle;
|
||||
}
|
||||
|
||||
public static void RestoreWindow(IntPtr handle)
|
||||
{
|
||||
WINDOWPLACEMENT wp = new WINDOWPLACEMENT();
|
||||
|
|
|
@ -92,7 +92,7 @@ public int ProcessId
|
|||
|
||||
public bool IsCloaked => NativeMethods.IsWindowCloaked(Handle);
|
||||
|
||||
public bool IsActive => NativeMethods.GetForegroundWindow() == Handle;
|
||||
public bool IsActive => NativeMethods.IsActive(Handle);
|
||||
|
||||
public WindowInfo(IntPtr handle)
|
||||
{
|
||||
|
|
2
ShareX/Forms/FirstTimeUploadForm.Designer.cs
generated
2
ShareX/Forms/FirstTimeUploadForm.Designer.cs
generated
|
@ -44,6 +44,7 @@ private void InitializeComponent()
|
|||
//
|
||||
// btnYes
|
||||
//
|
||||
this.btnYes.DialogResult = System.Windows.Forms.DialogResult.Yes;
|
||||
resources.ApplyResources(this.btnYes, "btnYes");
|
||||
this.btnYes.Name = "btnYes";
|
||||
this.btnYes.UseVisualStyleBackColor = true;
|
||||
|
@ -51,6 +52,7 @@ private void InitializeComponent()
|
|||
//
|
||||
// btnNo
|
||||
//
|
||||
this.btnNo.DialogResult = System.Windows.Forms.DialogResult.No;
|
||||
resources.ApplyResources(this.btnNo, "btnNo");
|
||||
this.btnNo.Name = "btnNo";
|
||||
this.btnNo.UseVisualStyleBackColor = true;
|
||||
|
|
|
@ -48,8 +48,6 @@ public FirstTimeUploadForm()
|
|||
}
|
||||
|
||||
private void UpdateCountdown()
|
||||
{
|
||||
if (!IsDisposed)
|
||||
{
|
||||
if (countdown < 1)
|
||||
{
|
||||
|
@ -63,7 +61,6 @@ private void UpdateCountdown()
|
|||
countdown--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void FirstTimeUploadForm_Shown(object sender, System.EventArgs e)
|
||||
{
|
||||
|
@ -71,9 +68,12 @@ private void FirstTimeUploadForm_Shown(object sender, System.EventArgs e)
|
|||
}
|
||||
|
||||
private void tCountdown_Tick(object sender, System.EventArgs e)
|
||||
{
|
||||
if (!IsDisposed && NativeMethods.IsActive(Handle))
|
||||
{
|
||||
UpdateCountdown();
|
||||
}
|
||||
}
|
||||
|
||||
private void btnYes_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
|
|
|
@ -132,7 +132,7 @@
|
|||
<value>1</value>
|
||||
</data>
|
||||
<data name="lblInfo.Text" xml:space="preserve">
|
||||
<value>Are you sure you want to upload screenshots?
|
||||
<value>Do you want ShareX to upload screenshots?
|
||||
|
||||
Press "No" to cancel the current upload and disable screenshot auto uploading.</value>
|
||||
</data>
|
||||
|
@ -218,7 +218,7 @@ Press "No" to cancel the current upload and disable screenshot auto uploading.</
|
|||
<value>0</value>
|
||||
</data>
|
||||
<data name="lblHeader.Text" xml:space="preserve">
|
||||
<value>Important!</value>
|
||||
<value>Attention!</value>
|
||||
</data>
|
||||
<data name="lblHeader.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>MiddleCenter</value>
|
||||
|
|
Loading…
Reference in a new issue