Moving source files into a separate folder
This commit is contained in:
35
src/EVE-O-Preview.sln
Normal file
35
src/EVE-O-Preview.sln
Normal file
@@ -0,0 +1,35 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30907.101
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Eve-O-Preview", "Eve-O-Preview\Eve-O-Preview.csproj", "{6CA62DF3-8589-484C-8BC8-F763CA66BBB1}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Eve-O-Mock", "Eve-O-Mock\Eve-O-Mock.csproj", "{BE2C3A13-CC19-4525-895F-381DD71C5833}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Build", "..\build\Build.csproj", "{68083BCC-92B8-4A73-BFD2-0DE619873F86}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{6CA62DF3-8589-484C-8BC8-F763CA66BBB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6CA62DF3-8589-484C-8BC8-F763CA66BBB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6CA62DF3-8589-484C-8BC8-F763CA66BBB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6CA62DF3-8589-484C-8BC8-F763CA66BBB1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BE2C3A13-CC19-4525-895F-381DD71C5833}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BE2C3A13-CC19-4525-895F-381DD71C5833}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BE2C3A13-CC19-4525-895F-381DD71C5833}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BE2C3A13-CC19-4525-895F-381DD71C5833}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{68083BCC-92B8-4A73-BFD2-0DE619873F86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{68083BCC-92B8-4A73-BFD2-0DE619873F86}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {157D7AB8-ED90-4599-BD45-ECE31A4226A8}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
6
src/Eve-O-Mock/App.config
Normal file
6
src/Eve-O-Mock/App.config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
||||
8
src/Eve-O-Mock/App.xaml
Normal file
8
src/Eve-O-Mock/App.xaml
Normal file
@@ -0,0 +1,8 @@
|
||||
<Application x:Class="EveOMock.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
8
src/Eve-O-Mock/App.xaml.cs
Normal file
8
src/Eve-O-Mock/App.xaml.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace EveOMock
|
||||
{
|
||||
public partial class App : Application
|
||||
{
|
||||
}
|
||||
}
|
||||
105
src/Eve-O-Mock/Eve-O-Mock.csproj
Normal file
105
src/Eve-O-Mock/Eve-O-Mock.csproj
Normal file
@@ -0,0 +1,105 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{BE2C3A13-CC19-4525-895F-381DD71C5833}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>EveOMock</RootNamespace>
|
||||
<AssemblyName>ExeFile</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<AppDesigner Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
10
src/Eve-O-Mock/MainWindow.xaml
Normal file
10
src/Eve-O-Mock/MainWindow.xaml
Normal file
@@ -0,0 +1,10 @@
|
||||
<Window x:Class="EveOMock.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="Mock " Height="480" Width="640">
|
||||
<Grid x:Name="grid">
|
||||
<Grid.Background>
|
||||
<SolidColorBrush Color="{Binding Background.Color, ElementName=grid}"/>
|
||||
</Grid.Background>
|
||||
</Grid>
|
||||
</Window>
|
||||
17
src/Eve-O-Mock/MainWindow.xaml.cs
Normal file
17
src/Eve-O-Mock/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace EveOMock
|
||||
{
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
Random random = new Random();
|
||||
this.Title += random.Next().ToString("X");
|
||||
this.grid.Background = new SolidColorBrush(Color.FromArgb(255, (byte)random.Next(0, 255), (byte)random.Next(0, 255), (byte)random.Next(0, 255)));
|
||||
}
|
||||
}
|
||||
}
|
||||
28
src/Eve-O-Mock/Properties/AssemblyInfo.cs
Normal file
28
src/Eve-O-Mock/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
[assembly: AssemblyTitle("EVE Online mock executable for the EVE-O Preview project")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("EVE-O Mock")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
||||
[assembly: CLSCompliant(true)]
|
||||
63
src/Eve-O-Mock/Properties/Resources.Designer.cs
generated
Normal file
63
src/Eve-O-Mock/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace EveOMock.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("EveOMock.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
117
src/Eve-O-Mock/Properties/Resources.resx
Normal file
117
src/Eve-O-Mock/Properties/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
26
src/Eve-O-Mock/Properties/Settings.Designer.cs
generated
Normal file
26
src/Eve-O-Mock/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace EveOMock.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
7
src/Eve-O-Mock/Properties/Settings.settings
Normal file
7
src/Eve-O-Mock/Properties/Settings.settings
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
186
src/Eve-O-Preview/AboutBox.Designer.cs
generated
Normal file
186
src/Eve-O-Preview/AboutBox.Designer.cs
generated
Normal file
@@ -0,0 +1,186 @@
|
||||
namespace PreviewToy
|
||||
{
|
||||
partial class AboutBox
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.logoPictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.labelProductName = new System.Windows.Forms.Label();
|
||||
this.labelVersion = new System.Windows.Forms.Label();
|
||||
this.labelCopyright = new System.Windows.Forms.LinkLabel();
|
||||
this.labelCompanyName = new System.Windows.Forms.LinkLabel();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.richTextBoxDescription = new System.Windows.Forms.RichTextBox();
|
||||
this.tableLayoutPanel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tableLayoutPanel
|
||||
//
|
||||
this.tableLayoutPanel.ColumnCount = 2;
|
||||
this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33F));
|
||||
this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 67F));
|
||||
this.tableLayoutPanel.Controls.Add(this.logoPictureBox, 0, 0);
|
||||
this.tableLayoutPanel.Controls.Add(this.labelProductName, 1, 0);
|
||||
this.tableLayoutPanel.Controls.Add(this.labelVersion, 1, 1);
|
||||
this.tableLayoutPanel.Controls.Add(this.labelCopyright, 1, 2);
|
||||
this.tableLayoutPanel.Controls.Add(this.labelCompanyName, 1, 3);
|
||||
this.tableLayoutPanel.Controls.Add(this.okButton, 1, 5);
|
||||
this.tableLayoutPanel.Controls.Add(this.richTextBoxDescription, 1, 4);
|
||||
this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel.Location = new System.Drawing.Point(9, 9);
|
||||
this.tableLayoutPanel.Name = "tableLayoutPanel";
|
||||
this.tableLayoutPanel.RowCount = 6;
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel.Size = new System.Drawing.Size(534, 490);
|
||||
this.tableLayoutPanel.TabIndex = 0;
|
||||
//
|
||||
// logoPictureBox
|
||||
//
|
||||
this.logoPictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.logoPictureBox.Image = global::PreviewToy.Properties.Resources.Eve_online;
|
||||
this.logoPictureBox.Location = new System.Drawing.Point(3, 3);
|
||||
this.logoPictureBox.Name = "logoPictureBox";
|
||||
this.tableLayoutPanel.SetRowSpan(this.logoPictureBox, 6);
|
||||
this.logoPictureBox.Size = new System.Drawing.Size(170, 484);
|
||||
this.logoPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.logoPictureBox.TabIndex = 12;
|
||||
this.logoPictureBox.TabStop = false;
|
||||
//
|
||||
// labelProductName
|
||||
//
|
||||
this.labelProductName.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.labelProductName.Location = new System.Drawing.Point(182, 0);
|
||||
this.labelProductName.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
|
||||
this.labelProductName.MaximumSize = new System.Drawing.Size(0, 17);
|
||||
this.labelProductName.Name = "labelProductName";
|
||||
this.labelProductName.Size = new System.Drawing.Size(349, 17);
|
||||
this.labelProductName.TabIndex = 19;
|
||||
this.labelProductName.Text = "Product Name";
|
||||
this.labelProductName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// labelVersion
|
||||
//
|
||||
this.labelVersion.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.labelVersion.Location = new System.Drawing.Point(182, 49);
|
||||
this.labelVersion.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
|
||||
this.labelVersion.MaximumSize = new System.Drawing.Size(0, 17);
|
||||
this.labelVersion.Name = "labelVersion";
|
||||
this.labelVersion.Size = new System.Drawing.Size(349, 17);
|
||||
this.labelVersion.TabIndex = 0;
|
||||
this.labelVersion.Text = "Version";
|
||||
this.labelVersion.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// labelCopyright
|
||||
//
|
||||
this.labelCopyright.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.labelCopyright.Location = new System.Drawing.Point(182, 98);
|
||||
this.labelCopyright.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
|
||||
this.labelCopyright.MaximumSize = new System.Drawing.Size(0, 17);
|
||||
this.labelCopyright.Name = "labelCopyright";
|
||||
this.labelCopyright.Size = new System.Drawing.Size(349, 17);
|
||||
this.labelCopyright.TabIndex = 21;
|
||||
this.labelCopyright.TabStop = true;
|
||||
this.labelCopyright.Text = "Copyright";
|
||||
this.labelCopyright.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.labelCopyright.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.labelCopyright_LinkClicked);
|
||||
//
|
||||
// labelCompanyName
|
||||
//
|
||||
this.labelCompanyName.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.labelCompanyName.Location = new System.Drawing.Point(182, 147);
|
||||
this.labelCompanyName.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
|
||||
this.labelCompanyName.MaximumSize = new System.Drawing.Size(0, 17);
|
||||
this.labelCompanyName.Name = "labelCompanyName";
|
||||
this.labelCompanyName.Size = new System.Drawing.Size(349, 17);
|
||||
this.labelCompanyName.TabIndex = 22;
|
||||
this.labelCompanyName.TabStop = true;
|
||||
this.labelCompanyName.Text = "Company Name";
|
||||
this.labelCompanyName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.labelCompanyName.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.labelCompanyName_LinkClicked);
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.okButton.Location = new System.Drawing.Point(456, 464);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.okButton.TabIndex = 24;
|
||||
this.okButton.Text = "&OK";
|
||||
//
|
||||
// richTextBoxDescription
|
||||
//
|
||||
this.richTextBoxDescription.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.richTextBoxDescription.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.richTextBoxDescription.Font = new System.Drawing.Font("Microsoft Sans Serif", 6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.richTextBoxDescription.Location = new System.Drawing.Point(179, 199);
|
||||
this.richTextBoxDescription.Name = "richTextBoxDescription";
|
||||
this.richTextBoxDescription.ReadOnly = true;
|
||||
this.richTextBoxDescription.Size = new System.Drawing.Size(352, 239);
|
||||
this.richTextBoxDescription.TabIndex = 25;
|
||||
this.richTextBoxDescription.Text = "Description";
|
||||
//
|
||||
// AboutBox
|
||||
//
|
||||
this.AcceptButton = this.okButton;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(552, 508);
|
||||
this.Controls.Add(this.tableLayoutPanel);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "AboutBox";
|
||||
this.Padding = new System.Windows.Forms.Padding(9);
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "About EVE-O Preview";
|
||||
this.tableLayoutPanel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel;
|
||||
private System.Windows.Forms.PictureBox logoPictureBox;
|
||||
private System.Windows.Forms.Label labelProductName;
|
||||
private System.Windows.Forms.Label labelVersion;
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.RichTextBox richTextBoxDescription;
|
||||
private System.Windows.Forms.LinkLabel labelCompanyName;
|
||||
private System.Windows.Forms.LinkLabel labelCopyright;
|
||||
}
|
||||
}
|
||||
139
src/Eve-O-Preview/AboutBox.cs
Normal file
139
src/Eve-O-Preview/AboutBox.cs
Normal file
@@ -0,0 +1,139 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace PreviewToy
|
||||
{
|
||||
partial class AboutBox : Form
|
||||
{
|
||||
public AboutBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Text = String.Format("About {0}", AssemblyTitle);
|
||||
this.labelProductName.Text = AssemblyProduct;
|
||||
this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion);
|
||||
this.labelCopyright.Text = AssemblyCopyright;
|
||||
this.labelCompanyName.Text = AssemblyCompany;
|
||||
this.richTextBoxDescription.Rtf =
|
||||
@"{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 Arial;}{\f1\fnil\fcharset0 Calibri;}{\f2\fnil\fcharset2 Symbol;}}
|
||||
{\*\generator Riched20 6.3.9600}\viewkind4\uc1
|
||||
\pard\sa200\sl276\slmult1\qc\b\fs28\lang9 EVE-O Preview\par
|
||||
|
||||
\pard\sa200\sl276\slmult1\b0\fs24 EVE-O Preview is a multi-client management tool which displays miniature windows, or previews, of your client(s) and allows you to switch between them easily. Due to the nature of the window tracking (Windows DLLs), Linux and Mac are not supported.\par
|
||||
\i Requirements:\line\i0 Windows Vista/7/8/8.1\line Windows Aero\par
|
||||
\i Key Features:\par
|
||||
|
||||
\pard{\pntext\f2\'B7\tab}{\*\pn\pnlvlblt\pnf2\pnindent0{\pntxtb\'B7}}\fi-360\li720\sa200\sl276\slmult1\i0 Client Previews (windowed and borderless)\par
|
||||
{\pntext\f2\'B7\tab}Resizable previews (independent or syncronized)\par
|
||||
{\pntext\f2\'B7\tab}Options for 'always on top', 'hide when EVE client not active', 'hide active client preview', and 'zoom on hover'\par
|
||||
{\pntext\f2\'B7\tab}EVE Client position tracking (CCP FoxFour)\par
|
||||
|
||||
\pard\sa200\sl276\slmult1\i Current Maintainer(s):\i0\line CCP FoxFour\line Makari Aeron\par
|
||||
\i Original Creator:\line\i0 StinkRay\par
|
||||
\i Devs:\line\i0 StinkRay, CCP FoxFour, Makari Aeron\par
|
||||
\i Special Thanks:\i0\line Takagamu\f1\fs22\par
|
||||
}";
|
||||
}
|
||||
|
||||
//StinkRay
|
||||
private void labelCopyright_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||
{
|
||||
string url = "https://forums.eveonline.com/default.aspx?g=posts&t=246157";
|
||||
ProcessStartInfo sInfo = new ProcessStartInfo(new Uri(url).AbsoluteUri);
|
||||
Process.Start(sInfo);
|
||||
}
|
||||
|
||||
//New Thread
|
||||
private void labelCompanyName_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||
{
|
||||
string url = "https://forums.eveonline.com/default.aspx?g=posts&m=5264866";
|
||||
ProcessStartInfo sInfo = new ProcessStartInfo(new Uri(url).AbsoluteUri);
|
||||
Process.Start(sInfo);
|
||||
}
|
||||
|
||||
#region Assembly Attribute Accessors
|
||||
|
||||
public string AssemblyTitle
|
||||
{
|
||||
get
|
||||
{
|
||||
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
|
||||
if (attributes.Length > 0)
|
||||
{
|
||||
AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
|
||||
if (titleAttribute.Title != "")
|
||||
{
|
||||
return titleAttribute.Title;
|
||||
}
|
||||
}
|
||||
return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
|
||||
}
|
||||
}
|
||||
|
||||
public string AssemblyVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
return Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public string AssemblyDescription
|
||||
{
|
||||
get
|
||||
{
|
||||
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
|
||||
if (attributes.Length == 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return ((AssemblyDescriptionAttribute)attributes[0]).Description;
|
||||
}
|
||||
}
|
||||
|
||||
public string AssemblyProduct
|
||||
{
|
||||
get
|
||||
{
|
||||
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
|
||||
if (attributes.Length == 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return ((AssemblyProductAttribute)attributes[0]).Product;
|
||||
}
|
||||
}
|
||||
|
||||
public string AssemblyCopyright
|
||||
{
|
||||
get
|
||||
{
|
||||
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
|
||||
if (attributes.Length == 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
|
||||
}
|
||||
}
|
||||
|
||||
public string AssemblyCompany
|
||||
{
|
||||
get
|
||||
{
|
||||
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
|
||||
if (attributes.Length == 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return ((AssemblyCompanyAttribute)attributes[0]).Company;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
120
src/Eve-O-Preview/AboutBox.resx
Normal file
120
src/Eve-O-Preview/AboutBox.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
69
src/Eve-O-Preview/ApplicationBase/ApplicationController.cs
Normal file
69
src/Eve-O-Preview/ApplicationBase/ApplicationController.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
namespace EveOPreview
|
||||
{
|
||||
public class ApplicationController : IApplicationController
|
||||
{
|
||||
private readonly IIocContainer _container;
|
||||
|
||||
public ApplicationController(IIocContainer container)
|
||||
{
|
||||
this._container = container;
|
||||
this._container.RegisterInstance<IApplicationController>(this);
|
||||
}
|
||||
|
||||
public IApplicationController RegisterView<TView, TImplementation>()
|
||||
where TView : IView
|
||||
where TImplementation : class, TView
|
||||
{
|
||||
this._container.Register<TView, TImplementation>();
|
||||
return this;
|
||||
}
|
||||
|
||||
public IApplicationController RegisterInstance<TArgument>(TArgument instance)
|
||||
{
|
||||
this._container.RegisterInstance(instance);
|
||||
return this;
|
||||
}
|
||||
|
||||
public IApplicationController RegisterService<TService, TImplementation>()
|
||||
where TImplementation : class, TService
|
||||
{
|
||||
this._container.Register<TService, TImplementation>();
|
||||
return this;
|
||||
}
|
||||
|
||||
public void Run<TPresenter>()
|
||||
where TPresenter : class, IPresenter
|
||||
{
|
||||
if (!this._container.IsRegistered<TPresenter>())
|
||||
{
|
||||
this._container.Register<TPresenter>();
|
||||
}
|
||||
|
||||
TPresenter presenter = this._container.Resolve<TPresenter>();
|
||||
presenter.Run();
|
||||
}
|
||||
|
||||
public void Run<TPresenter, TParameter>(TParameter args)
|
||||
where TPresenter : class, IPresenter<TParameter>
|
||||
{
|
||||
if (!this._container.IsRegistered<TPresenter>())
|
||||
{
|
||||
this._container.Register<TPresenter>();
|
||||
}
|
||||
|
||||
TPresenter presenter = this._container.Resolve<TPresenter>();
|
||||
presenter.Run(args);
|
||||
}
|
||||
|
||||
public TService Create<TService>()
|
||||
where TService : class
|
||||
{
|
||||
if (!this._container.IsRegistered<TService>())
|
||||
{
|
||||
this._container.Register<TService>();
|
||||
}
|
||||
|
||||
return this._container.Resolve<TService>();
|
||||
}
|
||||
}
|
||||
}
|
||||
55
src/Eve-O-Preview/ApplicationBase/ExceptionHandler.cs
Normal file
55
src/Eve-O-Preview/ApplicationBase/ExceptionHandler.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
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 EXCEPTION_DUMP_FILE_NAME = "EVE-O Preview.log";
|
||||
private const string EXCEPTION_MESSAGE = "EVE-O Preview has encountered a problem and needs to close. Additional information has been saved in the crash log file.";
|
||||
|
||||
public void SetupExceptionHandlers()
|
||||
{
|
||||
if (System.Diagnostics.Debugger.IsAttached)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
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.EXCEPTION_DUMP_FILE_NAME, exceptionMessage);
|
||||
|
||||
MessageBox.Show(ExceptionHandler.EXCEPTION_MESSAGE, @"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);
|
||||
}
|
||||
}
|
||||
}
|
||||
26
src/Eve-O-Preview/ApplicationBase/IApplicationController.cs
Normal file
26
src/Eve-O-Preview/ApplicationBase/IApplicationController.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
namespace EveOPreview
|
||||
{
|
||||
/// <summary>
|
||||
/// Application controller
|
||||
/// </summary>
|
||||
public interface IApplicationController
|
||||
{
|
||||
IApplicationController RegisterView<TView, TPresenter>()
|
||||
where TPresenter : class, TView
|
||||
where TView : IView;
|
||||
|
||||
IApplicationController RegisterInstance<T>(T instance);
|
||||
|
||||
IApplicationController RegisterService<TService, TImplementation>()
|
||||
where TImplementation : class, TService;
|
||||
|
||||
void Run<TPresenter>()
|
||||
where TPresenter : class, IPresenter;
|
||||
|
||||
void Run<TPresenter, TArgument>(TArgument args)
|
||||
where TPresenter : class, IPresenter<TArgument>;
|
||||
|
||||
TService Create<TService>()
|
||||
where TService : class;
|
||||
}
|
||||
}
|
||||
26
src/Eve-O-Preview/ApplicationBase/IIocContainer.cs
Normal file
26
src/Eve-O-Preview/ApplicationBase/IIocContainer.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
|
||||
namespace EveOPreview
|
||||
{
|
||||
/// <summary>
|
||||
/// Generic interface for an Inversion Of Control container
|
||||
/// </summary>
|
||||
public interface IIocContainer
|
||||
{
|
||||
void Register<TService, TImplementation>()
|
||||
where TImplementation : TService;
|
||||
void Register(Type serviceType, Assembly container);
|
||||
void Register<TService>();
|
||||
void Register<TService>(Expression<Func<TService>> factory);
|
||||
void Register<TService, TArgument>(Expression<Func<TArgument, TService>> factory);
|
||||
void RegisterInstance<TService>(TService instance);
|
||||
TService Resolve<TService>();
|
||||
IEnumerable<TService> ResolveAll<TService>();
|
||||
object Resolve(Type serviceType);
|
||||
IEnumerable<object> ResolveAll(Type serviceType);
|
||||
bool IsRegistered<TService>();
|
||||
}
|
||||
}
|
||||
7
src/Eve-O-Preview/ApplicationBase/IPresenter.cs
Normal file
7
src/Eve-O-Preview/ApplicationBase/IPresenter.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace EveOPreview
|
||||
{
|
||||
public interface IPresenter
|
||||
{
|
||||
void Run();
|
||||
}
|
||||
}
|
||||
7
src/Eve-O-Preview/ApplicationBase/IPresenterGeneric.cs
Normal file
7
src/Eve-O-Preview/ApplicationBase/IPresenterGeneric.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace EveOPreview
|
||||
{
|
||||
public interface IPresenter<in TArgument>
|
||||
{
|
||||
void Run(TArgument args);
|
||||
}
|
||||
}
|
||||
12
src/Eve-O-Preview/ApplicationBase/IView.cs
Normal file
12
src/Eve-O-Preview/ApplicationBase/IView.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace EveOPreview
|
||||
{
|
||||
/// <summary>
|
||||
/// Properties and methods that are common for all views
|
||||
/// </summary>
|
||||
public interface IView
|
||||
{
|
||||
void Show();
|
||||
void Hide();
|
||||
void Close();
|
||||
}
|
||||
}
|
||||
99
src/Eve-O-Preview/ApplicationBase/LightInjectContainer.cs
Normal file
99
src/Eve-O-Preview/ApplicationBase/LightInjectContainer.cs
Normal file
@@ -0,0 +1,99 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
using LightInject;
|
||||
|
||||
namespace EveOPreview
|
||||
{
|
||||
// Adapts LighInject to the generic IoC interface
|
||||
sealed class LightInjectContainer : IIocContainer
|
||||
{
|
||||
private readonly ServiceContainer _container;
|
||||
|
||||
public LightInjectContainer()
|
||||
{
|
||||
this._container = new ServiceContainer(ContainerOptions.Default);
|
||||
}
|
||||
|
||||
public bool IsRegistered<TService>()
|
||||
{
|
||||
return this._container.CanGetInstance(typeof(TService), "");
|
||||
}
|
||||
|
||||
public void Register(Type serviceType, Assembly container)
|
||||
{
|
||||
if (!serviceType.IsInterface)
|
||||
{
|
||||
this._container.Register(serviceType, new PerContainerLifetime());
|
||||
return;
|
||||
}
|
||||
|
||||
if (serviceType.IsInterface && serviceType.IsGenericType)
|
||||
{
|
||||
this._container.RegisterAssembly(container, (st, it) => st.IsConstructedGenericType && st.GetGenericTypeDefinition() == serviceType);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (TypeInfo implementationType in container.DefinedTypes)
|
||||
{
|
||||
if (!implementationType.IsClass || implementationType.IsAbstract)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (serviceType.IsAssignableFrom(implementationType))
|
||||
{
|
||||
this._container.Register(serviceType, implementationType, new PerContainerLifetime());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Register<TService>()
|
||||
{
|
||||
this.Register(typeof(TService), typeof(TService).Assembly);
|
||||
}
|
||||
|
||||
public void Register<TService, TImplementation>()
|
||||
where TImplementation : TService
|
||||
{
|
||||
this._container.Register<TService, TImplementation>();
|
||||
}
|
||||
|
||||
public void Register<TService>(Expression<Func<TService>> factory)
|
||||
{
|
||||
this._container.Register(f => factory);
|
||||
}
|
||||
|
||||
public void Register<TService, TArgument>(Expression<Func<TArgument, TService>> factory)
|
||||
{
|
||||
this._container.Register(f => factory);
|
||||
}
|
||||
|
||||
public void RegisterInstance<TService>(TService instance)
|
||||
{
|
||||
this._container.RegisterInstance(instance);
|
||||
}
|
||||
|
||||
public TService Resolve<TService>()
|
||||
{
|
||||
return this._container.GetInstance<TService>();
|
||||
}
|
||||
|
||||
public IEnumerable<TService> ResolveAll<TService>()
|
||||
{
|
||||
return this._container.GetAllInstances<TService>();
|
||||
}
|
||||
|
||||
public object Resolve(Type serviceType)
|
||||
{
|
||||
return this._container.GetInstance(serviceType);
|
||||
}
|
||||
|
||||
public IEnumerable<object> ResolveAll(Type serviceType)
|
||||
{
|
||||
return this._container.GetAllInstances(serviceType);
|
||||
}
|
||||
}
|
||||
}
|
||||
22
src/Eve-O-Preview/ApplicationBase/Presenter.cs
Normal file
22
src/Eve-O-Preview/ApplicationBase/Presenter.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
namespace EveOPreview
|
||||
{
|
||||
public abstract class Presenter<TView> : IPresenter
|
||||
where TView : IView
|
||||
{
|
||||
// Properties are used instead of fields so the code remains CLS compliant
|
||||
// 'protected readonly' fields would result in non-CLS compliant code
|
||||
protected TView View { get; private set; }
|
||||
protected IApplicationController Controller { get; private set; }
|
||||
|
||||
protected Presenter(IApplicationController controller, TView view)
|
||||
{
|
||||
this.Controller = controller;
|
||||
this.View = view;
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
this.View.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
19
src/Eve-O-Preview/ApplicationBase/PresenterGeneric.cs
Normal file
19
src/Eve-O-Preview/ApplicationBase/PresenterGeneric.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace EveOPreview
|
||||
{
|
||||
public abstract class Presenter<TView, TArgument> : IPresenter<TArgument>
|
||||
where TView : IView
|
||||
{
|
||||
// Properties are used instead of fields so the code remains CLS compliant
|
||||
// 'protected readonly' fields would result in non-CLS compliant code
|
||||
protected TView View { get; private set; }
|
||||
protected IApplicationController Controller { get; private set; }
|
||||
|
||||
protected Presenter(IApplicationController controller, TView view)
|
||||
{
|
||||
this.Controller = controller;
|
||||
this.View = view;
|
||||
}
|
||||
|
||||
public abstract void Run(TArgument args);
|
||||
}
|
||||
}
|
||||
13
src/Eve-O-Preview/Configuration/Implementation/AppConfig.cs
Normal file
13
src/Eve-O-Preview/Configuration/Implementation/AppConfig.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace EveOPreview.Configuration.Implementation
|
||||
{
|
||||
class AppConfig : IAppConfig
|
||||
{
|
||||
public AppConfig()
|
||||
{
|
||||
// Default values
|
||||
this.ConfigFileName = null;
|
||||
}
|
||||
|
||||
public string ConfigFileName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace EveOPreview.Configuration.Implementation
|
||||
{
|
||||
class ConfigurationStorage : IConfigurationStorage
|
||||
{
|
||||
private const string CONFIGURATION_FILE_NAME = "EVE-O Preview.json";
|
||||
|
||||
private readonly IAppConfig _appConfig;
|
||||
private readonly IThumbnailConfiguration _thumbnailConfiguration;
|
||||
|
||||
public ConfigurationStorage(IAppConfig appConfig, IThumbnailConfiguration thumbnailConfiguration)
|
||||
{
|
||||
this._appConfig = appConfig;
|
||||
this._thumbnailConfiguration = thumbnailConfiguration;
|
||||
}
|
||||
|
||||
public void Load()
|
||||
{
|
||||
string filename = this.GetConfigFileName();
|
||||
|
||||
if (!File.Exists(filename))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
string rawData = File.ReadAllText(filename);
|
||||
|
||||
JsonConvert.PopulateObject(rawData, this._thumbnailConfiguration);
|
||||
|
||||
// Validate data after loading it
|
||||
this._thumbnailConfiguration.ApplyRestrictions();
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
string rawData = JsonConvert.SerializeObject(this._thumbnailConfiguration, Formatting.Indented);
|
||||
string filename = this.GetConfigFileName();
|
||||
|
||||
try
|
||||
{
|
||||
File.WriteAllText(filename, rawData);
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
// Ignore error if for some reason the updated config cannot be written down
|
||||
}
|
||||
}
|
||||
|
||||
private string GetConfigFileName()
|
||||
{
|
||||
return string.IsNullOrEmpty(this._appConfig.ConfigFileName) ? ConfigurationStorage.CONFIGURATION_FILE_NAME : this._appConfig.ConfigFileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,262 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace EveOPreview.Configuration.Implementation
|
||||
{
|
||||
sealed class ThumbnailConfiguration : IThumbnailConfiguration
|
||||
{
|
||||
#region Private fields
|
||||
private bool _enablePerClientThumbnailLayouts;
|
||||
private bool _enableClientLayoutTracking;
|
||||
#endregion
|
||||
|
||||
public ThumbnailConfiguration()
|
||||
{
|
||||
this.PerClientLayout = new Dictionary<string, Dictionary<string, Point>>();
|
||||
this.FlatLayout = new Dictionary<string, Point>();
|
||||
this.ClientLayout = new Dictionary<string, ClientLayout>();
|
||||
this.ClientHotkey = new Dictionary<string, string>();
|
||||
this.DisableThumbnail = new Dictionary<string, bool>();
|
||||
this.PriorityClients = new List<string>();
|
||||
|
||||
this.MinimizeToTray = false;
|
||||
this.ThumbnailRefreshPeriod = 500;
|
||||
|
||||
this.EnableCompatibilityMode = false;
|
||||
|
||||
this.ThumbnailOpacity = 0.5;
|
||||
|
||||
this.EnableClientLayoutTracking = false;
|
||||
this.HideActiveClientThumbnail = false;
|
||||
this.MinimizeInactiveClients = false;
|
||||
this.ShowThumbnailsAlwaysOnTop = true;
|
||||
this.HideThumbnailsOnLostFocus = false;
|
||||
this.EnablePerClientThumbnailLayouts = false;
|
||||
|
||||
this.ThumbnailSize = new Size(384, 216);
|
||||
this.ThumbnailMinimumSize = new Size(192, 108);
|
||||
this.ThumbnailMaximumSize = new Size(960, 540);
|
||||
|
||||
this.EnableThumbnailSnap = true;
|
||||
|
||||
this.ThumbnailZoomEnabled = false;
|
||||
this.ThumbnailZoomFactor = 2;
|
||||
this.ThumbnailZoomAnchor = ZoomAnchor.NW;
|
||||
|
||||
this.ShowThumbnailOverlays = true;
|
||||
this.ShowThumbnailFrames = false;
|
||||
|
||||
this.EnableActiveClientHighlight = false;
|
||||
this.ActiveClientHighlightColor = Color.GreenYellow;
|
||||
this.ActiveClientHighlightThickness = 3;
|
||||
}
|
||||
|
||||
public bool MinimizeToTray { get; set; }
|
||||
public int ThumbnailRefreshPeriod { get; set; }
|
||||
|
||||
[JsonProperty("CompatibilityMode")]
|
||||
public bool EnableCompatibilityMode { get; set; }
|
||||
|
||||
[JsonProperty("ThumbnailsOpacity")]
|
||||
public double ThumbnailOpacity { get; set; }
|
||||
|
||||
public bool EnableClientLayoutTracking
|
||||
{
|
||||
get => this._enableClientLayoutTracking;
|
||||
set
|
||||
{
|
||||
if (!value)
|
||||
{
|
||||
this.ClientLayout.Clear();
|
||||
}
|
||||
|
||||
this._enableClientLayoutTracking = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool HideActiveClientThumbnail { get; set; }
|
||||
public bool MinimizeInactiveClients { get; set; }
|
||||
public bool ShowThumbnailsAlwaysOnTop { get; set; }
|
||||
public bool HideThumbnailsOnLostFocus { get; set; }
|
||||
|
||||
public bool EnablePerClientThumbnailLayouts
|
||||
{
|
||||
get => this._enablePerClientThumbnailLayouts;
|
||||
set
|
||||
{
|
||||
if (!value)
|
||||
{
|
||||
this.PerClientLayout.Clear();
|
||||
}
|
||||
|
||||
this._enablePerClientThumbnailLayouts = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Size ThumbnailSize { get; set; }
|
||||
public Size ThumbnailMaximumSize { get; set; }
|
||||
public Size ThumbnailMinimumSize { get; set; }
|
||||
|
||||
public bool EnableThumbnailSnap { get; set; }
|
||||
|
||||
[JsonProperty("EnableThumbnailZoom")]
|
||||
public bool ThumbnailZoomEnabled { get; set; }
|
||||
public int ThumbnailZoomFactor { get; set; }
|
||||
public ZoomAnchor ThumbnailZoomAnchor { get; set; }
|
||||
|
||||
public bool ShowThumbnailOverlays { get; set; }
|
||||
public bool ShowThumbnailFrames { get; set; }
|
||||
|
||||
public bool EnableActiveClientHighlight { get; set; }
|
||||
|
||||
public Color ActiveClientHighlightColor { get; set; }
|
||||
|
||||
public int ActiveClientHighlightThickness { get; set; }
|
||||
|
||||
[JsonProperty]
|
||||
private Dictionary<string, Dictionary<string, Point>> PerClientLayout { get; set; }
|
||||
[JsonProperty]
|
||||
private Dictionary<string, Point> FlatLayout { get; set; }
|
||||
[JsonProperty]
|
||||
private Dictionary<string, ClientLayout> ClientLayout { get; set; }
|
||||
[JsonProperty]
|
||||
private Dictionary<string, string> ClientHotkey { get; set; }
|
||||
[JsonProperty]
|
||||
private Dictionary<string, bool> DisableThumbnail { get; set; }
|
||||
[JsonProperty]
|
||||
private List<string> PriorityClients { 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;
|
||||
|
||||
// What this code does:
|
||||
// If Per-Client layouts are enabled
|
||||
// and client name is known
|
||||
// and there is a separate thumbnails layout for this client
|
||||
// and this layout contains an entry for the current client
|
||||
// then return that entry
|
||||
// otherwise try to get client layout from the flat all-clients layout
|
||||
// If there is no layout too then use the default one
|
||||
if (this.EnablePerClientThumbnailLayouts && !string.IsNullOrEmpty(activeClient))
|
||||
{
|
||||
Dictionary<string, Point> layoutSource;
|
||||
if (this.PerClientLayout.TryGetValue(activeClient, out layoutSource) && layoutSource.TryGetValue(currentClient, out location))
|
||||
{
|
||||
return location;
|
||||
}
|
||||
}
|
||||
|
||||
return this.FlatLayout.TryGetValue(currentClient, out location) ? location : defaultLocation;
|
||||
}
|
||||
|
||||
public void SetThumbnailLocation(string currentClient, string activeClient, Point location)
|
||||
{
|
||||
Dictionary<string, Point> layoutSource;
|
||||
|
||||
if (this.EnablePerClientThumbnailLayouts)
|
||||
{
|
||||
if (string.IsNullOrEmpty(activeClient))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.PerClientLayout.TryGetValue(activeClient, out layoutSource))
|
||||
{
|
||||
layoutSource = new Dictionary<string, Point>();
|
||||
this.PerClientLayout[activeClient] = layoutSource;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
layoutSource = this.FlatLayout;
|
||||
}
|
||||
|
||||
layoutSource[currentClient] = location;
|
||||
}
|
||||
|
||||
public ClientLayout GetClientLayout(string currentClient)
|
||||
{
|
||||
ClientLayout layout;
|
||||
this.ClientLayout.TryGetValue(currentClient, out layout);
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
public void SetClientLayout(string currentClient, ClientLayout layout)
|
||||
{
|
||||
this.ClientLayout[currentClient] = layout;
|
||||
}
|
||||
|
||||
public Keys GetClientHotkey(string currentClient)
|
||||
{
|
||||
string hotkey;
|
||||
if (this.ClientHotkey.TryGetValue(currentClient, out hotkey))
|
||||
{
|
||||
// Protect from incorrect values
|
||||
object rawValue = (new KeysConverter()).ConvertFromInvariantString(hotkey);
|
||||
return rawValue != null ? (Keys)rawValue : Keys.None;
|
||||
}
|
||||
|
||||
return Keys.None;
|
||||
}
|
||||
|
||||
public void SetClientHotkey(string currentClient, Keys hotkey)
|
||||
{
|
||||
this.ClientHotkey[currentClient] = (new KeysConverter()).ConvertToInvariantString(hotkey);
|
||||
}
|
||||
|
||||
public bool IsPriorityClient(string currentClient)
|
||||
{
|
||||
return this.PriorityClients.Contains(currentClient);
|
||||
}
|
||||
|
||||
public bool IsThumbnailDisabled(string currentClient)
|
||||
{
|
||||
return this.DisableThumbnail.TryGetValue(currentClient, out bool isDisabled) && isDisabled;
|
||||
}
|
||||
|
||||
public void ToggleThumbnail(string currentClient, bool isDisabled)
|
||||
{
|
||||
this.DisableThumbnail[currentClient] = isDisabled;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Applies restrictions to different parameters of the config
|
||||
/// </summary>
|
||||
public void ApplyRestrictions()
|
||||
{
|
||||
this.ThumbnailRefreshPeriod = ThumbnailConfiguration.ApplyRestrictions(this.ThumbnailRefreshPeriod, 300, 1000);
|
||||
this.ThumbnailSize = new Size(ThumbnailConfiguration.ApplyRestrictions(this.ThumbnailSize.Width, this.ThumbnailMinimumSize.Width, this.ThumbnailMaximumSize.Width),
|
||||
ThumbnailConfiguration.ApplyRestrictions(this.ThumbnailSize.Height, this.ThumbnailMinimumSize.Height, this.ThumbnailMaximumSize.Height));
|
||||
this.ThumbnailOpacity = ThumbnailConfiguration.ApplyRestrictions((int)(this.ThumbnailOpacity * 100.00), 20, 100) / 100.00;
|
||||
this.ThumbnailZoomFactor = ThumbnailConfiguration.ApplyRestrictions(this.ThumbnailZoomFactor, 2, 10);
|
||||
this.ActiveClientHighlightThickness = ThumbnailConfiguration.ApplyRestrictions(this.ActiveClientHighlightThickness, 1, 6);
|
||||
}
|
||||
|
||||
private static int ApplyRestrictions(int value, int minimum, int maximum)
|
||||
{
|
||||
if (value <= minimum)
|
||||
{
|
||||
return minimum;
|
||||
}
|
||||
|
||||
if (value >= maximum)
|
||||
{
|
||||
return maximum;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
28
src/Eve-O-Preview/Configuration/Interface/ClientLayout.cs
Normal file
28
src/Eve-O-Preview/Configuration/Interface/ClientLayout.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
namespace EveOPreview.Configuration
|
||||
{
|
||||
public class ClientLayout
|
||||
{
|
||||
public ClientLayout()
|
||||
{
|
||||
}
|
||||
|
||||
public ClientLayout(int x, int y, int width, int height, bool maximized)
|
||||
{
|
||||
this.X = x;
|
||||
this.Y = y;
|
||||
this.Width = width;
|
||||
this.Height = height;
|
||||
this.IsMaximized = maximized;
|
||||
}
|
||||
|
||||
public int X { get; set; }
|
||||
|
||||
public int Y { get; set; }
|
||||
|
||||
public int Width { get; set; }
|
||||
|
||||
public int Height { get; set; }
|
||||
|
||||
public bool IsMaximized { get; set; }
|
||||
}
|
||||
}
|
||||
10
src/Eve-O-Preview/Configuration/Interface/IAppConfig.cs
Normal file
10
src/Eve-O-Preview/Configuration/Interface/IAppConfig.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace EveOPreview.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// Application configuration
|
||||
/// </summary>
|
||||
public interface IAppConfig
|
||||
{
|
||||
string ConfigFileName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace EveOPreview.Configuration
|
||||
{
|
||||
public interface IConfigurationStorage
|
||||
{
|
||||
void Load();
|
||||
void Save();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace EveOPreview.Configuration
|
||||
{
|
||||
public interface IThumbnailConfiguration
|
||||
{
|
||||
bool MinimizeToTray { get; set; }
|
||||
int ThumbnailRefreshPeriod { get; set; }
|
||||
|
||||
bool EnableCompatibilityMode { get; set; }
|
||||
|
||||
double ThumbnailOpacity { get; set; }
|
||||
|
||||
bool EnableClientLayoutTracking { get; set; }
|
||||
bool HideActiveClientThumbnail { get; set; }
|
||||
bool MinimizeInactiveClients { get; set; }
|
||||
bool ShowThumbnailsAlwaysOnTop { get; set; }
|
||||
bool HideThumbnailsOnLostFocus { get; set; }
|
||||
bool EnablePerClientThumbnailLayouts { get; set; }
|
||||
|
||||
Size ThumbnailSize { get; set; }
|
||||
Size ThumbnailMinimumSize { get; set; }
|
||||
Size ThumbnailMaximumSize { get; set; }
|
||||
|
||||
bool EnableThumbnailSnap { get; set; }
|
||||
|
||||
bool ThumbnailZoomEnabled { get; set; }
|
||||
int ThumbnailZoomFactor { get; set; }
|
||||
ZoomAnchor ThumbnailZoomAnchor { get; set; }
|
||||
|
||||
bool ShowThumbnailOverlays { get; set; }
|
||||
bool ShowThumbnailFrames { get; set; }
|
||||
|
||||
bool EnableActiveClientHighlight { get; set; }
|
||||
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);
|
||||
|
||||
ClientLayout GetClientLayout(string currentClient);
|
||||
void SetClientLayout(string currentClient, ClientLayout layout);
|
||||
|
||||
Keys GetClientHotkey(string currentClient);
|
||||
void SetClientHotkey(string currentClient, Keys hotkey);
|
||||
|
||||
bool IsPriorityClient(string currentClient);
|
||||
|
||||
bool IsThumbnailDisabled(string currentClient);
|
||||
void ToggleThumbnail(string currentClient, bool isDisabled);
|
||||
|
||||
void ApplyRestrictions();
|
||||
}
|
||||
}
|
||||
15
src/Eve-O-Preview/Configuration/Interface/ZoomAnchor.cs
Normal file
15
src/Eve-O-Preview/Configuration/Interface/ZoomAnchor.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace EveOPreview.Configuration
|
||||
{
|
||||
public enum ZoomAnchor
|
||||
{
|
||||
NW,
|
||||
N,
|
||||
NE,
|
||||
W,
|
||||
C,
|
||||
E,
|
||||
SW,
|
||||
S,
|
||||
SE
|
||||
}
|
||||
}
|
||||
246
src/Eve-O-Preview/Eve-O-Preview.csproj
Normal file
246
src/Eve-O-Preview/Eve-O-Preview.csproj
Normal file
@@ -0,0 +1,246 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{6CA62DF3-8589-484C-8BC8-F763CA66BBB1}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>EveOPreview</RootNamespace>
|
||||
<AssemblyName>EVE-O Preview</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\bin</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\bin</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>icon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>EveOPreview.Program</StartupObject>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestCertificateThumbprint>4B29FD125BFAD24FF900FC81CCE0B0AD37464FDB</ManifestCertificateThumbprint>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestKeyFile>preview toy_TemporaryKey.pfx</ManifestKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GenerateManifests>false</GenerateManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignManifests>false</SignManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup />
|
||||
<PropertyGroup>
|
||||
<TargetZone>LocalIntranet</TargetZone>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup />
|
||||
<PropertyGroup />
|
||||
<PropertyGroup />
|
||||
<PropertyGroup />
|
||||
<PropertyGroup>
|
||||
<SignAssembly>false</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>
|
||||
</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup />
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.IO" />
|
||||
<Reference Include="System.Linq.Expressions" />
|
||||
<Reference Include="System.Runtime" />
|
||||
<Reference Include="System.Threading.Tasks" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.XML" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Xml.Serialization" />
|
||||
<Reference Include="WindowsBase" />
|
||||
</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" />
|
||||
<Compile Include="ApplicationBase\LightInjectContainer.cs" />
|
||||
<Compile Include="ApplicationBase\Presenter.cs" />
|
||||
<Compile Include="ApplicationBase\PresenterGeneric.cs" />
|
||||
<Compile Include="Configuration\Implementation\AppConfig.cs" />
|
||||
<Compile Include="Configuration\Implementation\ConfigurationStorage.cs" />
|
||||
<Compile Include="Configuration\Interface\IAppConfig.cs" />
|
||||
<Compile Include="Configuration\Interface\IThumbnailConfiguration.cs" />
|
||||
<Compile Include="Configuration\Interface\ZoomAnchor.cs" />
|
||||
<Compile Include="Mediator\Handlers\Configuration\SaveConfigurationHandler.cs" />
|
||||
<Compile Include="Mediator\Handlers\Thumbnails\ThumbnailFrameSettingsUpdatedHandler.cs" />
|
||||
<Compile Include="Mediator\Handlers\Thumbnails\ThumbnailConfiguredSizeUpdatedHandler.cs" />
|
||||
<Compile Include="Mediator\Handlers\Thumbnails\ThumbnailListUpdatedHandler.cs" />
|
||||
<Compile Include="Mediator\Messages\Thumbnails\ThumbnailFrameSettingsUpdated.cs" />
|
||||
<Compile Include="Mediator\Messages\Thumbnails\ThumbnailConfiguredSizeUpdated.cs" />
|
||||
<Compile Include="Mediator\Messages\Thumbnails\ThumbnailListUpdated.cs" />
|
||||
<Compile Include="Mediator\Handlers\Thumbnails\ThumbnailLocationUpdatedHandler.cs" />
|
||||
<Compile Include="Mediator\Handlers\Thumbnails\ThumbnailActiveSizeUpdatedHandler.cs" />
|
||||
<Compile Include="Mediator\Handlers\Services\StartStopServiceHandler.cs" />
|
||||
<Compile Include="Mediator\Messages\Base\NotificationBase.cs" />
|
||||
<Compile Include="Mediator\Messages\Configuration\SaveConfiguration.cs" />
|
||||
<Compile Include="Mediator\Messages\Services\StartService.cs" />
|
||||
<Compile Include="Mediator\Messages\Services\StopService.cs" />
|
||||
<Compile Include="Mediator\Messages\Thumbnails\ThumbnailLocationUpdated.cs" />
|
||||
<Compile Include="Mediator\Messages\Thumbnails\ThumbnailActiveSizeUpdated.cs" />
|
||||
<Compile Include="Presenters\Interface\IMainFormPresenter.cs" />
|
||||
<Compile Include="Services\Implementation\ProcessInfo.cs" />
|
||||
<Compile Include="Services\Implementation\ProcessMonitor.cs" />
|
||||
<Compile Include="Services\Interface\IProcessInfo.cs" />
|
||||
<Compile Include="Services\Interface\IProcessMonitor.cs" />
|
||||
<Compile Include="Services\Implementation\DwmThumbnail.cs" />
|
||||
<Compile Include="Services\Interface\IDwmThumbnail.cs" />
|
||||
<Compile Include="Services\Interface\InteropConstants.cs" />
|
||||
<Compile Include="Services\Interop\DWM_BLURBEHIND.cs" />
|
||||
<Compile Include="Services\Interop\DWM_THUMBNAIL_PROPERTIES.cs" />
|
||||
<Compile Include="Services\Interop\DWM_TNP_CONSTANTS.cs" />
|
||||
<Compile Include="Services\Interface\IWindowManager.cs" />
|
||||
<Compile Include="Services\Interop\Gdi32NativeMethods.cs" />
|
||||
<Compile Include="Services\Interop\MARGINS.cs" />
|
||||
<Compile Include="Services\Interop\RECT.cs" />
|
||||
<Compile Include="Configuration\Interface\ClientLayout.cs" />
|
||||
<Compile Include="ApplicationBase\IPresenter.cs" />
|
||||
<Compile Include="Services\Implementation\WindowManager.cs" />
|
||||
<Compile Include="Services\Interop\User32NativeMethods.cs" />
|
||||
<Compile Include="Presenters\Implementation\MainFormPresenter.cs" />
|
||||
<Compile Include="Presenters\Interface\ViewCloseRequest.cs" />
|
||||
<Compile Include="Presenters\Implementation\ViewZoomAnchorConverter.cs" />
|
||||
<Compile Include="Services\Interop\WINDOWPLACEMENT.cs" />
|
||||
<Compile Include="View\Implementation\LiveThumbnailView.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="View\Implementation\StaticThumbnailImage.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="View\Implementation\StaticThumbnailView.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="View\Interface\IThumbnailViewFactory.cs" />
|
||||
<Compile Include="Services\Interface\IThumbnailManager.cs" />
|
||||
<Compile Include="View\Implementation\ThumbnailDescription.cs" />
|
||||
<Compile Include="View\Interface\IMainFormView.cs" />
|
||||
<Compile Include="ApplicationBase\IView.cs" />
|
||||
<Compile Include="View\Interface\IThumbnailDescription.cs" />
|
||||
<Compile Include="View\Interface\ViewZoomAnchor.cs" />
|
||||
<Compile Include="Configuration\Implementation\ThumbnailConfiguration.cs" />
|
||||
<Compile Include="Hotkeys\HotkeyHandler.cs" />
|
||||
<Compile Include="Hotkeys\HotkeyHandlerNativeMethods.cs" />
|
||||
<Compile Include="View\Implementation\MainForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="View\Implementation\MainForm.Designer.cs">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Configuration\Interface\IConfigurationStorage.cs" />
|
||||
<Compile Include="View\Interface\IThumbnailView.cs" />
|
||||
<Compile Include="View\Implementation\ThumbnailViewFactory.cs" />
|
||||
<Compile Include="Services\Implementation\ThumbnailManager.cs" />
|
||||
<Compile Include="View\Implementation\ThumbnailOverlay.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="View\Implementation\ThumbnailOverlay.Designer.cs">
|
||||
<DependentUpon>ThumbnailOverlay.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="View\Implementation\MainForm.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="View\Implementation\ThumbnailOverlay.resx">
|
||||
<DependentUpon>ThumbnailOverlay.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="View\Implementation\ThumbnailView.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>ThumbnailView.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<Compile Include="View\Implementation\ThumbnailView.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="View\Implementation\ThumbnailView.Designer.cs">
|
||||
<DependentUpon>ThumbnailView.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Services\Interop\DwmNativeMethods.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<EmbeddedResource Include="app.manifest" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="FodyWeavers.xml" />
|
||||
<Content Include="icon.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Costura.Fody">
|
||||
<Version>3.3.2</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Fody">
|
||||
<Version>4.0.2</Version>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="LightInject">
|
||||
<Version>5.4.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="MediatR">
|
||||
<Version>6.0.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Newtonsoft.Json">
|
||||
<Version>12.0.1</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.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">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
4
src/Eve-O-Preview/FodyWeavers.xml
Normal file
4
src/Eve-O-Preview/FodyWeavers.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
|
||||
<Costura IncludeDebugSymbols="false" />
|
||||
</Weavers>
|
||||
111
src/Eve-O-Preview/FodyWeavers.xsd
Normal file
111
src/Eve-O-Preview/FodyWeavers.xsd
Normal file
@@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
|
||||
<xs:element name="Weavers">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="Costura" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="IncludeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged64Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="PreloadOrder" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>The order of preloaded assemblies, delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
<xs:attribute name="CreateTemporaryAssemblies" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="IncludeDebugSymbols" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Controls if .pdbs for reference assemblies are also embedded.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="DisableCompression" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="DisableCleanup" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="LoadAtModuleInit" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="IgnoreSatelliteAssemblies" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="ExcludeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="IncludeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="Unmanaged32Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="Unmanaged64Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="PreloadOrder" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>The order of preloaded assemblies, delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
<xs:attribute name="VerifyAssembly" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="GenerateXsd" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
132
src/Eve-O-Preview/Hotkeys/HotkeyHandler.cs
Normal file
132
src/Eve-O-Preview/Hotkeys/HotkeyHandler.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace EveOPreview.UI.Hotkeys
|
||||
{
|
||||
class HotkeyHandler : IMessageFilter, IDisposable
|
||||
{
|
||||
private static int _currentId;
|
||||
private const int MAX_ID = 0xBFFF;
|
||||
|
||||
#region Private fields
|
||||
private readonly int _hotkeyId;
|
||||
private readonly IntPtr _hotkeyTarget;
|
||||
#endregion
|
||||
|
||||
public HotkeyHandler(IntPtr target, Keys hotkey)
|
||||
{
|
||||
this._hotkeyId = HotkeyHandler._currentId;
|
||||
HotkeyHandler._currentId = (HotkeyHandler._currentId + 1) & HotkeyHandler.MAX_ID;
|
||||
|
||||
this._hotkeyTarget = target;
|
||||
|
||||
// Assign properties
|
||||
this.IsRegistered = false;
|
||||
|
||||
this.KeyCode = hotkey;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
this.Unregister();
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
~HotkeyHandler()
|
||||
{
|
||||
// Unregister the hotkey if necessary
|
||||
this.Unregister();
|
||||
}
|
||||
|
||||
public bool IsRegistered { get; private set; }
|
||||
|
||||
public Keys KeyCode { get; private set; }
|
||||
|
||||
public event HandledEventHandler Pressed;
|
||||
|
||||
public bool CanRegister()
|
||||
{
|
||||
// Attempt to register
|
||||
if (this.Register())
|
||||
{
|
||||
// Unregister and say we managed it
|
||||
this.Unregister();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Register()
|
||||
{
|
||||
// Check that we have not registered
|
||||
if (this.IsRegistered)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.KeyCode == Keys.None)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Remove all modifiers from the 'main' hotkey
|
||||
uint key = (uint)this.KeyCode & (~(uint)Keys.Alt) & (~(uint)Keys.Control) & (~(uint)Keys.Shift);
|
||||
|
||||
// Get unmanaged version of the modifiers code
|
||||
uint modifiers = (this.KeyCode.HasFlag(Keys.Alt) ? HotkeyHandlerNativeMethods.MOD_ALT : 0)
|
||||
| (this.KeyCode.HasFlag(Keys.Control) ? HotkeyHandlerNativeMethods.MOD_CONTROL : 0)
|
||||
| (this.KeyCode.HasFlag(Keys.Shift) ? HotkeyHandlerNativeMethods.MOD_SHIFT : 0);
|
||||
|
||||
// Register the hotkey
|
||||
if (!HotkeyHandlerNativeMethods.RegisterHotKey(this._hotkeyTarget, this._hotkeyId, modifiers, key))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Application.AddMessageFilter(this);
|
||||
|
||||
this.IsRegistered = true;
|
||||
|
||||
// We successfully registered
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Unregister()
|
||||
{
|
||||
// Check that we have registered
|
||||
if (!this.IsRegistered)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.IsRegistered = false;
|
||||
|
||||
Application.RemoveMessageFilter(this);
|
||||
|
||||
// Clean up after ourselves
|
||||
HotkeyHandlerNativeMethods.UnregisterHotKey(this._hotkeyTarget, this._hotkeyId);
|
||||
}
|
||||
|
||||
#region IMessageFilter
|
||||
public bool PreFilterMessage(ref Message message)
|
||||
{
|
||||
return this.IsRegistered
|
||||
&& (message.Msg == HotkeyHandlerNativeMethods.WM_HOTKEY)
|
||||
&& (message.WParam.ToInt32() == this._hotkeyId)
|
||||
&& this.OnPressed();
|
||||
}
|
||||
#endregion
|
||||
|
||||
private bool OnPressed()
|
||||
{
|
||||
// Fire the event if we can
|
||||
HandledEventArgs handledEventArgs = new HandledEventArgs(false);
|
||||
this.Pressed?.Invoke(this, handledEventArgs);
|
||||
|
||||
// Return whether we handled the event or not
|
||||
return handledEventArgs.Handled;
|
||||
}
|
||||
}
|
||||
}
|
||||
23
src/Eve-O-Preview/Hotkeys/HotkeyHandlerNativeMethods.cs
Normal file
23
src/Eve-O-Preview/Hotkeys/HotkeyHandlerNativeMethods.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace EveOPreview.UI.Hotkeys
|
||||
{
|
||||
static class HotkeyHandlerNativeMethods
|
||||
{
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool RegisterHotKey(IntPtr hWnd, int id, uint fsModifiers, uint vk);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool UnregisterHotKey(IntPtr hWnd, int id);
|
||||
|
||||
public const uint WM_HOTKEY = 0x0312;
|
||||
|
||||
public const uint MOD_ALT = 0x1;
|
||||
public const uint MOD_CONTROL = 0x2;
|
||||
public const uint MOD_SHIFT = 0x4;
|
||||
public const uint MOD_WIN = 0x8;
|
||||
|
||||
public const uint ERROR_HOTKEY_ALREADY_REGISTERED = 1409;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using EveOPreview.Configuration;
|
||||
using EveOPreview.Mediator.Messages;
|
||||
using MediatR;
|
||||
|
||||
namespace EveOPreview.Mediator.Handlers.Configuration
|
||||
{
|
||||
sealed class SaveConfigurationHandler : IRequestHandler<SaveConfiguration>
|
||||
{
|
||||
private readonly IConfigurationStorage _storage;
|
||||
|
||||
public SaveConfigurationHandler(IConfigurationStorage storage)
|
||||
{
|
||||
this._storage = storage;
|
||||
}
|
||||
|
||||
public Task<Unit> Handle(SaveConfiguration message, CancellationToken cancellationToken)
|
||||
{
|
||||
this._storage.Save();
|
||||
|
||||
return Unit.Task;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using EveOPreview.Mediator.Messages;
|
||||
using EveOPreview.Services;
|
||||
using MediatR;
|
||||
|
||||
namespace EveOPreview.Mediator.Handlers.Services
|
||||
{
|
||||
sealed class StartStopServiceHandler : IRequestHandler<StartService>, IRequestHandler<StopService>
|
||||
{
|
||||
private readonly IThumbnailManager _manager;
|
||||
|
||||
public StartStopServiceHandler(IThumbnailManager manager)
|
||||
{
|
||||
this._manager = manager;
|
||||
}
|
||||
|
||||
public Task<Unit> Handle(StartService message, CancellationToken cancellationToken)
|
||||
{
|
||||
this._manager.Start();
|
||||
|
||||
return Unit.Task;
|
||||
}
|
||||
|
||||
public Task<Unit> Handle(StopService message, CancellationToken cancellationToken)
|
||||
{
|
||||
this._manager.Stop();
|
||||
|
||||
return Unit.Task;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using EveOPreview.Mediator.Messages;
|
||||
using EveOPreview.Presenters;
|
||||
using MediatR;
|
||||
|
||||
namespace EveOPreview.Mediator.Handlers.Thumbnails
|
||||
{
|
||||
sealed class ThumbnailActiveSizeUpdatedHandler : INotificationHandler<ThumbnailActiveSizeUpdated>
|
||||
{
|
||||
private readonly IMainFormPresenter _presenter;
|
||||
|
||||
public ThumbnailActiveSizeUpdatedHandler(MainFormPresenter presenter)
|
||||
{
|
||||
this._presenter = presenter;
|
||||
}
|
||||
|
||||
public Task Handle(ThumbnailActiveSizeUpdated notification, CancellationToken cancellationToken)
|
||||
{
|
||||
this._presenter.UpdateThumbnailSize(notification.Value);
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using EveOPreview.Mediator.Messages;
|
||||
using EveOPreview.Services;
|
||||
using MediatR;
|
||||
|
||||
namespace EveOPreview.Mediator.Handlers.Thumbnails
|
||||
{
|
||||
sealed class ThumbnailConfiguredSizeUpdatedHandler : INotificationHandler<ThumbnailConfiguredSizeUpdated>
|
||||
{
|
||||
private readonly IThumbnailManager _manager;
|
||||
|
||||
public ThumbnailConfiguredSizeUpdatedHandler(IThumbnailManager manager)
|
||||
{
|
||||
this._manager = manager;
|
||||
}
|
||||
|
||||
public Task Handle(ThumbnailConfiguredSizeUpdated notification, CancellationToken cancellationToken)
|
||||
{
|
||||
this._manager.UpdateThumbnailsSize();
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using EveOPreview.Mediator.Messages;
|
||||
using EveOPreview.Services;
|
||||
using MediatR;
|
||||
|
||||
namespace EveOPreview.Mediator.Handlers.Thumbnails
|
||||
{
|
||||
sealed class ThumbnailFrameSettingsUpdatedHandler : INotificationHandler<ThumbnailFrameSettingsUpdated>
|
||||
{
|
||||
private readonly IThumbnailManager _manager;
|
||||
|
||||
public ThumbnailFrameSettingsUpdatedHandler(IThumbnailManager manager)
|
||||
{
|
||||
this._manager = manager;
|
||||
}
|
||||
|
||||
public Task Handle(ThumbnailFrameSettingsUpdated notification, CancellationToken cancellationToken)
|
||||
{
|
||||
this._manager.UpdateThumbnailFrames();
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using EveOPreview.Mediator.Messages;
|
||||
using EveOPreview.Presenters;
|
||||
using MediatR;
|
||||
|
||||
namespace EveOPreview.Mediator.Handlers.Thumbnails
|
||||
{
|
||||
sealed class ThumbnailListUpdatedHandler : INotificationHandler<ThumbnailListUpdated>
|
||||
{
|
||||
#region Private fields
|
||||
private readonly IMainFormPresenter _presenter;
|
||||
#endregion
|
||||
|
||||
public ThumbnailListUpdatedHandler(MainFormPresenter presenter)
|
||||
{
|
||||
this._presenter = presenter;
|
||||
}
|
||||
|
||||
public Task Handle(ThumbnailListUpdated notification, CancellationToken cancellationToken)
|
||||
{
|
||||
if (notification.Added.Count > 0)
|
||||
{
|
||||
this._presenter.AddThumbnails(notification.Added);
|
||||
}
|
||||
|
||||
if (notification.Removed.Count > 0)
|
||||
{
|
||||
this._presenter.RemoveThumbnails(notification.Removed);
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using EveOPreview.Configuration;
|
||||
using EveOPreview.Mediator.Messages;
|
||||
using MediatR;
|
||||
|
||||
namespace EveOPreview.Mediator.Handlers.Thumbnails
|
||||
{
|
||||
sealed class ThumbnailLocationUpdatedHandler : INotificationHandler<ThumbnailLocationUpdated>
|
||||
{
|
||||
private readonly IMediator _mediator;
|
||||
private readonly IThumbnailConfiguration _configuration;
|
||||
|
||||
public ThumbnailLocationUpdatedHandler(IMediator mediator, IThumbnailConfiguration configuration)
|
||||
{
|
||||
this._mediator = mediator;
|
||||
this._configuration = configuration;
|
||||
}
|
||||
|
||||
public Task Handle(ThumbnailLocationUpdated notification, CancellationToken cancellationToken)
|
||||
{
|
||||
this._configuration.SetThumbnailLocation(notification.ThumbnailName, notification.ActiveClientName, notification.Location);
|
||||
|
||||
return this._mediator.Send(new SaveConfiguration(), cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
14
src/Eve-O-Preview/Mediator/Messages/Base/NotificationBase.cs
Normal file
14
src/Eve-O-Preview/Mediator/Messages/Base/NotificationBase.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using MediatR;
|
||||
|
||||
namespace EveOPreview.Mediator.Messages
|
||||
{
|
||||
abstract class NotificationBase<TValue> : INotification
|
||||
{
|
||||
protected NotificationBase(TValue value)
|
||||
{
|
||||
this.Value = value;
|
||||
}
|
||||
|
||||
public TValue Value { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using MediatR;
|
||||
|
||||
namespace EveOPreview.Mediator.Messages
|
||||
{
|
||||
sealed class SaveConfiguration : IRequest
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using MediatR;
|
||||
|
||||
namespace EveOPreview.Mediator.Messages
|
||||
{
|
||||
sealed class StartService : IRequest
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using MediatR;
|
||||
|
||||
namespace EveOPreview.Mediator.Messages
|
||||
{
|
||||
sealed class StopService : IRequest
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.Drawing;
|
||||
|
||||
namespace EveOPreview.Mediator.Messages
|
||||
{
|
||||
sealed class ThumbnailActiveSizeUpdated : NotificationBase<Size>
|
||||
{
|
||||
public ThumbnailActiveSizeUpdated(Size size)
|
||||
: base(size)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using MediatR;
|
||||
|
||||
namespace EveOPreview.Mediator.Messages
|
||||
{
|
||||
sealed class ThumbnailConfiguredSizeUpdated : INotification
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using MediatR;
|
||||
|
||||
namespace EveOPreview.Mediator.Messages
|
||||
{
|
||||
sealed class ThumbnailFrameSettingsUpdated : INotification
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
using MediatR;
|
||||
|
||||
namespace EveOPreview.Mediator.Messages
|
||||
{
|
||||
sealed class ThumbnailListUpdated : INotification
|
||||
{
|
||||
public ThumbnailListUpdated(IList<string> addedThumbnails, IList<string> removedThumbnails)
|
||||
{
|
||||
this.Added = addedThumbnails;
|
||||
this.Removed = removedThumbnails;
|
||||
}
|
||||
|
||||
public IList<string> Added { get; }
|
||||
public IList<string> Removed { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Drawing;
|
||||
using MediatR;
|
||||
|
||||
namespace EveOPreview.Mediator.Messages
|
||||
{
|
||||
sealed class ThumbnailLocationUpdated : INotification
|
||||
{
|
||||
public ThumbnailLocationUpdated(string thumbnailName, string activeClientName, Point location)
|
||||
{
|
||||
this.ThumbnailName = thumbnailName;
|
||||
this.ActiveClientName = activeClientName;
|
||||
this.Location = location;
|
||||
}
|
||||
|
||||
public string ThumbnailName { get; }
|
||||
|
||||
public string ActiveClientName { get; }
|
||||
|
||||
public Point Location { get; }
|
||||
}
|
||||
}
|
||||
244
src/Eve-O-Preview/Presenters/Implementation/MainFormPresenter.cs
Normal file
244
src/Eve-O-Preview/Presenters/Implementation/MainFormPresenter.cs
Normal file
@@ -0,0 +1,244 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using EveOPreview.Configuration;
|
||||
using EveOPreview.Mediator.Messages;
|
||||
using EveOPreview.View;
|
||||
using MediatR;
|
||||
|
||||
namespace EveOPreview.Presenters
|
||||
{
|
||||
public class MainFormPresenter : Presenter<IMainFormView>, IMainFormPresenter
|
||||
{
|
||||
#region Private constants
|
||||
private const string FORUM_URL = @"https://forum.eveonline.com/t/4202";
|
||||
#endregion
|
||||
|
||||
#region Private fields
|
||||
private readonly IMediator _mediator;
|
||||
private readonly IThumbnailConfiguration _configuration;
|
||||
private readonly IConfigurationStorage _configurationStorage;
|
||||
private readonly IDictionary<string, IThumbnailDescription> _descriptionsCache;
|
||||
private bool _suppressSizeNotifications;
|
||||
|
||||
private bool _exitApplication;
|
||||
#endregion
|
||||
|
||||
public MainFormPresenter(IApplicationController controller, IMainFormView view, IMediator mediator, IThumbnailConfiguration configuration, IConfigurationStorage configurationStorage)
|
||||
: base(controller, view)
|
||||
{
|
||||
this._mediator = mediator;
|
||||
this._configuration = configuration;
|
||||
this._configurationStorage = configurationStorage;
|
||||
|
||||
this._descriptionsCache = new Dictionary<string, IThumbnailDescription>();
|
||||
|
||||
this._suppressSizeNotifications = false;
|
||||
this._exitApplication = false;
|
||||
|
||||
this.View.FormActivated = this.Activate;
|
||||
this.View.FormMinimized = this.Minimize;
|
||||
this.View.FormCloseRequested = this.Close;
|
||||
this.View.ApplicationSettingsChanged = this.SaveApplicationSettings;
|
||||
this.View.ThumbnailsSizeChanged = this.UpdateThumbnailsSize;
|
||||
this.View.ThumbnailStateChanged = this.UpdateThumbnailState;
|
||||
this.View.DocumentationLinkActivated = this.OpenDocumentationLink;
|
||||
this.View.ApplicationExitRequested = this.ExitApplication;
|
||||
}
|
||||
|
||||
private void Activate()
|
||||
{
|
||||
this.LoadApplicationSettings();
|
||||
this.View.SetDocumentationUrl(MainFormPresenter.FORUM_URL);
|
||||
this.View.SetVersionInfo(this.GetApplicationVersion());
|
||||
if (this._configuration.MinimizeToTray)
|
||||
{
|
||||
this.View.Minimize();
|
||||
}
|
||||
|
||||
this._mediator.Send(new StartService());
|
||||
}
|
||||
|
||||
private void Minimize()
|
||||
{
|
||||
if (!this._configuration.MinimizeToTray)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.View.Hide();
|
||||
}
|
||||
|
||||
private void Close(ViewCloseRequest request)
|
||||
{
|
||||
if (this._exitApplication || !this.View.MinimizeToTray)
|
||||
{
|
||||
this._mediator.Send(new StopService()).Wait();
|
||||
|
||||
this._configurationStorage.Save();
|
||||
request.Allow = true;
|
||||
return;
|
||||
}
|
||||
|
||||
request.Allow = false;
|
||||
this.View.Minimize();
|
||||
}
|
||||
|
||||
private async void UpdateThumbnailsSize()
|
||||
{
|
||||
this.SaveApplicationSettings();
|
||||
|
||||
if (!this._suppressSizeNotifications)
|
||||
{
|
||||
await this._mediator.Publish(new ThumbnailConfiguredSizeUpdated());
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadApplicationSettings()
|
||||
{
|
||||
this._configurationStorage.Load();
|
||||
|
||||
this.View.MinimizeToTray = this._configuration.MinimizeToTray;
|
||||
|
||||
this.View.ThumbnailOpacity = this._configuration.ThumbnailOpacity;
|
||||
|
||||
this.View.EnableClientLayoutTracking = this._configuration.EnableClientLayoutTracking;
|
||||
this.View.HideActiveClientThumbnail = this._configuration.HideActiveClientThumbnail;
|
||||
this.View.MinimizeInactiveClients = this._configuration.MinimizeInactiveClients;
|
||||
this.View.ShowThumbnailsAlwaysOnTop = this._configuration.ShowThumbnailsAlwaysOnTop;
|
||||
this.View.HideThumbnailsOnLostFocus = this._configuration.HideThumbnailsOnLostFocus;
|
||||
this.View.EnablePerClientThumbnailLayouts = this._configuration.EnablePerClientThumbnailLayouts;
|
||||
|
||||
this.View.SetThumbnailSizeLimitations(this._configuration.ThumbnailMinimumSize, this._configuration.ThumbnailMaximumSize);
|
||||
this.View.ThumbnailSize = this._configuration.ThumbnailSize;
|
||||
|
||||
this.View.EnableThumbnailZoom = this._configuration.ThumbnailZoomEnabled;
|
||||
this.View.ThumbnailZoomFactor = this._configuration.ThumbnailZoomFactor;
|
||||
this.View.ThumbnailZoomAnchor = ViewZoomAnchorConverter.Convert(this._configuration.ThumbnailZoomAnchor);
|
||||
|
||||
this.View.ShowThumbnailOverlays = this._configuration.ShowThumbnailOverlays;
|
||||
this.View.ShowThumbnailFrames = this._configuration.ShowThumbnailFrames;
|
||||
this.View.EnableActiveClientHighlight = this._configuration.EnableActiveClientHighlight;
|
||||
this.View.ActiveClientHighlightColor = this._configuration.ActiveClientHighlightColor;
|
||||
}
|
||||
|
||||
private async void SaveApplicationSettings()
|
||||
{
|
||||
this._configuration.MinimizeToTray = this.View.MinimizeToTray;
|
||||
|
||||
this._configuration.ThumbnailOpacity = (float)this.View.ThumbnailOpacity;
|
||||
|
||||
this._configuration.EnableClientLayoutTracking = this.View.EnableClientLayoutTracking;
|
||||
this._configuration.HideActiveClientThumbnail = this.View.HideActiveClientThumbnail;
|
||||
this._configuration.MinimizeInactiveClients = this.View.MinimizeInactiveClients;
|
||||
this._configuration.ShowThumbnailsAlwaysOnTop = this.View.ShowThumbnailsAlwaysOnTop;
|
||||
this._configuration.HideThumbnailsOnLostFocus = this.View.HideThumbnailsOnLostFocus;
|
||||
this._configuration.EnablePerClientThumbnailLayouts = this.View.EnablePerClientThumbnailLayouts;
|
||||
|
||||
this._configuration.ThumbnailSize = this.View.ThumbnailSize;
|
||||
|
||||
this._configuration.ThumbnailZoomEnabled = this.View.EnableThumbnailZoom;
|
||||
this._configuration.ThumbnailZoomFactor = this.View.ThumbnailZoomFactor;
|
||||
this._configuration.ThumbnailZoomAnchor = ViewZoomAnchorConverter.Convert(this.View.ThumbnailZoomAnchor);
|
||||
|
||||
this._configuration.ShowThumbnailOverlays = this.View.ShowThumbnailOverlays;
|
||||
if (this._configuration.ShowThumbnailFrames != this.View.ShowThumbnailFrames)
|
||||
{
|
||||
this._configuration.ShowThumbnailFrames = this.View.ShowThumbnailFrames;
|
||||
await this._mediator.Publish(new ThumbnailFrameSettingsUpdated());
|
||||
}
|
||||
|
||||
this._configuration.EnableActiveClientHighlight = this.View.EnableActiveClientHighlight;
|
||||
this._configuration.ActiveClientHighlightColor = this.View.ActiveClientHighlightColor;
|
||||
|
||||
this._configurationStorage.Save();
|
||||
|
||||
this.View.RefreshZoomSettings();
|
||||
|
||||
await this._mediator.Send(new SaveConfiguration());
|
||||
}
|
||||
|
||||
|
||||
public void AddThumbnails(IList<string> thumbnailTitles)
|
||||
{
|
||||
IList<IThumbnailDescription> descriptions = new List<IThumbnailDescription>(thumbnailTitles.Count);
|
||||
|
||||
lock (this._descriptionsCache)
|
||||
{
|
||||
foreach (string title in thumbnailTitles)
|
||||
{
|
||||
IThumbnailDescription description = this.CreateThumbnailDescription(title);
|
||||
this._descriptionsCache[title] = description;
|
||||
|
||||
descriptions.Add(description);
|
||||
}
|
||||
}
|
||||
|
||||
this.View.AddThumbnails(descriptions);
|
||||
}
|
||||
|
||||
public void RemoveThumbnails(IList<string> thumbnailTitles)
|
||||
{
|
||||
IList<IThumbnailDescription> descriptions = new List<IThumbnailDescription>(thumbnailTitles.Count);
|
||||
|
||||
lock (this._descriptionsCache)
|
||||
{
|
||||
foreach (string title in thumbnailTitles)
|
||||
{
|
||||
if (!this._descriptionsCache.TryGetValue(title, out IThumbnailDescription description))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
this._descriptionsCache.Remove(title);
|
||||
descriptions.Add(description);
|
||||
}
|
||||
}
|
||||
|
||||
this.View.RemoveThumbnails(descriptions);
|
||||
}
|
||||
|
||||
private IThumbnailDescription CreateThumbnailDescription(string title)
|
||||
{
|
||||
bool isDisabled = this._configuration.IsThumbnailDisabled(title);
|
||||
return new ThumbnailDescription(title, isDisabled);
|
||||
}
|
||||
|
||||
private async void UpdateThumbnailState(String title)
|
||||
{
|
||||
if (this._descriptionsCache.TryGetValue(title, out IThumbnailDescription description))
|
||||
{
|
||||
this._configuration.ToggleThumbnail(title, description.IsDisabled);
|
||||
}
|
||||
|
||||
await this._mediator.Send(new SaveConfiguration());
|
||||
}
|
||||
|
||||
public void UpdateThumbnailSize(Size size)
|
||||
{
|
||||
this._suppressSizeNotifications = true;
|
||||
this.View.ThumbnailSize = size;
|
||||
this._suppressSizeNotifications = false;
|
||||
}
|
||||
|
||||
private void OpenDocumentationLink()
|
||||
{
|
||||
// TODO Move out to a separate service / presenter / message handler
|
||||
ProcessStartInfo processStartInfo = new ProcessStartInfo(new Uri(MainFormPresenter.FORUM_URL).AbsoluteUri);
|
||||
Process.Start(processStartInfo);
|
||||
}
|
||||
|
||||
private string GetApplicationVersion()
|
||||
{
|
||||
Version version = System.Reflection.Assembly.GetEntryAssembly().GetName().Version;
|
||||
return $"{version.Major}.{version.Minor}.{version.Build}";
|
||||
}
|
||||
|
||||
private void ExitApplication()
|
||||
{
|
||||
this._exitApplication = true;
|
||||
this.View.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using EveOPreview.Configuration;
|
||||
|
||||
namespace EveOPreview.View
|
||||
{
|
||||
static class ViewZoomAnchorConverter
|
||||
{
|
||||
public static ZoomAnchor Convert(ViewZoomAnchor value)
|
||||
{
|
||||
// Cheat based on fact that the order and byte values of both enums are the same
|
||||
return (ZoomAnchor)((int)value);
|
||||
}
|
||||
|
||||
public static ViewZoomAnchor Convert(ZoomAnchor value)
|
||||
{
|
||||
// Cheat based on fact that the order and byte values of both enums are the same
|
||||
return (ViewZoomAnchor)((int)value);
|
||||
}
|
||||
}
|
||||
}
|
||||
13
src/Eve-O-Preview/Presenters/Interface/IMainFormPresenter.cs
Normal file
13
src/Eve-O-Preview/Presenters/Interface/IMainFormPresenter.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
|
||||
namespace EveOPreview.Presenters
|
||||
{
|
||||
interface IMainFormPresenter
|
||||
{
|
||||
void AddThumbnails(IList<string> thumbnailTitles);
|
||||
void RemoveThumbnails(IList<string> thumbnailTitles);
|
||||
|
||||
void UpdateThumbnailSize(Size size);
|
||||
}
|
||||
}
|
||||
12
src/Eve-O-Preview/Presenters/Interface/ViewCloseRequest.cs
Normal file
12
src/Eve-O-Preview/Presenters/Interface/ViewCloseRequest.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace EveOPreview.View
|
||||
{
|
||||
public class ViewCloseRequest
|
||||
{
|
||||
public ViewCloseRequest()
|
||||
{
|
||||
this.Allow = true;
|
||||
}
|
||||
|
||||
public bool Allow { get; set; }
|
||||
}
|
||||
}
|
||||
111
src/Eve-O-Preview/Program.cs
Normal file
111
src/Eve-O-Preview/Program.cs
Normal file
@@ -0,0 +1,111 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using EveOPreview.Configuration;
|
||||
using EveOPreview.Presenters;
|
||||
using EveOPreview.Services;
|
||||
using EveOPreview.View;
|
||||
using MediatR;
|
||||
|
||||
namespace EveOPreview
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
private static string MUTEX_NAME = "EVE-O Preview Single Instance Mutex";
|
||||
|
||||
private static Mutex _singleInstanceMutex;
|
||||
|
||||
/// <summary>The main entry point for the application.</summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
// The very usual Mutex-based single-instance screening
|
||||
// 'token' variable is used to store reference to the instance Mutex
|
||||
// during the app lifetime
|
||||
Program._singleInstanceMutex = Program.GetInstanceToken();
|
||||
|
||||
// If it was not possible to acquire the app token then another app instance is already running
|
||||
// Nothing to do here
|
||||
if (Program._singleInstanceMutex == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ExceptionHandler handler = new ExceptionHandler();
|
||||
handler.SetupExceptionHandlers();
|
||||
|
||||
IApplicationController controller = Program.InitializeApplicationController();
|
||||
|
||||
Program.InitializeWinForms();
|
||||
controller.Run<MainFormPresenter>();
|
||||
}
|
||||
|
||||
private static Mutex GetInstanceToken()
|
||||
{
|
||||
// The code might look overcomplicated here for a single Mutex operation
|
||||
// Yet we had already experienced a Windows-level issue
|
||||
// where .NET finalizer thread was literally paralyzed by
|
||||
// a failed Mutex operation. That did lead to weird OutOfMemory
|
||||
// exceptions later
|
||||
try
|
||||
{
|
||||
Mutex.OpenExisting(Program.MUTEX_NAME);
|
||||
// if that didn't fail then another instance is already running
|
||||
return null;
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Mutex token = new Mutex(true, Program.MUTEX_NAME, out var result);
|
||||
return result ? token : null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void InitializeWinForms()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
}
|
||||
|
||||
private static IApplicationController InitializeApplicationController()
|
||||
{
|
||||
IIocContainer container = new LightInjectContainer();
|
||||
|
||||
// Singleton registration is used for services
|
||||
// Low-level services
|
||||
container.Register<IWindowManager>();
|
||||
container.Register<IProcessMonitor>();
|
||||
|
||||
// MediatR
|
||||
container.Register<IMediator, MediatR.Mediator>();
|
||||
container.RegisterInstance<ServiceFactory>(t => container.Resolve(t));
|
||||
container.Register(typeof(INotificationHandler<>), typeof(Program).Assembly);
|
||||
container.Register(typeof(IRequestHandler<>), typeof(Program).Assembly);
|
||||
container.Register(typeof(IRequestHandler<,>), typeof(Program).Assembly);
|
||||
|
||||
// Configuration services
|
||||
container.Register<IConfigurationStorage>();
|
||||
container.Register<IAppConfig>();
|
||||
container.Register<IThumbnailConfiguration>();
|
||||
|
||||
// Application services
|
||||
container.Register<IThumbnailManager>();
|
||||
container.Register<IThumbnailViewFactory>();
|
||||
container.Register<IThumbnailDescription>();
|
||||
|
||||
IApplicationController controller = new ApplicationController(container);
|
||||
|
||||
// UI classes
|
||||
controller.RegisterView<StaticThumbnailView, StaticThumbnailView>();
|
||||
controller.RegisterView<LiveThumbnailView, LiveThumbnailView>();
|
||||
|
||||
controller.RegisterView<IMainFormView, MainForm>();
|
||||
controller.RegisterInstance(new ApplicationContext());
|
||||
|
||||
return controller;
|
||||
}
|
||||
}
|
||||
}
|
||||
18
src/Eve-O-Preview/Properties/AssemblyInfo.cs
Normal file
18
src/Eve-O-Preview/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("EVE-O Preview")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("EVE-O Preview")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: Guid("04f08f8d-9e98-423b-acdb-4effb31c0d35")]
|
||||
[assembly: AssemblyVersion("5.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("5.0.0.0")]
|
||||
|
||||
[assembly: CLSCompliant(false)]
|
||||
63
src/Eve-O-Preview/Properties/Resources.Designer.cs
generated
Normal file
63
src/Eve-O-Preview/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace EveOPreview.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("EveOPreview.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
120
src/Eve-O-Preview/Properties/Resources.resx
Normal file
120
src/Eve-O-Preview/Properties/Resources.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
103
src/Eve-O-Preview/Services/Implementation/DwmThumbnail.cs
Normal file
103
src/Eve-O-Preview/Services/Implementation/DwmThumbnail.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using EveOPreview.Services.Interop;
|
||||
|
||||
namespace EveOPreview.Services.Implementation
|
||||
{
|
||||
class DwmThumbnail : IDwmThumbnail
|
||||
{
|
||||
#region Private fields
|
||||
private readonly IWindowManager _windowManager;
|
||||
private IntPtr _handle;
|
||||
private DWM_THUMBNAIL_PROPERTIES _properties;
|
||||
#endregion
|
||||
|
||||
public DwmThumbnail(IWindowManager windowManager)
|
||||
{
|
||||
this._windowManager = windowManager;
|
||||
this._handle = IntPtr.Zero;
|
||||
}
|
||||
|
||||
public void Register(IntPtr destination, IntPtr source)
|
||||
{
|
||||
this._properties = new DWM_THUMBNAIL_PROPERTIES();
|
||||
this._properties.dwFlags = DWM_TNP_CONSTANTS.DWM_TNP_VISIBLE
|
||||
+ DWM_TNP_CONSTANTS.DWM_TNP_OPACITY
|
||||
+ DWM_TNP_CONSTANTS.DWM_TNP_RECTDESTINATION
|
||||
+ DWM_TNP_CONSTANTS.DWM_TNP_SOURCECLIENTAREAONLY;
|
||||
this._properties.opacity = 255;
|
||||
this._properties.fVisible = true;
|
||||
this._properties.fSourceClientAreaOnly = true;
|
||||
|
||||
if (!this._windowManager.IsCompositionEnabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
this._handle = DwmNativeMethods.DwmRegisterThumbnail(destination, source);
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
// This exception is raised if the source client is already closed
|
||||
// Can happen on a really slow CPU's that the window is still being
|
||||
// listed in the process list yet it already cannot be used as
|
||||
// a thumbnail source
|
||||
this._handle = IntPtr.Zero;
|
||||
}
|
||||
catch (COMException)
|
||||
{
|
||||
// This exception is raised if DWM is suddenly not available
|
||||
// (f.e. when switching between Windows user accounts)
|
||||
this._handle = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
public void Unregister()
|
||||
{
|
||||
if ((!this._windowManager.IsCompositionEnabled) || (this._handle == IntPtr.Zero))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
DwmNativeMethods.DwmUnregisterThumbnail(this._handle);
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
}
|
||||
catch (COMException)
|
||||
{
|
||||
// This exception is raised when DWM is not available for some reason
|
||||
}
|
||||
}
|
||||
|
||||
public void Move(int left, int top, int right, int bottom)
|
||||
{
|
||||
this._properties.rcDestination = new RECT(left, top, right, bottom);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if ((!this._windowManager.IsCompositionEnabled) || (this._handle == IntPtr.Zero))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
DwmNativeMethods.DwmUpdateThumbnailProperties(this._handle, this._properties);
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
// This exception will be thrown if the EVE client disappears while this method is running
|
||||
}
|
||||
catch (COMException)
|
||||
{
|
||||
// This exception is raised when DWM is not available for some reason
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
16
src/Eve-O-Preview/Services/Implementation/ProcessInfo.cs
Normal file
16
src/Eve-O-Preview/Services/Implementation/ProcessInfo.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
|
||||
namespace EveOPreview.Services.Implementation
|
||||
{
|
||||
sealed class ProcessInfo : IProcessInfo
|
||||
{
|
||||
public ProcessInfo(IntPtr handle, string title)
|
||||
{
|
||||
this.Handle = handle;
|
||||
this.Title = title;
|
||||
}
|
||||
|
||||
public IntPtr Handle { get; }
|
||||
public string Title { get; }
|
||||
}
|
||||
}
|
||||
93
src/Eve-O-Preview/Services/Implementation/ProcessMonitor.cs
Normal file
93
src/Eve-O-Preview/Services/Implementation/ProcessMonitor.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace EveOPreview.Services.Implementation
|
||||
{
|
||||
sealed class ProcessMonitor : IProcessMonitor
|
||||
{
|
||||
#region Private constants
|
||||
private const string DEFAULT_PROCESS_NAME = "ExeFile";
|
||||
#endregion
|
||||
|
||||
#region Private fields
|
||||
private readonly IDictionary<IntPtr, string> _processCache;
|
||||
#endregion
|
||||
|
||||
public ProcessMonitor()
|
||||
{
|
||||
this._processCache = new Dictionary<IntPtr, string>(512);
|
||||
}
|
||||
|
||||
private bool IsMonitoredProcess(string processName)
|
||||
{
|
||||
// This is a possible extension point
|
||||
return String.Equals(processName, ProcessMonitor.DEFAULT_PROCESS_NAME, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public void GetUpdatedProcesses(out ICollection<IProcessInfo> addedProcesses, out ICollection<IProcessInfo> updatedProcesses, out ICollection<IProcessInfo> removedProcesses)
|
||||
{
|
||||
addedProcesses = new List<IProcessInfo>(16);
|
||||
updatedProcesses = new List<IProcessInfo>(16);
|
||||
removedProcesses = new List<IProcessInfo>(16);
|
||||
|
||||
IList<IntPtr> knownProcesses = new List<IntPtr>(this._processCache.Keys);
|
||||
foreach (Process process in Process.GetProcesses())
|
||||
{
|
||||
string processName = process.ProcessName;
|
||||
|
||||
if (!this.IsMonitoredProcess(processName))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
IntPtr mainWindowHandle = process.MainWindowHandle;
|
||||
if (mainWindowHandle == IntPtr.Zero)
|
||||
{
|
||||
continue; // No need to monitor non-visual processes
|
||||
}
|
||||
|
||||
string mainWindowTitle = process.MainWindowTitle;
|
||||
this._processCache.TryGetValue(mainWindowHandle, out string cachedTitle);
|
||||
|
||||
if (cachedTitle == null)
|
||||
{
|
||||
// This is a new process in the list
|
||||
this._processCache.Add(mainWindowHandle, mainWindowTitle);
|
||||
addedProcesses.Add(new ProcessInfo(mainWindowHandle, mainWindowTitle));
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is an already known process
|
||||
if (cachedTitle != mainWindowTitle)
|
||||
{
|
||||
this._processCache[mainWindowHandle] = mainWindowTitle;
|
||||
updatedProcesses.Add(new ProcessInfo(mainWindowHandle, mainWindowTitle));
|
||||
}
|
||||
|
||||
knownProcesses.Remove(mainWindowHandle);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (IntPtr index in knownProcesses)
|
||||
{
|
||||
string title = this._processCache[index];
|
||||
removedProcesses.Add(new ProcessInfo(index, title));
|
||||
this._processCache.Remove(index);
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<IProcessInfo> GetAllProcesses()
|
||||
{
|
||||
ICollection<IProcessInfo> result = new List<IProcessInfo>(this._processCache.Count);
|
||||
|
||||
// TODO Lock list here just in case
|
||||
foreach (KeyValuePair<IntPtr, string> entry in this._processCache)
|
||||
{
|
||||
result.Add(new ProcessInfo(entry.Key, entry.Value));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
705
src/Eve-O-Preview/Services/Implementation/ThumbnailManager.cs
Normal file
705
src/Eve-O-Preview/Services/Implementation/ThumbnailManager.cs
Normal file
@@ -0,0 +1,705 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Threading;
|
||||
using EveOPreview.Configuration;
|
||||
using EveOPreview.Mediator.Messages;
|
||||
using EveOPreview.View;
|
||||
using MediatR;
|
||||
|
||||
namespace EveOPreview.Services
|
||||
{
|
||||
sealed class ThumbnailManager : IThumbnailManager
|
||||
{
|
||||
#region Private constants
|
||||
private const int WINDOW_POSITION_THRESHOLD_LOW = -10_000;
|
||||
private const int WINDOW_POSITION_THRESHOLD_HIGH = 31_000;
|
||||
private const int WINDOW_SIZE_THRESHOLD = 10;
|
||||
private const int FORCED_REFRESH_CYCLE_THRESHOLD = 2;
|
||||
private const int DEFAULT_LOCATION_CHANGE_NOTIFICATION_DELAY = 2;
|
||||
|
||||
private const string DEFAULT_CLIENT_TITLE = "EVE";
|
||||
#endregion
|
||||
|
||||
#region Private fields
|
||||
private readonly IMediator _mediator;
|
||||
private readonly IProcessMonitor _processMonitor;
|
||||
private readonly IWindowManager _windowManager;
|
||||
private readonly IThumbnailConfiguration _configuration;
|
||||
private readonly DispatcherTimer _thumbnailUpdateTimer;
|
||||
private readonly IThumbnailViewFactory _thumbnailViewFactory;
|
||||
private readonly Dictionary<IntPtr, IThumbnailView> _thumbnailViews;
|
||||
|
||||
private (IntPtr Handle, string Title) _activeClient;
|
||||
private IntPtr _externalApplication;
|
||||
|
||||
private readonly object _locationChangeNotificationSyncRoot;
|
||||
private (IntPtr Handle, string Title, string ActiveClient, Point Location, int Delay) _enqueuedLocationChangeNotification;
|
||||
|
||||
private bool _ignoreViewEvents;
|
||||
private bool _isHoverEffectActive;
|
||||
|
||||
private int _refreshCycleCount;
|
||||
#endregion
|
||||
|
||||
public ThumbnailManager(IMediator mediator, IThumbnailConfiguration configuration, IProcessMonitor processMonitor, IWindowManager windowManager, IThumbnailViewFactory factory)
|
||||
{
|
||||
this._mediator = mediator;
|
||||
this._processMonitor = processMonitor;
|
||||
this._windowManager = windowManager;
|
||||
this._configuration = configuration;
|
||||
this._thumbnailViewFactory = factory;
|
||||
|
||||
this._activeClient = (IntPtr.Zero, ThumbnailManager.DEFAULT_CLIENT_TITLE);
|
||||
|
||||
this.EnableViewEvents();
|
||||
this._isHoverEffectActive = false;
|
||||
|
||||
this._refreshCycleCount = 0;
|
||||
this._locationChangeNotificationSyncRoot = new object();
|
||||
this._enqueuedLocationChangeNotification = (IntPtr.Zero, null, null, Point.Empty, -1);
|
||||
|
||||
this._thumbnailViews = new Dictionary<IntPtr, IThumbnailView>();
|
||||
|
||||
// DispatcherTimer setup
|
||||
this._thumbnailUpdateTimer = new DispatcherTimer();
|
||||
this._thumbnailUpdateTimer.Tick += ThumbnailUpdateTimerTick;
|
||||
this._thumbnailUpdateTimer.Interval = new TimeSpan(0, 0, 0, 0, configuration.ThumbnailRefreshPeriod);
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
this._thumbnailUpdateTimer.Start();
|
||||
|
||||
this.RefreshThumbnails();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
this._thumbnailUpdateTimer.Stop();
|
||||
}
|
||||
|
||||
private void ThumbnailUpdateTimerTick(object sender, EventArgs e)
|
||||
{
|
||||
this.UpdateThumbnailsList();
|
||||
this.RefreshThumbnails();
|
||||
}
|
||||
|
||||
private async void UpdateThumbnailsList()
|
||||
{
|
||||
this._processMonitor.GetUpdatedProcesses(out ICollection<IProcessInfo> addedProcesses, out ICollection<IProcessInfo> updatedProcesses, out ICollection<IProcessInfo> removedProcesses);
|
||||
|
||||
List<string> viewsAdded = new List<string>();
|
||||
List<string> viewsRemoved = new List<string>();
|
||||
|
||||
foreach (IProcessInfo process in addedProcesses)
|
||||
{
|
||||
IThumbnailView view = this._thumbnailViewFactory.Create(process.Handle, process.Title, this._configuration.ThumbnailSize);
|
||||
view.IsOverlayEnabled = this._configuration.ShowThumbnailOverlays;
|
||||
view.SetFrames(this._configuration.ShowThumbnailFrames);
|
||||
// Max/Min size limitations should be set AFTER the frames are disabled
|
||||
// Otherwise thumbnail window will be unnecessary resized
|
||||
view.SetSizeLimitations(this._configuration.ThumbnailMinimumSize, this._configuration.ThumbnailMaximumSize);
|
||||
view.SetTopMost(this._configuration.ShowThumbnailsAlwaysOnTop);
|
||||
|
||||
view.ThumbnailLocation = this.IsManageableThumbnail(view)
|
||||
? this._configuration.GetThumbnailLocation(view.Title, this._activeClient.Title, view.ThumbnailLocation)
|
||||
: this._configuration.GetDefaultThumbnailLocation();
|
||||
|
||||
this._thumbnailViews.Add(view.Id, view);
|
||||
|
||||
view.ThumbnailResized = this.ThumbnailViewResized;
|
||||
view.ThumbnailMoved = this.ThumbnailViewMoved;
|
||||
view.ThumbnailFocused = this.ThumbnailViewFocused;
|
||||
view.ThumbnailLostFocus = this.ThumbnailViewLostFocus;
|
||||
view.ThumbnailActivated = this.ThumbnailActivated;
|
||||
view.ThumbnailDeactivated = this.ThumbnailDeactivated;
|
||||
|
||||
view.RegisterHotkey(this._configuration.GetClientHotkey(view.Title));
|
||||
|
||||
this.ApplyClientLayout(view.Id, view.Title);
|
||||
|
||||
// TODO Add extension filter here later
|
||||
if (view.Title != ThumbnailManager.DEFAULT_CLIENT_TITLE)
|
||||
{
|
||||
viewsAdded.Add(view.Title);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (IProcessInfo process in updatedProcesses)
|
||||
{
|
||||
this._thumbnailViews.TryGetValue(process.Handle, out IThumbnailView view);
|
||||
|
||||
if (view == null)
|
||||
{
|
||||
// Something went terribly wrong
|
||||
continue;
|
||||
}
|
||||
|
||||
if (process.Title != view.Title) // update thumbnail title
|
||||
{
|
||||
viewsRemoved.Add(view.Title);
|
||||
view.Title = process.Title;
|
||||
viewsAdded.Add(view.Title);
|
||||
|
||||
view.RegisterHotkey(this._configuration.GetClientHotkey(process.Title));
|
||||
|
||||
this.ApplyClientLayout(view.Id, view.Title);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (IProcessInfo process in removedProcesses)
|
||||
{
|
||||
IThumbnailView view = this._thumbnailViews[process.Handle];
|
||||
|
||||
this._thumbnailViews.Remove(view.Id);
|
||||
if (view.Title != ThumbnailManager.DEFAULT_CLIENT_TITLE)
|
||||
{
|
||||
viewsRemoved.Add(view.Title);
|
||||
}
|
||||
|
||||
view.UnregisterHotkey();
|
||||
|
||||
view.ThumbnailResized = null;
|
||||
view.ThumbnailMoved = null;
|
||||
view.ThumbnailFocused = null;
|
||||
view.ThumbnailLostFocus = null;
|
||||
view.ThumbnailActivated = null;
|
||||
|
||||
view.Close();
|
||||
}
|
||||
|
||||
if ((viewsAdded.Count > 0) || (viewsRemoved.Count > 0))
|
||||
{
|
||||
await this._mediator.Publish(new ThumbnailListUpdated(viewsAdded, viewsRemoved));
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshThumbnails()
|
||||
{
|
||||
// TODO Split this method
|
||||
IntPtr foregroundWindowHandle = this._windowManager.GetForegroundWindowHandle();
|
||||
string foregroundWindowTitle = null;
|
||||
|
||||
// Check if the foreground window handle is one of the known handles for client windows or their thumbnails
|
||||
bool isClientWindow = this.IsClientWindowActive(foregroundWindowHandle);
|
||||
|
||||
if (foregroundWindowHandle == this._activeClient.Handle)
|
||||
{
|
||||
foregroundWindowTitle = this._activeClient.Title;
|
||||
}
|
||||
else if (this._thumbnailViews.TryGetValue(foregroundWindowHandle, out IThumbnailView foregroundView))
|
||||
{
|
||||
// This code will work only on Alt+Tab switch between clients
|
||||
foregroundWindowTitle = foregroundView.Title;
|
||||
}
|
||||
else if (!isClientWindow)
|
||||
{
|
||||
// Under some circumstances Foreground WindowHandle can be zero
|
||||
// (f.e. when Thumbnail is silently stealing focus from the currently open app)
|
||||
if (foregroundWindowHandle != IntPtr.Zero)
|
||||
{
|
||||
this._externalApplication = foregroundWindowHandle;
|
||||
}
|
||||
}
|
||||
|
||||
// No need to minimize EVE clients when switching out to non-EVE window (like thumbnail)
|
||||
if (!string.IsNullOrEmpty(foregroundWindowTitle))
|
||||
{
|
||||
this.SwitchActiveClient(foregroundWindowHandle, foregroundWindowTitle);
|
||||
}
|
||||
|
||||
bool hideAllThumbnails = this._configuration.HideThumbnailsOnLostFocus && !isClientWindow;
|
||||
|
||||
this._refreshCycleCount++;
|
||||
|
||||
bool forceRefresh;
|
||||
if (this._refreshCycleCount >= ThumbnailManager.FORCED_REFRESH_CYCLE_THRESHOLD)
|
||||
{
|
||||
this._refreshCycleCount = 0;
|
||||
forceRefresh = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
forceRefresh = false;
|
||||
}
|
||||
|
||||
this.DisableViewEvents();
|
||||
|
||||
// Snap thumbnail
|
||||
// No need to update Thumbnails while one of them is highlighted
|
||||
if ((!this._isHoverEffectActive) && this.TryDequeueLocationChange(out var locationChange))
|
||||
{
|
||||
if ((locationChange.ActiveClient == this._activeClient.Title) && this._thumbnailViews.TryGetValue(locationChange.Handle, out var view))
|
||||
{
|
||||
this.SnapThumbnailView(view);
|
||||
|
||||
this.RaiseThumbnailLocationUpdatedNotification(view.Title);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.RaiseThumbnailLocationUpdatedNotification(locationChange.Title);
|
||||
}
|
||||
}
|
||||
|
||||
// Hide, show, resize and move
|
||||
foreach (KeyValuePair<IntPtr, IThumbnailView> entry in this._thumbnailViews)
|
||||
{
|
||||
IThumbnailView view = entry.Value;
|
||||
|
||||
if (hideAllThumbnails || this._configuration.IsThumbnailDisabled(view.Title))
|
||||
{
|
||||
if (view.IsActive)
|
||||
{
|
||||
view.Hide();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this._configuration.HideActiveClientThumbnail && (view.Id == this._activeClient.Handle))
|
||||
{
|
||||
if (view.IsActive)
|
||||
{
|
||||
view.Hide();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// No need to update Thumbnails while one of them is highlighted
|
||||
if (!this._isHoverEffectActive)
|
||||
{
|
||||
// Do not even move thumbnails with default caption
|
||||
if (this.IsManageableThumbnail(view))
|
||||
{
|
||||
view.ThumbnailLocation = this._configuration.GetThumbnailLocation(view.Title, this._activeClient.Title, view.ThumbnailLocation);
|
||||
}
|
||||
|
||||
view.SetOpacity(this._configuration.ThumbnailOpacity);
|
||||
view.SetTopMost(this._configuration.ShowThumbnailsAlwaysOnTop);
|
||||
}
|
||||
|
||||
view.IsOverlayEnabled = this._configuration.ShowThumbnailOverlays;
|
||||
|
||||
view.SetHighlight(this._configuration.EnableActiveClientHighlight && (view.Id == this._activeClient.Handle),
|
||||
this._configuration.ActiveClientHighlightColor, this._configuration.ActiveClientHighlightThickness);
|
||||
|
||||
if (!view.IsActive)
|
||||
{
|
||||
view.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
view.Refresh(forceRefresh);
|
||||
}
|
||||
}
|
||||
|
||||
this.EnableViewEvents();
|
||||
}
|
||||
|
||||
public void UpdateThumbnailsSize()
|
||||
{
|
||||
this.SetThumbnailsSize(this._configuration.ThumbnailSize);
|
||||
}
|
||||
|
||||
private void SetThumbnailsSize(Size size)
|
||||
{
|
||||
this.DisableViewEvents();
|
||||
|
||||
foreach (KeyValuePair<IntPtr, IThumbnailView> entry in this._thumbnailViews)
|
||||
{
|
||||
entry.Value.ThumbnailSize = size;
|
||||
entry.Value.Refresh(false);
|
||||
}
|
||||
|
||||
this.EnableViewEvents();
|
||||
}
|
||||
|
||||
public void UpdateThumbnailFrames()
|
||||
{
|
||||
this.DisableViewEvents();
|
||||
|
||||
foreach (KeyValuePair<IntPtr, IThumbnailView> entry in this._thumbnailViews)
|
||||
{
|
||||
entry.Value.SetFrames(this._configuration.ShowThumbnailFrames);
|
||||
}
|
||||
|
||||
this.EnableViewEvents();
|
||||
}
|
||||
|
||||
private void EnableViewEvents()
|
||||
{
|
||||
this._ignoreViewEvents = false;
|
||||
}
|
||||
|
||||
private void DisableViewEvents()
|
||||
{
|
||||
this._ignoreViewEvents = true;
|
||||
}
|
||||
|
||||
private void SwitchActiveClient(IntPtr foregroundClientHandle, string foregroundClientTitle)
|
||||
{
|
||||
// Check if any actions are needed
|
||||
if (this._activeClient.Handle == foregroundClientHandle)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Minimize the currently active client if needed
|
||||
if (this._configuration.MinimizeInactiveClients && !this._configuration.IsPriorityClient(this._activeClient.Title))
|
||||
{
|
||||
this._windowManager.MinimizeWindow(this._activeClient.Handle, false);
|
||||
}
|
||||
|
||||
this._activeClient = (foregroundClientHandle, foregroundClientTitle);
|
||||
}
|
||||
|
||||
private void ThumbnailViewFocused(IntPtr id)
|
||||
{
|
||||
if (this._isHoverEffectActive)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this._isHoverEffectActive = true;
|
||||
|
||||
IThumbnailView view = this._thumbnailViews[id];
|
||||
|
||||
view.SetTopMost(true);
|
||||
view.SetOpacity(1.0);
|
||||
|
||||
if (this._configuration.ThumbnailZoomEnabled)
|
||||
{
|
||||
this.ThumbnailZoomIn(view);
|
||||
}
|
||||
}
|
||||
|
||||
private void ThumbnailViewLostFocus(IntPtr id)
|
||||
{
|
||||
if (!this._isHoverEffectActive)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IThumbnailView view = this._thumbnailViews[id];
|
||||
|
||||
if (this._configuration.ThumbnailZoomEnabled)
|
||||
{
|
||||
this.ThumbnailZoomOut(view);
|
||||
}
|
||||
|
||||
view.SetOpacity(this._configuration.ThumbnailOpacity);
|
||||
|
||||
this._isHoverEffectActive = false;
|
||||
}
|
||||
|
||||
private void ThumbnailActivated(IntPtr id)
|
||||
{
|
||||
IThumbnailView view = this._thumbnailViews[id];
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
this._windowManager.ActivateWindow(view.Id);
|
||||
})
|
||||
.ContinueWith((task) =>
|
||||
{
|
||||
// This code should be executed on UI thread
|
||||
this.SwitchActiveClient(view.Id, view.Title);
|
||||
this.UpdateClientLayouts();
|
||||
this.RefreshThumbnails();
|
||||
}, TaskScheduler.FromCurrentSynchronizationContext());
|
||||
}
|
||||
|
||||
private void ThumbnailDeactivated(IntPtr id, bool switchOut)
|
||||
{
|
||||
if (switchOut)
|
||||
{
|
||||
this._windowManager.ActivateWindow(this._externalApplication);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!this._thumbnailViews.TryGetValue(id, out IThumbnailView view))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this._windowManager.MinimizeWindow(view.Id, true);
|
||||
this.RefreshThumbnails();
|
||||
}
|
||||
}
|
||||
|
||||
private async void ThumbnailViewResized(IntPtr id)
|
||||
{
|
||||
if (this._ignoreViewEvents)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IThumbnailView view = this._thumbnailViews[id];
|
||||
|
||||
this.SetThumbnailsSize(view.ThumbnailSize);
|
||||
|
||||
view.Refresh(false);
|
||||
|
||||
await this._mediator.Publish(new ThumbnailActiveSizeUpdated(view.ThumbnailSize));
|
||||
}
|
||||
|
||||
private void ThumbnailViewMoved(IntPtr id)
|
||||
{
|
||||
if (this._ignoreViewEvents)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IThumbnailView view = this._thumbnailViews[id];
|
||||
view.Refresh(false);
|
||||
this.EnqueueLocationChange(view);
|
||||
}
|
||||
|
||||
private bool IsClientWindowActive(IntPtr windowHandle)
|
||||
{
|
||||
if (windowHandle == IntPtr.Zero)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (KeyValuePair<IntPtr, IThumbnailView> entry in this._thumbnailViews)
|
||||
{
|
||||
IThumbnailView view = entry.Value;
|
||||
|
||||
if (view.IsKnownHandle(windowHandle))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void ThumbnailZoomIn(IThumbnailView view)
|
||||
{
|
||||
this.DisableViewEvents();
|
||||
|
||||
view.ZoomIn(ViewZoomAnchorConverter.Convert(this._configuration.ThumbnailZoomAnchor), this._configuration.ThumbnailZoomFactor);
|
||||
view.Refresh(false);
|
||||
|
||||
this.EnableViewEvents();
|
||||
}
|
||||
|
||||
private void ThumbnailZoomOut(IThumbnailView view)
|
||||
{
|
||||
this.DisableViewEvents();
|
||||
|
||||
view.ZoomOut();
|
||||
view.Refresh(false);
|
||||
|
||||
this.EnableViewEvents();
|
||||
}
|
||||
|
||||
private void SnapThumbnailView(IThumbnailView view)
|
||||
{
|
||||
// Check if this feature is enabled
|
||||
if (!this._configuration.EnableThumbnailSnap)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Only borderless thumbnails can be docked
|
||||
if (this._configuration.ShowThumbnailFrames)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int width = this._configuration.ThumbnailSize.Width;
|
||||
int height = this._configuration.ThumbnailSize.Height;
|
||||
|
||||
// TODO Extract method
|
||||
int baseX = view.ThumbnailLocation.X;
|
||||
int baseY = view.ThumbnailLocation.Y;
|
||||
|
||||
Point[] viewPoints = { new Point(baseX, baseY), new Point(baseX + width, baseY), new Point(baseX, baseY + height), new Point(baseX + width, baseY + height) };
|
||||
|
||||
// TODO Extract constants
|
||||
int thresholdX = Math.Max(20, width / 10);
|
||||
int thresholdY = Math.Max(20, height / 10);
|
||||
|
||||
foreach (var entry in this._thumbnailViews)
|
||||
{
|
||||
IThumbnailView testView = entry.Value;
|
||||
|
||||
if (view.Id == testView.Id)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int testX = testView.ThumbnailLocation.X;
|
||||
int testY = testView.ThumbnailLocation.Y;
|
||||
|
||||
Point[] testPoints = { new Point(testX, testY), new Point(testX + width, testY), new Point(testX, testY + height), new Point(testX + width, testY + height) };
|
||||
|
||||
var delta = ThumbnailManager.TestViewPoints(viewPoints, testPoints, thresholdX, thresholdY);
|
||||
|
||||
if ((delta.X == 0) && (delta.Y == 0))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
view.ThumbnailLocation = new Point(view.ThumbnailLocation.X + delta.X, view.ThumbnailLocation.Y + delta.Y);
|
||||
this._configuration.SetThumbnailLocation(view.Title, this._activeClient.Title, view.ThumbnailLocation);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static (int X, int Y) TestViewPoints(Point[] viewPoints, Point[] testPoints, int thresholdX, int thresholdY)
|
||||
{
|
||||
// Point combinations that we need to check
|
||||
// No need to check all 4x4 combinations
|
||||
(int ViewOffset, int TestOffset)[] testOffsets =
|
||||
{ ( 0, 3 ), ( 0, 2 ), ( 1, 2 ),
|
||||
( 0, 1 ), ( 0, 0 ), ( 1, 0 ),
|
||||
( 2, 1 ), ( 2, 0 ), ( 3, 0 )};
|
||||
|
||||
foreach (var testOffset in testOffsets)
|
||||
{
|
||||
Point viewPoint = viewPoints[testOffset.ViewOffset];
|
||||
Point testPoint = testPoints[testOffset.TestOffset];
|
||||
|
||||
int deltaX = testPoint.X - viewPoint.X;
|
||||
int deltaY = testPoint.Y - viewPoint.Y;
|
||||
|
||||
if ((Math.Abs(deltaX) <= thresholdX) && (Math.Abs(deltaY) <= thresholdY))
|
||||
{
|
||||
return (deltaX, deltaY);
|
||||
}
|
||||
}
|
||||
|
||||
return (0, 0);
|
||||
}
|
||||
|
||||
private void ApplyClientLayout(IntPtr clientHandle, string clientTitle)
|
||||
{
|
||||
if (!this._configuration.EnableClientLayoutTracking)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ClientLayout clientLayout = this._configuration.GetClientLayout(clientTitle);
|
||||
|
||||
if (clientLayout == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (clientLayout.IsMaximized)
|
||||
{
|
||||
this._windowManager.MaximizeWindow(clientHandle);
|
||||
}
|
||||
else
|
||||
{
|
||||
this._windowManager.MoveWindow(clientHandle, clientLayout.X, clientLayout.Y, clientLayout.Width, clientLayout.Height);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateClientLayouts()
|
||||
{
|
||||
if (!this._configuration.EnableClientLayoutTracking)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (KeyValuePair<IntPtr, IThumbnailView> entry in this._thumbnailViews)
|
||||
{
|
||||
IThumbnailView view = entry.Value;
|
||||
(int Left, int Top, int Right, int Bottom) position = this._windowManager.GetWindowPosition(view.Id);
|
||||
int width = Math.Abs(position.Right - position.Left);
|
||||
int height = Math.Abs(position.Bottom - position.Top);
|
||||
|
||||
var isMaximized = this._windowManager.IsWindowMaximized(view.Id);
|
||||
|
||||
if (!(isMaximized || this.IsValidWindowPosition(position.Left, position.Top, width, height)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
this._configuration.SetClientLayout(view.Title, new ClientLayout(position.Left, position.Top, width, height, isMaximized));
|
||||
}
|
||||
}
|
||||
|
||||
private void EnqueueLocationChange(IThumbnailView view)
|
||||
{
|
||||
string activeClientTitle = this._activeClient.Title;
|
||||
// TODO ??
|
||||
this._configuration.SetThumbnailLocation(view.Title, activeClientTitle, view.ThumbnailLocation);
|
||||
|
||||
lock (this._locationChangeNotificationSyncRoot)
|
||||
{
|
||||
if (this._enqueuedLocationChangeNotification.Handle == IntPtr.Zero)
|
||||
{
|
||||
this._enqueuedLocationChangeNotification = (view.Id, view.Title, activeClientTitle, view.ThumbnailLocation, ThumbnailManager.DEFAULT_LOCATION_CHANGE_NOTIFICATION_DELAY);
|
||||
return;
|
||||
}
|
||||
|
||||
// Reset the delay and exit
|
||||
if ((this._enqueuedLocationChangeNotification.Handle == view.Id) &&
|
||||
(this._enqueuedLocationChangeNotification.ActiveClient == activeClientTitle))
|
||||
{
|
||||
this._enqueuedLocationChangeNotification.Delay = ThumbnailManager.DEFAULT_LOCATION_CHANGE_NOTIFICATION_DELAY;
|
||||
return;
|
||||
}
|
||||
|
||||
this.RaiseThumbnailLocationUpdatedNotification(this._enqueuedLocationChangeNotification.Title);
|
||||
this._enqueuedLocationChangeNotification = (view.Id, view.Title, activeClientTitle, view.ThumbnailLocation, ThumbnailManager.DEFAULT_LOCATION_CHANGE_NOTIFICATION_DELAY);
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryDequeueLocationChange(out (IntPtr Handle, string Title, string ActiveClient, Point Location) change)
|
||||
{
|
||||
lock (this._locationChangeNotificationSyncRoot)
|
||||
{
|
||||
change = (IntPtr.Zero, null, null, Point.Empty);
|
||||
|
||||
if (this._enqueuedLocationChangeNotification.Handle == IntPtr.Zero)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
this._enqueuedLocationChangeNotification.Delay--;
|
||||
|
||||
if (this._enqueuedLocationChangeNotification.Delay > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
change = (this._enqueuedLocationChangeNotification.Handle, this._enqueuedLocationChangeNotification.Title, this._enqueuedLocationChangeNotification.ActiveClient, this._enqueuedLocationChangeNotification.Location);
|
||||
this._enqueuedLocationChangeNotification = (IntPtr.Zero, null, null, Point.Empty, -1);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private async void RaiseThumbnailLocationUpdatedNotification(string title)
|
||||
{
|
||||
if (string.IsNullOrEmpty(title) || (title == ThumbnailManager.DEFAULT_CLIENT_TITLE))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
await this._mediator.Send(new SaveConfiguration());
|
||||
}
|
||||
|
||||
// We shouldn't manage some thumbnails (like thumbnail of the EVE client sitting on the login screen)
|
||||
// TODO Move to a service (?)
|
||||
private bool IsManageableThumbnail(IThumbnailView view)
|
||||
{
|
||||
return view.Title != ThumbnailManager.DEFAULT_CLIENT_TITLE;
|
||||
}
|
||||
|
||||
// Quick sanity check that the window is not minimized
|
||||
private bool IsValidWindowPosition(int left, int top, int width, int height)
|
||||
{
|
||||
return (left > ThumbnailManager.WINDOW_POSITION_THRESHOLD_LOW) && (left < ThumbnailManager.WINDOW_POSITION_THRESHOLD_HIGH)
|
||||
&& (top > ThumbnailManager.WINDOW_POSITION_THRESHOLD_LOW) && (top < ThumbnailManager.WINDOW_POSITION_THRESHOLD_HIGH)
|
||||
&& (width > ThumbnailManager.WINDOW_SIZE_THRESHOLD) && (height > ThumbnailManager.WINDOW_SIZE_THRESHOLD);
|
||||
}
|
||||
}
|
||||
}
|
||||
123
src/Eve-O-Preview/Services/Implementation/WindowManager.cs
Normal file
123
src/Eve-O-Preview/Services/Implementation/WindowManager.cs
Normal file
@@ -0,0 +1,123 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using EveOPreview.Services.Interop;
|
||||
|
||||
namespace EveOPreview.Services.Implementation
|
||||
{
|
||||
sealed class WindowManager : IWindowManager
|
||||
{
|
||||
#region Private constants
|
||||
private const int WINDOW_SIZE_THRESHOLD = 300;
|
||||
#endregion
|
||||
|
||||
public WindowManager()
|
||||
{
|
||||
// Composition is always enabled for Windows 8+
|
||||
this.IsCompositionEnabled =
|
||||
((Environment.OSVersion.Version.Major == 6) && (Environment.OSVersion.Version.Minor >= 2)) // Win 8 and Win 8.1
|
||||
|| (Environment.OSVersion.Version.Major >= 10) // Win 10
|
||||
|| DwmNativeMethods.DwmIsCompositionEnabled(); // In case of Win 7 an API call is requiredWin 7
|
||||
}
|
||||
|
||||
public bool IsCompositionEnabled { get; }
|
||||
|
||||
public IntPtr GetForegroundWindowHandle()
|
||||
{
|
||||
return User32NativeMethods.GetForegroundWindow();
|
||||
}
|
||||
|
||||
public void ActivateWindow(IntPtr handle)
|
||||
{
|
||||
User32NativeMethods.SetForegroundWindow(handle);
|
||||
|
||||
int style = User32NativeMethods.GetWindowLong(handle, InteropConstants.GWL_STYLE);
|
||||
|
||||
if ((style & InteropConstants.WS_MINIMIZE) == InteropConstants.WS_MINIMIZE)
|
||||
{
|
||||
User32NativeMethods.ShowWindowAsync(handle, InteropConstants.SW_RESTORE);
|
||||
}
|
||||
}
|
||||
|
||||
public void MinimizeWindow(IntPtr handle, bool enableAnimation)
|
||||
{
|
||||
if (enableAnimation)
|
||||
{
|
||||
User32NativeMethods.SendMessage(handle, InteropConstants.WM_SYSCOMMAND, InteropConstants.SC_MINIMIZE, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
WINDOWPLACEMENT param = new WINDOWPLACEMENT();
|
||||
param.length = Marshal.SizeOf(typeof(WINDOWPLACEMENT));
|
||||
User32NativeMethods.GetWindowPlacement(handle, ref param);
|
||||
param.showCmd = WINDOWPLACEMENT.SW_MINIMIZE;
|
||||
User32NativeMethods.SetWindowPlacement(handle, ref param);
|
||||
}
|
||||
}
|
||||
|
||||
public void MoveWindow(IntPtr handle, int left, int top, int width, int height)
|
||||
{
|
||||
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)
|
||||
{
|
||||
User32NativeMethods.GetWindowRect(handle, out RECT windowRectangle);
|
||||
|
||||
return (windowRectangle.Left, windowRectangle.Top, windowRectangle.Right, windowRectangle.Bottom);
|
||||
}
|
||||
|
||||
public bool IsWindowMaximized(IntPtr handle)
|
||||
{
|
||||
return User32NativeMethods.IsZoomed(handle);
|
||||
}
|
||||
|
||||
public bool IsWindowMinimized(IntPtr handle)
|
||||
{
|
||||
return User32NativeMethods.IsIconic(handle);
|
||||
}
|
||||
|
||||
public IDwmThumbnail GetLiveThumbnail(IntPtr destination, IntPtr source)
|
||||
{
|
||||
IDwmThumbnail thumbnail = new DwmThumbnail(this);
|
||||
thumbnail.Register(destination, source);
|
||||
|
||||
return thumbnail;
|
||||
}
|
||||
|
||||
public Image GetStaticThumbnail(IntPtr source)
|
||||
{
|
||||
var sourceContext = User32NativeMethods.GetDC(source);
|
||||
|
||||
User32NativeMethods.GetClientRect(source, out RECT windowRect);
|
||||
|
||||
var width = windowRect.Right - windowRect.Left;
|
||||
var height = windowRect.Bottom - windowRect.Top;
|
||||
|
||||
// Check if there is anything to make thumbnail of
|
||||
if ((width < WINDOW_SIZE_THRESHOLD) || (height < WINDOW_SIZE_THRESHOLD))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var destContext = Gdi32NativeMethods.CreateCompatibleDC(sourceContext);
|
||||
var bitmap = Gdi32NativeMethods.CreateCompatibleBitmap(sourceContext, width, height);
|
||||
|
||||
var oldBitmap = Gdi32NativeMethods.SelectObject(destContext, bitmap);
|
||||
Gdi32NativeMethods.BitBlt(destContext, 0, 0, width, height, sourceContext, 0, 0, Gdi32NativeMethods.SRCCOPY);
|
||||
Gdi32NativeMethods.SelectObject(destContext, oldBitmap);
|
||||
Gdi32NativeMethods.DeleteDC(destContext);
|
||||
User32NativeMethods.ReleaseDC(source, sourceContext);
|
||||
|
||||
Image image = Image.FromHbitmap(bitmap);
|
||||
Gdi32NativeMethods.DeleteObject(bitmap);
|
||||
|
||||
return image;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
src/Eve-O-Preview/Services/Interface/IDwmThumbnail.cs
Normal file
13
src/Eve-O-Preview/Services/Interface/IDwmThumbnail.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
|
||||
namespace EveOPreview.Services
|
||||
{
|
||||
public interface IDwmThumbnail
|
||||
{
|
||||
void Register(IntPtr destination, IntPtr source);
|
||||
void Unregister();
|
||||
|
||||
void Move(int left, int top, int right, int bottom);
|
||||
void Update();
|
||||
}
|
||||
}
|
||||
10
src/Eve-O-Preview/Services/Interface/IProcessInfo.cs
Normal file
10
src/Eve-O-Preview/Services/Interface/IProcessInfo.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
|
||||
namespace EveOPreview.Services
|
||||
{
|
||||
public interface IProcessInfo
|
||||
{
|
||||
IntPtr Handle { get; }
|
||||
string Title { get; }
|
||||
}
|
||||
}
|
||||
10
src/Eve-O-Preview/Services/Interface/IProcessMonitor.cs
Normal file
10
src/Eve-O-Preview/Services/Interface/IProcessMonitor.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace EveOPreview.Services
|
||||
{
|
||||
public interface IProcessMonitor
|
||||
{
|
||||
ICollection<IProcessInfo> GetAllProcesses();
|
||||
void GetUpdatedProcesses(out ICollection<IProcessInfo> addedProcesses, out ICollection<IProcessInfo> updatedProcesses, out ICollection<IProcessInfo> removedProcesses);
|
||||
}
|
||||
}
|
||||
11
src/Eve-O-Preview/Services/Interface/IThumbnailManager.cs
Normal file
11
src/Eve-O-Preview/Services/Interface/IThumbnailManager.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace EveOPreview.Services
|
||||
{
|
||||
public interface IThumbnailManager
|
||||
{
|
||||
void Start();
|
||||
void Stop();
|
||||
|
||||
void UpdateThumbnailsSize();
|
||||
void UpdateThumbnailFrames();
|
||||
}
|
||||
}
|
||||
21
src/Eve-O-Preview/Services/Interface/IWindowManager.cs
Normal file
21
src/Eve-O-Preview/Services/Interface/IWindowManager.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
namespace EveOPreview.Services
|
||||
{
|
||||
public interface IWindowManager
|
||||
{
|
||||
bool IsCompositionEnabled { get; }
|
||||
|
||||
IntPtr GetForegroundWindowHandle();
|
||||
void ActivateWindow(IntPtr handle);
|
||||
void MinimizeWindow(IntPtr handle, bool enableAnimation);
|
||||
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);
|
||||
bool IsWindowMaximized(IntPtr handle);
|
||||
bool IsWindowMinimized(IntPtr handle);
|
||||
IDwmThumbnail GetLiveThumbnail(IntPtr destination, IntPtr source);
|
||||
Image GetStaticThumbnail(IntPtr source);
|
||||
}
|
||||
}
|
||||
83
src/Eve-O-Preview/Services/Interface/InteropConstants.cs
Normal file
83
src/Eve-O-Preview/Services/Interface/InteropConstants.cs
Normal file
@@ -0,0 +1,83 @@
|
||||
using System;
|
||||
|
||||
namespace EveOPreview.Services
|
||||
{
|
||||
public static class InteropConstants
|
||||
{
|
||||
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 inheritance 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;
|
||||
public const int SIZE_MAXSHOW = 3;
|
||||
public const int SIZE_MAXHIDE = 4;
|
||||
|
||||
public const int WM_NCLBUTTONDOWN = 0xA1;
|
||||
public const int HTCAPTION = 0x2;
|
||||
|
||||
public const int SW_SHOWNORMAL = 1;
|
||||
public const int SW_SHOWMINIMIZED = 2;
|
||||
public const int SW_SHOWMAXIMIZED = 3;
|
||||
public const int SW_RESTORE = 9;
|
||||
}
|
||||
}
|
||||
20
src/Eve-O-Preview/Services/Interop/DWM_BLURBEHIND.cs
Normal file
20
src/Eve-O-Preview/Services/Interop/DWM_BLURBEHIND.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace EveOPreview.Services.Interop
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
class DWM_BLURBEHIND
|
||||
{
|
||||
public uint dwFlags;
|
||||
[MarshalAs(UnmanagedType.Bool)]
|
||||
public bool fEnable;
|
||||
public IntPtr hRegionBlur;
|
||||
[MarshalAs(UnmanagedType.Bool)]
|
||||
public bool fTransitionOnMaximized;
|
||||
|
||||
public const uint DWM_BB_ENABLE = 0x00000001;
|
||||
public const uint DWM_BB_BLURREGION = 0x00000002;
|
||||
public const uint DWM_BB_TRANSITIONONMAXIMIZED = 0x00000004;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace EveOPreview.Services.Interop
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
class DWM_THUMBNAIL_PROPERTIES
|
||||
{
|
||||
public uint dwFlags;
|
||||
public RECT rcDestination;
|
||||
public RECT rcSource;
|
||||
public byte opacity;
|
||||
[MarshalAs(UnmanagedType.Bool)]
|
||||
public bool fVisible;
|
||||
[MarshalAs(UnmanagedType.Bool)]
|
||||
public bool fSourceClientAreaOnly;
|
||||
}
|
||||
}
|
||||
11
src/Eve-O-Preview/Services/Interop/DWM_TNP_CONSTANTS.cs
Normal file
11
src/Eve-O-Preview/Services/Interop/DWM_TNP_CONSTANTS.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace EveOPreview.Services.Interop
|
||||
{
|
||||
static class DWM_TNP_CONSTANTS
|
||||
{
|
||||
public const uint DWM_TNP_RECTDESTINATION = 0x00000001;
|
||||
public const uint DWM_TNP_RECTSOURCE = 0x00000002;
|
||||
public const uint DWM_TNP_OPACITY = 0x00000004;
|
||||
public const uint DWM_TNP_VISIBLE = 0x00000008;
|
||||
public const uint DWM_TNP_SOURCECLIENTAREAONLY = 0x00000010;
|
||||
}
|
||||
}
|
||||
38
src/Eve-O-Preview/Services/Interop/DwmNativeMethods.cs
Normal file
38
src/Eve-O-Preview/Services/Interop/DwmNativeMethods.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Drawing;
|
||||
|
||||
namespace EveOPreview.Services.Interop
|
||||
{
|
||||
static class DwmNativeMethods
|
||||
{
|
||||
[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);
|
||||
}
|
||||
}
|
||||
28
src/Eve-O-Preview/Services/Interop/Gdi32NativeMethods.cs
Normal file
28
src/Eve-O-Preview/Services/Interop/Gdi32NativeMethods.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace EveOPreview.Services.Interop
|
||||
{
|
||||
static class Gdi32NativeMethods
|
||||
{
|
||||
public const int SRCCOPY = 13369376;
|
||||
|
||||
[DllImport("gdi32.dll")]
|
||||
public static extern IntPtr CreateCompatibleDC(IntPtr hdc);
|
||||
|
||||
[DllImport("gdi32.dll")]
|
||||
public static extern bool DeleteDC(IntPtr hdc);
|
||||
|
||||
[DllImport("gdi32.dll")]
|
||||
public static extern IntPtr CreateCompatibleBitmap(IntPtr hdc, int width, int height);
|
||||
|
||||
[DllImport("gdi32.dll")]
|
||||
public static extern IntPtr SelectObject(IntPtr hdc, IntPtr hObject);
|
||||
|
||||
[DllImport("gdi32.dll")]
|
||||
public static extern bool DeleteObject(IntPtr hObject);
|
||||
|
||||
[DllImport("gdi32.dll")]
|
||||
public static extern bool BitBlt(IntPtr hObject, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hObjectSource, int nXSrc, int nYSrc, int dwRop);
|
||||
}
|
||||
}
|
||||
21
src/Eve-O-Preview/Services/Interop/MARGINS.cs
Normal file
21
src/Eve-O-Preview/Services/Interop/MARGINS.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace EveOPreview.Services.Interop
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
class MARGINS
|
||||
{
|
||||
public int cxLeftWidth;
|
||||
public int cxRightWidth;
|
||||
public int cyTopHeight;
|
||||
public int cyBottomHeight;
|
||||
|
||||
public MARGINS(int left, int top, int right, int bottom)
|
||||
{
|
||||
cxLeftWidth = left;
|
||||
cyTopHeight = top;
|
||||
cxRightWidth = right;
|
||||
cyBottomHeight = bottom;
|
||||
}
|
||||
}
|
||||
}
|
||||
21
src/Eve-O-Preview/Services/Interop/RECT.cs
Normal file
21
src/Eve-O-Preview/Services/Interop/RECT.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace EveOPreview.Services.Interop
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct RECT
|
||||
{
|
||||
public int Left;
|
||||
public int Top;
|
||||
public int Right;
|
||||
public int Bottom;
|
||||
|
||||
public RECT(int left, int top, int right, int bottom)
|
||||
{
|
||||
this.Left = left;
|
||||
this.Top = top;
|
||||
this.Right = right;
|
||||
this.Bottom = bottom;
|
||||
}
|
||||
}
|
||||
}
|
||||
58
src/Eve-O-Preview/Services/Interop/User32NativeMethods.cs
Normal file
58
src/Eve-O-Preview/Services/Interop/User32NativeMethods.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace EveOPreview.Services.Interop
|
||||
{
|
||||
static class User32NativeMethods
|
||||
{
|
||||
[DllImport("user32.dll")]
|
||||
public static extern IntPtr GetForegroundWindow();
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool SetForegroundWindow(IntPtr window);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
|
||||
|
||||
[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);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern int GetWindowRect(IntPtr hWnd, out RECT rect);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool GetClientRect(IntPtr hWnd, out RECT rect);
|
||||
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern bool GetWindowPlacement(IntPtr hWnd, ref WINDOWPLACEMENT lpwndpl);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool SetWindowPlacement(IntPtr hWnd, [In] ref WINDOWPLACEMENT lpwndpl);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern bool IsIconic(IntPtr hWnd);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool IsZoomed(IntPtr hWnd);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern IntPtr GetWindowDC(IntPtr hWnd);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern IntPtr GetDC(IntPtr hWnd);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern IntPtr ReleaseDC(IntPtr hWnd, IntPtr hdc);
|
||||
}
|
||||
}
|
||||
30
src/Eve-O-Preview/Services/Interop/WINDOWPLACEMENT.cs
Normal file
30
src/Eve-O-Preview/Services/Interop/WINDOWPLACEMENT.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace EveOPreview.Services.Interop
|
||||
{
|
||||
//Definition for Window Placement Structure
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct WINDOWPLACEMENT
|
||||
{
|
||||
public int length;
|
||||
public int flags;
|
||||
public int showCmd;
|
||||
public System.Drawing.Point ptMinPosition;
|
||||
public System.Drawing.Point ptMaxPosition;
|
||||
public System.Drawing.Rectangle rcNormalPosition;
|
||||
|
||||
//Definitions For Different Window Placement Constants
|
||||
public const int SW_HIDE = 0;
|
||||
public const int SW_SHOWNORMAL = 1;
|
||||
public const int SW_NORMAL = 1;
|
||||
public const int SW_SHOWMINIMIZED = 2;
|
||||
public const int SW_SHOWMAXIMIZED = 3;
|
||||
public const int SW_MAXIMIZE = 3;
|
||||
public const int SW_SHOWNOACTIVATE = 4;
|
||||
public const int SW_SHOW = 5;
|
||||
public const int SW_MINIMIZE = 6;
|
||||
public const int SW_SHOWMINNOACTIVE = 7;
|
||||
public const int SW_SHOWNA = 8;
|
||||
public const int SW_RESTORE = 9;
|
||||
}
|
||||
}
|
||||
60
src/Eve-O-Preview/View/Implementation/LiveThumbnailView.cs
Normal file
60
src/Eve-O-Preview/View/Implementation/LiveThumbnailView.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using EveOPreview.Services;
|
||||
|
||||
namespace EveOPreview.View
|
||||
{
|
||||
sealed class LiveThumbnailView : ThumbnailView
|
||||
{
|
||||
#region Private fields
|
||||
private IDwmThumbnail _thumbnail;
|
||||
private Point _startLocation;
|
||||
private Point _endLocation;
|
||||
#endregion
|
||||
|
||||
public LiveThumbnailView(IWindowManager windowManager)
|
||||
: base(windowManager)
|
||||
{
|
||||
this._startLocation = new Point(0, 0);
|
||||
this._endLocation = new Point(this.ClientSize);
|
||||
}
|
||||
|
||||
protected override void RefreshThumbnail(bool forceRefresh)
|
||||
{
|
||||
// To prevent flickering the old broken thumbnail is removed AFTER the new shiny one is created
|
||||
IDwmThumbnail obsoleteThumbnail = forceRefresh ? this._thumbnail : null;
|
||||
|
||||
if ((this._thumbnail == null) || forceRefresh)
|
||||
{
|
||||
this.RegisterThumbnail();
|
||||
}
|
||||
|
||||
obsoleteThumbnail?.Unregister();
|
||||
}
|
||||
|
||||
protected override void ResizeThumbnail(int baseWidth, int baseHeight, int highlightWidthTop, int highlightWidthRight, int highlightWidthBottom, int highlightWidthLeft)
|
||||
{
|
||||
var left = 0 + highlightWidthLeft;
|
||||
var top = 0 + highlightWidthTop;
|
||||
var right = baseWidth - highlightWidthRight;
|
||||
var bottom = baseHeight - highlightWidthBottom;
|
||||
|
||||
if ((this._startLocation.X == left) && (this._startLocation.Y == top) && (this._endLocation.X == right) && (this._endLocation.Y == bottom))
|
||||
{
|
||||
return; // No update required
|
||||
}
|
||||
this._startLocation = new Point(left, top);
|
||||
this._endLocation = new Point(right, bottom);
|
||||
|
||||
this._thumbnail.Move(left, top, right, bottom);
|
||||
this._thumbnail.Update();
|
||||
}
|
||||
|
||||
private void RegisterThumbnail()
|
||||
{
|
||||
this._thumbnail = this.WindowManager.GetLiveThumbnail(this.Handle, this.Id);
|
||||
this._thumbnail.Move(this._startLocation.X, this._startLocation.Y, this._endLocation.X, this._endLocation.Y);
|
||||
this._thumbnail.Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
971
src/Eve-O-Preview/View/Implementation/MainForm.Designer.cs
generated
Normal file
971
src/Eve-O-Preview/View/Implementation/MainForm.Designer.cs
generated
Normal file
@@ -0,0 +1,971 @@
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace EveOPreview.View
|
||||
{
|
||||
partial class MainForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>s
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.Windows.Forms.ToolStripMenuItem RestoreWindowMenuItem;
|
||||
System.Windows.Forms.ToolStripMenuItem ExitMenuItem;
|
||||
System.Windows.Forms.ToolStripMenuItem TitleMenuItem;
|
||||
System.Windows.Forms.ToolStripSeparator SeparatorMenuItem;
|
||||
System.Windows.Forms.TabControl ContentTabControl;
|
||||
System.Windows.Forms.TabPage GeneralTabPage;
|
||||
System.Windows.Forms.Panel GeneralSettingsPanel;
|
||||
System.Windows.Forms.TabPage ThumbnailTabPage;
|
||||
System.Windows.Forms.Panel ThumbnailSettingsPanel;
|
||||
System.Windows.Forms.Label HeigthLabel;
|
||||
System.Windows.Forms.Label WidthLabel;
|
||||
System.Windows.Forms.Label OpacityLabel;
|
||||
System.Windows.Forms.Panel ZoomSettingsPanel;
|
||||
System.Windows.Forms.Label ZoomFactorLabel;
|
||||
System.Windows.Forms.Label ZoomAnchorLabel;
|
||||
System.Windows.Forms.TabPage OverlayTabPage;
|
||||
System.Windows.Forms.Panel OverlaySettingsPanel;
|
||||
System.Windows.Forms.TabPage ClientsTabPage;
|
||||
System.Windows.Forms.Panel ClientsPanel;
|
||||
System.Windows.Forms.Label ThumbnailsListLabel;
|
||||
System.Windows.Forms.TabPage AboutTabPage;
|
||||
System.Windows.Forms.Panel AboutPanel;
|
||||
System.Windows.Forms.Label DocumentationLinkLabel;
|
||||
System.Windows.Forms.Label DescriptionLabel;
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
|
||||
System.Windows.Forms.Label NameLabel;
|
||||
this.MinimizeInactiveClientsCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.EnableClientLayoutTrackingCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.HideActiveClientThumbnailCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.ShowThumbnailsAlwaysOnTopCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.HideThumbnailsOnLostFocusCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.EnablePerClientThumbnailsLayoutsCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.MinimizeToTrayCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.ThumbnailsWidthNumericEdit = new System.Windows.Forms.NumericUpDown();
|
||||
this.ThumbnailsHeightNumericEdit = new System.Windows.Forms.NumericUpDown();
|
||||
this.ThumbnailOpacityTrackBar = new System.Windows.Forms.TrackBar();
|
||||
this.ZoomTabPage = new System.Windows.Forms.TabPage();
|
||||
this.ZoomAnchorPanel = new System.Windows.Forms.Panel();
|
||||
this.ZoomAanchorNWRadioButton = new System.Windows.Forms.RadioButton();
|
||||
this.ZoomAanchorNRadioButton = new System.Windows.Forms.RadioButton();
|
||||
this.ZoomAanchorNERadioButton = new System.Windows.Forms.RadioButton();
|
||||
this.ZoomAanchorWRadioButton = new System.Windows.Forms.RadioButton();
|
||||
this.ZoomAanchorSERadioButton = new System.Windows.Forms.RadioButton();
|
||||
this.ZoomAanchorCRadioButton = new System.Windows.Forms.RadioButton();
|
||||
this.ZoomAanchorSRadioButton = new System.Windows.Forms.RadioButton();
|
||||
this.ZoomAanchorERadioButton = new System.Windows.Forms.RadioButton();
|
||||
this.ZoomAanchorSWRadioButton = new System.Windows.Forms.RadioButton();
|
||||
this.EnableThumbnailZoomCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.ThumbnailZoomFactorNumericEdit = new System.Windows.Forms.NumericUpDown();
|
||||
this.HighlightColorLabel = new System.Windows.Forms.Label();
|
||||
this.ActiveClientHighlightColorButton = new System.Windows.Forms.Panel();
|
||||
this.EnableActiveClientHighlightCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.ShowThumbnailOverlaysCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.ShowThumbnailFramesCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.ThumbnailsList = new System.Windows.Forms.CheckedListBox();
|
||||
this.VersionLabel = new System.Windows.Forms.Label();
|
||||
this.DocumentationLink = new System.Windows.Forms.LinkLabel();
|
||||
this.NotifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
|
||||
this.TrayMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
RestoreWindowMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
TitleMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
SeparatorMenuItem = new System.Windows.Forms.ToolStripSeparator();
|
||||
ContentTabControl = new System.Windows.Forms.TabControl();
|
||||
GeneralTabPage = new System.Windows.Forms.TabPage();
|
||||
GeneralSettingsPanel = new System.Windows.Forms.Panel();
|
||||
ThumbnailTabPage = new System.Windows.Forms.TabPage();
|
||||
ThumbnailSettingsPanel = new System.Windows.Forms.Panel();
|
||||
HeigthLabel = new System.Windows.Forms.Label();
|
||||
WidthLabel = new System.Windows.Forms.Label();
|
||||
OpacityLabel = new System.Windows.Forms.Label();
|
||||
ZoomSettingsPanel = new System.Windows.Forms.Panel();
|
||||
ZoomFactorLabel = new System.Windows.Forms.Label();
|
||||
ZoomAnchorLabel = new System.Windows.Forms.Label();
|
||||
OverlayTabPage = new System.Windows.Forms.TabPage();
|
||||
OverlaySettingsPanel = new System.Windows.Forms.Panel();
|
||||
ClientsTabPage = new System.Windows.Forms.TabPage();
|
||||
ClientsPanel = new System.Windows.Forms.Panel();
|
||||
ThumbnailsListLabel = new System.Windows.Forms.Label();
|
||||
AboutTabPage = new System.Windows.Forms.TabPage();
|
||||
AboutPanel = new System.Windows.Forms.Panel();
|
||||
DocumentationLinkLabel = new System.Windows.Forms.Label();
|
||||
DescriptionLabel = new System.Windows.Forms.Label();
|
||||
NameLabel = new System.Windows.Forms.Label();
|
||||
ContentTabControl.SuspendLayout();
|
||||
GeneralTabPage.SuspendLayout();
|
||||
GeneralSettingsPanel.SuspendLayout();
|
||||
ThumbnailTabPage.SuspendLayout();
|
||||
ThumbnailSettingsPanel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ThumbnailsWidthNumericEdit)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ThumbnailsHeightNumericEdit)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ThumbnailOpacityTrackBar)).BeginInit();
|
||||
this.ZoomTabPage.SuspendLayout();
|
||||
ZoomSettingsPanel.SuspendLayout();
|
||||
this.ZoomAnchorPanel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ThumbnailZoomFactorNumericEdit)).BeginInit();
|
||||
OverlayTabPage.SuspendLayout();
|
||||
OverlaySettingsPanel.SuspendLayout();
|
||||
ClientsTabPage.SuspendLayout();
|
||||
ClientsPanel.SuspendLayout();
|
||||
AboutTabPage.SuspendLayout();
|
||||
AboutPanel.SuspendLayout();
|
||||
this.TrayMenu.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// RestoreWindowMenuItem
|
||||
//
|
||||
RestoreWindowMenuItem.Name = "RestoreWindowMenuItem";
|
||||
RestoreWindowMenuItem.Size = new System.Drawing.Size(199, 30);
|
||||
RestoreWindowMenuItem.Text = "Restore";
|
||||
RestoreWindowMenuItem.Click += new System.EventHandler(this.RestoreMainForm_Handler);
|
||||
//
|
||||
// ExitMenuItem
|
||||
//
|
||||
ExitMenuItem.Name = "ExitMenuItem";
|
||||
ExitMenuItem.Size = new System.Drawing.Size(199, 30);
|
||||
ExitMenuItem.Text = "Exit";
|
||||
ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItemClick_Handler);
|
||||
//
|
||||
// TitleMenuItem
|
||||
//
|
||||
TitleMenuItem.Enabled = false;
|
||||
TitleMenuItem.Name = "TitleMenuItem";
|
||||
TitleMenuItem.Size = new System.Drawing.Size(199, 30);
|
||||
TitleMenuItem.Text = "EVE-O Preview";
|
||||
//
|
||||
// SeparatorMenuItem
|
||||
//
|
||||
SeparatorMenuItem.Name = "SeparatorMenuItem";
|
||||
SeparatorMenuItem.Size = new System.Drawing.Size(196, 6);
|
||||
//
|
||||
// ContentTabControl
|
||||
//
|
||||
ContentTabControl.Alignment = System.Windows.Forms.TabAlignment.Left;
|
||||
ContentTabControl.Controls.Add(GeneralTabPage);
|
||||
ContentTabControl.Controls.Add(ThumbnailTabPage);
|
||||
ContentTabControl.Controls.Add(this.ZoomTabPage);
|
||||
ContentTabControl.Controls.Add(OverlayTabPage);
|
||||
ContentTabControl.Controls.Add(ClientsTabPage);
|
||||
ContentTabControl.Controls.Add(AboutTabPage);
|
||||
ContentTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
ContentTabControl.DrawMode = System.Windows.Forms.TabDrawMode.OwnerDrawFixed;
|
||||
ContentTabControl.ItemSize = new System.Drawing.Size(35, 120);
|
||||
ContentTabControl.Location = new System.Drawing.Point(0, 0);
|
||||
ContentTabControl.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
ContentTabControl.Multiline = true;
|
||||
ContentTabControl.Name = "ContentTabControl";
|
||||
ContentTabControl.SelectedIndex = 0;
|
||||
ContentTabControl.Size = new System.Drawing.Size(585, 335);
|
||||
ContentTabControl.SizeMode = System.Windows.Forms.TabSizeMode.Fixed;
|
||||
ContentTabControl.TabIndex = 6;
|
||||
ContentTabControl.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.ContentTabControl_DrawItem);
|
||||
//
|
||||
// GeneralTabPage
|
||||
//
|
||||
GeneralTabPage.BackColor = System.Drawing.SystemColors.Control;
|
||||
GeneralTabPage.Controls.Add(GeneralSettingsPanel);
|
||||
GeneralTabPage.Location = new System.Drawing.Point(124, 4);
|
||||
GeneralTabPage.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
GeneralTabPage.Name = "GeneralTabPage";
|
||||
GeneralTabPage.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
GeneralTabPage.Size = new System.Drawing.Size(457, 327);
|
||||
GeneralTabPage.TabIndex = 0;
|
||||
GeneralTabPage.Text = "General";
|
||||
//
|
||||
// GeneralSettingsPanel
|
||||
//
|
||||
GeneralSettingsPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
GeneralSettingsPanel.Controls.Add(this.MinimizeInactiveClientsCheckBox);
|
||||
GeneralSettingsPanel.Controls.Add(this.EnableClientLayoutTrackingCheckBox);
|
||||
GeneralSettingsPanel.Controls.Add(this.HideActiveClientThumbnailCheckBox);
|
||||
GeneralSettingsPanel.Controls.Add(this.ShowThumbnailsAlwaysOnTopCheckBox);
|
||||
GeneralSettingsPanel.Controls.Add(this.HideThumbnailsOnLostFocusCheckBox);
|
||||
GeneralSettingsPanel.Controls.Add(this.EnablePerClientThumbnailsLayoutsCheckBox);
|
||||
GeneralSettingsPanel.Controls.Add(this.MinimizeToTrayCheckBox);
|
||||
GeneralSettingsPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
GeneralSettingsPanel.Location = new System.Drawing.Point(4, 5);
|
||||
GeneralSettingsPanel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
GeneralSettingsPanel.Name = "GeneralSettingsPanel";
|
||||
GeneralSettingsPanel.Size = new System.Drawing.Size(449, 317);
|
||||
GeneralSettingsPanel.TabIndex = 18;
|
||||
//
|
||||
// MinimizeInactiveClientsCheckBox
|
||||
//
|
||||
this.MinimizeInactiveClientsCheckBox.AutoSize = true;
|
||||
this.MinimizeInactiveClientsCheckBox.Location = new System.Drawing.Point(12, 122);
|
||||
this.MinimizeInactiveClientsCheckBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.MinimizeInactiveClientsCheckBox.Name = "MinimizeInactiveClientsCheckBox";
|
||||
this.MinimizeInactiveClientsCheckBox.Size = new System.Drawing.Size(239, 24);
|
||||
this.MinimizeInactiveClientsCheckBox.TabIndex = 24;
|
||||
this.MinimizeInactiveClientsCheckBox.Text = "Minimize inactive EVE clients";
|
||||
this.MinimizeInactiveClientsCheckBox.UseVisualStyleBackColor = true;
|
||||
this.MinimizeInactiveClientsCheckBox.CheckedChanged += new System.EventHandler(this.OptionChanged_Handler);
|
||||
//
|
||||
// EnableClientLayoutTrackingCheckBox
|
||||
//
|
||||
this.EnableClientLayoutTrackingCheckBox.AutoSize = true;
|
||||
this.EnableClientLayoutTrackingCheckBox.Location = new System.Drawing.Point(12, 48);
|
||||
this.EnableClientLayoutTrackingCheckBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.EnableClientLayoutTrackingCheckBox.Name = "EnableClientLayoutTrackingCheckBox";
|
||||
this.EnableClientLayoutTrackingCheckBox.Size = new System.Drawing.Size(182, 24);
|
||||
this.EnableClientLayoutTrackingCheckBox.TabIndex = 19;
|
||||
this.EnableClientLayoutTrackingCheckBox.Text = "Track client locations";
|
||||
this.EnableClientLayoutTrackingCheckBox.UseVisualStyleBackColor = true;
|
||||
this.EnableClientLayoutTrackingCheckBox.CheckedChanged += new System.EventHandler(this.OptionChanged_Handler);
|
||||
//
|
||||
// HideActiveClientThumbnailCheckBox
|
||||
//
|
||||
this.HideActiveClientThumbnailCheckBox.AutoSize = true;
|
||||
this.HideActiveClientThumbnailCheckBox.Checked = true;
|
||||
this.HideActiveClientThumbnailCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.HideActiveClientThumbnailCheckBox.Location = new System.Drawing.Point(12, 85);
|
||||
this.HideActiveClientThumbnailCheckBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.HideActiveClientThumbnailCheckBox.Name = "HideActiveClientThumbnailCheckBox";
|
||||
this.HideActiveClientThumbnailCheckBox.Size = new System.Drawing.Size(266, 24);
|
||||
this.HideActiveClientThumbnailCheckBox.TabIndex = 20;
|
||||
this.HideActiveClientThumbnailCheckBox.Text = "Hide preview of active EVE client";
|
||||
this.HideActiveClientThumbnailCheckBox.UseVisualStyleBackColor = true;
|
||||
this.HideActiveClientThumbnailCheckBox.CheckedChanged += new System.EventHandler(this.OptionChanged_Handler);
|
||||
//
|
||||
// ShowThumbnailsAlwaysOnTopCheckBox
|
||||
//
|
||||
this.ShowThumbnailsAlwaysOnTopCheckBox.AutoSize = true;
|
||||
this.ShowThumbnailsAlwaysOnTopCheckBox.Checked = true;
|
||||
this.ShowThumbnailsAlwaysOnTopCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.ShowThumbnailsAlwaysOnTopCheckBox.Location = new System.Drawing.Point(12, 159);
|
||||
this.ShowThumbnailsAlwaysOnTopCheckBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.ShowThumbnailsAlwaysOnTopCheckBox.Name = "ShowThumbnailsAlwaysOnTopCheckBox";
|
||||
this.ShowThumbnailsAlwaysOnTopCheckBox.RightToLeft = System.Windows.Forms.RightToLeft.No;
|
||||
this.ShowThumbnailsAlwaysOnTopCheckBox.Size = new System.Drawing.Size(197, 24);
|
||||
this.ShowThumbnailsAlwaysOnTopCheckBox.TabIndex = 21;
|
||||
this.ShowThumbnailsAlwaysOnTopCheckBox.Text = "Previews always on top";
|
||||
this.ShowThumbnailsAlwaysOnTopCheckBox.UseVisualStyleBackColor = true;
|
||||
this.ShowThumbnailsAlwaysOnTopCheckBox.CheckedChanged += new System.EventHandler(this.OptionChanged_Handler);
|
||||
//
|
||||
// HideThumbnailsOnLostFocusCheckBox
|
||||
//
|
||||
this.HideThumbnailsOnLostFocusCheckBox.AutoSize = true;
|
||||
this.HideThumbnailsOnLostFocusCheckBox.Checked = true;
|
||||
this.HideThumbnailsOnLostFocusCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.HideThumbnailsOnLostFocusCheckBox.Location = new System.Drawing.Point(12, 196);
|
||||
this.HideThumbnailsOnLostFocusCheckBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.HideThumbnailsOnLostFocusCheckBox.Name = "HideThumbnailsOnLostFocusCheckBox";
|
||||
this.HideThumbnailsOnLostFocusCheckBox.Size = new System.Drawing.Size(340, 24);
|
||||
this.HideThumbnailsOnLostFocusCheckBox.TabIndex = 22;
|
||||
this.HideThumbnailsOnLostFocusCheckBox.Text = "Hide previews when EVE client is not active";
|
||||
this.HideThumbnailsOnLostFocusCheckBox.UseVisualStyleBackColor = true;
|
||||
this.HideThumbnailsOnLostFocusCheckBox.CheckedChanged += new System.EventHandler(this.OptionChanged_Handler);
|
||||
//
|
||||
// EnablePerClientThumbnailsLayoutsCheckBox
|
||||
//
|
||||
this.EnablePerClientThumbnailsLayoutsCheckBox.AutoSize = true;
|
||||
this.EnablePerClientThumbnailsLayoutsCheckBox.Checked = true;
|
||||
this.EnablePerClientThumbnailsLayoutsCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.EnablePerClientThumbnailsLayoutsCheckBox.Location = new System.Drawing.Point(12, 233);
|
||||
this.EnablePerClientThumbnailsLayoutsCheckBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.EnablePerClientThumbnailsLayoutsCheckBox.Name = "EnablePerClientThumbnailsLayoutsCheckBox";
|
||||
this.EnablePerClientThumbnailsLayoutsCheckBox.Size = new System.Drawing.Size(272, 24);
|
||||
this.EnablePerClientThumbnailsLayoutsCheckBox.TabIndex = 23;
|
||||
this.EnablePerClientThumbnailsLayoutsCheckBox.Text = "Unique layout for each EVE client";
|
||||
this.EnablePerClientThumbnailsLayoutsCheckBox.UseVisualStyleBackColor = true;
|
||||
this.EnablePerClientThumbnailsLayoutsCheckBox.CheckedChanged += new System.EventHandler(this.OptionChanged_Handler);
|
||||
//
|
||||
// MinimizeToTrayCheckBox
|
||||
//
|
||||
this.MinimizeToTrayCheckBox.AutoSize = true;
|
||||
this.MinimizeToTrayCheckBox.Location = new System.Drawing.Point(12, 11);
|
||||
this.MinimizeToTrayCheckBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.MinimizeToTrayCheckBox.Name = "MinimizeToTrayCheckBox";
|
||||
this.MinimizeToTrayCheckBox.Size = new System.Drawing.Size(205, 24);
|
||||
this.MinimizeToTrayCheckBox.TabIndex = 18;
|
||||
this.MinimizeToTrayCheckBox.Text = "Minimize to System Tray";
|
||||
this.MinimizeToTrayCheckBox.UseVisualStyleBackColor = true;
|
||||
this.MinimizeToTrayCheckBox.CheckedChanged += new System.EventHandler(this.OptionChanged_Handler);
|
||||
//
|
||||
// ThumbnailTabPage
|
||||
//
|
||||
ThumbnailTabPage.BackColor = System.Drawing.SystemColors.Control;
|
||||
ThumbnailTabPage.Controls.Add(ThumbnailSettingsPanel);
|
||||
ThumbnailTabPage.Location = new System.Drawing.Point(124, 4);
|
||||
ThumbnailTabPage.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
ThumbnailTabPage.Name = "ThumbnailTabPage";
|
||||
ThumbnailTabPage.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
ThumbnailTabPage.Size = new System.Drawing.Size(457, 327);
|
||||
ThumbnailTabPage.TabIndex = 1;
|
||||
ThumbnailTabPage.Text = "Thumbnail";
|
||||
//
|
||||
// ThumbnailSettingsPanel
|
||||
//
|
||||
ThumbnailSettingsPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
ThumbnailSettingsPanel.Controls.Add(HeigthLabel);
|
||||
ThumbnailSettingsPanel.Controls.Add(WidthLabel);
|
||||
ThumbnailSettingsPanel.Controls.Add(this.ThumbnailsWidthNumericEdit);
|
||||
ThumbnailSettingsPanel.Controls.Add(this.ThumbnailsHeightNumericEdit);
|
||||
ThumbnailSettingsPanel.Controls.Add(this.ThumbnailOpacityTrackBar);
|
||||
ThumbnailSettingsPanel.Controls.Add(OpacityLabel);
|
||||
ThumbnailSettingsPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
ThumbnailSettingsPanel.Location = new System.Drawing.Point(4, 5);
|
||||
ThumbnailSettingsPanel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
ThumbnailSettingsPanel.Name = "ThumbnailSettingsPanel";
|
||||
ThumbnailSettingsPanel.Size = new System.Drawing.Size(449, 317);
|
||||
ThumbnailSettingsPanel.TabIndex = 19;
|
||||
//
|
||||
// HeigthLabel
|
||||
//
|
||||
HeigthLabel.AutoSize = true;
|
||||
HeigthLabel.Location = new System.Drawing.Point(12, 88);
|
||||
HeigthLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
HeigthLabel.Name = "HeigthLabel";
|
||||
HeigthLabel.Size = new System.Drawing.Size(133, 20);
|
||||
HeigthLabel.TabIndex = 24;
|
||||
HeigthLabel.Text = "Thumbnail Heigth";
|
||||
//
|
||||
// WidthLabel
|
||||
//
|
||||
WidthLabel.AutoSize = true;
|
||||
WidthLabel.Location = new System.Drawing.Point(12, 51);
|
||||
WidthLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
WidthLabel.Name = "WidthLabel";
|
||||
WidthLabel.Size = new System.Drawing.Size(127, 20);
|
||||
WidthLabel.TabIndex = 23;
|
||||
WidthLabel.Text = "Thumbnail Width";
|
||||
//
|
||||
// ThumbnailsWidthNumericEdit
|
||||
//
|
||||
this.ThumbnailsWidthNumericEdit.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.ThumbnailsWidthNumericEdit.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.ThumbnailsWidthNumericEdit.CausesValidation = false;
|
||||
this.ThumbnailsWidthNumericEdit.Increment = new decimal(new int[] {
|
||||
10,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.ThumbnailsWidthNumericEdit.Location = new System.Drawing.Point(158, 48);
|
||||
this.ThumbnailsWidthNumericEdit.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.ThumbnailsWidthNumericEdit.Maximum = new decimal(new int[] {
|
||||
999999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.ThumbnailsWidthNumericEdit.Name = "ThumbnailsWidthNumericEdit";
|
||||
this.ThumbnailsWidthNumericEdit.Size = new System.Drawing.Size(72, 26);
|
||||
this.ThumbnailsWidthNumericEdit.TabIndex = 21;
|
||||
this.ThumbnailsWidthNumericEdit.Value = new decimal(new int[] {
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.ThumbnailsWidthNumericEdit.ValueChanged += new System.EventHandler(this.ThumbnailSizeChanged_Handler);
|
||||
//
|
||||
// ThumbnailsHeightNumericEdit
|
||||
//
|
||||
this.ThumbnailsHeightNumericEdit.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.ThumbnailsHeightNumericEdit.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.ThumbnailsHeightNumericEdit.CausesValidation = false;
|
||||
this.ThumbnailsHeightNumericEdit.Increment = new decimal(new int[] {
|
||||
10,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.ThumbnailsHeightNumericEdit.Location = new System.Drawing.Point(158, 85);
|
||||
this.ThumbnailsHeightNumericEdit.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.ThumbnailsHeightNumericEdit.Maximum = new decimal(new int[] {
|
||||
99999999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.ThumbnailsHeightNumericEdit.Name = "ThumbnailsHeightNumericEdit";
|
||||
this.ThumbnailsHeightNumericEdit.Size = new System.Drawing.Size(72, 26);
|
||||
this.ThumbnailsHeightNumericEdit.TabIndex = 22;
|
||||
this.ThumbnailsHeightNumericEdit.Value = new decimal(new int[] {
|
||||
70,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.ThumbnailsHeightNumericEdit.ValueChanged += new System.EventHandler(this.ThumbnailSizeChanged_Handler);
|
||||
//
|
||||
// ThumbnailOpacityTrackBar
|
||||
//
|
||||
this.ThumbnailOpacityTrackBar.AutoSize = false;
|
||||
this.ThumbnailOpacityTrackBar.LargeChange = 10;
|
||||
this.ThumbnailOpacityTrackBar.Location = new System.Drawing.Point(92, 9);
|
||||
this.ThumbnailOpacityTrackBar.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.ThumbnailOpacityTrackBar.Maximum = 100;
|
||||
this.ThumbnailOpacityTrackBar.Minimum = 20;
|
||||
this.ThumbnailOpacityTrackBar.Name = "ThumbnailOpacityTrackBar";
|
||||
this.ThumbnailOpacityTrackBar.Size = new System.Drawing.Size(286, 34);
|
||||
this.ThumbnailOpacityTrackBar.TabIndex = 20;
|
||||
this.ThumbnailOpacityTrackBar.TickFrequency = 10;
|
||||
this.ThumbnailOpacityTrackBar.Value = 20;
|
||||
this.ThumbnailOpacityTrackBar.ValueChanged += new System.EventHandler(this.OptionChanged_Handler);
|
||||
//
|
||||
// OpacityLabel
|
||||
//
|
||||
OpacityLabel.AutoSize = true;
|
||||
OpacityLabel.Location = new System.Drawing.Point(12, 14);
|
||||
OpacityLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
OpacityLabel.Name = "OpacityLabel";
|
||||
OpacityLabel.Size = new System.Drawing.Size(62, 20);
|
||||
OpacityLabel.TabIndex = 19;
|
||||
OpacityLabel.Text = "Opacity";
|
||||
//
|
||||
// ZoomTabPage
|
||||
//
|
||||
this.ZoomTabPage.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.ZoomTabPage.Controls.Add(ZoomSettingsPanel);
|
||||
this.ZoomTabPage.Location = new System.Drawing.Point(124, 4);
|
||||
this.ZoomTabPage.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.ZoomTabPage.Name = "ZoomTabPage";
|
||||
this.ZoomTabPage.Size = new System.Drawing.Size(457, 327);
|
||||
this.ZoomTabPage.TabIndex = 2;
|
||||
this.ZoomTabPage.Text = "Zoom";
|
||||
//
|
||||
// ZoomSettingsPanel
|
||||
//
|
||||
ZoomSettingsPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
ZoomSettingsPanel.Controls.Add(ZoomFactorLabel);
|
||||
ZoomSettingsPanel.Controls.Add(this.ZoomAnchorPanel);
|
||||
ZoomSettingsPanel.Controls.Add(ZoomAnchorLabel);
|
||||
ZoomSettingsPanel.Controls.Add(this.EnableThumbnailZoomCheckBox);
|
||||
ZoomSettingsPanel.Controls.Add(this.ThumbnailZoomFactorNumericEdit);
|
||||
ZoomSettingsPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
ZoomSettingsPanel.Location = new System.Drawing.Point(0, 0);
|
||||
ZoomSettingsPanel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
ZoomSettingsPanel.Name = "ZoomSettingsPanel";
|
||||
ZoomSettingsPanel.Size = new System.Drawing.Size(457, 327);
|
||||
ZoomSettingsPanel.TabIndex = 36;
|
||||
//
|
||||
// ZoomFactorLabel
|
||||
//
|
||||
ZoomFactorLabel.AutoSize = true;
|
||||
ZoomFactorLabel.Location = new System.Drawing.Point(12, 51);
|
||||
ZoomFactorLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
ZoomFactorLabel.Name = "ZoomFactorLabel";
|
||||
ZoomFactorLabel.Size = new System.Drawing.Size(100, 20);
|
||||
ZoomFactorLabel.TabIndex = 39;
|
||||
ZoomFactorLabel.Text = "Zoom Factor";
|
||||
//
|
||||
// ZoomAnchorPanel
|
||||
//
|
||||
this.ZoomAnchorPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.ZoomAnchorPanel.Controls.Add(this.ZoomAanchorNWRadioButton);
|
||||
this.ZoomAnchorPanel.Controls.Add(this.ZoomAanchorNRadioButton);
|
||||
this.ZoomAnchorPanel.Controls.Add(this.ZoomAanchorNERadioButton);
|
||||
this.ZoomAnchorPanel.Controls.Add(this.ZoomAanchorWRadioButton);
|
||||
this.ZoomAnchorPanel.Controls.Add(this.ZoomAanchorSERadioButton);
|
||||
this.ZoomAnchorPanel.Controls.Add(this.ZoomAanchorCRadioButton);
|
||||
this.ZoomAnchorPanel.Controls.Add(this.ZoomAanchorSRadioButton);
|
||||
this.ZoomAnchorPanel.Controls.Add(this.ZoomAanchorERadioButton);
|
||||
this.ZoomAnchorPanel.Controls.Add(this.ZoomAanchorSWRadioButton);
|
||||
this.ZoomAnchorPanel.Location = new System.Drawing.Point(122, 83);
|
||||
this.ZoomAnchorPanel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.ZoomAnchorPanel.Name = "ZoomAnchorPanel";
|
||||
this.ZoomAnchorPanel.Size = new System.Drawing.Size(114, 111);
|
||||
this.ZoomAnchorPanel.TabIndex = 38;
|
||||
//
|
||||
// ZoomAanchorNWRadioButton
|
||||
//
|
||||
this.ZoomAanchorNWRadioButton.AutoSize = true;
|
||||
this.ZoomAanchorNWRadioButton.Location = new System.Drawing.Point(4, 5);
|
||||
this.ZoomAanchorNWRadioButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.ZoomAanchorNWRadioButton.Name = "ZoomAanchorNWRadioButton";
|
||||
this.ZoomAanchorNWRadioButton.Size = new System.Drawing.Size(21, 20);
|
||||
this.ZoomAanchorNWRadioButton.TabIndex = 0;
|
||||
this.ZoomAanchorNWRadioButton.TabStop = true;
|
||||
this.ZoomAanchorNWRadioButton.UseVisualStyleBackColor = true;
|
||||
this.ZoomAanchorNWRadioButton.CheckedChanged += new System.EventHandler(this.OptionChanged_Handler);
|
||||
//
|
||||
// ZoomAanchorNRadioButton
|
||||
//
|
||||
this.ZoomAanchorNRadioButton.AutoSize = true;
|
||||
this.ZoomAanchorNRadioButton.Location = new System.Drawing.Point(46, 5);
|
||||
this.ZoomAanchorNRadioButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.ZoomAanchorNRadioButton.Name = "ZoomAanchorNRadioButton";
|
||||
this.ZoomAanchorNRadioButton.Size = new System.Drawing.Size(21, 20);
|
||||
this.ZoomAanchorNRadioButton.TabIndex = 1;
|
||||
this.ZoomAanchorNRadioButton.TabStop = true;
|
||||
this.ZoomAanchorNRadioButton.UseVisualStyleBackColor = true;
|
||||
this.ZoomAanchorNRadioButton.CheckedChanged += new System.EventHandler(this.OptionChanged_Handler);
|
||||
//
|
||||
// ZoomAanchorNERadioButton
|
||||
//
|
||||
this.ZoomAanchorNERadioButton.AutoSize = true;
|
||||
this.ZoomAanchorNERadioButton.Location = new System.Drawing.Point(88, 5);
|
||||
this.ZoomAanchorNERadioButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.ZoomAanchorNERadioButton.Name = "ZoomAanchorNERadioButton";
|
||||
this.ZoomAanchorNERadioButton.Size = new System.Drawing.Size(21, 20);
|
||||
this.ZoomAanchorNERadioButton.TabIndex = 2;
|
||||
this.ZoomAanchorNERadioButton.TabStop = true;
|
||||
this.ZoomAanchorNERadioButton.UseVisualStyleBackColor = true;
|
||||
this.ZoomAanchorNERadioButton.CheckedChanged += new System.EventHandler(this.OptionChanged_Handler);
|
||||
//
|
||||
// ZoomAanchorWRadioButton
|
||||
//
|
||||
this.ZoomAanchorWRadioButton.AutoSize = true;
|
||||
this.ZoomAanchorWRadioButton.Location = new System.Drawing.Point(4, 45);
|
||||
this.ZoomAanchorWRadioButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.ZoomAanchorWRadioButton.Name = "ZoomAanchorWRadioButton";
|
||||
this.ZoomAanchorWRadioButton.Size = new System.Drawing.Size(21, 20);
|
||||
this.ZoomAanchorWRadioButton.TabIndex = 3;
|
||||
this.ZoomAanchorWRadioButton.TabStop = true;
|
||||
this.ZoomAanchorWRadioButton.UseVisualStyleBackColor = true;
|
||||
this.ZoomAanchorWRadioButton.CheckedChanged += new System.EventHandler(this.OptionChanged_Handler);
|
||||
//
|
||||
// ZoomAanchorSERadioButton
|
||||
//
|
||||
this.ZoomAanchorSERadioButton.AutoSize = true;
|
||||
this.ZoomAanchorSERadioButton.Location = new System.Drawing.Point(88, 85);
|
||||
this.ZoomAanchorSERadioButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.ZoomAanchorSERadioButton.Name = "ZoomAanchorSERadioButton";
|
||||
this.ZoomAanchorSERadioButton.Size = new System.Drawing.Size(21, 20);
|
||||
this.ZoomAanchorSERadioButton.TabIndex = 8;
|
||||
this.ZoomAanchorSERadioButton.TabStop = true;
|
||||
this.ZoomAanchorSERadioButton.UseVisualStyleBackColor = true;
|
||||
this.ZoomAanchorSERadioButton.CheckedChanged += new System.EventHandler(this.OptionChanged_Handler);
|
||||
//
|
||||
// ZoomAanchorCRadioButton
|
||||
//
|
||||
this.ZoomAanchorCRadioButton.AutoSize = true;
|
||||
this.ZoomAanchorCRadioButton.Location = new System.Drawing.Point(46, 45);
|
||||
this.ZoomAanchorCRadioButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.ZoomAanchorCRadioButton.Name = "ZoomAanchorCRadioButton";
|
||||
this.ZoomAanchorCRadioButton.Size = new System.Drawing.Size(21, 20);
|
||||
this.ZoomAanchorCRadioButton.TabIndex = 4;
|
||||
this.ZoomAanchorCRadioButton.TabStop = true;
|
||||
this.ZoomAanchorCRadioButton.UseVisualStyleBackColor = true;
|
||||
this.ZoomAanchorCRadioButton.CheckedChanged += new System.EventHandler(this.OptionChanged_Handler);
|
||||
//
|
||||
// ZoomAanchorSRadioButton
|
||||
//
|
||||
this.ZoomAanchorSRadioButton.AutoSize = true;
|
||||
this.ZoomAanchorSRadioButton.Location = new System.Drawing.Point(46, 85);
|
||||
this.ZoomAanchorSRadioButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.ZoomAanchorSRadioButton.Name = "ZoomAanchorSRadioButton";
|
||||
this.ZoomAanchorSRadioButton.Size = new System.Drawing.Size(21, 20);
|
||||
this.ZoomAanchorSRadioButton.TabIndex = 7;
|
||||
this.ZoomAanchorSRadioButton.TabStop = true;
|
||||
this.ZoomAanchorSRadioButton.UseVisualStyleBackColor = true;
|
||||
this.ZoomAanchorSRadioButton.CheckedChanged += new System.EventHandler(this.OptionChanged_Handler);
|
||||
//
|
||||
// ZoomAanchorERadioButton
|
||||
//
|
||||
this.ZoomAanchorERadioButton.AutoSize = true;
|
||||
this.ZoomAanchorERadioButton.Location = new System.Drawing.Point(88, 45);
|
||||
this.ZoomAanchorERadioButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.ZoomAanchorERadioButton.Name = "ZoomAanchorERadioButton";
|
||||
this.ZoomAanchorERadioButton.Size = new System.Drawing.Size(21, 20);
|
||||
this.ZoomAanchorERadioButton.TabIndex = 5;
|
||||
this.ZoomAanchorERadioButton.TabStop = true;
|
||||
this.ZoomAanchorERadioButton.UseVisualStyleBackColor = true;
|
||||
this.ZoomAanchorERadioButton.CheckedChanged += new System.EventHandler(this.OptionChanged_Handler);
|
||||
//
|
||||
// ZoomAanchorSWRadioButton
|
||||
//
|
||||
this.ZoomAanchorSWRadioButton.AutoSize = true;
|
||||
this.ZoomAanchorSWRadioButton.Location = new System.Drawing.Point(4, 85);
|
||||
this.ZoomAanchorSWRadioButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.ZoomAanchorSWRadioButton.Name = "ZoomAanchorSWRadioButton";
|
||||
this.ZoomAanchorSWRadioButton.Size = new System.Drawing.Size(21, 20);
|
||||
this.ZoomAanchorSWRadioButton.TabIndex = 6;
|
||||
this.ZoomAanchorSWRadioButton.TabStop = true;
|
||||
this.ZoomAanchorSWRadioButton.UseVisualStyleBackColor = true;
|
||||
this.ZoomAanchorSWRadioButton.CheckedChanged += new System.EventHandler(this.OptionChanged_Handler);
|
||||
//
|
||||
// ZoomAnchorLabel
|
||||
//
|
||||
ZoomAnchorLabel.AutoSize = true;
|
||||
ZoomAnchorLabel.Location = new System.Drawing.Point(12, 88);
|
||||
ZoomAnchorLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
ZoomAnchorLabel.Name = "ZoomAnchorLabel";
|
||||
ZoomAnchorLabel.Size = new System.Drawing.Size(60, 20);
|
||||
ZoomAnchorLabel.TabIndex = 40;
|
||||
ZoomAnchorLabel.Text = "Anchor";
|
||||
//
|
||||
// EnableThumbnailZoomCheckBox
|
||||
//
|
||||
this.EnableThumbnailZoomCheckBox.AutoSize = true;
|
||||
this.EnableThumbnailZoomCheckBox.Checked = true;
|
||||
this.EnableThumbnailZoomCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.EnableThumbnailZoomCheckBox.Location = new System.Drawing.Point(12, 11);
|
||||
this.EnableThumbnailZoomCheckBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.EnableThumbnailZoomCheckBox.Name = "EnableThumbnailZoomCheckBox";
|
||||
this.EnableThumbnailZoomCheckBox.RightToLeft = System.Windows.Forms.RightToLeft.No;
|
||||
this.EnableThumbnailZoomCheckBox.Size = new System.Drawing.Size(141, 24);
|
||||
this.EnableThumbnailZoomCheckBox.TabIndex = 36;
|
||||
this.EnableThumbnailZoomCheckBox.Text = "Zoom on hover";
|
||||
this.EnableThumbnailZoomCheckBox.UseVisualStyleBackColor = true;
|
||||
this.EnableThumbnailZoomCheckBox.CheckedChanged += new System.EventHandler(this.OptionChanged_Handler);
|
||||
//
|
||||
// ThumbnailZoomFactorNumericEdit
|
||||
//
|
||||
this.ThumbnailZoomFactorNumericEdit.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.ThumbnailZoomFactorNumericEdit.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.ThumbnailZoomFactorNumericEdit.Location = new System.Drawing.Point(122, 48);
|
||||
this.ThumbnailZoomFactorNumericEdit.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.ThumbnailZoomFactorNumericEdit.Maximum = new decimal(new int[] {
|
||||
10,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.ThumbnailZoomFactorNumericEdit.Minimum = new decimal(new int[] {
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.ThumbnailZoomFactorNumericEdit.Name = "ThumbnailZoomFactorNumericEdit";
|
||||
this.ThumbnailZoomFactorNumericEdit.Size = new System.Drawing.Size(57, 26);
|
||||
this.ThumbnailZoomFactorNumericEdit.TabIndex = 37;
|
||||
this.ThumbnailZoomFactorNumericEdit.Value = new decimal(new int[] {
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.ThumbnailZoomFactorNumericEdit.ValueChanged += new System.EventHandler(this.OptionChanged_Handler);
|
||||
//
|
||||
// OverlayTabPage
|
||||
//
|
||||
OverlayTabPage.BackColor = System.Drawing.SystemColors.Control;
|
||||
OverlayTabPage.Controls.Add(OverlaySettingsPanel);
|
||||
OverlayTabPage.Location = new System.Drawing.Point(124, 4);
|
||||
OverlayTabPage.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
OverlayTabPage.Name = "OverlayTabPage";
|
||||
OverlayTabPage.Size = new System.Drawing.Size(457, 327);
|
||||
OverlayTabPage.TabIndex = 3;
|
||||
OverlayTabPage.Text = "Overlay";
|
||||
//
|
||||
// OverlaySettingsPanel
|
||||
//
|
||||
OverlaySettingsPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
OverlaySettingsPanel.Controls.Add(this.HighlightColorLabel);
|
||||
OverlaySettingsPanel.Controls.Add(this.ActiveClientHighlightColorButton);
|
||||
OverlaySettingsPanel.Controls.Add(this.EnableActiveClientHighlightCheckBox);
|
||||
OverlaySettingsPanel.Controls.Add(this.ShowThumbnailOverlaysCheckBox);
|
||||
OverlaySettingsPanel.Controls.Add(this.ShowThumbnailFramesCheckBox);
|
||||
OverlaySettingsPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
OverlaySettingsPanel.Location = new System.Drawing.Point(0, 0);
|
||||
OverlaySettingsPanel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
OverlaySettingsPanel.Name = "OverlaySettingsPanel";
|
||||
OverlaySettingsPanel.Size = new System.Drawing.Size(457, 327);
|
||||
OverlaySettingsPanel.TabIndex = 25;
|
||||
//
|
||||
// HighlightColorLabel
|
||||
//
|
||||
this.HighlightColorLabel.AutoSize = true;
|
||||
this.HighlightColorLabel.Location = new System.Drawing.Point(8, 120);
|
||||
this.HighlightColorLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.HighlightColorLabel.Name = "HighlightColorLabel";
|
||||
this.HighlightColorLabel.Size = new System.Drawing.Size(46, 20);
|
||||
this.HighlightColorLabel.TabIndex = 29;
|
||||
this.HighlightColorLabel.Text = "Color";
|
||||
//
|
||||
// ActiveClientHighlightColorButton
|
||||
//
|
||||
this.ActiveClientHighlightColorButton.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.ActiveClientHighlightColorButton.Location = new System.Drawing.Point(63, 118);
|
||||
this.ActiveClientHighlightColorButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.ActiveClientHighlightColorButton.Name = "ActiveClientHighlightColorButton";
|
||||
this.ActiveClientHighlightColorButton.Size = new System.Drawing.Size(138, 25);
|
||||
this.ActiveClientHighlightColorButton.TabIndex = 28;
|
||||
this.ActiveClientHighlightColorButton.Click += new System.EventHandler(this.ActiveClientHighlightColorButton_Click);
|
||||
//
|
||||
// EnableActiveClientHighlightCheckBox
|
||||
//
|
||||
this.EnableActiveClientHighlightCheckBox.AutoSize = true;
|
||||
this.EnableActiveClientHighlightCheckBox.Checked = true;
|
||||
this.EnableActiveClientHighlightCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.EnableActiveClientHighlightCheckBox.Location = new System.Drawing.Point(12, 85);
|
||||
this.EnableActiveClientHighlightCheckBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.EnableActiveClientHighlightCheckBox.Name = "EnableActiveClientHighlightCheckBox";
|
||||
this.EnableActiveClientHighlightCheckBox.RightToLeft = System.Windows.Forms.RightToLeft.No;
|
||||
this.EnableActiveClientHighlightCheckBox.Size = new System.Drawing.Size(183, 24);
|
||||
this.EnableActiveClientHighlightCheckBox.TabIndex = 27;
|
||||
this.EnableActiveClientHighlightCheckBox.Text = "Highlight active client";
|
||||
this.EnableActiveClientHighlightCheckBox.UseVisualStyleBackColor = true;
|
||||
this.EnableActiveClientHighlightCheckBox.CheckedChanged += new System.EventHandler(this.OptionChanged_Handler);
|
||||
//
|
||||
// ShowThumbnailOverlaysCheckBox
|
||||
//
|
||||
this.ShowThumbnailOverlaysCheckBox.AutoSize = true;
|
||||
this.ShowThumbnailOverlaysCheckBox.Checked = true;
|
||||
this.ShowThumbnailOverlaysCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.ShowThumbnailOverlaysCheckBox.Location = new System.Drawing.Point(12, 11);
|
||||
this.ShowThumbnailOverlaysCheckBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.ShowThumbnailOverlaysCheckBox.Name = "ShowThumbnailOverlaysCheckBox";
|
||||
this.ShowThumbnailOverlaysCheckBox.RightToLeft = System.Windows.Forms.RightToLeft.No;
|
||||
this.ShowThumbnailOverlaysCheckBox.Size = new System.Drawing.Size(128, 24);
|
||||
this.ShowThumbnailOverlaysCheckBox.TabIndex = 25;
|
||||
this.ShowThumbnailOverlaysCheckBox.Text = "Show overlay";
|
||||
this.ShowThumbnailOverlaysCheckBox.UseVisualStyleBackColor = true;
|
||||
this.ShowThumbnailOverlaysCheckBox.CheckedChanged += new System.EventHandler(this.OptionChanged_Handler);
|
||||
//
|
||||
// ShowThumbnailFramesCheckBox
|
||||
//
|
||||
this.ShowThumbnailFramesCheckBox.AutoSize = true;
|
||||
this.ShowThumbnailFramesCheckBox.Checked = true;
|
||||
this.ShowThumbnailFramesCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.ShowThumbnailFramesCheckBox.Location = new System.Drawing.Point(12, 48);
|
||||
this.ShowThumbnailFramesCheckBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.ShowThumbnailFramesCheckBox.Name = "ShowThumbnailFramesCheckBox";
|
||||
this.ShowThumbnailFramesCheckBox.RightToLeft = System.Windows.Forms.RightToLeft.No;
|
||||
this.ShowThumbnailFramesCheckBox.Size = new System.Drawing.Size(128, 24);
|
||||
this.ShowThumbnailFramesCheckBox.TabIndex = 26;
|
||||
this.ShowThumbnailFramesCheckBox.Text = "Show frames";
|
||||
this.ShowThumbnailFramesCheckBox.UseVisualStyleBackColor = true;
|
||||
this.ShowThumbnailFramesCheckBox.CheckedChanged += new System.EventHandler(this.OptionChanged_Handler);
|
||||
//
|
||||
// ClientsTabPage
|
||||
//
|
||||
ClientsTabPage.BackColor = System.Drawing.SystemColors.Control;
|
||||
ClientsTabPage.Controls.Add(ClientsPanel);
|
||||
ClientsTabPage.Location = new System.Drawing.Point(124, 4);
|
||||
ClientsTabPage.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
ClientsTabPage.Name = "ClientsTabPage";
|
||||
ClientsTabPage.Size = new System.Drawing.Size(457, 327);
|
||||
ClientsTabPage.TabIndex = 4;
|
||||
ClientsTabPage.Text = "Active Clients";
|
||||
//
|
||||
// ClientsPanel
|
||||
//
|
||||
ClientsPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
ClientsPanel.Controls.Add(this.ThumbnailsList);
|
||||
ClientsPanel.Controls.Add(ThumbnailsListLabel);
|
||||
ClientsPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
ClientsPanel.Location = new System.Drawing.Point(0, 0);
|
||||
ClientsPanel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
ClientsPanel.Name = "ClientsPanel";
|
||||
ClientsPanel.Size = new System.Drawing.Size(457, 327);
|
||||
ClientsPanel.TabIndex = 32;
|
||||
//
|
||||
// ThumbnailsList
|
||||
//
|
||||
this.ThumbnailsList.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.ThumbnailsList.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.ThumbnailsList.CheckOnClick = true;
|
||||
this.ThumbnailsList.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.ThumbnailsList.FormattingEnabled = true;
|
||||
this.ThumbnailsList.IntegralHeight = false;
|
||||
this.ThumbnailsList.Location = new System.Drawing.Point(0, 49);
|
||||
this.ThumbnailsList.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.ThumbnailsList.Name = "ThumbnailsList";
|
||||
this.ThumbnailsList.Size = new System.Drawing.Size(455, 276);
|
||||
this.ThumbnailsList.TabIndex = 34;
|
||||
this.ThumbnailsList.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.ThumbnailsList_ItemCheck_Handler);
|
||||
//
|
||||
// ThumbnailsListLabel
|
||||
//
|
||||
ThumbnailsListLabel.AutoSize = true;
|
||||
ThumbnailsListLabel.Location = new System.Drawing.Point(12, 14);
|
||||
ThumbnailsListLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
ThumbnailsListLabel.Name = "ThumbnailsListLabel";
|
||||
ThumbnailsListLabel.Size = new System.Drawing.Size(238, 20);
|
||||
ThumbnailsListLabel.TabIndex = 33;
|
||||
ThumbnailsListLabel.Text = "Thumbnails (check to force hide)";
|
||||
//
|
||||
// AboutTabPage
|
||||
//
|
||||
AboutTabPage.BackColor = System.Drawing.SystemColors.Control;
|
||||
AboutTabPage.Controls.Add(AboutPanel);
|
||||
AboutTabPage.Location = new System.Drawing.Point(124, 4);
|
||||
AboutTabPage.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
AboutTabPage.Name = "AboutTabPage";
|
||||
AboutTabPage.Size = new System.Drawing.Size(457, 327);
|
||||
AboutTabPage.TabIndex = 5;
|
||||
AboutTabPage.Text = "About";
|
||||
//
|
||||
// AboutPanel
|
||||
//
|
||||
AboutPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
AboutPanel.Controls.Add(DocumentationLinkLabel);
|
||||
AboutPanel.Controls.Add(DescriptionLabel);
|
||||
AboutPanel.Controls.Add(this.VersionLabel);
|
||||
AboutPanel.Controls.Add(NameLabel);
|
||||
AboutPanel.Controls.Add(this.DocumentationLink);
|
||||
AboutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
AboutPanel.Location = new System.Drawing.Point(0, 0);
|
||||
AboutPanel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
AboutPanel.Name = "AboutPanel";
|
||||
AboutPanel.Size = new System.Drawing.Size(457, 327);
|
||||
AboutPanel.TabIndex = 2;
|
||||
//
|
||||
// DocumentationLinkLabel
|
||||
//
|
||||
DocumentationLinkLabel.AutoSize = true;
|
||||
DocumentationLinkLabel.Location = new System.Drawing.Point(0, 242);
|
||||
DocumentationLinkLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
DocumentationLinkLabel.Name = "DocumentationLinkLabel";
|
||||
DocumentationLinkLabel.Padding = new System.Windows.Forms.Padding(12, 5, 12, 5);
|
||||
DocumentationLinkLabel.Size = new System.Drawing.Size(336, 30);
|
||||
DocumentationLinkLabel.TabIndex = 6;
|
||||
DocumentationLinkLabel.Text = "For more information visit the forum thread:";
|
||||
//
|
||||
// DescriptionLabel
|
||||
//
|
||||
DescriptionLabel.Location = new System.Drawing.Point(0, 63);
|
||||
DescriptionLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
DescriptionLabel.Name = "DescriptionLabel";
|
||||
DescriptionLabel.Padding = new System.Windows.Forms.Padding(12, 5, 12, 5);
|
||||
DescriptionLabel.Size = new System.Drawing.Size(392, 178);
|
||||
DescriptionLabel.TabIndex = 5;
|
||||
DescriptionLabel.Text = resources.GetString("DescriptionLabel.Text");
|
||||
//
|
||||
// VersionLabel
|
||||
//
|
||||
this.VersionLabel.AutoSize = true;
|
||||
this.VersionLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
|
||||
this.VersionLabel.Location = new System.Drawing.Point(200, 14);
|
||||
this.VersionLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.VersionLabel.Name = "VersionLabel";
|
||||
this.VersionLabel.Size = new System.Drawing.Size(69, 29);
|
||||
this.VersionLabel.TabIndex = 4;
|
||||
this.VersionLabel.Text = "1.0.0";
|
||||
//
|
||||
// NameLabel
|
||||
//
|
||||
NameLabel.AutoSize = true;
|
||||
NameLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
|
||||
NameLabel.Location = new System.Drawing.Point(6, 14);
|
||||
NameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
NameLabel.Name = "NameLabel";
|
||||
NameLabel.Size = new System.Drawing.Size(193, 29);
|
||||
NameLabel.TabIndex = 3;
|
||||
NameLabel.Text = "EVE-O Preview";
|
||||
//
|
||||
// DocumentationLink
|
||||
//
|
||||
this.DocumentationLink.Location = new System.Drawing.Point(0, 266);
|
||||
this.DocumentationLink.Margin = new System.Windows.Forms.Padding(45, 5, 4, 5);
|
||||
this.DocumentationLink.Name = "DocumentationLink";
|
||||
this.DocumentationLink.Padding = new System.Windows.Forms.Padding(12, 5, 12, 5);
|
||||
this.DocumentationLink.Size = new System.Drawing.Size(393, 51);
|
||||
this.DocumentationLink.TabIndex = 2;
|
||||
this.DocumentationLink.TabStop = true;
|
||||
this.DocumentationLink.Text = "to be set from prresenter to be set from prresenter to be set from prresenter to " +
|
||||
"be set from prresenter";
|
||||
this.DocumentationLink.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.DocumentationLinkClicked_Handler);
|
||||
//
|
||||
// NotifyIcon
|
||||
//
|
||||
this.NotifyIcon.ContextMenuStrip = this.TrayMenu;
|
||||
this.NotifyIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("NotifyIcon.Icon")));
|
||||
this.NotifyIcon.Text = "EVE-O Preview";
|
||||
this.NotifyIcon.Visible = true;
|
||||
this.NotifyIcon.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.RestoreMainForm_Handler);
|
||||
//
|
||||
// TrayMenu
|
||||
//
|
||||
this.TrayMenu.ImageScalingSize = new System.Drawing.Size(24, 24);
|
||||
this.TrayMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
TitleMenuItem,
|
||||
RestoreWindowMenuItem,
|
||||
SeparatorMenuItem,
|
||||
ExitMenuItem});
|
||||
this.TrayMenu.Name = "contextMenuStrip1";
|
||||
this.TrayMenu.Size = new System.Drawing.Size(200, 100);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.ClientSize = new System.Drawing.Size(585, 335);
|
||||
this.Controls.Add(ContentTabControl);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "MainForm";
|
||||
this.Text = "EVE-O Preview";
|
||||
this.TopMost = true;
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainFormClosing_Handler);
|
||||
this.Load += new System.EventHandler(this.MainFormResize_Handler);
|
||||
this.Resize += new System.EventHandler(this.MainFormResize_Handler);
|
||||
ContentTabControl.ResumeLayout(false);
|
||||
GeneralTabPage.ResumeLayout(false);
|
||||
GeneralSettingsPanel.ResumeLayout(false);
|
||||
GeneralSettingsPanel.PerformLayout();
|
||||
ThumbnailTabPage.ResumeLayout(false);
|
||||
ThumbnailSettingsPanel.ResumeLayout(false);
|
||||
ThumbnailSettingsPanel.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ThumbnailsWidthNumericEdit)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ThumbnailsHeightNumericEdit)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ThumbnailOpacityTrackBar)).EndInit();
|
||||
this.ZoomTabPage.ResumeLayout(false);
|
||||
ZoomSettingsPanel.ResumeLayout(false);
|
||||
ZoomSettingsPanel.PerformLayout();
|
||||
this.ZoomAnchorPanel.ResumeLayout(false);
|
||||
this.ZoomAnchorPanel.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ThumbnailZoomFactorNumericEdit)).EndInit();
|
||||
OverlayTabPage.ResumeLayout(false);
|
||||
OverlaySettingsPanel.ResumeLayout(false);
|
||||
OverlaySettingsPanel.PerformLayout();
|
||||
ClientsTabPage.ResumeLayout(false);
|
||||
ClientsPanel.ResumeLayout(false);
|
||||
ClientsPanel.PerformLayout();
|
||||
AboutTabPage.ResumeLayout(false);
|
||||
AboutPanel.ResumeLayout(false);
|
||||
AboutPanel.PerformLayout();
|
||||
this.TrayMenu.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private NotifyIcon NotifyIcon;
|
||||
private ContextMenuStrip TrayMenu;
|
||||
private TabPage ZoomTabPage;
|
||||
private CheckBox EnableClientLayoutTrackingCheckBox;
|
||||
private CheckBox HideActiveClientThumbnailCheckBox;
|
||||
private CheckBox ShowThumbnailsAlwaysOnTopCheckBox;
|
||||
private CheckBox HideThumbnailsOnLostFocusCheckBox;
|
||||
private CheckBox EnablePerClientThumbnailsLayoutsCheckBox;
|
||||
private CheckBox MinimizeToTrayCheckBox;
|
||||
private NumericUpDown ThumbnailsWidthNumericEdit;
|
||||
private NumericUpDown ThumbnailsHeightNumericEdit;
|
||||
private TrackBar ThumbnailOpacityTrackBar;
|
||||
private Panel ZoomAnchorPanel;
|
||||
private RadioButton ZoomAanchorNWRadioButton;
|
||||
private RadioButton ZoomAanchorNRadioButton;
|
||||
private RadioButton ZoomAanchorNERadioButton;
|
||||
private RadioButton ZoomAanchorWRadioButton;
|
||||
private RadioButton ZoomAanchorSERadioButton;
|
||||
private RadioButton ZoomAanchorCRadioButton;
|
||||
private RadioButton ZoomAanchorSRadioButton;
|
||||
private RadioButton ZoomAanchorERadioButton;
|
||||
private RadioButton ZoomAanchorSWRadioButton;
|
||||
private CheckBox EnableThumbnailZoomCheckBox;
|
||||
private NumericUpDown ThumbnailZoomFactorNumericEdit;
|
||||
private Label HighlightColorLabel;
|
||||
private Panel ActiveClientHighlightColorButton;
|
||||
private CheckBox EnableActiveClientHighlightCheckBox;
|
||||
private CheckBox ShowThumbnailOverlaysCheckBox;
|
||||
private CheckBox ShowThumbnailFramesCheckBox;
|
||||
private CheckedListBox ThumbnailsList;
|
||||
private LinkLabel DocumentationLink;
|
||||
private Label VersionLabel;
|
||||
private CheckBox MinimizeInactiveClientsCheckBox;
|
||||
}
|
||||
}
|
||||
395
src/Eve-O-Preview/View/Implementation/MainForm.cs
Normal file
395
src/Eve-O-Preview/View/Implementation/MainForm.cs
Normal file
@@ -0,0 +1,395 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace EveOPreview.View
|
||||
{
|
||||
public partial class MainForm : Form, IMainFormView
|
||||
{
|
||||
#region Private fields
|
||||
private readonly ApplicationContext _context;
|
||||
private readonly Dictionary<ViewZoomAnchor, RadioButton> _zoomAnchorMap;
|
||||
private ViewZoomAnchor _cachedThumbnailZoomAnchor;
|
||||
private bool _suppressEvents;
|
||||
private Size _minimumSize;
|
||||
private Size _maximumSize;
|
||||
#endregion
|
||||
|
||||
public MainForm(ApplicationContext context)
|
||||
{
|
||||
this._context = context;
|
||||
this._zoomAnchorMap = new Dictionary<ViewZoomAnchor, RadioButton>();
|
||||
this._cachedThumbnailZoomAnchor = ViewZoomAnchor.NW;
|
||||
this._suppressEvents = false;
|
||||
this._minimumSize = new Size(80, 60);
|
||||
this._maximumSize = new Size(80, 60);
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
this.ThumbnailsList.DisplayMember = "Title";
|
||||
|
||||
this.InitZoomAnchorMap();
|
||||
}
|
||||
|
||||
public bool MinimizeToTray
|
||||
{
|
||||
get => this.MinimizeToTrayCheckBox.Checked;
|
||||
set => this.MinimizeToTrayCheckBox.Checked = value;
|
||||
}
|
||||
|
||||
public double ThumbnailOpacity
|
||||
{
|
||||
get => Math.Min(this.ThumbnailOpacityTrackBar.Value / 100.00, 1.00);
|
||||
set
|
||||
{
|
||||
int barValue = (int)(100.0 * value);
|
||||
if (barValue > 100)
|
||||
{
|
||||
barValue = 100;
|
||||
}
|
||||
else if (barValue < 10)
|
||||
{
|
||||
barValue = 10;
|
||||
}
|
||||
|
||||
this.ThumbnailOpacityTrackBar.Value = barValue;
|
||||
}
|
||||
}
|
||||
|
||||
public bool EnableClientLayoutTracking
|
||||
{
|
||||
get => this.EnableClientLayoutTrackingCheckBox.Checked;
|
||||
set => this.EnableClientLayoutTrackingCheckBox.Checked = value;
|
||||
}
|
||||
|
||||
public bool HideActiveClientThumbnail
|
||||
{
|
||||
get => this.HideActiveClientThumbnailCheckBox.Checked;
|
||||
set => this.HideActiveClientThumbnailCheckBox.Checked = value;
|
||||
}
|
||||
|
||||
public bool MinimizeInactiveClients
|
||||
{
|
||||
get => this.MinimizeInactiveClientsCheckBox.Checked;
|
||||
set => this.MinimizeInactiveClientsCheckBox.Checked = value;
|
||||
}
|
||||
|
||||
public bool ShowThumbnailsAlwaysOnTop
|
||||
{
|
||||
get => this.ShowThumbnailsAlwaysOnTopCheckBox.Checked;
|
||||
set => this.ShowThumbnailsAlwaysOnTopCheckBox.Checked = value;
|
||||
}
|
||||
|
||||
public bool HideThumbnailsOnLostFocus
|
||||
{
|
||||
get => this.HideThumbnailsOnLostFocusCheckBox.Checked;
|
||||
set => this.HideThumbnailsOnLostFocusCheckBox.Checked = value;
|
||||
}
|
||||
|
||||
public bool EnablePerClientThumbnailLayouts
|
||||
{
|
||||
get => this.EnablePerClientThumbnailsLayoutsCheckBox.Checked;
|
||||
set => this.EnablePerClientThumbnailsLayoutsCheckBox.Checked = value;
|
||||
}
|
||||
|
||||
public Size ThumbnailSize
|
||||
{
|
||||
get => new Size((int)this.ThumbnailsWidthNumericEdit.Value, (int)this.ThumbnailsHeightNumericEdit.Value);
|
||||
set
|
||||
{
|
||||
this.ThumbnailsWidthNumericEdit.Value = value.Width;
|
||||
this.ThumbnailsHeightNumericEdit.Value = value.Height;
|
||||
}
|
||||
}
|
||||
|
||||
public bool EnableThumbnailZoom
|
||||
{
|
||||
get => this.EnableThumbnailZoomCheckBox.Checked;
|
||||
set
|
||||
{
|
||||
this.EnableThumbnailZoomCheckBox.Checked = value;
|
||||
this.RefreshZoomSettings();
|
||||
}
|
||||
}
|
||||
|
||||
public int ThumbnailZoomFactor
|
||||
{
|
||||
get => (int)this.ThumbnailZoomFactorNumericEdit.Value;
|
||||
set => this.ThumbnailZoomFactorNumericEdit.Value = value;
|
||||
}
|
||||
|
||||
public ViewZoomAnchor ThumbnailZoomAnchor
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._zoomAnchorMap[this._cachedThumbnailZoomAnchor].Checked)
|
||||
{
|
||||
return this._cachedThumbnailZoomAnchor;
|
||||
}
|
||||
|
||||
foreach (KeyValuePair<ViewZoomAnchor, RadioButton> valuePair in this._zoomAnchorMap)
|
||||
{
|
||||
if (!valuePair.Value.Checked)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
this._cachedThumbnailZoomAnchor = valuePair.Key;
|
||||
return this._cachedThumbnailZoomAnchor;
|
||||
}
|
||||
|
||||
// Default value
|
||||
return ViewZoomAnchor.NW;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._cachedThumbnailZoomAnchor = value;
|
||||
this._zoomAnchorMap[this._cachedThumbnailZoomAnchor].Checked = true;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShowThumbnailOverlays
|
||||
{
|
||||
get => this.ShowThumbnailOverlaysCheckBox.Checked;
|
||||
set => this.ShowThumbnailOverlaysCheckBox.Checked = value;
|
||||
}
|
||||
|
||||
public bool ShowThumbnailFrames
|
||||
{
|
||||
get => this.ShowThumbnailFramesCheckBox.Checked;
|
||||
set => this.ShowThumbnailFramesCheckBox.Checked = value;
|
||||
}
|
||||
|
||||
public bool EnableActiveClientHighlight
|
||||
{
|
||||
get => this.EnableActiveClientHighlightCheckBox.Checked;
|
||||
set => this.EnableActiveClientHighlightCheckBox.Checked = value;
|
||||
}
|
||||
|
||||
public Color ActiveClientHighlightColor
|
||||
{
|
||||
get => this._activeClientHighlightColor;
|
||||
set
|
||||
{
|
||||
this._activeClientHighlightColor = value;
|
||||
this.ActiveClientHighlightColorButton.BackColor = value;
|
||||
}
|
||||
}
|
||||
private Color _activeClientHighlightColor;
|
||||
|
||||
public new void Show()
|
||||
{
|
||||
// Registers the current instance as the application's Main Form
|
||||
this._context.MainForm = this;
|
||||
|
||||
this._suppressEvents = true;
|
||||
this.FormActivated?.Invoke();
|
||||
this._suppressEvents = false;
|
||||
|
||||
Application.Run(this._context);
|
||||
}
|
||||
|
||||
public void SetThumbnailSizeLimitations(Size minimumSize, Size maximumSize)
|
||||
{
|
||||
this._minimumSize = minimumSize;
|
||||
this._maximumSize = maximumSize;
|
||||
}
|
||||
|
||||
public void Minimize()
|
||||
{
|
||||
this.WindowState = FormWindowState.Minimized;
|
||||
}
|
||||
|
||||
public void SetVersionInfo(string version)
|
||||
{
|
||||
this.VersionLabel.Text = version;
|
||||
}
|
||||
|
||||
public void SetDocumentationUrl(string url)
|
||||
{
|
||||
this.DocumentationLink.Text = url;
|
||||
}
|
||||
|
||||
public void AddThumbnails(IList<IThumbnailDescription> thumbnails)
|
||||
{
|
||||
this.ThumbnailsList.BeginUpdate();
|
||||
|
||||
foreach (IThumbnailDescription view in thumbnails)
|
||||
{
|
||||
this.ThumbnailsList.SetItemChecked(this.ThumbnailsList.Items.Add(view), view.IsDisabled);
|
||||
}
|
||||
|
||||
this.ThumbnailsList.EndUpdate();
|
||||
}
|
||||
|
||||
public void RemoveThumbnails(IList<IThumbnailDescription> thumbnails)
|
||||
{
|
||||
this.ThumbnailsList.BeginUpdate();
|
||||
|
||||
foreach (IThumbnailDescription view in thumbnails)
|
||||
{
|
||||
this.ThumbnailsList.Items.Remove(view);
|
||||
}
|
||||
|
||||
this.ThumbnailsList.EndUpdate();
|
||||
}
|
||||
|
||||
public void RefreshZoomSettings()
|
||||
{
|
||||
bool enableControls = this.EnableThumbnailZoom;
|
||||
this.ThumbnailZoomFactorNumericEdit.Enabled = enableControls;
|
||||
this.ZoomAnchorPanel.Enabled = enableControls;
|
||||
}
|
||||
|
||||
public Action ApplicationExitRequested { get; set; }
|
||||
|
||||
public Action FormActivated { get; set; }
|
||||
|
||||
public Action FormMinimized { get; set; }
|
||||
|
||||
public Action<ViewCloseRequest> FormCloseRequested { get; set; }
|
||||
|
||||
public Action ApplicationSettingsChanged { get; set; }
|
||||
|
||||
public Action ThumbnailsSizeChanged { get; set; }
|
||||
|
||||
public Action<string> ThumbnailStateChanged { get; set; }
|
||||
|
||||
public Action DocumentationLinkActivated { get; set; }
|
||||
|
||||
#region UI events
|
||||
private void ContentTabControl_DrawItem(object sender, DrawItemEventArgs e)
|
||||
{
|
||||
TabControl control = (TabControl)sender;
|
||||
TabPage page = control.TabPages[e.Index];
|
||||
Rectangle bounds = control.GetTabRect(e.Index);
|
||||
|
||||
Graphics graphics = e.Graphics;
|
||||
|
||||
Brush textBrush = new SolidBrush(SystemColors.ActiveCaptionText);
|
||||
Brush backgroundBrush = (e.State == DrawItemState.Selected)
|
||||
? new SolidBrush(SystemColors.Control)
|
||||
: new SolidBrush(SystemColors.ControlDark);
|
||||
graphics.FillRectangle(backgroundBrush, e.Bounds);
|
||||
|
||||
// Use our own font
|
||||
Font font = new Font("Arial", this.Font.Size * 1.5f, FontStyle.Bold, GraphicsUnit.Pixel);
|
||||
|
||||
// Draw string and center the text
|
||||
StringFormat stringFlags = new StringFormat();
|
||||
stringFlags.Alignment = StringAlignment.Center;
|
||||
stringFlags.LineAlignment = StringAlignment.Center;
|
||||
|
||||
graphics.DrawString(page.Text, font, textBrush, bounds, stringFlags);
|
||||
}
|
||||
|
||||
private void OptionChanged_Handler(object sender, EventArgs e)
|
||||
{
|
||||
if (this._suppressEvents)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.ApplicationSettingsChanged?.Invoke();
|
||||
}
|
||||
|
||||
private void ThumbnailSizeChanged_Handler(object sender, EventArgs e)
|
||||
{
|
||||
if (this._suppressEvents)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Perform some View work that is not properly done in the Control
|
||||
this._suppressEvents = true;
|
||||
Size thumbnailSize = this.ThumbnailSize;
|
||||
thumbnailSize.Width = Math.Min(Math.Max(thumbnailSize.Width, this._minimumSize.Width), this._maximumSize.Width);
|
||||
thumbnailSize.Height = Math.Min(Math.Max(thumbnailSize.Height, this._minimumSize.Height), this._maximumSize.Height);
|
||||
this.ThumbnailSize = thumbnailSize;
|
||||
this._suppressEvents = false;
|
||||
|
||||
this.ThumbnailsSizeChanged?.Invoke();
|
||||
}
|
||||
|
||||
private void ActiveClientHighlightColorButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (ColorDialog dialog = new ColorDialog())
|
||||
{
|
||||
dialog.Color = this.ActiveClientHighlightColor;
|
||||
|
||||
if (dialog.ShowDialog() != DialogResult.OK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.ActiveClientHighlightColor = dialog.Color;
|
||||
}
|
||||
|
||||
this.OptionChanged_Handler(sender, e);
|
||||
}
|
||||
|
||||
private void ThumbnailsList_ItemCheck_Handler(object sender, ItemCheckEventArgs e)
|
||||
{
|
||||
if (!(this.ThumbnailsList.Items[e.Index] is IThumbnailDescription selectedItem))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
selectedItem.IsDisabled = (e.NewValue == CheckState.Checked);
|
||||
|
||||
this.ThumbnailStateChanged?.Invoke(selectedItem.Title);
|
||||
}
|
||||
|
||||
private void DocumentationLinkClicked_Handler(object sender, LinkLabelLinkClickedEventArgs e)
|
||||
{
|
||||
this.DocumentationLinkActivated?.Invoke();
|
||||
}
|
||||
|
||||
private void MainFormResize_Handler(object sender, EventArgs e)
|
||||
{
|
||||
if (this.WindowState != FormWindowState.Minimized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.FormMinimized?.Invoke();
|
||||
}
|
||||
|
||||
private void MainFormClosing_Handler(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
ViewCloseRequest request = new ViewCloseRequest();
|
||||
|
||||
this.FormCloseRequested?.Invoke(request);
|
||||
|
||||
e.Cancel = !request.Allow;
|
||||
}
|
||||
|
||||
private void RestoreMainForm_Handler(object sender, EventArgs e)
|
||||
{
|
||||
// This is form's GUI lifecycle event that is invariant to the Form data
|
||||
base.Show();
|
||||
this.WindowState = FormWindowState.Normal;
|
||||
this.BringToFront();
|
||||
}
|
||||
|
||||
private void ExitMenuItemClick_Handler(object sender, EventArgs e)
|
||||
{
|
||||
this.ApplicationExitRequested?.Invoke();
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void InitZoomAnchorMap()
|
||||
{
|
||||
this._zoomAnchorMap[ViewZoomAnchor.NW] = this.ZoomAanchorNWRadioButton;
|
||||
this._zoomAnchorMap[ViewZoomAnchor.N] = this.ZoomAanchorNRadioButton;
|
||||
this._zoomAnchorMap[ViewZoomAnchor.NE] = this.ZoomAanchorNERadioButton;
|
||||
this._zoomAnchorMap[ViewZoomAnchor.W] = this.ZoomAanchorWRadioButton;
|
||||
this._zoomAnchorMap[ViewZoomAnchor.C] = this.ZoomAanchorCRadioButton;
|
||||
this._zoomAnchorMap[ViewZoomAnchor.E] = this.ZoomAanchorERadioButton;
|
||||
this._zoomAnchorMap[ViewZoomAnchor.SW] = this.ZoomAanchorSWRadioButton;
|
||||
this._zoomAnchorMap[ViewZoomAnchor.S] = this.ZoomAanchorSRadioButton;
|
||||
this._zoomAnchorMap[ViewZoomAnchor.SE] = this.ZoomAanchorSERadioButton;
|
||||
}
|
||||
}
|
||||
}
|
||||
1662
src/Eve-O-Preview/View/Implementation/MainForm.resx
Normal file
1662
src/Eve-O-Preview/View/Implementation/MainForm.resx
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace EveOPreview.View
|
||||
{
|
||||
sealed class StaticThumbnailImage : PictureBox
|
||||
{
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
const int WM_NCHITTEST = 0x0084;
|
||||
const int HTTRANSPARENT = (-1);
|
||||
|
||||
if (m.Msg == WM_NCHITTEST)
|
||||
{
|
||||
m.Result = (IntPtr)HTTRANSPARENT;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.WndProc(ref m);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
70
src/Eve-O-Preview/View/Implementation/StaticThumbnailView.cs
Normal file
70
src/Eve-O-Preview/View/Implementation/StaticThumbnailView.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using EveOPreview.Services;
|
||||
|
||||
namespace EveOPreview.View
|
||||
{
|
||||
sealed class StaticThumbnailView : ThumbnailView
|
||||
{
|
||||
#region Private fields
|
||||
private readonly PictureBox _thumbnail;
|
||||
#endregion
|
||||
|
||||
public StaticThumbnailView(IWindowManager windowManager)
|
||||
: base(windowManager)
|
||||
{
|
||||
this._thumbnail = new StaticThumbnailImage
|
||||
{
|
||||
TabStop = false,
|
||||
SizeMode = PictureBoxSizeMode.StretchImage,
|
||||
Location = new Point(0, 0),
|
||||
Size = new Size(this.ClientSize.Width, this.ClientSize.Height)
|
||||
};
|
||||
this.Controls.Add(this._thumbnail);
|
||||
}
|
||||
|
||||
protected override void RefreshThumbnail(bool forceRefresh)
|
||||
{
|
||||
if (!forceRefresh)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var thumbnail = this.WindowManager.GetStaticThumbnail(this.Id);
|
||||
if (thumbnail != null)
|
||||
{
|
||||
var oldImage = this._thumbnail.Image;
|
||||
this._thumbnail.Image = thumbnail;
|
||||
oldImage?.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void ResizeThumbnail(int baseWidth, int baseHeight, int highlightWidthTop, int highlightWidthRight, int highlightWidthBottom, int highlightWidthLeft)
|
||||
{
|
||||
var left = 0 + highlightWidthLeft;
|
||||
var top = 0 + highlightWidthTop;
|
||||
if (this.IsLocationUpdateRequired(this._thumbnail.Location, left, top))
|
||||
{
|
||||
this._thumbnail.Location = new Point(left, top);
|
||||
}
|
||||
|
||||
var width = baseWidth - highlightWidthLeft - highlightWidthRight;
|
||||
var height = baseHeight - highlightWidthTop - highlightWidthBottom;
|
||||
if (this.IsSizeUpdateRequired(this._thumbnail.Size, width, height))
|
||||
{
|
||||
this._thumbnail.Size = new Size(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsLocationUpdateRequired(Point currentLocation, int left, int top)
|
||||
{
|
||||
return (currentLocation.X != left) || (currentLocation.Y != top);
|
||||
}
|
||||
|
||||
private bool IsSizeUpdateRequired(Size currentSize, int width, int height)
|
||||
{
|
||||
return (currentSize.Width != width) || (currentSize.Height != height);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace EveOPreview.View
|
||||
{
|
||||
sealed class ThumbnailDescription : IThumbnailDescription
|
||||
{
|
||||
public ThumbnailDescription(string title, bool isDisabled)
|
||||
{
|
||||
this.Title = title;
|
||||
this.IsDisabled = isDisabled;
|
||||
}
|
||||
|
||||
public string Title { get; set; }
|
||||
public bool IsDisabled { get; set; }
|
||||
}
|
||||
}
|
||||
89
src/Eve-O-Preview/View/Implementation/ThumbnailOverlay.Designer.cs
generated
Normal file
89
src/Eve-O-Preview/View/Implementation/ThumbnailOverlay.Designer.cs
generated
Normal file
@@ -0,0 +1,89 @@
|
||||
namespace EveOPreview.View
|
||||
{
|
||||
partial class ThumbnailOverlay
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.Windows.Forms.PictureBox OverlayAreaPictureBox;
|
||||
this.OverlayLabel = new System.Windows.Forms.Label();
|
||||
OverlayAreaPictureBox = new System.Windows.Forms.PictureBox();
|
||||
((System.ComponentModel.ISupportInitialize)(OverlayAreaPictureBox)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// OverlayAreaPictureBox
|
||||
//
|
||||
OverlayAreaPictureBox.BackColor = System.Drawing.Color.Transparent;
|
||||
OverlayAreaPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
OverlayAreaPictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
OverlayAreaPictureBox.Location = new System.Drawing.Point(0, 0);
|
||||
OverlayAreaPictureBox.Name = "OverlayAreaPictureBox";
|
||||
OverlayAreaPictureBox.Size = new System.Drawing.Size(284, 262);
|
||||
OverlayAreaPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
|
||||
OverlayAreaPictureBox.TabIndex = 0;
|
||||
OverlayAreaPictureBox.TabStop = false;
|
||||
OverlayAreaPictureBox.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OverlayArea_Click);
|
||||
//
|
||||
// OverlayLabel
|
||||
//
|
||||
this.OverlayLabel.AutoSize = true;
|
||||
this.OverlayLabel.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.OverlayLabel.ForeColor = System.Drawing.Color.DarkGray;
|
||||
this.OverlayLabel.Location = new System.Drawing.Point(8, 8);
|
||||
this.OverlayLabel.Name = "OverlayLabel";
|
||||
this.OverlayLabel.Size = new System.Drawing.Size(25, 13);
|
||||
this.OverlayLabel.TabIndex = 1;
|
||||
this.OverlayLabel.Text = "...";
|
||||
//
|
||||
// ThumbnailOverlay
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.Black;
|
||||
this.ClientSize = new System.Drawing.Size(284, 262);
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.OverlayLabel);
|
||||
this.Controls.Add(OverlayAreaPictureBox);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "ThumbnailOverlay";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.Text = "PreviewOverlay";
|
||||
this.TransparencyKey = System.Drawing.Color.Black;
|
||||
((System.ComponentModel.ISupportInitialize)(OverlayAreaPictureBox)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label OverlayLabel;
|
||||
}
|
||||
}
|
||||
46
src/Eve-O-Preview/View/Implementation/ThumbnailOverlay.cs
Normal file
46
src/Eve-O-Preview/View/Implementation/ThumbnailOverlay.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using EveOPreview.Services;
|
||||
|
||||
namespace EveOPreview.View
|
||||
{
|
||||
public partial class ThumbnailOverlay : Form
|
||||
{
|
||||
#region Private fields
|
||||
private readonly Action<object, MouseEventArgs> _areaClickAction;
|
||||
#endregion
|
||||
|
||||
public ThumbnailOverlay(Form owner, Action<object, MouseEventArgs> areaClickAction)
|
||||
{
|
||||
this.Owner = owner;
|
||||
this._areaClickAction = areaClickAction;
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OverlayArea_Click(object sender, MouseEventArgs e)
|
||||
{
|
||||
this._areaClickAction(this, e);
|
||||
}
|
||||
|
||||
public void SetOverlayLabel(string label)
|
||||
{
|
||||
this.OverlayLabel.Text = label;
|
||||
}
|
||||
|
||||
public void EnableOverlayLabel(bool enable)
|
||||
{
|
||||
this.OverlayLabel.Visible = enable;
|
||||
}
|
||||
|
||||
protected override CreateParams CreateParams
|
||||
{
|
||||
get
|
||||
{
|
||||
var Params = base.CreateParams;
|
||||
Params.ExStyle |= (int)InteropConstants.WS_EX_TOOLWINDOW;
|
||||
return Params;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
123
src/Eve-O-Preview/View/Implementation/ThumbnailOverlay.resx
Normal file
123
src/Eve-O-Preview/View/Implementation/ThumbnailOverlay.resx
Normal file
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="OverlayAreaPictureBox.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
</root>
|
||||
53
src/Eve-O-Preview/View/Implementation/ThumbnailView.Designer.cs
generated
Normal file
53
src/Eve-O-Preview/View/Implementation/ThumbnailView.Designer.cs
generated
Normal file
@@ -0,0 +1,53 @@
|
||||
namespace EveOPreview.View
|
||||
{
|
||||
partial class ThumbnailView
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// ThumbnailView
|
||||
//
|
||||
this.AccessibleRole = System.Windows.Forms.AccessibleRole.None;
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.Black;
|
||||
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.ClientSize = new System.Drawing.Size(153, 89);
|
||||
this.ControlBox = false;
|
||||
this.DoubleBuffered = true;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.MinimumSize = new System.Drawing.Size(64, 64);
|
||||
this.Name = "ThumbnailView";
|
||||
this.Opacity = 0.1D;
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.Text = "Preview";
|
||||
this.TopMost = true;
|
||||
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.MouseDown_Handler);
|
||||
this.MouseEnter += new System.EventHandler(this.MouseEnter_Handler);
|
||||
this.MouseLeave += new System.EventHandler(this.MouseLeave_Handler);
|
||||
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.MouseMove_Handler);
|
||||
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.MouseUp_Handler);
|
||||
this.Move += new System.EventHandler(this.Move_Handler);
|
||||
this.Resize += new System.EventHandler(this.Resize_Handler);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
566
src/Eve-O-Preview/View/Implementation/ThumbnailView.cs
Normal file
566
src/Eve-O-Preview/View/Implementation/ThumbnailView.cs
Normal file
@@ -0,0 +1,566 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using EveOPreview.Services;
|
||||
using EveOPreview.UI.Hotkeys;
|
||||
|
||||
namespace EveOPreview.View
|
||||
{
|
||||
public abstract partial class ThumbnailView : Form, IThumbnailView
|
||||
{
|
||||
#region Private constants
|
||||
private const int RESIZE_EVENT_TIMEOUT = 500;
|
||||
private const double OPACITY_THRESHOLD = 0.9;
|
||||
private const double OPACITY_EPSILON = 0.1;
|
||||
#endregion
|
||||
|
||||
#region Private fields
|
||||
private readonly ThumbnailOverlay _overlay;
|
||||
|
||||
// Part of the logic (namely current size / position management)
|
||||
// was moved to the view due to the performance reasons
|
||||
private bool _isOverlayVisible;
|
||||
private bool _isTopMost;
|
||||
private bool _isHighlightEnabled;
|
||||
private bool _isHighlightRequested;
|
||||
private int _highlightWidth;
|
||||
|
||||
private bool _isLocationChanged;
|
||||
private bool _isSizeChanged;
|
||||
|
||||
private bool _isCustomMouseModeActive;
|
||||
|
||||
private double _opacity;
|
||||
|
||||
private DateTime _suppressResizeEventsTimestamp;
|
||||
private Size _baseZoomSize;
|
||||
private Point _baseZoomLocation;
|
||||
private Point _baseMousePosition;
|
||||
private Size _baseZoomMaximumSize;
|
||||
|
||||
private HotkeyHandler _hotkeyHandler;
|
||||
#endregion
|
||||
|
||||
protected ThumbnailView(IWindowManager windowManager)
|
||||
{
|
||||
this.SuppressResizeEvent();
|
||||
|
||||
this.WindowManager = windowManager;
|
||||
|
||||
this.IsActive = false;
|
||||
|
||||
this.IsOverlayEnabled = false;
|
||||
this._isOverlayVisible = false;
|
||||
this._isTopMost = false;
|
||||
this._isHighlightEnabled = false;
|
||||
this._isHighlightRequested = false;
|
||||
|
||||
this._isLocationChanged = true;
|
||||
this._isSizeChanged = true;
|
||||
|
||||
this._isCustomMouseModeActive = false;
|
||||
|
||||
this._opacity = 0.1;
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
this._overlay = new ThumbnailOverlay(this, this.MouseDown_Handler);
|
||||
}
|
||||
|
||||
protected IWindowManager WindowManager { get; }
|
||||
|
||||
public IntPtr Id { get; set; }
|
||||
|
||||
public string Title
|
||||
{
|
||||
get => this.Text;
|
||||
set
|
||||
{
|
||||
this.Text = value;
|
||||
this._overlay.SetOverlayLabel(value);
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
public bool IsOverlayEnabled { get; set; }
|
||||
|
||||
public Point ThumbnailLocation
|
||||
{
|
||||
get => this.Location;
|
||||
set
|
||||
{
|
||||
if ((value.X > 0) || (value.Y > 0))
|
||||
{
|
||||
this.StartPosition = FormStartPosition.Manual;
|
||||
}
|
||||
this.Location = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Size ThumbnailSize
|
||||
{
|
||||
get => this.ClientSize;
|
||||
set => this.ClientSize = value;
|
||||
}
|
||||
|
||||
public Action<IntPtr> ThumbnailResized { get; set; }
|
||||
|
||||
public Action<IntPtr> ThumbnailMoved { get; set; }
|
||||
|
||||
public Action<IntPtr> ThumbnailFocused { get; set; }
|
||||
|
||||
public Action<IntPtr> ThumbnailLostFocus { get; set; }
|
||||
|
||||
public Action<IntPtr> ThumbnailActivated { get; set; }
|
||||
|
||||
public Action<IntPtr, bool> ThumbnailDeactivated { get; set; }
|
||||
|
||||
public new void Show()
|
||||
{
|
||||
this.SuppressResizeEvent();
|
||||
|
||||
base.Show();
|
||||
|
||||
this._isLocationChanged = true;
|
||||
this._isSizeChanged = true;
|
||||
this._isOverlayVisible = false;
|
||||
|
||||
this.Refresh(true);
|
||||
|
||||
this.IsActive = true;
|
||||
}
|
||||
|
||||
public new void Hide()
|
||||
{
|
||||
this.SuppressResizeEvent();
|
||||
|
||||
this.IsActive = false;
|
||||
|
||||
this._overlay.Hide();
|
||||
base.Hide();
|
||||
}
|
||||
|
||||
public new virtual void Close()
|
||||
{
|
||||
this.SuppressResizeEvent();
|
||||
|
||||
this.IsActive = false;
|
||||
this._overlay.Close();
|
||||
base.Close();
|
||||
}
|
||||
|
||||
// This method is used to determine if the provided Handle is related to client or its thumbnail
|
||||
public bool IsKnownHandle(IntPtr handle)
|
||||
{
|
||||
return (this.Id == handle) || (this.Handle == handle) || (this._overlay.Handle == handle);
|
||||
}
|
||||
|
||||
public void SetSizeLimitations(Size minimumSize, Size maximumSize)
|
||||
{
|
||||
this.MinimumSize = minimumSize;
|
||||
this.MaximumSize = maximumSize;
|
||||
}
|
||||
|
||||
public void SetOpacity(double opacity)
|
||||
{
|
||||
if (opacity >= OPACITY_THRESHOLD)
|
||||
{
|
||||
opacity = 1.0;
|
||||
}
|
||||
|
||||
if (Math.Abs(opacity - this._opacity) < OPACITY_EPSILON)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
this.Opacity = opacity;
|
||||
|
||||
// Overlay opacity settings
|
||||
// Of the thumbnail's opacity is almost full then set the overlay's one to
|
||||
// full. Otherwise set it to half of the thumbnail opacity
|
||||
// Opacity value is stored even if the overlay is not displayed atm
|
||||
this._overlay.Opacity = opacity > 0.8 ? 1.0 : 1.0 - (1.0 - opacity) / 2;
|
||||
|
||||
this._opacity = opacity;
|
||||
}
|
||||
catch (Win32Exception)
|
||||
{
|
||||
// Something went wrong in WinForms internals
|
||||
// Opacity will be updated in the next cycle
|
||||
}
|
||||
}
|
||||
|
||||
public void SetFrames(bool enable)
|
||||
{
|
||||
FormBorderStyle style = enable ? FormBorderStyle.SizableToolWindow : FormBorderStyle.None;
|
||||
|
||||
// No need to change the borders style if it is ALREADY correct
|
||||
if (this.FormBorderStyle == style)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.SuppressResizeEvent();
|
||||
|
||||
this.FormBorderStyle = style;
|
||||
}
|
||||
|
||||
public void SetTopMost(bool enableTopmost)
|
||||
{
|
||||
if (this._isTopMost == enableTopmost)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.TopLevel = enableTopmost;
|
||||
this.TopMost = enableTopmost;
|
||||
this._overlay.TopMost = enableTopmost;
|
||||
|
||||
this._isTopMost = enableTopmost;
|
||||
}
|
||||
|
||||
public void SetHighlight(bool enabled, Color color, int width)
|
||||
{
|
||||
if (this._isHighlightRequested == enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
this._isHighlightRequested = true;
|
||||
this._highlightWidth = width;
|
||||
this.BackColor = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._isHighlightRequested = false;
|
||||
this.BackColor = SystemColors.Control;
|
||||
}
|
||||
|
||||
this._isSizeChanged = true;
|
||||
}
|
||||
|
||||
public void ZoomIn(ViewZoomAnchor anchor, int zoomFactor)
|
||||
{
|
||||
int oldWidth = this._baseZoomSize.Width;
|
||||
int oldHeight = this._baseZoomSize.Height;
|
||||
|
||||
int locationX = this.Location.X;
|
||||
int locationY = this.Location.Y;
|
||||
|
||||
int clientSizeWidth = this.ClientSize.Width;
|
||||
int clientSizeHeight = this.ClientSize.Height;
|
||||
int newWidth = (zoomFactor * clientSizeWidth) + (this.Size.Width - clientSizeWidth);
|
||||
int newHeight = (zoomFactor * clientSizeHeight) + (this.Size.Height - clientSizeHeight);
|
||||
|
||||
// First change size, THEN move the window
|
||||
// Otherwise there is a chance to fail in a loop
|
||||
// Zoom required -> Moved the windows 1st -> Focus is lost -> Window is moved back -> Focus is back on -> Zoom required -> ...
|
||||
this.MaximumSize = new Size(0, 0);
|
||||
this.Size = new Size(newWidth, newHeight);
|
||||
|
||||
switch (anchor)
|
||||
{
|
||||
case ViewZoomAnchor.NW:
|
||||
break;
|
||||
case ViewZoomAnchor.N:
|
||||
this.Location = new Point(locationX - newWidth / 2 + oldWidth / 2, locationY);
|
||||
break;
|
||||
case ViewZoomAnchor.NE:
|
||||
this.Location = new Point(locationX - newWidth + oldWidth, locationY);
|
||||
break;
|
||||
|
||||
case ViewZoomAnchor.W:
|
||||
this.Location = new Point(locationX, locationY - newHeight / 2 + oldHeight / 2);
|
||||
break;
|
||||
case ViewZoomAnchor.C:
|
||||
this.Location = new Point(locationX - newWidth / 2 + oldWidth / 2, locationY - newHeight / 2 + oldHeight / 2);
|
||||
break;
|
||||
case ViewZoomAnchor.E:
|
||||
this.Location = new Point(locationX - newWidth + oldWidth, locationY - newHeight / 2 + oldHeight / 2);
|
||||
break;
|
||||
|
||||
case ViewZoomAnchor.SW:
|
||||
this.Location = new Point(locationX, locationY - newHeight + this._baseZoomSize.Height);
|
||||
break;
|
||||
case ViewZoomAnchor.S:
|
||||
this.Location = new Point(locationX - newWidth / 2 + oldWidth / 2, locationY - newHeight + oldHeight);
|
||||
break;
|
||||
case ViewZoomAnchor.SE:
|
||||
this.Location = new Point(locationX - newWidth + oldWidth, locationY - newHeight + oldHeight);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void ZoomOut()
|
||||
{
|
||||
this.RestoreWindowSizeAndLocation();
|
||||
}
|
||||
|
||||
public void RegisterHotkey(Keys hotkey)
|
||||
{
|
||||
if (this._hotkeyHandler != null)
|
||||
{
|
||||
this.UnregisterHotkey();
|
||||
}
|
||||
|
||||
if (hotkey == Keys.None)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this._hotkeyHandler = new HotkeyHandler(this.Handle, hotkey);
|
||||
this._hotkeyHandler.Pressed += HotkeyPressed_Handler;
|
||||
this._hotkeyHandler.Register();
|
||||
}
|
||||
|
||||
public void UnregisterHotkey()
|
||||
{
|
||||
if (this._hotkeyHandler == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this._hotkeyHandler.Unregister();
|
||||
this._hotkeyHandler.Pressed -= HotkeyPressed_Handler;
|
||||
this._hotkeyHandler.Dispose();
|
||||
this._hotkeyHandler = null;
|
||||
}
|
||||
|
||||
public void Refresh(bool forceRefresh)
|
||||
{
|
||||
this.RefreshThumbnail(forceRefresh);
|
||||
this.HighlightThumbnail(forceRefresh || this._isSizeChanged);
|
||||
this.RefreshOverlay(forceRefresh || this._isSizeChanged || this._isLocationChanged);
|
||||
|
||||
this._isSizeChanged = false;
|
||||
}
|
||||
|
||||
protected abstract void RefreshThumbnail(bool forceRefresh);
|
||||
|
||||
protected abstract void ResizeThumbnail(int baseWidth, int baseHeight, int highlightWidthTop, int highlightWidthRight, int highlightWidthBottom, int highlightWidthLeft);
|
||||
|
||||
private void HighlightThumbnail(bool forceRefresh)
|
||||
{
|
||||
if (!forceRefresh && (this._isHighlightRequested == this._isHighlightEnabled))
|
||||
{
|
||||
// Nothing to do here
|
||||
return;
|
||||
}
|
||||
|
||||
this._isHighlightEnabled = this._isHighlightRequested;
|
||||
|
||||
int baseWidth = this.ClientSize.Width;
|
||||
int baseHeight = this.ClientSize.Height;
|
||||
|
||||
if (!this._isHighlightRequested)
|
||||
{
|
||||
//No highlighting enabled, so no math required
|
||||
this.ResizeThumbnail(baseWidth, baseHeight, 0, 0, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
double baseAspectRatio = ((double)baseWidth) / baseHeight;
|
||||
|
||||
int actualHeight = baseHeight - 2 * this._highlightWidth;
|
||||
double desiredWidth = actualHeight * baseAspectRatio;
|
||||
int actualWidth = (int)Math.Round(desiredWidth, MidpointRounding.AwayFromZero);
|
||||
int highlightWidthLeft = (baseWidth - actualWidth) / 2;
|
||||
int highlightWidthRight = baseWidth - actualWidth - highlightWidthLeft;
|
||||
|
||||
this.ResizeThumbnail(this.ClientSize.Width, this.ClientSize.Height, this._highlightWidth, highlightWidthRight, this._highlightWidth, highlightWidthLeft);
|
||||
}
|
||||
|
||||
private void RefreshOverlay(bool forceRefresh)
|
||||
{
|
||||
if (this._isOverlayVisible && !forceRefresh)
|
||||
{
|
||||
// No need to update anything. Everything is already set up
|
||||
return;
|
||||
}
|
||||
|
||||
this._overlay.EnableOverlayLabel(this.IsOverlayEnabled);
|
||||
|
||||
if (!this._isOverlayVisible)
|
||||
{
|
||||
// One-time action to show the Overlay before it is set up
|
||||
// Otherwise its position won't be set
|
||||
this._overlay.Show();
|
||||
this._isOverlayVisible = true;
|
||||
}
|
||||
|
||||
Size overlaySize = this.ClientSize;
|
||||
Point overlayLocation = this.Location;
|
||||
|
||||
int borderWidth = (this.Size.Width - this.ClientSize.Width) / 2;
|
||||
overlayLocation.X += borderWidth;
|
||||
overlayLocation.Y += (this.Size.Height - this.ClientSize.Height) - borderWidth;
|
||||
|
||||
this._isLocationChanged = false;
|
||||
this._overlay.Size = overlaySize;
|
||||
this._overlay.Location = overlayLocation;
|
||||
this._overlay.Refresh();
|
||||
}
|
||||
|
||||
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.RESIZE_EVENT_TIMEOUT);
|
||||
}
|
||||
|
||||
#region GUI events
|
||||
protected override CreateParams CreateParams
|
||||
{
|
||||
get
|
||||
{
|
||||
var Params = base.CreateParams;
|
||||
Params.ExStyle |= (int)InteropConstants.WS_EX_TOOLWINDOW;
|
||||
return Params;
|
||||
}
|
||||
}
|
||||
|
||||
private void Move_Handler(object sender, EventArgs e)
|
||||
{
|
||||
this._isLocationChanged = true;
|
||||
this.ThumbnailMoved?.Invoke(this.Id);
|
||||
}
|
||||
|
||||
private void Resize_Handler(object sender, EventArgs e)
|
||||
{
|
||||
if (DateTime.UtcNow < this._suppressResizeEventsTimestamp)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this._isSizeChanged = true;
|
||||
|
||||
this.ThumbnailResized?.Invoke(this.Id);
|
||||
}
|
||||
|
||||
private void MouseEnter_Handler(object sender, EventArgs e)
|
||||
{
|
||||
this.ExitCustomMouseMode();
|
||||
this.SaveWindowSizeAndLocation();
|
||||
|
||||
this.ThumbnailFocused?.Invoke(this.Id);
|
||||
}
|
||||
|
||||
private void MouseLeave_Handler(object sender, EventArgs e)
|
||||
{
|
||||
this.ThumbnailLostFocus?.Invoke(this.Id);
|
||||
}
|
||||
|
||||
private void MouseDown_Handler(object sender, MouseEventArgs e)
|
||||
{
|
||||
this.MouseDownEventHandler(e.Button, Control.ModifierKeys);
|
||||
}
|
||||
|
||||
private void MouseMove_Handler(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (this._isCustomMouseModeActive)
|
||||
{
|
||||
this.ProcessCustomMouseMode(e.Button.HasFlag(MouseButtons.Left), e.Button.HasFlag(MouseButtons.Right));
|
||||
}
|
||||
}
|
||||
|
||||
private void MouseUp_Handler(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Right)
|
||||
{
|
||||
this.ExitCustomMouseMode();
|
||||
}
|
||||
}
|
||||
|
||||
private void HotkeyPressed_Handler(object sender, HandledEventArgs e)
|
||||
{
|
||||
this.ThumbnailActivated?.Invoke(this.Id);
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Custom Mouse mode
|
||||
// This pair of methods saves/restores certain window properties
|
||||
// Methods are used to remove the 'Zoom' effect (if any) when the
|
||||
// custom resize/move mode is activated
|
||||
// Methods are kept on this level because moving to the presenter
|
||||
// the code that responds to the mouse events like movement
|
||||
// seems like a huge overkill
|
||||
private void SaveWindowSizeAndLocation()
|
||||
{
|
||||
this._baseZoomSize = this.Size;
|
||||
this._baseZoomLocation = this.Location;
|
||||
this._baseZoomMaximumSize = this.MaximumSize;
|
||||
}
|
||||
|
||||
private void RestoreWindowSizeAndLocation()
|
||||
{
|
||||
this.Size = this._baseZoomSize;
|
||||
this.MaximumSize = this._baseZoomMaximumSize;
|
||||
this.Location = this._baseZoomLocation;
|
||||
}
|
||||
|
||||
private void EnterCustomMouseMode()
|
||||
{
|
||||
this.RestoreWindowSizeAndLocation();
|
||||
|
||||
this._isCustomMouseModeActive = true;
|
||||
this._baseMousePosition = Control.MousePosition;
|
||||
}
|
||||
|
||||
private void ProcessCustomMouseMode(bool leftButton, bool rightButton)
|
||||
{
|
||||
Point mousePosition = Control.MousePosition;
|
||||
int offsetX = mousePosition.X - this._baseMousePosition.X;
|
||||
int offsetY = mousePosition.Y - this._baseMousePosition.Y;
|
||||
this._baseMousePosition = mousePosition;
|
||||
|
||||
// Left + Right buttons trigger thumbnail resize
|
||||
// Right button only trigger thumbnail movement
|
||||
if (leftButton && rightButton)
|
||||
{
|
||||
this.Size = new Size(this.Size.Width + offsetX, this.Size.Height + offsetY);
|
||||
this._baseZoomSize = this.Size;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Location = new Point(this.Location.X + offsetX, this.Location.Y + offsetY);
|
||||
this._baseZoomLocation = this.Location;
|
||||
}
|
||||
}
|
||||
|
||||
private void ExitCustomMouseMode()
|
||||
{
|
||||
this._isCustomMouseModeActive = false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Custom GUI events
|
||||
protected virtual void MouseDownEventHandler(MouseButtons mouseButtons, Keys modifierKeys)
|
||||
{
|
||||
switch (mouseButtons)
|
||||
{
|
||||
case MouseButtons.Left when modifierKeys == Keys.Control:
|
||||
this.ThumbnailDeactivated?.Invoke(this.Id, false);
|
||||
break;
|
||||
case MouseButtons.Left when modifierKeys == (Keys.Control | Keys.Shift):
|
||||
this.ThumbnailDeactivated?.Invoke(this.Id, true);
|
||||
break;
|
||||
case MouseButtons.Left:
|
||||
this.ThumbnailActivated?.Invoke(this.Id);
|
||||
break;
|
||||
case MouseButtons.Right:
|
||||
case MouseButtons.Left | MouseButtons.Right:
|
||||
this.EnterCustomMouseMode();
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
120
src/Eve-O-Preview/View/Implementation/ThumbnailView.resx
Normal file
120
src/Eve-O-Preview/View/Implementation/ThumbnailView.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using EveOPreview.Configuration;
|
||||
|
||||
namespace EveOPreview.View
|
||||
{
|
||||
sealed class ThumbnailViewFactory : IThumbnailViewFactory
|
||||
{
|
||||
private readonly IApplicationController _controller;
|
||||
private readonly bool _isCompatibilityModeEnabled;
|
||||
|
||||
public ThumbnailViewFactory(IApplicationController controller, IThumbnailConfiguration configuration)
|
||||
{
|
||||
this._controller = controller;
|
||||
this._isCompatibilityModeEnabled = configuration.EnableCompatibilityMode;
|
||||
}
|
||||
|
||||
public IThumbnailView Create(IntPtr id, string title, Size size)
|
||||
{
|
||||
IThumbnailView view = this._isCompatibilityModeEnabled
|
||||
? (IThumbnailView)this._controller.Create<StaticThumbnailView>()
|
||||
: (IThumbnailView)this._controller.Create<LiveThumbnailView>();
|
||||
|
||||
view.Id = id;
|
||||
view.Title = title;
|
||||
view.ThumbnailSize = size;
|
||||
|
||||
return view;
|
||||
}
|
||||
}
|
||||
}
|
||||
55
src/Eve-O-Preview/View/Interface/IMainFormView.cs
Normal file
55
src/Eve-O-Preview/View/Interface/IMainFormView.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
|
||||
namespace EveOPreview.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Main view interface
|
||||
/// Presenter uses it to access GUI properties
|
||||
/// </summary>
|
||||
public interface IMainFormView : IView
|
||||
{
|
||||
bool MinimizeToTray { get; set; }
|
||||
|
||||
double ThumbnailOpacity { get; set; }
|
||||
|
||||
bool EnableClientLayoutTracking { get; set; }
|
||||
bool HideActiveClientThumbnail { get; set; }
|
||||
bool MinimizeInactiveClients { get; set; }
|
||||
bool ShowThumbnailsAlwaysOnTop { get; set; }
|
||||
bool HideThumbnailsOnLostFocus { get; set; }
|
||||
bool EnablePerClientThumbnailLayouts { get; set; }
|
||||
|
||||
Size ThumbnailSize { get; set; }
|
||||
|
||||
bool EnableThumbnailZoom { get; set; }
|
||||
int ThumbnailZoomFactor { get; set; }
|
||||
ViewZoomAnchor ThumbnailZoomAnchor { get; set; }
|
||||
|
||||
bool ShowThumbnailOverlays { get; set; }
|
||||
bool ShowThumbnailFrames { get; set; }
|
||||
|
||||
bool EnableActiveClientHighlight { get; set; }
|
||||
Color ActiveClientHighlightColor { get; set; }
|
||||
|
||||
void SetDocumentationUrl(string url);
|
||||
void SetVersionInfo(string version);
|
||||
void SetThumbnailSizeLimitations(Size minimumSize, Size maximumSize);
|
||||
|
||||
void Minimize();
|
||||
|
||||
void AddThumbnails(IList<IThumbnailDescription> thumbnails);
|
||||
void RemoveThumbnails(IList<IThumbnailDescription> thumbnails);
|
||||
void RefreshZoomSettings();
|
||||
|
||||
Action ApplicationExitRequested { get; set; }
|
||||
Action FormActivated { get; set; }
|
||||
Action FormMinimized { get; set; }
|
||||
Action<ViewCloseRequest> FormCloseRequested { get; set; }
|
||||
Action ApplicationSettingsChanged { get; set; }
|
||||
Action ThumbnailsSizeChanged { get; set; }
|
||||
Action<string> ThumbnailStateChanged { get; set; }
|
||||
Action DocumentationLinkActivated { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace EveOPreview.View
|
||||
{
|
||||
public interface IThumbnailDescription
|
||||
{
|
||||
string Title { get; set; }
|
||||
bool IsDisabled { get; set; }
|
||||
}
|
||||
}
|
||||
41
src/Eve-O-Preview/View/Interface/IThumbnailView.cs
Normal file
41
src/Eve-O-Preview/View/Interface/IThumbnailView.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace EveOPreview.View
|
||||
{
|
||||
public interface IThumbnailView : IView
|
||||
{
|
||||
IntPtr Id { get; set; }
|
||||
string Title { get; set; }
|
||||
|
||||
bool IsActive { get; set; }
|
||||
Point ThumbnailLocation { get; set; }
|
||||
Size ThumbnailSize { get; set; }
|
||||
bool IsOverlayEnabled { get; set; }
|
||||
|
||||
bool IsKnownHandle(IntPtr handle);
|
||||
|
||||
void SetSizeLimitations(Size minimumSize, Size maximumSize);
|
||||
void SetOpacity(double opacity);
|
||||
void SetFrames(bool enable);
|
||||
void SetTopMost(bool enableTopmost);
|
||||
void SetHighlight(bool enabled, Color color, int width);
|
||||
|
||||
void ZoomIn(ViewZoomAnchor anchor, int zoomFactor);
|
||||
void ZoomOut();
|
||||
|
||||
void RegisterHotkey(Keys hotkey);
|
||||
void UnregisterHotkey();
|
||||
|
||||
void Refresh(bool forceRefresh);
|
||||
|
||||
Action<IntPtr> ThumbnailResized { get; set; }
|
||||
Action<IntPtr> ThumbnailMoved { get; set; }
|
||||
Action<IntPtr> ThumbnailFocused { get; set; }
|
||||
Action<IntPtr> ThumbnailLostFocus { get; set; }
|
||||
|
||||
Action<IntPtr> ThumbnailActivated { get; set; }
|
||||
Action<IntPtr, bool> ThumbnailDeactivated { get; set; }
|
||||
}
|
||||
}
|
||||
10
src/Eve-O-Preview/View/Interface/IThumbnailViewFactory.cs
Normal file
10
src/Eve-O-Preview/View/Interface/IThumbnailViewFactory.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
namespace EveOPreview.View
|
||||
{
|
||||
public interface IThumbnailViewFactory
|
||||
{
|
||||
IThumbnailView Create(IntPtr id, string title, Size size);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user