Update to .NET 4.7

This commit is contained in:
Anton Kasyanov
2018-03-18 16:09:18 +02:00
parent 771383a681
commit dba28de9ec
7 changed files with 31 additions and 37 deletions

View File

@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>EveOPreview</RootNamespace> <RootNamespace>EveOPreview</RootNamespace>
<AssemblyName>Eve-O Preview</AssemblyName> <AssemblyName>Eve-O Preview</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<NuGetPackageImportStamp> <NuGetPackageImportStamp>
</NuGetPackageImportStamp> </NuGetPackageImportStamp>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
@@ -227,10 +227,10 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup> </PropertyGroup>
<Error Condition="!Exists('..\packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets'))" /> <Error Condition="!Exists('..\packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets'))" />
<Error Condition="!Exists('..\packages\Fody.2.4.1\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.2.4.1\build\Fody.targets'))" /> <Error Condition="!Exists('..\packages\Fody.2.4.6\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.2.4.6\build\Fody.targets'))" />
</Target> </Target>
<Import Project="..\packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets" Condition="Exists('..\packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets')" /> <Import Project="..\packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets" Condition="Exists('..\packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets')" />
<Import Project="..\packages\Fody.2.4.1\build\Fody.targets" Condition="Exists('..\packages\Fody.2.4.1\build\Fody.targets')" /> <Import Project="..\packages\Fody.2.4.6\build\Fody.targets" Condition="Exists('..\packages\Fody.2.4.6\build\Fody.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild"> <Target Name="BeforeBuild">

View File

