Refresh solution and add WindowsFormsAero as NuGet package

This commit is contained in:
Lorenz Cuno Klopfenstein 2017-11-29 23:16:52 +01:00
parent 9ab38b5963
commit 57d8fed017
17 changed files with 202 additions and 174 deletions

1
.gitignore vendored
View file

@ -5,3 +5,4 @@
Installer/OnTopReplica-Setup.exe
*.user
*.suo
packages/

View file

@ -1,20 +1,55 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual C# Express 2010
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27004.2008
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OnTopReplica", "OnTopReplica\OnTopReplica.csproj", "{E626BD6E-BF38-4EB7-A128-5CA6F40EF557}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Debug|x64.ActiveCfg = Debug|Any CPU
{E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Debug|x64.Build.0 = Debug|Any CPU
{E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Debug|x86.ActiveCfg = Debug|Any CPU
{E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Debug|x86.Build.0 = Debug|Any CPU
{E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Release|Any CPU.Build.0 = Release|Any CPU
{E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Release|x64.ActiveCfg = Release|Any CPU
{E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Release|x64.Build.0 = Release|Any CPU
{E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Release|x86.ActiveCfg = Release|Any CPU
{E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Release|x86.Build.0 = Release|Any CPU
{01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Debug|x64.ActiveCfg = Debug|x64
{01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Debug|x64.Build.0 = Debug|x64
{01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Debug|x64.Deploy.0 = Debug|x64
{01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Debug|x86.ActiveCfg = Debug|x86
{01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Debug|x86.Build.0 = Debug|x86
{01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Debug|x86.Deploy.0 = Debug|x86
{01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Release|Any CPU.Build.0 = Release|Any CPU
{01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Release|Any CPU.Deploy.0 = Release|Any CPU
{01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Release|x64.ActiveCfg = Release|x64
{01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Release|x64.Build.0 = Release|x64
{01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Release|x64.Deploy.0 = Release|x64
{01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Release|x86.ActiveCfg = Release|x86
{01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Release|x86.Build.0 = Release|x86
{01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Release|x86.Deploy.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3F135F78-F70E-4127-BA77-6C262C7CCCEF}
EndGlobalSection
EndGlobal

View file

@ -4,14 +4,13 @@ using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using OnTopReplica.Native;
using WindowsFormsAero.Dwm.Helpers;
namespace OnTopReplica {
/// <summary>
/// Form that automatically keeps a certain aspect ratio and resizes without flickering.
/// </summary>
public class AspectRatioForm : GlassForm {
public class AspectRatioForm : WindowsFormsAero.AeroForm {
bool _keepAspectRatio = true;

View file

@ -97,9 +97,8 @@ namespace OnTopReplica {
private void CommonCompleteSwitch(bool enabled) {
//UI stuff switching
_mainForm.GlassEnabled = !enabled;
_mainForm.GlassMargins = (!enabled) ? new Padding(-1) : Padding.Empty;
_mainForm.TopMost = !enabled;
_mainForm.HandleMouseMove = !enabled;
IsFullscreen = enabled;

View file

@ -64,8 +64,7 @@ namespace OnTopReplica {
//Window init
KeepAspectRatio = false;
GlassEnabled = true;
GlassMargins = new Margins(-1);
GlassMargins = new Padding(-1);
//Managers
_msgPumpManager.Initialize(this);

View file

@ -18,9 +18,9 @@ namespace OnTopReplica {
set {
if (value && Settings.Default.FirstTimeClickForwarding) {
TaskDialog dlg = new TaskDialog(Strings.InfoClickForwarding, Strings.InfoClickForwardingTitle, Strings.InfoClickForwardingContent) {
CommonButtons = TaskDialogButton.Yes | TaskDialogButton.No
CommonButtons = CommonButton.Yes | CommonButton.No
};
if (dlg.Show(this).CommonButton == Result.No)
if (dlg.Show(this).CommonButton == CommonButtonResult.No)
return;
Settings.Default.FirstTimeClickForwarding = false;

View file

@ -54,7 +54,7 @@ namespace OnTopReplica {
/// <param name="errorMessage">Expanded error codes/messages.</param>
private void ShowErrorDialog(string mainInstruction, string explanation, string errorMessage) {
TaskDialog dlg = new TaskDialog(mainInstruction, Strings.ErrorGenericTitle, explanation) {
CommonIcon = TaskDialogIcon.Stop,
CommonIcon = CommonIcon.Stop,
IsExpanded = false
};
@ -85,12 +85,12 @@ namespace OnTopReplica {
var dlg = new TaskDialog(Strings.AskReset, Strings.AskResetTitle, Strings.AskResetContent);
dlg.UseCommandLinks = true;
dlg.CustomButtons = new CustomButton[] {
new CustomButton(Result.OK, Strings.AskResetButtonOk),
new CustomButton(Result.Cancel, Strings.ButtonCancel)
new CustomButton(CommonButtonResult.OK, Strings.AskResetButtonOk),
new CustomButton(CommonButtonResult.Cancel, Strings.ButtonCancel)
};
dlg.CommonIcon = TaskDialogIcon.Information;
dlg.CommonIcon = CommonIcon.Information;
if (dlg.Show(this).CommonButton == Result.OK) {
if (dlg.Show(this).CommonButton == CommonButtonResult.OK) {
ResetMainForm();
}
}

View file

@ -98,8 +98,8 @@
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="WindowsFormsAero">
<HintPath>..\Lib\WindowsFormsAero.dll</HintPath>
<Reference Include="WindowsFormsAero, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Windows-Forms-Aero.3.0.1\lib\net461\WindowsFormsAero.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@ -408,6 +408,7 @@
<LastGenOutput>Strings.pt.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="OnTopReplica.exe.manifest" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
@ -535,72 +536,72 @@
<ItemGroup>
<PublishFile Include="Assets\icon.ico">
<Visible>False</Visible>
<PublishState>Exclude</PublishState>
<IncludeHash>True</IncludeHash>
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Exclude</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>File</FileType>
</PublishFile>
<PublishFile Include="Assets\screenshot-icon.ico">
<Visible>False</Visible>
<PublishState>Exclude</PublishState>
<IncludeHash>True</IncludeHash>
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Exclude</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>File</FileType>
</PublishFile>
<PublishFile Include="Assets\window_multiple16.ico">
<Visible>False</Visible>
<PublishState>Exclude</PublishState>
<IncludeHash>True</IncludeHash>
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Exclude</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>File</FileType>
</PublishFile>
<PublishFile Include="Assets\xiao_arrow.png">
<Visible>False</Visible>
<PublishState>Exclude</PublishState>
<IncludeHash>True</IncludeHash>
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Exclude</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>File</FileType>
</PublishFile>
<PublishFile Include="cs\OnTopReplica.resources">
<Visible>False</Visible>
<PublishState>Include</PublishState>
<IncludeHash>True</IncludeHash>
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Include</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>Satellite</FileType>
</PublishFile>
<PublishFile Include="da\OnTopReplica.resources">
<Visible>False</Visible>
<PublishState>Include</PublishState>
<IncludeHash>True</IncludeHash>
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Include</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>Satellite</FileType>
</PublishFile>
<PublishFile Include="it\OnTopReplica.resources">
<Visible>False</Visible>
<PublishState>Include</PublishState>
<IncludeHash>True</IncludeHash>
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Include</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>Satellite</FileType>
</PublishFile>
</ItemGroup>

View file

@ -15,7 +15,7 @@ namespace OnTopReplica.Platforms {
}
public override void PostHandleFormInit(MainForm form) {
DwmManager.SetWindowFlip3dPolicy(form, Flip3DPolicy.ExcludeAbove);
DwmManager.SetWindowFlip3dPolicy(form, WindowsFormsAero.Flip3DPolicy.ExcludeAbove);
DwmManager.SetExcludeFromPeek(form, true);
DwmManager.SetDisallowPeek(form, true);
}

View file

@ -23,7 +23,7 @@ namespace OnTopReplica.Platforms {
//NOTE: this also makes HotKey registration critically fail on Windows 7
form.ShowInTaskbar = false;
DwmManager.SetWindowFlip3dPolicy(form, Flip3DPolicy.ExcludeAbove);
DwmManager.SetWindowFlip3dPolicy(form, WindowsFormsAero.Flip3DPolicy.ExcludeAbove);
_icon = new NotificationIcon(form);
}

View file

@ -65,11 +65,11 @@ namespace OnTopReplica {
}
/// <summary>
/// Gets the panel's desired glass margins or null if no glass surface is required.
/// Gets the panel's desired glass margins.
/// </summary>
public virtual Margins? GlassMargins {
public virtual Padding GlassMargins {
get {
return null;
return Padding.Empty;
}
}

View file

@ -4,13 +4,12 @@ using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using WindowsFormsAero.Dwm.Helpers;
namespace OnTopReplica {
/// <summary>
/// Acts as a form that can contain a SidePanel instance.
/// </summary>
partial class SidePanelContainer : GlassForm {
partial class SidePanelContainer : WindowsFormsAero.AeroForm {
EventHandler RequestClosingHandler;
@ -56,15 +55,7 @@ namespace OnTopReplica {
var minSize = panel.MinimumSize.Expand(this.Padding);
this.ClientSize = minSize;
this.EnsureMinimumClientSize(minSize);
//Enable glass if needed
var margins = panel.GlassMargins;
if (margins.HasValue) {
this.GlassMargins = margins.Value;
this.GlassEnabled = true;
}
else
this.GlassEnabled = false;
this.GlassMargins = panel.GlassMargins;
this.ResumeLayout();
}

View file

@ -23,7 +23,7 @@
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.labelVersion = new WindowsFormsAero.ThemeText.ThemedLabel();
this.labelVersion = new WindowsFormsAero.ThemeLabel();
this.panelContents = new OnTopReplica.SidePanels.AboutPanelContents();
this.SuspendLayout();
//
@ -66,7 +66,7 @@
#endregion
private WindowsFormsAero.ThemeText.ThemedLabel labelVersion;
private WindowsFormsAero.ThemeLabel labelVersion;
private AboutPanelContents panelContents;
}

View file

@ -23,9 +23,9 @@ namespace OnTopReplica.SidePanels {
}
}
public override Margins? GlassMargins {
public override Padding GlassMargins {
get {
return new Margins(0, 0, 0, labelVersion.Height);
return new Padding(0, 0, 0, labelVersion.Height);
}
}

View file

@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using WindowsFormsAero.Dwm;
using WindowsFormsAero.ThemeText;
using System.Drawing;
using System.Windows.Forms.VisualStyles;
using OnTopReplica.Native;
@ -16,7 +15,7 @@ namespace OnTopReplica {
Thumbnail _thumbnail = null;
//Labels
ThemedLabel _labelGlass;
WindowsFormsAero.ThemeLabel _labelGlass;
public ThumbnailPanel() {
InitFormComponents();
@ -26,7 +25,7 @@ namespace OnTopReplica {
BackColor = Color.Black;
//Themed Label
_labelGlass = new ThemedLabel {
_labelGlass = new WindowsFormsAero.ThemeLabel {
Dock = DockStyle.Fill,
ForeColor = SystemColors.ControlText,
Location = Point.Empty,
@ -138,11 +137,11 @@ namespace OnTopReplica {
get {
if (_thumbnail != null && !_thumbnail.IsInvalid) {
if (_regionEnabled) {
return _currentRegion.ComputeRegionSize(_thumbnail.SourceSize);
return _currentRegion.ComputeRegionSize(_thumbnail.GetSourceSize());
}
else {
//Thumbnail is not cropped, return full thumbnail source size
return _thumbnail.SourceSize;
return _thumbnail.GetSourceSize();
}
}
else {
@ -164,7 +163,7 @@ namespace OnTopReplica {
public Size ThumbnailOriginalSize {
get {
if (_thumbnail != null && !_thumbnail.IsInvalid) {
return _thumbnail.SourceSize;
return _thumbnail.GetSourceSize();
}
else {
#if DEBUG
@ -272,7 +271,7 @@ namespace OnTopReplica {
System.Diagnostics.Debug.WriteLine("Fitting {0} inside {1} as {2}. Padding {3},{4}.", sourceSize, Size, _thumbnailSize, _padWidth, _padHeight);
var target = new Rectangle(_padWidth, _padHeight, _thumbnailSize.Width, _thumbnailSize.Height);
Rectangle source = (_regionEnabled) ? _currentRegion.ComputeRegionRectangle(_thumbnail.SourceSize) : new Rectangle(Point.Empty, _thumbnail.SourceSize);
Rectangle source = (_regionEnabled) ? _currentRegion.ComputeRegionRectangle(_thumbnail.GetSourceSize()) : new Rectangle(Point.Empty, _thumbnail.GetSourceSize());
_thumbnail.Update(target, source, ThumbnailOpacity, true, true);
}

View file

@ -146,14 +146,14 @@ namespace OnTopReplica.Update {
Instruction = string.Format(Strings.UpdateAvailableInstruction, LastInformation.LatestVersion),
Content = Strings.UpdateAvailableContent,
CustomButtons = new CustomButton[] {
new CustomButton(Result.OK, string.Format(Strings.UpdateAvailableCommandOk, LastInformation.LatestVersion)),
new CustomButton(Result.Cancel, Strings.UpdateAvailableCommandCancel)
new CustomButton(CommonButtonResult.OK, string.Format(Strings.UpdateAvailableCommandOk, LastInformation.LatestVersion)),
new CustomButton(CommonButtonResult.Cancel, Strings.UpdateAvailableCommandCancel)
},
UseCommandLinks = true,
CommonIcon = TaskDialogIcon.Information,
CommonIcon = CommonIcon.Information,
ExpandedInformation = string.Format(Strings.UpdateAvailableExpanded, LastInformation.CurrentVersion, LastInformation.LatestVersion),
};
if (updateDialog.Show(AttachedForm).CommonButton == Result.OK) {
if (updateDialog.Show(AttachedForm).CommonButton == CommonButtonResult.OK) {
Shell.Execute(LastInformation.DownloadPage);
}
}
@ -175,9 +175,9 @@ namespace OnTopReplica.Update {
Instruction = Strings.UpdateInfoInstruction,
Content = Strings.UpdateInfoContent,
EnableHyperlinks = true,
CommonButtons = TaskDialogButton.Close,
CommonButtons = CommonButton.Close,
AllowDialogCancellation = true,
CommonIcon = TaskDialogIcon.Information,
CommonIcon = CommonIcon.Information,
Footer = string.Format(Strings.UpdateInfoFooter, LastInformation.LatestVersionRelease.ToLongDateString())
};
dlg.HyperlinkClick += delegate(object sender, HyperlinkEventArgs args) {

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Windows-Forms-Aero" version="3.0.1" targetFramework="net47" />
</packages>