cleanup code
This commit is contained in:
parent
e68f256d80
commit
6d086205d4
@ -1,6 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// ReSharper disable InconsistentNaming
|
||||||
|
|
||||||
namespace Katteker.Gui
|
namespace Katteker.Gui
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -8,6 +10,16 @@ namespace Katteker.Gui
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class NativeMethods
|
public static class NativeMethods
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Hit Test Caption
|
||||||
|
/// </summary>
|
||||||
|
public const int HTCAPTION = 0x2;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Posted when the user presses the left mouse button while the cursor is within the nonclient area of a window.
|
||||||
|
/// </summary>
|
||||||
|
public const int WM_NCLBUTTONDOWN = 0xA1;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Release the capture
|
/// Release the capture
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -25,6 +37,5 @@ namespace Katteker.Gui
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
public static extern bool SetProcessDPIAware();
|
public static extern bool SetProcessDPIAware();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,10 +8,8 @@ namespace Katteker.Gui
|
|||||||
{
|
{
|
||||||
public sealed partial class UpdateWindow : Form
|
public sealed partial class UpdateWindow : Form
|
||||||
{
|
{
|
||||||
private readonly UpdateManager _updateManager;
|
|
||||||
private readonly ReleaseEntry _entry;
|
private readonly ReleaseEntry _entry;
|
||||||
private const int HTCAPTION = 0x2;
|
private readonly UpdateManager _updateManager;
|
||||||
private const int WM_NCLBUTTONDOWN = 0xA1;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The Update Window
|
/// The Update Window
|
||||||
@ -38,10 +36,7 @@ namespace Katteker.Gui
|
|||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if (disposing)
|
if (disposing) components?.Dispose();
|
||||||
{
|
|
||||||
components?.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,9 +62,10 @@ namespace Katteker.Gui
|
|||||||
MaximizeBtn_Click(sender, e);
|
MaximizeBtn_Click(sender, e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.Button != MouseButtons.Left) return;
|
if (e.Button != MouseButtons.Left) return;
|
||||||
NativeMethods.ReleaseCapture();
|
NativeMethods.ReleaseCapture();
|
||||||
NativeMethods.SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0);
|
NativeMethods.SendMessage(Handle, NativeMethods.WM_NCLBUTTONDOWN, NativeMethods.HTCAPTION, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -128,9 +124,9 @@ namespace Katteker.Gui
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show(Resources.CouldNotUpdateYourApplication + Environment.NewLine + ex.Message, Gui.Properties.Resources.Updater, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(Resources.CouldNotUpdateYourApplication + Environment.NewLine + ex.Message,
|
||||||
|
Resources.Updater, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
WriteTitle(Resources.Updater);
|
WriteTitle(Resources.Updater);
|
||||||
|
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user