Browse Source

Removed old wpf control host and added new nuget package

pull/1016/head
Nikita Tsukanov 9 years ago
parent
commit
a2c46aceea
  1. 15
      packages.cake
  2. 52
      src/Windows/Avalonia.Win32/Embedding/WpfAvaloniaControlHost.cs

15
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
///////////////////////////////////////////////////////////////////////////////

52
src/Windows/Avalonia.Win32/Embedding/WpfAvaloniaControlHost.cs

@ -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();
}
}
}
Loading…
Cancel
Save