Merge branch 'develop' into beta

This commit is contained in:
Anton Kasyanov
2019-06-10 21:34:29 +03:00
8 changed files with 36 additions and 21 deletions

View File

@@ -6,18 +6,23 @@ namespace EveOPreview.Configuration
{ {
} }
public ClientLayout(int x, int y, int width, int height) public ClientLayout(int x, int y, int width, int height, bool maximized)
{ {
this.X = x; this.X = x;
this.Y = y; this.Y = y;
this.Width = width; this.Width = width;
this.Height = height; this.Height = height;
this.IsMaximized = maximized;
} }
public int X { get; set; } public int X { get; set; }
public int Y { get; set; } public int Y { get; set; }
public int Width { get; set; } public int Width { get; set; }
public int Height { get; set; } public int Height { get; set; }
public bool IsMaximized { get; set; }
} }
} }

View File

@@ -10,7 +10,7 @@
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>EveOPreview</RootNamespace> <RootNamespace>EveOPreview</RootNamespace>
<AssemblyName>Eve-O Preview</AssemblyName> <AssemblyName>EVE-O Preview</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<NuGetPackageImportStamp> <NuGetPackageImportStamp>
</NuGetPackageImportStamp> </NuGetPackageImportStamp>

View File

@@ -19,14 +19,6 @@ namespace EveOPreview
[STAThread] [STAThread]
static void Main() static void Main()
{ {
#if DEBUG
var expirationDate = new DateTime(2019, 5, 15);
if (DateTime.Today >= expirationDate)
{
MessageBox.Show(@"This Beta version is expired. Please download a new build at https://github.com/Phrynohyas/eve-o-preview/releases", @"EVE-O Preview", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
#endif
// The very usual Mutex-based single-instance screening // The very usual Mutex-based single-instance screening
// 'token' variable is used to store reference to the instance Mutex // 'token' variable is used to store reference to the instance Mutex
// during the app lifetime // during the app lifetime

View File

@@ -12,7 +12,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
[assembly: Guid("04f08f8d-9e98-423b-acdb-4effb31c0d35")] [assembly: Guid("04f08f8d-9e98-423b-acdb-4effb31c0d35")]
[assembly: AssemblyVersion("4.1.0.1")] [assembly: AssemblyVersion("4.1.0.6")]
[assembly: AssemblyFileVersion("4.1.0.1")] [assembly: AssemblyFileVersion("4.1.0.6")]
[assembly: CLSCompliant(false)] [assembly: CLSCompliant(false)]

View File

@@ -590,8 +590,15 @@ namespace EveOPreview.Services
return; return;
} }
if (clientLayout.IsMaximized)
{
this._windowManager.MaximizeWindow(clientHandle);
}
else
{
this._windowManager.MoveWindow(clientHandle, clientLayout.X, clientLayout.Y, clientLayout.Width, clientLayout.Height); this._windowManager.MoveWindow(clientHandle, clientLayout.X, clientLayout.Y, clientLayout.Width, clientLayout.Height);
} }
}
private void UpdateClientLayouts() private void UpdateClientLayouts()
{ {
@@ -604,16 +611,17 @@ namespace EveOPreview.Services
{ {
IThumbnailView view = entry.Value; IThumbnailView view = entry.Value;
(int Left, int Top, int Right, int Bottom) position = this._windowManager.GetWindowPosition(view.Id); (int Left, int Top, int Right, int Bottom) position = this._windowManager.GetWindowPosition(view.Id);
int width = Math.Abs(position.Right - position.Left); int width = Math.Abs(position.Right - position.Left);
int height = Math.Abs(position.Bottom - position.Top); int height = Math.Abs(position.Bottom - position.Top);
if (!this.IsValidWindowPosition(position.Left, position.Top, width, height)) var isMaximized = this._windowManager.IsWindowMaximized(view.Id);
if (!(isMaximized || this.IsValidWindowPosition(position.Left, position.Top, width, height)))
{ {
continue; continue;
} }
this._configuration.SetClientLayout(view.Title, new ClientLayout(position.Left, position.Top, width, height)); this._configuration.SetClientLayout(view.Title, new ClientLayout(position.Left, position.Top, width, height, isMaximized));
} }
} }

View File

