mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-02 21:20:28 +12:00
First update message box can activate
This commit is contained in:
parent
5f41b5771d
commit
34cade70a6
|
@ -42,8 +42,8 @@
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows.Forms;
|
|
||||||
using System.Web;
|
using System.Web;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace ShareX.HelpersLib
|
namespace ShareX.HelpersLib
|
||||||
{
|
{
|
||||||
|
@ -668,7 +668,7 @@ public static void CreateDirectoryIfNotExist(string path, bool isFilePath = true
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
DebugHelper.WriteException(e);
|
DebugHelper.WriteException(e);
|
||||||
MessageBox.Show(Resources.Helpers_CreateDirectoryIfNotExist_Create_failed_ + "\r\n" + e, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(Resources.Helpers_CreateDirectoryIfNotExist_Create_failed_ + "\r\n\r\n" + e, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// This code was generated by a tool.
|
||||||
// Runtime Version:4.0.30319.18444
|
// Runtime Version:4.0.30319.34209
|
||||||
//
|
//
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
// the code is regenerated.
|
// the code is regenerated.
|
||||||
|
@ -673,7 +673,7 @@ internal class Resources {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Could not create directory, check your path settings:.
|
/// Looks up a localized string similar to Could not create directory, check your path settings..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static string Helpers_CreateDirectoryIfNotExist_Create_failed_ {
|
internal static string Helpers_CreateDirectoryIfNotExist_Create_failed_ {
|
||||||
get {
|
get {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
<root>
|
||||||
<!--
|
<!--
|
||||||
Microsoft ResX Schema
|
Microsoft ResX Schema
|
||||||
|
@ -617,6 +616,6 @@ Would you like to download and install it?</value>
|
||||||
<value>Update is available</value>
|
<value>Update is available</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Helpers_CreateDirectoryIfNotExist_Create_failed_" xml:space="preserve">
|
<data name="Helpers_CreateDirectoryIfNotExist_Create_failed_" xml:space="preserve">
|
||||||
<value>Could not create directory, check your path settings:</value>
|
<value>Could not create directory, check your path settings.</value>
|
||||||
</data>
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -593,4 +593,7 @@ Dosya boyutu: {2:n0} / {3:n0} KB</value>
|
||||||
<data name="UpdateMessageBox_UpdateMessageBox_update_is_available" xml:space="preserve">
|
<data name="UpdateMessageBox_UpdateMessageBox_update_is_available" xml:space="preserve">
|
||||||
<value>Güncelleştirme mevcut</value>
|
<value>Güncelleştirme mevcut</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Helpers_CreateDirectoryIfNotExist_Create_failed_" xml:space="preserve">
|
||||||
|
<value>Klasör yaratılamıyor, yol ayarlarını kontrol ediniz.</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -66,6 +66,7 @@ private void InitializeComponent()
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||||
this.MaximizeBox = false;
|
this.MaximizeBox = false;
|
||||||
this.Name = "UpdateMessageBox";
|
this.Name = "UpdateMessageBox";
|
||||||
|
this.Shown += new System.EventHandler(this.UpdateMessageBox_Shown);
|
||||||
this.Paint += new System.Windows.Forms.PaintEventHandler(this.UpdateMessageBox_Paint);
|
this.Paint += new System.Windows.Forms.PaintEventHandler(this.UpdateMessageBox_Paint);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,8 @@ public partial class UpdateMessageBox : Form
|
||||||
{
|
{
|
||||||
public static bool IsOpen { get; private set; }
|
public static bool IsOpen { get; private set; }
|
||||||
|
|
||||||
|
public bool ActivateWindow { get; set; }
|
||||||
|
|
||||||
private Rectangle fillRect;
|
private Rectangle fillRect;
|
||||||
|
|
||||||
public UpdateMessageBox()
|
public UpdateMessageBox()
|
||||||
|
@ -47,7 +49,7 @@ public UpdateMessageBox()
|
||||||
fillRect = new Rectangle(0, 0, ClientSize.Width, ClientSize.Height);
|
fillRect = new Rectangle(0, 0, ClientSize.Width, ClientSize.Height);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Start(UpdateChecker updateChecker)
|
public static void Start(UpdateChecker updateChecker, bool activateWindow = true)
|
||||||
{
|
{
|
||||||
if (updateChecker != null && updateChecker.Status == UpdateStatus.UpdateAvailable)
|
if (updateChecker != null && updateChecker.Status == UpdateStatus.UpdateAvailable)
|
||||||
{
|
{
|
||||||
|
@ -59,6 +61,7 @@ public static void Start(UpdateChecker updateChecker)
|
||||||
|
|
||||||
using (UpdateMessageBox messageBox = new UpdateMessageBox())
|
using (UpdateMessageBox messageBox = new UpdateMessageBox())
|
||||||
{
|
{
|
||||||
|
messageBox.ActivateWindow = activateWindow;
|
||||||
result = messageBox.ShowDialog();
|
result = messageBox.ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +87,18 @@ public static void Start(UpdateChecker updateChecker)
|
||||||
|
|
||||||
protected override bool ShowWithoutActivation
|
protected override bool ShowWithoutActivation
|
||||||
{
|
{
|
||||||
get { return true; }
|
get
|
||||||
|
{
|
||||||
|
return !ActivateWindow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateMessageBox_Shown(object sender, System.EventArgs e)
|
||||||
|
{
|
||||||
|
if (ActivateWindow)
|
||||||
|
{
|
||||||
|
this.ShowActivate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateMessageBox_Paint(object sender, PaintEventArgs e)
|
private void UpdateMessageBox_Paint(object sender, PaintEventArgs e)
|
||||||
|
|
|
@ -131,6 +131,10 @@
|
||||||
<data name="lblText.TabIndex" type="System.Int32, mscorlib">
|
<data name="lblText.TabIndex" type="System.Int32, mscorlib">
|
||||||
<value>2</value>
|
<value>2</value>
|
||||||
</data>
|
</data>
|
||||||
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="lblText.Text" type="System.Resources.ResXNullRef, System.Windows.Forms">
|
||||||
|
<value />
|
||||||
|
</data>
|
||||||
<data name=">>lblText.Name" xml:space="preserve">
|
<data name=">>lblText.Name" xml:space="preserve">
|
||||||
<value>lblText</value>
|
<value>lblText</value>
|
||||||
</data>
|
</data>
|
||||||
|
@ -206,10 +210,6 @@
|
||||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>399, 135</value>
|
<value>399, 135</value>
|
||||||
</data>
|
</data>
|
||||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
|
||||||
<data name="$this.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
|
||||||
<value>NoControl</value>
|
|
||||||
</data>
|
|
||||||
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
|
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
|
||||||
<value>CenterScreen</value>
|
<value>CenterScreen</value>
|
||||||
</data>
|
</data>
|
||||||
|
|
|
@ -43,7 +43,7 @@ public partial class MainForm : HotkeyForm
|
||||||
{
|
{
|
||||||
public bool IsReady { get; private set; }
|
public bool IsReady { get; private set; }
|
||||||
|
|
||||||
private bool forceClose;
|
private bool forceClose, firstUpdateCheck = true;
|
||||||
private UploadInfoManager uim;
|
private UploadInfoManager uim;
|
||||||
private ToolStripDropDownItem tsmiImageFileUploaders, tsmiTrayImageFileUploaders, tsmiTextFileUploaders, tsmiTrayTextFileUploaders;
|
private ToolStripDropDownItem tsmiImageFileUploaders, tsmiTrayImageFileUploaders, tsmiTextFileUploaders, tsmiTrayTextFileUploaders;
|
||||||
private System.Threading.Timer updateTimer;
|
private System.Threading.Timer updateTimer;
|
||||||
|
@ -662,7 +662,8 @@ private void CheckUpdate()
|
||||||
if (!UpdateMessageBox.IsOpen)
|
if (!UpdateMessageBox.IsOpen)
|
||||||
{
|
{
|
||||||
UpdateChecker updateChecker = TaskHelpers.CheckUpdate();
|
UpdateChecker updateChecker = TaskHelpers.CheckUpdate();
|
||||||
UpdateMessageBox.Start(updateChecker);
|
UpdateMessageBox.Start(updateChecker, firstUpdateCheck);
|
||||||
|
firstUpdateCheck = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue