From a2c46aceea16a9f9aced2292f0491999fa4fa5ec Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Wed, 7 Jun 2017 20:08:39 +0300 Subject: [PATCH] Removed old wpf control host and added new nuget package --- packages.cake | 15 ++++++ .../Embedding/WpfAvaloniaControlHost.cs | 52 ------------------- 2 files changed, 15 insertions(+), 52 deletions(-) delete mode 100644 src/Windows/Avalonia.Win32/Embedding/WpfAvaloniaControlHost.cs diff --git a/packages.cake b/packages.cake index 1e8e356694..bc1aeef416 100644 --- a/packages.cake +++ b/packages.cake @@ -465,6 +465,21 @@ public class Packages BasePath = context.Directory("./"), OutputDirectory = parameters.NugetRoot }, + new NuGetPackSettings() + { + Id = "Avalonia.Win32.Interoperability", + Dependencies = new [] + { + new NuSpecDependency() { Id = "Avalonia.Win32", Version = parameters.Version }, + new NuSpecDependency() { Id = "Avalonia.Direct2D1", Version = parameters.Version }, + }, + Files = new [] + { + new NuSpecContent { Source = "Avalonia.Win32.Interop/bin/" + parameters.DirSuffix + "/Avalonia.Win32.Interop.dll", Target = "lib/net45" } + }, + BasePath = context.Directory("./src/Windows"), + OutputDirectory = parameters.NugetRoot + }, /////////////////////////////////////////////////////////////////////////////// // Avalonia.LinuxFramebuffer /////////////////////////////////////////////////////////////////////////////// diff --git a/src/Windows/Avalonia.Win32/Embedding/WpfAvaloniaControlHost.cs b/src/Windows/Avalonia.Win32/Embedding/WpfAvaloniaControlHost.cs deleted file mode 100644 index 663f6906ed..0000000000 --- a/src/Windows/Avalonia.Win32/Embedding/WpfAvaloniaControlHost.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Forms.Integration; -using System.Windows.Interop; -using Avalonia.Controls; -using Avalonia.Win32.Interop; - -namespace Avalonia.Win32.Embedding -{ - public class WpfAvaloniaControlHost : HwndHost - { - private WinFormsAvaloniaControlHost _host; - private Avalonia.Controls.Control _content; - - public Avalonia.Controls.Control Content - { - get { return _content; } - set - { - if (_host != null) - _host.Content = value; - _content = value; - - } - } - - void DestroyHost() - { - _host?.Dispose(); - _host = null; - } - - protected override HandleRef BuildWindowCore(HandleRef hwndParent) - { - DestroyHost(); - _host = new WinFormsAvaloniaControlHost {Content = _content}; - UnmanagedMethods.SetParent(_host.Handle, hwndParent.Handle); - return new HandleRef(this, _host.Handle); - } - - protected override void DestroyWindowCore(HandleRef hwnd) - { - DestroyHost(); - } - } -}