@@ -31,7 +31,7 @@ namespace EveOPreview.Services.Implementation
if ((style & InteropConstants.WS_MINIMIZE) == InteropConstants.WS_MINIMIZE) if ((style & InteropConstants.WS_MINIMIZE) == InteropConstants.WS_MINIMIZE)
{ {
User32NativeMethods.ShowWindowAsync(handle, InteropConstants.SW_SHOWNORMAL); User32NativeMethods.ShowWindowAsync(handle, InteropConstants.SW_RESTORE);
} }
} }
@@ -56,6 +56,11 @@ namespace EveOPreview.Services.Implementation
User32NativeMethods.MoveWindow(handle, left, top, width, height, true); User32NativeMethods.MoveWindow(handle, left, top, width, height, true);
} }
public void MaximizeWindow(IntPtr handle)
{
User32NativeMethods.ShowWindowAsync(handle, InteropConstants.SW_SHOWMAXIMIZED);
}
public (int Left, int Top, int Right, int Bottom) GetWindowPosition(IntPtr handle) public (int Left, int Top, int Right, int Bottom) GetWindowPosition(IntPtr handle)
{ {
User32NativeMethods.GetWindowRect(handle, out RECT windowRectangle); User32NativeMethods.GetWindowRect(handle, out RECT windowRectangle);
@@ -63,6 +68,11 @@ namespace EveOPreview.Services.Implementation
return (windowRectangle.Left, windowRectangle.Top, windowRectangle.Right, windowRectangle.Bottom); return (windowRectangle.Left, windowRectangle.Top, windowRectangle.Right, windowRectangle.Bottom);
} }
public bool IsWindowMaximized(IntPtr handle)
{
return User32NativeMethods.IsZoomed(handle);
}
public bool IsWindowMinimized(IntPtr handle) public bool IsWindowMinimized(IntPtr handle)
{ {
return User32NativeMethods.IsIconic(handle); return User32NativeMethods.IsIconic(handle);

View File

@@ -8,14 +8,13 @@ namespace EveOPreview.Services
bool IsCompositionEnabled { get; } bool IsCompositionEnabled { get; }
IntPtr GetForegroundWindowHandle(); IntPtr GetForegroundWindowHandle();
void ActivateWindow(IntPtr handle); void ActivateWindow(IntPtr handle);
void MinimizeWindow(IntPtr handle, bool enableAnimation); void MinimizeWindow(IntPtr handle, bool enableAnimation);
void MoveWindow(IntPtr handle, int left, int top, int width, int height); void MoveWindow(IntPtr handle, int left, int top, int width, int height);
void MaximizeWindow(IntPtr handle);
(int Left, int Top, int Right, int Bottom) GetWindowPosition(IntPtr handle); (int Left, int Top, int Right, int Bottom) GetWindowPosition(IntPtr handle);
bool IsWindowMaximized(IntPtr handle);
bool IsWindowMinimized(IntPtr handle); bool IsWindowMinimized(IntPtr handle);
IDwmThumbnail GetLiveThumbnail(IntPtr destination, IntPtr source); IDwmThumbnail GetLiveThumbnail(IntPtr destination, IntPtr source);
Image GetStaticThumbnail(IntPtr source); Image GetStaticThumbnail(IntPtr source);
} }

View File

@@ -56,7 +56,7 @@ namespace EveOPreview.Services
public const UInt32 WS_EX_OVERLAPPEDWINDOW = (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE); public const UInt32 WS_EX_OVERLAPPEDWINDOW = (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE);
public const UInt32 WS_EX_PALETTEWINDOW = (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST); public const UInt32 WS_EX_PALETTEWINDOW = (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST);
public const UInt32 WS_EX_LAYERED = 0x00080000; public const UInt32 WS_EX_LAYERED = 0x00080000;
public const UInt32 WS_EX_NOINHERITLAYOUT = 0x00100000; // Disable inheritence of mirroring by children public const UInt32 WS_EX_NOINHERITLAYOUT = 0x00100000; // Disable inheritance of mirroring by children
public const UInt32 WS_EX_LAYOUTRTL = 0x00400000; // Right to left mirroring public const UInt32 WS_EX_LAYOUTRTL = 0x00400000; // Right to left mirroring
public const UInt32 WS_EX_COMPOSITED = 0x02000000; public const UInt32 WS_EX_COMPOSITED = 0x02000000;
public const UInt32 WS_EX_NOACTIVATE = 0x08000000; public const UInt32 WS_EX_NOACTIVATE = 0x08000000;
@@ -78,5 +78,6 @@ namespace EveOPreview.Services
public const int SW_SHOWNORMAL = 1; public const int SW_SHOWNORMAL = 1;
public const int SW_SHOWMINIMIZED = 2; public const int SW_SHOWMINIMIZED = 2;
public const int SW_SHOWMAXIMIZED = 3; public const int SW_SHOWMAXIMIZED = 3;
public const int SW_RESTORE = 9;
} }
} }