Skip to content
This repository has been archived by the owner on May 19, 2022. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Kasyanov committed Jun 17, 2017
2 parents 2aebc4d + c96ed1c commit 44687f9
Show file tree
Hide file tree
Showing 24 changed files with 1,932 additions and 1,808 deletions.
50 changes: 50 additions & 0 deletions Eve-O-Preview/ApplicationBase/ExceptionHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using System;
using System.IO;
using System.Threading;
using System.Windows.Forms;

namespace EveOPreview
{
// A really very primitive exception handler stuff here
// No IoC, no fancy DI containers - just a plain exception stacktrace dump
// If this code is called then something was gone really bad
// so even the DI infrastructure might be dead already.
// So this dumb and non elegant approach is used
sealed class ExceptionHandler
{
private const string ExceptionDumpFileName = "EVE-O Preview.log";
private const string ExceptionMessage = "EVE-O Preview has encountered a problem and needs to close. Additional information has been saved in the crash log file.";

public void SetupExceptionHandlers()
{
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
Application.ThreadException += delegate (Object sender, ThreadExceptionEventArgs e)
{
this.ExceptionEventHandler(e.Exception);
};

AppDomain.CurrentDomain.UnhandledException += delegate (Object sender, UnhandledExceptionEventArgs e)
{
this.ExceptionEventHandler(e.ExceptionObject as Exception);
};
}

private void ExceptionEventHandler(Exception exception)
{
try
{
String exceptionMessage = exception.ToString();
File.WriteAllText(ExceptionHandler.ExceptionDumpFileName, exceptionMessage);

MessageBox.Show(ExceptionHandler.ExceptionMessage, @"EVE-O Preview", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
catch
{
// We are in unstable state now so even this operation might fail
// Still we actually don't care anymore - anyway the application has been cashed
}

System.Environment.Exit(1);
}
}
}
1 change: 1 addition & 0 deletions Eve-O-Preview/Configuration/IThumbnailConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public interface IThumbnailConfig
Color ActiveClientHighlightColor { get; set; }
int ActiveClientHighlightThickness { get; set; }

Point GetDefaultThumbnailLocation();
Point GetThumbnailLocation(string currentClient, string activeClient, Point defaultLocation);
void SetThumbnailLocation(string currentClient, string activeClient, Point location);

Expand Down
8 changes: 8 additions & 0 deletions Eve-O-Preview/Configuration/ThumbnailConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ public ThumbnailConfig()
[JsonProperty]
private Dictionary<string, string> ClientHotkey { get; set; }

public Point GetDefaultThumbnailLocation()
{
// Returns default thumbnail location
// This location can be used for f.e. EVE clients sitting on the login screen
// Can be made configurable later (that's why it was moved out here)
return new Point(5, 5);
}

public Point GetThumbnailLocation(string currentClient, string activeClient, Point defaultLocation)
{
Point location;
Expand Down
230 changes: 117 additions & 113 deletions Eve-O-Preview/DwmAPI/WindowManagerNativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,121 +4,125 @@

namespace EveOPreview
{
// Desktop Windows Manager APIs
static class WindowManagerNativeMethods
{
[DllImport("user32.dll")]
public static extern IntPtr GetForegroundWindow();

[DllImport("user32.dll")]
public static extern bool SetForegroundWindow(IntPtr window);

[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern void DwmEnableBlurBehindWindow(IntPtr hWnd, DWM_BLURBEHIND pBlurBehind);

[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, MARGINS pMargins);

[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern bool DwmIsCompositionEnabled();

[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern void DwmGetColorizationColor(
out int pcrColorization,
[MarshalAs(UnmanagedType.Bool)]out bool pfOpaqueBlend);

[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern void DwmEnableComposition(bool bEnable);

[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern IntPtr DwmRegisterThumbnail(IntPtr dest, IntPtr source);

[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern void DwmUnregisterThumbnail(IntPtr hThumbnail);

[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern void DwmUpdateThumbnailProperties(IntPtr hThumbnail, DWM_THUMBNAIL_PROPERTIES props);

[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern void DwmQueryThumbnailSourceSize(IntPtr hThumbnail, out Size size);

public const int SW_SHOWNORMAL = 1;
public const int SW_SHOWMINIMIZED = 2;
public const int SW_SHOWMAXIMIZED = 3;

[DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);

public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HTCAPTION = 0x2;

[DllImport("User32.dll")]
public static extern bool ReleaseCapture();

[DllImport("User32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);

[DllImport("user32.dll", SetLastError = true)]
public static extern int GetWindowLong(IntPtr hWnd, int nIndex);

public const int GWL_ID = (-12);
public const int GWL_STYLE = (-16);
public const int GWL_EXSTYLE = (-20);

// Window Styles
public const UInt32 WS_OVERLAPPED = 0;
public const UInt32 WS_POPUP = 0x80000000;
public const UInt32 WS_CHILD = 0x40000000;
public const UInt32 WS_MINIMIZE = 0x20000000;
public const UInt32 WS_VISIBLE = 0x10000000;
public const UInt32 WS_DISABLED = 0x8000000;
public const UInt32 WS_CLIPSIBLINGS = 0x4000000;
public const UInt32 WS_CLIPCHILDREN = 0x2000000;
public const UInt32 WS_MAXIMIZE = 0x1000000;
public const UInt32 WS_CAPTION = 0xC00000; // WS_BORDER or WS_DLGFRAME
public const UInt32 WS_BORDER = 0x800000;
public const UInt32 WS_DLGFRAME = 0x400000;
public const UInt32 WS_VSCROLL = 0x200000;
public const UInt32 WS_HSCROLL = 0x100000;
public const UInt32 WS_SYSMENU = 0x80000;
public const UInt32 WS_THICKFRAME = 0x40000;
public const UInt32 WS_GROUP = 0x20000;
public const UInt32 WS_TABSTOP = 0x10000;
public const UInt32 WS_MINIMIZEBOX = 0x20000;
public const UInt32 WS_MAXIMIZEBOX = 0x10000;
public const UInt32 WS_TILED = WS_OVERLAPPED;
public const UInt32 WS_ICONIC = WS_MINIMIZE;
public const UInt32 WS_SIZEBOX = WS_THICKFRAME;

// Extended Window Styles
public const UInt32 WS_EX_DLGMODALFRAME = 0x0001;
public const UInt32 WS_EX_NOPARENTNOTIFY = 0x0004;
public const UInt32 WS_EX_TOPMOST = 0x0008;
public const UInt32 WS_EX_ACCEPTFILES = 0x0010;
public const UInt32 WS_EX_TRANSPARENT = 0x0020;
public const UInt32 WS_EX_MDICHILD = 0x0040;
public const UInt32 WS_EX_TOOLWINDOW = 0x0080;
public const UInt32 WS_EX_WINDOWEDGE = 0x0100;
public const UInt32 WS_EX_CLIENTEDGE = 0x0200;
public const UInt32 WS_EX_CONTEXTHELP = 0x0400;
public const UInt32 WS_EX_RIGHT = 0x1000;
public const UInt32 WS_EX_LEFT = 0x0000;
public const UInt32 WS_EX_RTLREADING = 0x2000;
public const UInt32 WS_EX_LTRREADING = 0x0000;
public const UInt32 WS_EX_LEFTSCROLLBAR = 0x4000;
public const UInt32 WS_EX_RIGHTSCROLLBAR = 0x0000;
public const UInt32 WS_EX_CONTROLPARENT = 0x10000;
public const UInt32 WS_EX_STATICEDGE = 0x20000;
public const UInt32 WS_EX_APPWINDOW = 0x40000;
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_LAYERED = 0x00080000;
public const UInt32 WS_EX_NOINHERITLAYOUT = 0x00100000; // Disable inheritence of mirroring by children
public const UInt32 WS_EX_LAYOUTRTL = 0x00400000; // Right to left mirroring
public const UInt32 WS_EX_COMPOSITED = 0x02000000;
public const UInt32 WS_EX_NOACTIVATE = 0x08000000;
// Desktop Windows Manager APIs
static class WindowManagerNativeMethods
{
[DllImport("user32.dll")]
public static extern IntPtr GetForegroundWindow();

[DllImport("user32.dll")]
public static extern bool SetForegroundWindow(IntPtr window);

[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern void DwmEnableBlurBehindWindow(IntPtr hWnd, DWM_BLURBEHIND pBlurBehind);

[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, MARGINS pMargins);

[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern bool DwmIsCompositionEnabled();

[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern void DwmGetColorizationColor(
out int pcrColorization,
[MarshalAs(UnmanagedType.Bool)]out bool pfOpaqueBlend);

[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern void DwmEnableComposition(bool bEnable);

[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern IntPtr DwmRegisterThumbnail(IntPtr dest, IntPtr source);

[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern void DwmUnregisterThumbnail(IntPtr hThumbnail);

[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern void DwmUpdateThumbnailProperties(IntPtr hThumbnail, DWM_THUMBNAIL_PROPERTIES props);

[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern void DwmQueryThumbnailSourceSize(IntPtr hThumbnail, out Size size);

public const int SW_SHOWNORMAL = 1;
public const int SW_SHOWMINIMIZED = 2;
public const int SW_SHOWMAXIMIZED = 3;

[DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);

public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HTCAPTION = 0x2;

[DllImport("User32.dll")]
public static extern bool ReleaseCapture();

[DllImport("User32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);

[DllImport("user32.dll", SetLastError = true)]
public static extern int GetWindowLong(IntPtr hWnd, int nIndex);

public const int GWL_ID = (-12);
public const int GWL_STYLE = (-16);
public const int GWL_EXSTYLE = (-20);

// Window Styles
public const UInt32 WS_OVERLAPPED = 0;
public const UInt32 WS_POPUP = 0x80000000;
public const UInt32 WS_CHILD = 0x40000000;
public const UInt32 WS_MINIMIZE = 0x20000000;
public const UInt32 WS_VISIBLE = 0x10000000;
public const UInt32 WS_DISABLED = 0x8000000;
public const UInt32 WS_CLIPSIBLINGS = 0x4000000;
public const UInt32 WS_CLIPCHILDREN = 0x2000000;
public const UInt32 WS_MAXIMIZE = 0x1000000;
public const UInt32 WS_CAPTION = 0xC00000; // WS_BORDER or WS_DLGFRAME
public const UInt32 WS_BORDER = 0x800000;
public const UInt32 WS_DLGFRAME = 0x400000;
public const UInt32 WS_VSCROLL = 0x200000;
public const UInt32 WS_HSCROLL = 0x100000;
public const UInt32 WS_SYSMENU = 0x80000;
public const UInt32 WS_THICKFRAME = 0x40000;
public const UInt32 WS_GROUP = 0x20000;
public const UInt32 WS_TABSTOP = 0x10000;
public const UInt32 WS_MINIMIZEBOX = 0x20000;
public const UInt32 WS_MAXIMIZEBOX = 0x10000;
public const UInt32 WS_TILED = WS_OVERLAPPED;
public const UInt32 WS_ICONIC = WS_MINIMIZE;
public const UInt32 WS_SIZEBOX = WS_THICKFRAME;

// Extended Window Styles
public const UInt32 WS_EX_DLGMODALFRAME = 0x0001;
public const UInt32 WS_EX_NOPARENTNOTIFY = 0x0004;
public const UInt32 WS_EX_TOPMOST = 0x0008;
public const UInt32 WS_EX_ACCEPTFILES = 0x0010;
public const UInt32 WS_EX_TRANSPARENT = 0x0020;
public const UInt32 WS_EX_MDICHILD = 0x0040;
public const UInt32 WS_EX_TOOLWINDOW = 0x0080;
public const UInt32 WS_EX_WINDOWEDGE = 0x0100;
public const UInt32 WS_EX_CLIENTEDGE = 0x0200;
public const UInt32 WS_EX_CONTEXTHELP = 0x0400;
public const UInt32 WS_EX_RIGHT = 0x1000;
public const UInt32 WS_EX_LEFT = 0x0000;
public const UInt32 WS_EX_RTLREADING = 0x2000;
public const UInt32 WS_EX_LTRREADING = 0x0000;
public const UInt32 WS_EX_LEFTSCROLLBAR = 0x4000;
public const UInt32 WS_EX_RIGHTSCROLLBAR = 0x0000;
public const UInt32 WS_EX_CONTROLPARENT = 0x10000;
public const UInt32 WS_EX_STATICEDGE = 0x20000;
public const UInt32 WS_EX_APPWINDOW = 0x40000;
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_LAYERED = 0x00080000;
public const UInt32 WS_EX_NOINHERITLAYOUT = 0x00100000; // Disable inheritence of mirroring by children
public const UInt32 WS_EX_LAYOUTRTL = 0x00400000; // Right to left mirroring
public const UInt32 WS_EX_COMPOSITED = 0x02000000;
public const UInt32 WS_EX_NOACTIVATE = 0x08000000;

public const int WM_SIZE = 5;
public const int WM_SYSCOMMAND = 0x0112;

public const int SC_MINIMIZE = 0xf020;

public const int SIZE_RESTORED = 0;
public const int SIZE_MINIMIZED = 1;
public const int SIZE_MAXIMIZED = 2;
Expand Down
25 changes: 15 additions & 10 deletions Eve-O-Preview/Eve-O-Preview.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,15 @@
</PropertyGroup>
<PropertyGroup />
<ItemGroup>
<Reference Include="LightInject, Version=4.0.9.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\LightInject.4.0.9\lib\net45\LightInject.dll</HintPath>
<Private>True</Private>
<Reference Include="Costura, Version=1.6.2.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
<HintPath>..\packages\Costura.Fody.1.6.2\lib\dotnet\Costura.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
<Reference Include="LightInject, Version=5.0.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\LightInject.5.0.3\lib\net45\LightInject.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Deployment" />
Expand All @@ -90,6 +92,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="ApplicationBase\ApplicationController.cs" />
<Compile Include="ApplicationBase\ExceptionHandler.cs" />
<Compile Include="ApplicationBase\IApplicationController.cs" />
<Compile Include="ApplicationBase\IIocContainer.cs" />
<Compile Include="ApplicationBase\IPresenterGeneric.cs" />
Expand Down Expand Up @@ -162,7 +165,6 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="packages.config" />
<Compile Include="UI\Implementation\ThumbnailView.cs">
<SubType>Form</SubType>
</Compile>
Expand All @@ -172,21 +174,24 @@
<Compile Include="DwmAPI\WindowManagerNativeMethods.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="Resources\icon.png" />
</ItemGroup>
<ItemGroup>
<Content Include="FodyWeavers.xml" />
<None Include="FodyWeavers.xml" />
<Content Include="icon.ico" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Fody.1.29.4\build\dotnet\Fody.targets" Condition="Exists('..\packages\Fody.1.29.4\build\dotnet\Fody.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<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>
<Error Condition="!Exists('..\packages\Fody.1.29.4\build\dotnet\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.29.4\build\dotnet\Fody.targets'))" />
<Error Condition="!Exists('..\packages\Fody.2.1.0\build\netstandard1.0\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.2.1.0\build\netstandard1.0\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'))" />
</Target>
<Import Project="..\packages\Fody.2.1.0\build\netstandard1.0\Fody.targets" Condition="Exists('..\packages\Fody.2.1.0\build\netstandard1.0\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')" />
<!-- 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.
<Target Name="BeforeBuild">
Expand Down
4 changes: 2 additions & 2 deletions Eve-O-Preview/FodyWeavers.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<Weavers>
<Costura IncludeDebugSymbols="false" />
<Costura IncludeDebugSymbols="false" />
</Weavers>
2 changes: 2 additions & 0 deletions Eve-O-Preview/Presentation/IThumbnailManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public interface IThumbnailManager
Action<IList<IThumbnailView>> ThumbnailsAdded { get; set; }
Action<IList<IThumbnailView>> ThumbnailsUpdated { get; set; }
Action<IList<IThumbnailView>> ThumbnailsRemoved { get; set; }

Action<String, String, Point> ThumbnailPositionChanged { get; set; }
Action<Size> ThumbnailSizeChanged { get; set; }
}
}
Loading

0 comments on commit 44687f9

Please sign in to comment.