@@ -29,8 +29,7 @@ namespace EveOPreview.Services
private readonly IThumbnailViewFactory _thumbnailViewFactory; private readonly IThumbnailViewFactory _thumbnailViewFactory;
private readonly Dictionary<IntPtr, IThumbnailView> _thumbnailViews; private readonly Dictionary<IntPtr, IThumbnailView> _thumbnailViews;
private IntPtr _activeClientHandle; private (IntPtr Handle, string Title) _activeClient;
private string _activeClientTitle;
private bool _ignoreViewEvents; private bool _ignoreViewEvents;
private bool _isHoverEffectActive; private bool _isHoverEffectActive;
@@ -46,8 +45,7 @@ namespace EveOPreview.Services
this._configuration = configuration; this._configuration = configuration;
this._thumbnailViewFactory = factory; this._thumbnailViewFactory = factory;
this._activeClientHandle = (IntPtr)0; this._activeClient = (IntPtr.Zero, ThumbnailManager.DefaultClientTitle);
this._activeClientTitle = ThumbnailManager.DefaultClientTitle;
this.EnableViewEvents(); this.EnableViewEvents();
this._isHoverEffectActive = false; this._isHoverEffectActive = false;
@@ -97,9 +95,9 @@ namespace EveOPreview.Services
IntPtr foregroundWindowHandle = this._windowManager.GetForegroundWindowHandle(); IntPtr foregroundWindowHandle = this._windowManager.GetForegroundWindowHandle();
string foregroundWindowTitle = null; string foregroundWindowTitle = null;
if (foregroundWindowHandle == this._activeClientHandle) if (foregroundWindowHandle == this._activeClient.Handle)
{ {
foregroundWindowTitle = this._activeClientTitle; foregroundWindowTitle = this._activeClient.Title;
} }
else if (this._thumbnailViews.TryGetValue(foregroundWindowHandle, out IThumbnailView foregroundView)) else if (this._thumbnailViews.TryGetValue(foregroundWindowHandle, out IThumbnailView foregroundView))
{ {
@@ -144,7 +142,7 @@ namespace EveOPreview.Services
continue; continue;
} }
if (this._configuration.HideActiveClientThumbnail && (view.Id == this._activeClientHandle)) if (this._configuration.HideActiveClientThumbnail && (view.Id == this._activeClient.Handle))
{ {
if (view.IsActive) if (view.IsActive)
{ {
@@ -159,7 +157,7 @@ namespace EveOPreview.Services
// Do not even move thumbnails with default caption // Do not even move thumbnails with default caption
if (this.IsManageableThumbnail(view)) if (this.IsManageableThumbnail(view))
{ {
view.ThumbnailLocation = this._configuration.GetThumbnailLocation(view.Title, this._activeClientTitle, view.ThumbnailLocation); view.ThumbnailLocation = this._configuration.GetThumbnailLocation(view.Title, this._activeClient.Title, view.ThumbnailLocation);
} }
view.SetOpacity(this._configuration.ThumbnailOpacity); view.SetOpacity(this._configuration.ThumbnailOpacity);
@@ -168,7 +166,7 @@ namespace EveOPreview.Services
view.IsOverlayEnabled = this._configuration.ShowThumbnailOverlays; view.IsOverlayEnabled = this._configuration.ShowThumbnailOverlays;
view.SetHighlight(this._configuration.EnableActiveClientHighlight && (view.Id == this._activeClientHandle), view.SetHighlight(this._configuration.EnableActiveClientHighlight && (view.Id == this._activeClient.Handle),
this._configuration.ActiveClientHighlightColor, this._configuration.ActiveClientHighlightThickness); this._configuration.ActiveClientHighlightColor, this._configuration.ActiveClientHighlightThickness);
if (!view.IsActive) if (!view.IsActive)
@@ -230,7 +228,7 @@ namespace EveOPreview.Services
view.SetTopMost(this._configuration.ShowThumbnailsAlwaysOnTop); view.SetTopMost(this._configuration.ShowThumbnailsAlwaysOnTop);
view.ThumbnailLocation = this.IsManageableThumbnail(view) view.ThumbnailLocation = this.IsManageableThumbnail(view)
? this._configuration.GetThumbnailLocation(view.Title, this._activeClientTitle, view.ThumbnailLocation) ? this._configuration.GetThumbnailLocation(view.Title, this._activeClient.Title, view.ThumbnailLocation)
: this._configuration.GetDefaultThumbnailLocation(); : this._configuration.GetDefaultThumbnailLocation();
this._thumbnailViews.Add(view.Id, view); this._thumbnailViews.Add(view.Id, view);
@@ -305,7 +303,7 @@ namespace EveOPreview.Services
private void SwitchActiveClient(IntPtr foregroungClientHandle, string foregroundClientTitle) private void SwitchActiveClient(IntPtr foregroungClientHandle, string foregroundClientTitle)
{ {
// Check if any actions are needed // Check if any actions are needed
if (this._activeClientHandle == foregroungClientHandle) if (this._activeClient.Handle == foregroungClientHandle)
{ {
return; return;
} }
@@ -313,11 +311,10 @@ namespace EveOPreview.Services
// Minimize the currently active client if needed // Minimize the currently active client if needed
if (this._configuration.MinimizeInactiveClients) if (this._configuration.MinimizeInactiveClients)
{ {
this._windowManager.MinimizeWindow(this._activeClientHandle, false); this._windowManager.MinimizeWindow(this._activeClient.Handle, false);
} }
this._activeClientHandle = foregroungClientHandle; this._activeClient = (foregroungClientHandle, foregroundClientTitle);
this._activeClientTitle = foregroundClientTitle;
} }
private void ThumbnailViewFocused(IntPtr id) private void ThumbnailViewFocused(IntPtr id)
@@ -410,7 +407,7 @@ namespace EveOPreview.Services
if (this.IsManageableThumbnail(view)) if (this.IsManageableThumbnail(view))
{ {
await this._mediator.Publish(new ThumbnailLocationUpdated(view.Title, this._activeClientTitle, view.ThumbnailLocation)); await this._mediator.Publish(new ThumbnailLocationUpdated(view.Title, this._activeClient.Title, view.ThumbnailLocation));
} }
view.Refresh(false); view.Refresh(false);
@@ -478,17 +475,17 @@ namespace EveOPreview.Services
foreach (KeyValuePair<IntPtr, IThumbnailView> entry in this._thumbnailViews) foreach (KeyValuePair<IntPtr, IThumbnailView> entry in this._thumbnailViews)
{ {
IThumbnailView view = entry.Value; IThumbnailView view = entry.Value;
this._windowManager.GetWindowCoordinates(view.Id, out int left, out int top, out int right, out int bottom); (int Left, int Top, int Right, int Bottom) position = this._windowManager.GetWindowPosition(view.Id);
int width = Math.Abs(right - left); int width = Math.Abs(position.Right - position.Left);
int height = Math.Abs(bottom - top); int height = Math.Abs(position.Bottom - position.Top);
if (!this.IsValidWindowPosition(left, top, width, height)) if (!this.IsValidWindowPosition(position.Left, position.Top, width, height))
{ {
continue; continue;
} }
this._configuration.SetClientLayout(view.Title, new ClientLayout(left, top, width, height)); this._configuration.SetClientLayout(view.Title, new ClientLayout(position.Left, position.Top, width, height));
} }
} }

View File

@@ -51,14 +51,11 @@ namespace EveOPreview.Services.Implementation
User32NativeMethods.MoveWindow(handle, left, top, width, height, true); User32NativeMethods.MoveWindow(handle, left, top, width, height, true);
} }
public void GetWindowCoordinates(IntPtr handle, out int left, out int top, out int right, out int bottom) public (int Left, int Top, int Right, int Bottom) GetWindowPosition(IntPtr handle)
{ {
User32NativeMethods.GetWindowRect(handle, out RECT windowRectangle); User32NativeMethods.GetWindowRect(handle, out RECT windowRectangle);
left = windowRectangle.Left; return (windowRectangle.Left, windowRectangle.Top, windowRectangle.Right, windowRectangle.Bottom);
top = windowRectangle.Top;
right = windowRectangle.Right;
bottom = windowRectangle.Bottom;
} }
public bool IsWindowMinimized(IntPtr handle) public bool IsWindowMinimized(IntPtr handle)

