Merge branch 'develop'

This commit is contained in:
Anton Kasyanov
2018-04-04 01:12:13 +03:00
15 changed files with 54 additions and 29 deletions

View File

@@ -1,4 +1,4 @@
namespace EveOPreview.Configuration namespace EveOPreview.Configuration.Implementation
{ {
class AppConfig : IAppConfig class AppConfig : IAppConfig
{ {

View File

@@ -1,7 +1,7 @@
using System.IO; using System.IO;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace EveOPreview.Configuration namespace EveOPreview.Configuration.Implementation
{ {
class ConfigurationStorage : IConfigurationStorage class ConfigurationStorage : IConfigurationStorage
{ {

View File

@@ -3,7 +3,7 @@ using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace EveOPreview.Configuration.Omplementation namespace EveOPreview.Configuration.Implementation
{ {
sealed class ThumbnailConfiguration : IThumbnailConfiguration sealed class ThumbnailConfiguration : IThumbnailConfiguration
{ {

View File

@@ -19,7 +19,7 @@
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath> <OutputPath>..\bin</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
@@ -30,7 +30,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath> <OutputPath>..\bin</OutputPath>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
@@ -108,11 +108,11 @@
<Compile Include="ApplicationBase\LightInjectContainer.cs" /> <Compile Include="ApplicationBase\LightInjectContainer.cs" />
<Compile Include="ApplicationBase\Presenter.cs" /> <Compile Include="ApplicationBase\Presenter.cs" />
<Compile Include="ApplicationBase\PresenterGeneric.cs" /> <Compile Include="ApplicationBase\PresenterGeneric.cs" />
<Compile Include="Configuration\AppConfig.cs" /> <Compile Include="Configuration\Implementation\AppConfig.cs" />
<Compile Include="Configuration\ConfigurationStorage.cs" /> <Compile Include="Configuration\Implementation\ConfigurationStorage.cs" />
<Compile Include="Configuration\IAppConfig.cs" /> <Compile Include="Configuration\Interface\IAppConfig.cs" />
<Compile Include="Configuration\Interface\IThumbnailConfiguration.cs" /> <Compile Include="Configuration\Interface\IThumbnailConfiguration.cs" />
<Compile Include="Configuration\ZoomAnchor.cs" /> <Compile Include="Configuration\Interface\ZoomAnchor.cs" />
<Compile Include="Mediator\Handlers\Configuration\SaveConfigurationHandler.cs" /> <Compile Include="Mediator\Handlers\Configuration\SaveConfigurationHandler.cs" />
<Compile Include="Mediator\Handlers\Thumbnails\ThumbnailFrameSettingsUpdatedHandler.cs" /> <Compile Include="Mediator\Handlers\Thumbnails\ThumbnailFrameSettingsUpdatedHandler.cs" />
<Compile Include="Mediator\Handlers\Thumbnails\ThumbnailConfiguredSizeUpdatedHandler.cs" /> <Compile Include="Mediator\Handlers\Thumbnails\ThumbnailConfiguredSizeUpdatedHandler.cs" />
@@ -143,7 +143,7 @@
<Compile Include="Services\Interface\IWindowManager.cs" /> <Compile Include="Services\Interface\IWindowManager.cs" />
<Compile Include="Services\Interop\MARGINS.cs" /> <Compile Include="Services\Interop\MARGINS.cs" />
<Compile Include="Services\Interop\RECT.cs" /> <Compile Include="Services\Interop\RECT.cs" />
<Compile Include="Configuration\ClientLayout.cs" /> <Compile Include="Configuration\Interface\ClientLayout.cs" />
<Compile Include="ApplicationBase\IPresenter.cs" /> <Compile Include="ApplicationBase\IPresenter.cs" />
<Compile Include="Services\Implementation\WindowManager.cs" /> <Compile Include="Services\Implementation\WindowManager.cs" />
<Compile Include="Services\Interop\User32NativeMethods.cs" /> <Compile Include="Services\Interop\User32NativeMethods.cs" />
@@ -167,7 +167,7 @@
<Compile Include="View\Implementation\MainForm.Designer.cs"> <Compile Include="View\Implementation\MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon> <DependentUpon>MainForm.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Configuration\IConfigurationStorage.cs" /> <Compile Include="Configuration\Interface\IConfigurationStorage.cs" />
<Compile Include="View\Interface\IThumbnailView.cs" /> <Compile Include="View\Interface\IThumbnailView.cs" />
<Compile Include="View\Implementation\ThumbnailViewFactory.cs" /> <Compile Include="View\Implementation\ThumbnailViewFactory.cs" />
<Compile Include="Services\Implementation\ThumbnailManager.cs" /> <Compile Include="Services\Implementation\ThumbnailManager.cs" />

View File

@@ -12,7 +12,7 @@ namespace EveOPreview.Presenters
public class MainFormPresenter : Presenter<IMainFormView>, IMainFormPresenter public class MainFormPresenter : Presenter<IMainFormView>, IMainFormPresenter
{ {
#region Private constants #region Private constants
private const string ForumUrl = @"https://meta.eveonline.com/t/4202"; private const string ForumUrl = @"https://forum.eveonline.com/t/4202";
#endregion #endregion
#region Private fields #region Private fields
@@ -232,7 +232,7 @@ namespace EveOPreview.Presenters
private string GetApplicationVersion() private string GetApplicationVersion()
{ {
Version version = System.Reflection.Assembly.GetEntryAssembly().GetName().Version; Version version = System.Reflection.Assembly.GetEntryAssembly().GetName().Version;
return $"{version.Major}.{version.Minor}.{version.Revision}"; return $"{version.Major}.{version.Minor}.{version.Build}";
} }
private void ExitApplication() private void ExitApplication()

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.0.0.0")] [assembly: AssemblyVersion("4.0.1.0")]
[assembly: AssemblyFileVersion("4.0.0.0")] [assembly: AssemblyFileVersion("4.0.1.0")]
[assembly: CLSCompliant(false)] [assembly: CLSCompliant(false)]

View File

@@ -198,7 +198,7 @@ namespace EveOPreview.Services
this.SwitchActiveClient(foregroundWindowHandle, foregroundWindowTitle); this.SwitchActiveClient(foregroundWindowHandle, foregroundWindowTitle);
} }
bool hideAllThumbnails = this._configuration.HideThumbnailsOnLostFocus && !(string.IsNullOrEmpty(foregroundWindowTitle) || this.IsClientWindowActive(foregroundWindowHandle)); bool hideAllThumbnails = this._configuration.HideThumbnailsOnLostFocus && !this.IsClientWindowActive(foregroundWindowHandle);
this._refreshCycleCount++; this._refreshCycleCount++;
@@ -383,11 +383,20 @@ namespace EveOPreview.Services
private void ThumbnailActivated(IntPtr id) private void ThumbnailActivated(IntPtr id)
{ {
// View is always available because this method is actually being called by
// a view callback
IThumbnailView view = this._thumbnailViews[id]; IThumbnailView view = this._thumbnailViews[id];
Task.Run(() => this._windowManager.ActivateWindow(view.Id)); Task.Run(() =>
{
this._windowManager.ActivateWindow(view.Id);
})
.ConfigureAwait(true)
.GetAwaiter()
.OnCompleted(() =>
{
this.SwitchActiveClient(view.Id, view.Title);
this.UpdateClientLayouts();
this.RefreshThumbnails();
});
this.UpdateClientLayouts(); this.UpdateClientLayouts();
} }

View File

@@ -61,7 +61,7 @@
// ThumbnailOverlay // ThumbnailOverlay
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.Black; this.BackColor = System.Drawing.Color.Black;
this.ClientSize = new System.Drawing.Size(284, 262); this.ClientSize = new System.Drawing.Size(284, 262);
this.ControlBox = false; this.ControlBox = false;

View File

@@ -20,7 +20,7 @@ namespace EveOPreview.View
// //
this.AccessibleRole = System.Windows.Forms.AccessibleRole.None; this.AccessibleRole = System.Windows.Forms.AccessibleRole.None;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.Black; this.BackColor = System.Drawing.Color.Black;
this.ClientSize = new System.Drawing.Size(153, 89); this.ClientSize = new System.Drawing.Size(153, 89);
this.ControlBox = false; this.ControlBox = false;

View File

@@ -9,6 +9,10 @@ namespace EveOPreview.View
{ {
public partial class ThumbnailView : Form, IThumbnailView public partial class ThumbnailView : Form, IThumbnailView
{ {
#region Private constants
private const int ResizeEventTimeout = 500;
#endregion
#region Private fields #region Private fields
private readonly IWindowManager _windowManager; private readonly IWindowManager _windowManager;
private readonly ThumbnailOverlay _overlay; private readonly ThumbnailOverlay _overlay;
@@ -34,6 +38,8 @@ namespace EveOPreview.View
public ThumbnailView(IWindowManager windowManager) public ThumbnailView(IWindowManager windowManager)
{ {
this.SuppressResizeEvent();
this._windowManager = windowManager; this._windowManager = windowManager;
this.IsActive = false; this.IsActive = false;
@@ -48,8 +54,6 @@ namespace EveOPreview.View
this._isHighlightEnabled = false; this._isHighlightEnabled = false;
this._suppressResizeEventsTimestamp = DateTime.UtcNow;
InitializeComponent(); InitializeComponent();
this._overlay = new ThumbnailOverlay(this, this.MouseDown_Handler); this._overlay = new ThumbnailOverlay(this, this.MouseDown_Handler);
@@ -104,20 +108,23 @@ namespace EveOPreview.View
public new void Show() public new void Show()
{ {
this.SuppressResizeEvent();
base.Show(); base.Show();
this._isLocationChanged = true; this._isLocationChanged = true;
this._isSizeChanged = true; this._isSizeChanged = true;
this._isOverlayVisible = false; this._isOverlayVisible = false;
// Thumbnail will be properly registered during the Manager's Refresh cycle this.Refresh(true);
this.Refresh();
this.IsActive = true; this.IsActive = true;
} }
public new void Hide() public new void Hide()
{ {
this.SuppressResizeEvent();
this.IsActive = false; this.IsActive = false;
this._overlay.Hide(); this._overlay.Hide();
@@ -126,6 +133,8 @@ namespace EveOPreview.View
public new void Close() public new void Close()
{ {
this.SuppressResizeEvent();
this.IsActive = false; this.IsActive = false;
this._thumbnail?.Unregister(); this._thumbnail?.Unregister();
this._overlay.Close(); this._overlay.Close();
@@ -165,9 +174,8 @@ namespace EveOPreview.View
return; return;
} }
// Fix for WinForms issue with the Resize event being fired with inconsistent ClientSize value this.SuppressResizeEvent();
// Any Resize events fired before this timestamp will be ignored
this._suppressResizeEventsTimestamp = DateTime.UtcNow.AddMilliseconds(450);
this.FormBorderStyle = style; this.FormBorderStyle = style;
// Notify about possible contents position change // Notify about possible contents position change
@@ -176,12 +184,12 @@ namespace EveOPreview.View
public void SetTopMost(bool enableTopmost) public void SetTopMost(bool enableTopmost)
{ {
// IMO WinForms could check this too
if (this._isTopMost == enableTopmost) if (this._isTopMost == enableTopmost)
{ {
return; return;
} }
this.TopLevel = enableTopmost;
this.TopMost = enableTopmost; this.TopMost = enableTopmost;
this._overlay.TopMost = enableTopmost; this._overlay.TopMost = enableTopmost;
@@ -384,6 +392,13 @@ namespace EveOPreview.View
this._thumbnail.Move(0 + highlightWidthLeft, 0 + this._highlightWidth, baseWidth - highlightWidthRight, baseHeight - this._highlightWidth); this._thumbnail.Move(0 + highlightWidthLeft, 0 + this._highlightWidth, baseWidth - highlightWidthRight, baseHeight - this._highlightWidth);
} }
private void SuppressResizeEvent()
{
// Workaround for WinForms issue with the Resize event being fired with inconsistent ClientSize value
// Any Resize events fired before this timestamp will be ignored
this._suppressResizeEventsTimestamp = DateTime.UtcNow.AddMilliseconds(ThumbnailView.ResizeEventTimeout);
}
#region GUI events #region GUI events
protected override CreateParams CreateParams protected override CreateParams CreateParams
{ {

View File

@@ -75,6 +75,7 @@
<asmv3:application> <asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"> <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>True/PM</dpiAware> <dpiAware>True/PM</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
</asmv3:windowsSettings> </asmv3:windowsSettings>
</asmv3:application> </asmv3:application>