View File

@@ -12,7 +12,7 @@ namespace EveOPreview.Services
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 GetWindowCoordinates(IntPtr handle, out int left, out int top, out int right, out int bottom); (int Left, int Top, int Right, int Bottom) GetWindowPosition(IntPtr handle);
bool IsWindowMinimized(IntPtr handle); bool IsWindowMinimized(IntPtr handle);
IDwmThumbnail RegisterThumbnail(IntPtr destination, IntPtr source); IDwmThumbnail RegisterThumbnail(IntPtr destination, IntPtr source);

View File

@@ -18,7 +18,7 @@ namespace EveOPreview.View
// was moved to the view due to the performance reasons // was moved to the view due to the performance reasons
private bool _isOverlayVisible; private bool _isOverlayVisible;
private bool _isTopMost; private bool _isTopMost;
private bool _isPositionChanged; private bool _isLocationChanged;
private bool _isSizeChanged; private bool _isSizeChanged;
private bool _isCustomMouseModeActive; private bool _isCustomMouseModeActive;
private bool _isHighlightEnabled; private bool _isHighlightEnabled;
@@ -42,7 +42,7 @@ namespace EveOPreview.View
this._isOverlayVisible = false; this._isOverlayVisible = false;
this._isTopMost = false; this._isTopMost = false;
this._isPositionChanged = true; this._isLocationChanged = true;
this._isSizeChanged = true; this._isSizeChanged = true;
this._isCustomMouseModeActive = false; this._isCustomMouseModeActive = false;
@@ -106,7 +106,7 @@ namespace EveOPreview.View
{ {
base.Show(); base.Show();
this._isPositionChanged = true; this._isLocationChanged = true;
this._isSizeChanged = true; this._isSizeChanged = true;
this._isOverlayVisible = false; this._isOverlayVisible = false;
@@ -314,7 +314,7 @@ namespace EveOPreview.View
} }
bool sizeChanged = this._isSizeChanged || forceRefresh; bool sizeChanged = this._isSizeChanged || forceRefresh;
bool locationChanged = this._isPositionChanged || forceRefresh; bool locationChanged = this._isLocationChanged || forceRefresh;
if (sizeChanged) if (sizeChanged)
{ {
@@ -352,7 +352,7 @@ namespace EveOPreview.View
overlayLocation.X += borderWidth; overlayLocation.X += borderWidth;
overlayLocation.Y += (this.Size.Height - this.ClientSize.Height) - borderWidth; overlayLocation.Y += (this.Size.Height - this.ClientSize.Height) - borderWidth;
this._isPositionChanged = false; this._isLocationChanged = false;
this._overlay.Size = overlaySize; this._overlay.Size = overlaySize;
this._overlay.Location = overlayLocation; this._overlay.Location = overlayLocation;
this._overlay.Refresh(); this._overlay.Refresh();
@@ -397,7 +397,7 @@ namespace EveOPreview.View
private void Move_Handler(object sender, EventArgs e) private void Move_Handler(object sender, EventArgs e)
{ {
this._isPositionChanged = true; this._isLocationChanged = true;
this.ThumbnailMoved?.Invoke(this.Id); this.ThumbnailMoved?.Invoke(this.Id);
} }

View File

@@ -1,3 +1,3 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/></startup></configuration> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7"/></startup></configuration>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Costura.Fody" version="1.6.2" targetFramework="net46" developmentDependency="true" /> <package id="Costura.Fody" version="1.6.2" targetFramework="net46" developmentDependency="true" />
<package id="Fody" version="2.4.1" targetFramework="net46" developmentDependency="true" /> <package id="Fody" version="2.4.6" targetFramework="net47" developmentDependency="true" />
<package id="LightInject" version="5.1.2" targetFramework="net452" requireReinstallation="true" /> <package id="LightInject" version="5.1.2" targetFramework="net452" requireReinstallation="true" />
<package id="MediatR" version="4.0.1" targetFramework="net452" /> <package id="MediatR" version="4.0.1" targetFramework="net452" />
<package id="Newtonsoft.Json" version="11.0.1" targetFramework="net46" /> <package id="Newtonsoft.Json" version="11.0.1" targetFramework="net46" />