diff --git a/build.cake b/build.cake index aa35d88aac..4dfbf67c10 100644 --- a/build.cake +++ b/build.cake @@ -93,7 +93,6 @@ Task("Clean") CleanDirectory(parameters.NugetRoot); CleanDirectory(parameters.ZipRoot); CleanDirectory(parameters.BinRoot); - CleanDirectory(parameters.DesignerTestsRoot); }); Task("Restore-NuGet-Packages") @@ -183,7 +182,6 @@ void RunCoreTest(string project, Parameters parameters, bool coreOnly = false) Task("Run-Unit-Tests") .IsDependentOn("Build") - .IsDependentOn("Run-Designer-Unit-Tests") .IsDependentOn("Run-Render-Tests") .WithCriteria(() => !parameters.SkipTests) .Does(() => { @@ -210,25 +208,6 @@ Task("Run-Render-Tests") RunCoreTest("./tests/Avalonia.Direct2D1.RenderTests/Avalonia.Direct2D1.RenderTests.csproj", parameters, true); }); -Task("Run-Designer-Unit-Tests") - .IsDependentOn("Build") - .WithCriteria(() => !parameters.SkipTests && parameters.IsRunningOnWindows) - .Does(() => -{ - var toolPath = (parameters.IsPlatformAnyCPU || parameters.IsPlatformX86) ? - Context.Tools.Resolve("xunit.console.x86.exe") : - Context.Tools.Resolve("xunit.console.exe"); - - var xUnitSettings = new XUnit2Settings - { - ToolPath = toolPath, - Parallelism = ParallelismOption.None, - ShadowCopy = false, - }; - - XUnit2("./artifacts/designer-tests/Avalonia.DesignerSupport.Tests.dll", xUnitSettings); -}); - Task("Copy-Files") .IsDependentOn("Run-Unit-Tests") .Does(() => @@ -376,7 +355,6 @@ Task("Inspect") { var badIssues = new []{"PossibleNullReferenceException"}; var whitelist = new []{"tests", "src\\android", "src\\ios", - "src\\windows\\avalonia.designer", "src\\markup\\avalonia.markup.xaml\\portablexaml\\portable.xaml.github"}; Information("Running code inspections"); diff --git a/parameters.cake b/parameters.cake index 9e6eaa9d27..759846c658 100644 --- a/parameters.cake +++ b/parameters.cake @@ -30,7 +30,6 @@ public class Parameters public DirectoryPath NugetRoot { get; private set; } public DirectoryPath ZipRoot { get; private set; } public DirectoryPath BinRoot { get; private set; } - public DirectoryPath DesignerTestsRoot { get; private set; } public string DirSuffix { get; private set; } public string DirSuffixIOS { get; private set; } public DirectoryPathCollection BuildDirs { get; private set; } @@ -106,7 +105,6 @@ public class Parameters NugetRoot = ArtifactsDir.Combine("nuget"); ZipRoot = ArtifactsDir.Combine("zip"); BinRoot = ArtifactsDir.Combine("bin"); - DesignerTestsRoot = ArtifactsDir.Combine("designer-tests"); BuildDirs = context.GetDirectories("**/bin") + context.GetDirectories("**/obj"); diff --git a/src/Avalonia.DesignerSupport/DesignerApi.cs b/src/Avalonia.DesignerSupport/DesignerApi.cs deleted file mode 100644 index cbbfbffec8..0000000000 --- a/src/Avalonia.DesignerSupport/DesignerApi.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; - -namespace Avalonia.DesignerSupport -{ - class DesignerApiDictionary - { - public Dictionary Dictionary { get; set; } - - public DesignerApiDictionary(Dictionary dictionary) - { - Dictionary = dictionary; - } - - protected object Get([CallerMemberName] string name = null) - { - object rv; - Dictionary.TryGetValue(name, out rv); - return rv; - } - - protected void Set(object value, [CallerMemberName] string name = null) - { - Dictionary[name] = value; - } - } - - class DesignerApi : DesignerApiDictionary - { - public Action UpdateXaml - { - get { return (Action) Get(); } - set {Set(value); } - } - - public Action> UpdateXaml2 - { - get { return (Action>)Get(); } - set { Set(value); } - } - - public Action OnResize - { - get { return (Action) Get(); } - set { Set(value);} - } - - public Action OnWindowCreated - { - set { Set(value); } - get { return (Action) Get(); } - } - - public Action SetScalingFactor - { - set { Set(value);} - get { return (Action) Get(); } - } - - public DesignerApi(Dictionary dictionary) : base(dictionary) - { - } - } - - class DesignerApiXamlFileInfo : DesignerApiDictionary - { - public string Xaml - { - get { return (string)Get(); } - set { Set(value); } - } - - public string AssemblyPath - { - get { return (string) Get(); } - set { Set(value); } - } - - public DesignerApiXamlFileInfo(Dictionary dictionary) : base(dictionary) - { - } - - public DesignerApiXamlFileInfo(): base(new Dictionary()) - { - - } - } -} diff --git a/src/Avalonia.DesignerSupport/DesignerAssist.cs b/src/Avalonia.DesignerSupport/DesignerAssist.cs deleted file mode 100644 index f6f704b838..0000000000 --- a/src/Avalonia.DesignerSupport/DesignerAssist.cs +++ /dev/null @@ -1,100 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Text; -using Avalonia.Controls; -using Avalonia.Controls.Platform; -using Avalonia.Markup.Xaml; -using Avalonia.Platform; -using Avalonia.Styling; -using Avalonia.Themes.Default; - -namespace Avalonia.DesignerSupport -{ - class DesignerAssist - { - class DesignerApp : Application - { - public override void Initialize() - { - Styles.Add(new DefaultTheme()); - - var loader = new AvaloniaXamlLoader(); - var baseLight = (IStyle)loader.Load( - new Uri("resm:Avalonia.Themes.Default.Accents.BaseLight.xaml?assembly=Avalonia.Themes.Default"), null); - Styles.Add(baseLight); - } - } - - public static DesignerApi Api { get; set; } - - public static void Init(Dictionary shared) - { - Design.IsDesignMode = true; - Api = new DesignerApi(shared) {UpdateXaml = UpdateXaml, UpdateXaml2 = UpdateXaml2, SetScalingFactor = SetScalingFactor}; - - var runtimeAssembly = Assembly.Load(new AssemblyName("Avalonia.DotNetFrameworkRuntime")); - - var plat = (IRuntimePlatform) Activator.CreateInstance(runtimeAssembly - .DefinedTypes.First(typeof (IRuntimePlatform).GetTypeInfo().IsAssignableFrom).AsType()); - - TypeInfo app = null; - var asms = plat.GetLoadedAssemblies(); - foreach (var asm in asms) - { - if(Equals(asm, typeof(Application).GetTypeInfo().Assembly) || Equals(asm, typeof(DesignerApp).GetTypeInfo().Assembly)) - continue; - try - { - app = asm.DefinedTypes.Where(typeof (Application).GetTypeInfo().IsAssignableFrom).FirstOrDefault(); - if (app != null) - break; - - } - catch - { - //Ignore, Assembly.DefinedTypes threw an exception, we can't do anything about that - } - } - - var builderType = runtimeAssembly.GetType("Avalonia.AppBuilder"); - - var builder = (dynamic)Activator.CreateInstance(builderType, - app == null ? new DesignerApp() : (Application) Activator.CreateInstance(app.AsType())); - builder - .UseWindowingSubsystem("Avalonia.Win32") - .UseRenderingSubsystem("Avalonia.Direct2D1") - .SetupWithoutStarting(); - } - - private static void SetScalingFactor(double factor) - { - PlatformManager.SetDesignerScalingFactor(factor); - s_currentWindow?.PlatformImpl?.Resize(s_currentWindow.ClientSize); - } - - static Window s_currentWindow; - - private static void UpdateXaml(string xaml) => UpdateXaml2(new DesignerApiXamlFileInfo - { - Xaml = xaml - }.Dictionary); - - private static void UpdateXaml2(Dictionary dic) - { - var xamlInfo = new DesignerApiXamlFileInfo(dic); - Window window = DesignWindowLoader.LoadDesignerWindow(xamlInfo.Xaml, xamlInfo.AssemblyPath); - - s_currentWindow?.Close(); - s_currentWindow = window; - - // ReSharper disable once PossibleNullReferenceException - // Always not null at this point - Api.OnWindowCreated?.Invoke(window.PlatformImpl.Handle.Handle); - Api.OnResize?.Invoke(); - } - } -} diff --git a/src/Windows/Avalonia.Designer/App.config b/src/Windows/Avalonia.Designer/App.config deleted file mode 100644 index d1428ad712..0000000000 --- a/src/Windows/Avalonia.Designer/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/src/Windows/Avalonia.Designer/App.xaml b/src/Windows/Avalonia.Designer/App.xaml deleted file mode 100644 index 720e53c1c2..0000000000 --- a/src/Windows/Avalonia.Designer/App.xaml +++ /dev/null @@ -1,8 +0,0 @@ - - - diff --git a/src/Windows/Avalonia.Designer/App.xaml.cs b/src/Windows/Avalonia.Designer/App.xaml.cs deleted file mode 100644 index 20d836cda6..0000000000 --- a/src/Windows/Avalonia.Designer/App.xaml.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace Avalonia.Designer -{ - /// - /// Interaction logic for App.xaml - /// - internal partial class App - { - public App() - { - InitializeComponent(); - } - } -} diff --git a/src/Windows/Avalonia.Designer/AppHost/AvaloniaAppHost.cs b/src/Windows/Avalonia.Designer/AppHost/AvaloniaAppHost.cs deleted file mode 100644 index d06e4929fa..0000000000 --- a/src/Windows/Avalonia.Designer/AppHost/AvaloniaAppHost.cs +++ /dev/null @@ -1,225 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading; -using System.Windows.Forms; -using System.Windows.Forms.Integration; -using System.Xml; -using Avalonia.Designer.Comm; -using Avalonia.Designer.InProcDesigner; -using Timer = System.Windows.Forms.Timer; -using Avalonia.DesignerSupport; - -namespace Avalonia.Designer.AppHost -{ - class AvaloniaAppHost - { - private string _appDir; - private readonly CommChannel _comm; - private string _lastXaml; - private string _currentXaml; - private string _currentSourceAssembly; - private bool _initSuccess; - private readonly HostedAppModel _appModel; - private Control _window; - - public AvaloniaAppHost(CommChannel channel) - { - _comm = channel; - _appModel = new HostedAppModel(this); - } - - public void Start() - { - AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; - _comm.OnMessage += Channel_OnMessage; - _comm.Start(); - } - - private void Channel_OnMessage(object obj) - { - var init = obj as InitMessage; - if (init != null) - { - Init(init.TargetExe); - } - var updateXaml = obj as UpdateXamlMessage; - if (updateXaml != null) - { - _currentXaml = updateXaml.Xaml; - _currentSourceAssembly = updateXaml.AssemblyPath; - } - } - - void UpdateState(string state) - { - _comm.SendMessage(new StateMessage(state)); - } - - Type LookupType(params string[] names) - { - var asms = AppDomain.CurrentDomain.GetAssemblies(); - foreach (var asm in asms) - { - foreach (var name in names) - { - var found = asm.GetType(name, false, true); - if (found != null) - return found; - } - } - throw new TypeLoadException("Unable to find any of types: " + string.Join(",", names)); - } - - private MethodInfo LookupStaticMethod(string typeName, string method) - { - var type = LookupType(typeName); - var methods = type.GetMethods(); - return methods.First(m => m.Name == method); - } - - private void Init(string targetExe) - { - var log = new StringBuilder(); - try - { - DoInit(targetExe, log); - } - catch (Exception e) - { - UpdateState("Unable to load Avalonia:\n\n" + e + "\n\n" + log); - } - } - - - - private void DoInit(string targetExe, StringBuilder logger) - { - _appDir = Path.GetFullPath(Path.GetDirectoryName(targetExe)); - Directory.SetCurrentDirectory(_appDir); - Action log = s => - { - UpdateState(s); - logger.AppendLine(s); - }; - log("Loading assemblies from " + _appDir); - var asms = new List(); - foreach(var asm in Directory.GetFiles(_appDir).Where(f=>f.ToLower().EndsWith(".dll")||f.ToLower().EndsWith(".exe"))) - try - { - log("Trying to load " + asm); - asms.Add(Assembly.LoadFrom(asm)); - } - catch (Exception e) - { - logger.AppendLine(e.ToString()); - } - - log("Initializing built-in designer"); - var dic = new Dictionary(); - Api = new DesignerApi(dic) {OnResize = OnResize, OnWindowCreated = OnWindowCreated}; - LookupStaticMethod("Avalonia.DesignerSupport.DesignerAssist", "Init").Invoke(null, new object[] {dic}); - - _window = new Control - { - Controls = - { - new ElementHost() - { - Child = new InProcDesignerView(_appModel), - Dock = DockStyle.Fill - } - } - }; - _window.CreateControl(); - - new Timer {Interval = 200, Enabled = true}.Tick += delegate { XamlUpdater(); }; - _comm.SendMessage(new WindowCreatedMessage(_window.Handle)); - _initSuccess = true; - } - - private void OnWindowCreated(IntPtr hWnd) - { - _appModel.NativeWindowHandle = hWnd; - } - - - public DesignerApi Api { get; set; } - - - bool ValidateXml(string xml) - { - try - { - var rdr = new XmlTextReader(new StringReader(xml)); - while (rdr.Read()) - { - - } - } - catch - { - return false; - } - return true; - } - - private void OnResize() - { - - } - - void XamlUpdater() - { - if (!_initSuccess) - return; - if(_lastXaml == _currentXaml) - return; - _lastXaml = _currentXaml; - - if (!ValidateXml(_currentXaml)) - { - _appModel.SetError("Invalid markup"); - return; - } - try - { - if (Api.UpdateXaml2 != null) - { - Api.UpdateXaml2(new DesignerApiXamlFileInfo - { - AssemblyPath = _currentSourceAssembly, - Xaml = _currentXaml - }.Dictionary); - } - else - Api.UpdateXaml(_currentXaml); - - _appModel.SetError(null); - } - catch (Exception e) - { - _appModel.SetError("XAML load error", e.ToString()); - } - } - - - - private Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) - { - string assemblyPath = Path.Combine(_appDir, new AssemblyName(args.Name).Name + ".dll"); - if (File.Exists(assemblyPath) == false) return null; - Assembly assembly = Assembly.LoadFrom(assemblyPath); - return assembly; - } - } - - static class Helper - { - public static object Prop(this object obj, string name) => obj.GetType().GetProperty(name).GetValue(obj); - - } -} diff --git a/src/Windows/Avalonia.Designer/AppHost/HostedAppModel.cs b/src/Windows/Avalonia.Designer/AppHost/HostedAppModel.cs deleted file mode 100644 index b5d0687baa..0000000000 --- a/src/Windows/Avalonia.Designer/AppHost/HostedAppModel.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Media; -using JetBrains.Annotations; - -namespace Avalonia.Designer.AppHost -{ - public class HostedAppModel : INotifyPropertyChanged - { - private readonly AvaloniaAppHost _host; - private IntPtr _nativeWindowHandle; - private string _error; - private string _errorDetails; - - internal HostedAppModel(AvaloniaAppHost host) - { - _host = host; - Background = Settings.Background; - } - - public IntPtr NativeWindowHandle - { - get { return _nativeWindowHandle; } - set - { - if (value.Equals(_nativeWindowHandle)) return; - _nativeWindowHandle = value; - OnPropertyChanged(); - } - } - - public string Error - { - get { return _error; } - private set - { - if (value == _error) return; - _error = value; - OnPropertyChanged(); - } - } - - public string ErrorDetails - { - get { return _errorDetails; } - private set - { - if (value == _errorDetails) return; - _errorDetails = value; - OnPropertyChanged(); - } - } - - public string Background - { - get { return _background; } - set - { - if (value == _background) return; - _background = value; - OnPropertyChanged(); - } - } - - public IReadOnlyList AvailableScalingFactors => new List() {1, 2, 4, 8}; - - public double CurrentScalingFactor - { - get { return _currentScalingFactor; } - set - { - _currentScalingFactor = value; - _host.Api.SetScalingFactor(value); - } - } - - public void SetError(string error, string details = null) - { - Error = error; - ErrorDetails = details; - } - - double _currentScalingFactor = 1; - private string _background; - - public event PropertyChangedEventHandler PropertyChanged; - - [NotifyPropertyChangedInvocator] - protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } - } -} diff --git a/src/Windows/Avalonia.Designer/AppHost/WindowHost.cs b/src/Windows/Avalonia.Designer/AppHost/WindowHost.cs deleted file mode 100644 index 998df93949..0000000000 --- a/src/Windows/Avalonia.Designer/AppHost/WindowHost.cs +++ /dev/null @@ -1,143 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace Avalonia.Designer.AppHost -{ - class WindowHost : UserControl - { - private readonly bool _supportScroll; - - public WindowHost(bool supportScroll) - { - _supportScroll = supportScroll; - if (_supportScroll) - { - AutoScroll = true; - VerticalScroll.Enabled = true; - HorizontalScroll.Enabled = true; - } - SetStyle(ControlStyles.AllPaintingInWmPaint, true); - Controls.Add(_windowHost); - _windowHost.Anchor = AnchorStyles.None; - if (!supportScroll) - _windowHost.Visible = false; - _timer.Tick += delegate - { - ReloadSettings(); - FixWindow(); - }; - } - - private void ReloadSettings() - { - var bkg = Settings.Background; - var color = System.Drawing.ColorTranslator.FromHtml(bkg); - if (BackColor != color) - BackColor = color; - } - - private readonly Control _windowHost = new Control() {Text = "WindowWrapper"}; - private readonly Timer _timer = new Timer {Enabled = true, Interval = 50}; - private IntPtr _hWnd; - private int _desiredWidth; - private int _desiredHeight; - - private const int WM_HSCROLL = 0x114; - private const int WM_VSCROLL = 0x115; - - protected override void WndProc(ref Message m) - { - if ((m.Msg == WM_HSCROLL || m.Msg == WM_VSCROLL) - && (((int) m.WParam & 0xFFFF) == 5)) - { - // Change SB_THUMBTRACK to SB_THUMBPOSITION - m.WParam = (IntPtr) (((int) m.WParam & ~0xFFFF) | 4); - } - base.WndProc(ref m); - } - - protected override void OnPaint(PaintEventArgs e) - { - using (var b = new SolidBrush(BackColor)) - e.Graphics.FillRectangle(b, e.ClipRectangle); - } - - void FixPosition() - { - var newScrollSize = new Size(_desiredWidth, _desiredHeight); - if (AutoScrollMinSize != newScrollSize) - AutoScrollMinSize = newScrollSize; - - var width = Width - AutoScrollMargin.Width; - var height = Height - AutoScrollMargin.Height; - var x = Math.Max(0, (width - _windowHost.Width)/2); - var y = Math.Max(0, (height - _windowHost.Height)/2); - - var newLoc = new Point(x - HorizontalScroll.Value, y - VerticalScroll.Value); - if(_windowHost.Location != newLoc) - _windowHost.Location = newLoc; - } - - protected override void Dispose(bool disposing) - { - if (disposing) - { - _timer.Dispose(); - } - base.Dispose(disposing); - } - - public void SetWindow(IntPtr hWnd) - { - if (_hWnd != IntPtr.Zero) - WinApi.SendMessage(_hWnd, WinApi.WM_CLOSE, IntPtr.Zero, IntPtr.Zero); - _hWnd = hWnd; - if (_hWnd != IntPtr.Zero) - { - WinApi.SetParent(hWnd, _supportScroll ? _windowHost.Handle : Handle); - FixWindow(); - } - } - - void FixWindow() - { - if (_hWnd != IntPtr.Zero) - { - if (_supportScroll) - { - WinApi.RECT rc; - WinApi.GetWindowRect(_hWnd, out rc); - _desiredWidth = rc.Right - rc.Left; - _desiredHeight = rc.Bottom - rc.Top; - var pt = _windowHost.PointToClient(new Point(rc.Left, rc.Top)); - - if ( - !(pt.Y == 0 && pt.X == 0 && _desiredWidth == _windowHost.Width && - _desiredHeight == _windowHost.Height)) - { - _windowHost.Width = _desiredWidth; - _windowHost.Height = _desiredHeight; - WinApi.MoveWindow(_hWnd, 0, 0, _desiredWidth, _desiredHeight, true); - } - FixPosition(); - } - else - { - WinApi.MoveWindow(_hWnd, 0, 0, Width, Height, true); - } - } - } - - protected override void OnResize(EventArgs e) - { - FixWindow(); - base.OnResize(e); - } - } -} diff --git a/src/Windows/Avalonia.Designer/Avalonia.Designer.csproj b/src/Windows/Avalonia.Designer/Avalonia.Designer.csproj deleted file mode 100644 index 4fdd06c9ce..0000000000 --- a/src/Windows/Avalonia.Designer/Avalonia.Designer.csproj +++ /dev/null @@ -1,126 +0,0 @@ - - - - - Debug - AnyCPU - {EC42600F-049B-43FF-AED1-8314D61B2749} - WinExe - Properties - Avalonia.Designer - Avalonia.Designer - v4.5 - 512 - true - PackageReference - - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - true - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - true - - - avalonia.designer.snk - - - - - - - - - - - - - - - - - - - - - - - - DesignerApi.cs - - - App.xaml - - - - - UserControl - - - - - - - - - DemoWindow.xaml - - - InProcDesignerView.xaml - - - AvaloniaDesigner.xaml - - - - - - - - - - - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - - - - - - - - - \ No newline at end of file diff --git a/src/Windows/Avalonia.Designer/AvaloniaDesigner.xaml b/src/Windows/Avalonia.Designer/AvaloniaDesigner.xaml deleted file mode 100644 index 7ed9223a22..0000000000 --- a/src/Windows/Avalonia.Designer/AvaloniaDesigner.xaml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - diff --git a/src/Windows/Avalonia.Designer/AvaloniaDesigner.xaml.cs b/src/Windows/Avalonia.Designer/AvaloniaDesigner.xaml.cs deleted file mode 100644 index e61ba01a96..0000000000 --- a/src/Windows/Avalonia.Designer/AvaloniaDesigner.xaml.cs +++ /dev/null @@ -1,142 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Forms.Integration; -using System.Windows.Input; -using System.Windows.Interop; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using Avalonia.Designer.AppHost; -using Avalonia.Designer.Comm; - -namespace Avalonia.Designer -{ - /// - /// Interaction logic for PerpexDesigner.xaml - /// - public partial class AvaloniaDesigner - { - public static readonly DependencyProperty TargetExeProperty = DependencyProperty.Register( - "TargetExe", typeof (string), typeof (AvaloniaDesigner), new FrameworkPropertyMetadata(TargetExeChanged)); - - private static void TargetExeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - ((AvaloniaDesigner) d).RestartProcess(); - } - public string TargetExe - { - get { return (string) GetValue(TargetExeProperty); } - set { SetValue(TargetExeProperty, value); } - } - - public static readonly DependencyProperty XamlProperty = DependencyProperty.Register( - "Xaml", typeof (string), typeof (AvaloniaDesigner), new FrameworkPropertyMetadata(XamlChanged)); - - private static void XamlChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - ((AvaloniaDesigner) d).OnXamlChanged(); - } - - public string Xaml - { - get { return (string) GetValue(XamlProperty); } - set { SetValue(XamlProperty, value); } - } - - public static readonly DependencyProperty SourceAssemblyProperty = DependencyProperty.Register( - "SourceAssembly", typeof (string), typeof (AvaloniaDesigner), new FrameworkPropertyMetadata(XamlChanged)); - - public string SourceAssembly - { - get { return (string) GetValue(SourceAssemblyProperty); } - set { SetValue(SourceAssemblyProperty, value); } - } - - private readonly ProcessHost _host = new ProcessHost(); - - - public AvaloniaDesigner() - { - InitializeComponent(); - BindingOperations.SetBinding(State, TextBox.TextProperty, - new Binding(nameof(ProcessHost.State)) {Source = _host, Mode = BindingMode.OneWay}); - - _host.PropertyChanged += _host_PropertyChanged; - } - - private void _host_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) - { - if (e.PropertyName == nameof(ProcessHost.WindowHandle)) - { - ResetNativeContainer(); - if(_host.WindowHandle == IntPtr.Zero) - return; - NativeContainer.Child = new WindowHost(false); - var wndHost = ((WindowHost) NativeContainer.Child); - wndHost.SetWindow(_host.WindowHandle); - } - } - - void ResetNativeContainer() - { - if (NativeContainer.Child != null) - { - var child = NativeContainer.Child; - NativeContainer.Child = null; - child.Dispose(); - } - } - - - public void KillProcess() - { - _host.Kill(); - ResetNativeContainer(); - } - - bool CheckTargetExeOrSetError() - { - if (string.IsNullOrEmpty(TargetExe)) - { - _host.State = "No target exe found"; - return false; - } - - if (File.Exists(TargetExe ?? "")) - return true; - _host.State = "No target binary found, build your project"; - return false; - } - - public void RestartProcess() - { - KillProcess(); - if(!CheckTargetExeOrSetError()) - return; - if(string.IsNullOrEmpty(Xaml)) - return; - _host.Start(TargetExe, Xaml, SourceAssembly); - } - - private void OnXamlChanged() - { - if (!CheckTargetExeOrSetError()) - return; - if (!_host.IsAlive) - _host.Start(TargetExe, Xaml, SourceAssembly); - else - _host.UpdateXaml(Xaml ?? "", SourceAssembly); - } - - } -} diff --git a/src/Windows/Avalonia.Designer/Comm/CommChannel.cs b/src/Windows/Avalonia.Designer/Comm/CommChannel.cs deleted file mode 100644 index 5851ad79c8..0000000000 --- a/src/Windows/Avalonia.Designer/Comm/CommChannel.cs +++ /dev/null @@ -1,137 +0,0 @@ -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.Serialization; -using System.Runtime.Serialization.Formatters.Binary; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using System.Windows.Forms; -using System.Windows.Threading; - -namespace Avalonia.Designer.Comm -{ - class CommChannel : IDisposable - { - private readonly BinaryReader _input; - private readonly BinaryWriter _output; - private readonly SynchronizationContext _dispatcher; - readonly TaskCompletionSource _terminating = new TaskCompletionSource(); - private readonly BlockingCollection _outputQueue = new BlockingCollection(); - public event Action OnMessage; - public event Action Disposed; - public event Action Exception; - public CommChannel(Stream input, Stream output) - { - _input = new BinaryReader(input); - _output = new BinaryWriter(output); - _dispatcher = SynchronizationContext.Current; - - } - - public void Start() - { - new Thread(WriterThread) { IsBackground = true }.Start(); - new Thread(ReaderThread) { IsBackground = true }.Start(); - } - - public void SendMessage(object message) - { - var fmt = GetFormatter(); - var ms = new MemoryStream(); - fmt.Serialize(ms, message); - _outputQueue.Add(ms.ToArray()); - } - - void WriterThread() - { - while (!_terminating.Task.IsCompleted) - { - var item = _outputQueue.Take(); - if(_terminating.Task.IsCompleted) - return; - try - { - _output.Write(item.Length); - _output.Write(item); - _output.Flush(); - } - catch (Exception e) - { - Exception?.Invoke(e); - Dispose(); - } - } - } - - private async Task ReadAsyncOrNull(int count) - { - var readTask = Task.Factory.StartNew(() => _input.ReadBytes(count)); - await Task.WhenAny(readTask, _terminating.Task); - if (_terminating.Task.IsCompleted) - return null; - return await readTask; - } - - async void ReaderThread() - { - await Task.Delay(10).ConfigureAwait(false); - var fmt = GetFormatter(); - while (!_terminating.Task.IsCompleted) - { - try - { - var lenb = await ReadAsyncOrNull(4); - if (lenb == null) - return; - var data = await ReadAsyncOrNull(BitConverter.ToInt32(lenb, 0)); - if (data == null) - return; - var message = fmt.Deserialize(new MemoryStream(data)); - _dispatcher.Post(_ => OnMessage?.Invoke(message), null); - } - catch(Exception e) - { - Dispose(); - Exception?.Invoke(e); - return; - } - } - - } - - sealed class BinderFix : SerializationBinder - { - private const string ListNamePrefix = "System.Collections.Generic.List`1[["; - public override Type BindToType(string assemblyName, string typeName) - { - if (typeName.StartsWith(ListNamePrefix)) - { - typeName = typeName.Substring(ListNamePrefix.Length); - typeName = typeName.Substring(0, typeName.IndexOf(",")); - return typeof (List<>).MakeGenericType(BindToType(assemblyName, typeName)); - } - - - return typeof (CommChannel).Assembly.GetType(typeName, false, true); - - } - } - - BinaryFormatter GetFormatter() - { - return new BinaryFormatter() {Binder = new BinderFix()}; - } - - public void Dispose() - { - if(_terminating.Task.IsCompleted) - return; - _terminating.TrySetResult(true); - _outputQueue.Add(null); - Disposed?.Invoke(); - } - } -} diff --git a/src/Windows/Avalonia.Designer/Comm/InitMessage.cs b/src/Windows/Avalonia.Designer/Comm/InitMessage.cs deleted file mode 100644 index 1f44e6e1b4..0000000000 --- a/src/Windows/Avalonia.Designer/Comm/InitMessage.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Avalonia.Designer.Comm -{ - [Serializable] - class InitMessage : UpdateXamlMessage - { - public string TargetExe { get; private set; } - public InitMessage(string targetExe, string xaml, string sourceAssembly) : base(xaml, sourceAssembly) - { - TargetExe = targetExe; - } - } -} diff --git a/src/Windows/Avalonia.Designer/Comm/ProcessHost.cs b/src/Windows/Avalonia.Designer/Comm/ProcessHost.cs deleted file mode 100644 index de7e51e261..0000000000 --- a/src/Windows/Avalonia.Designer/Comm/ProcessHost.cs +++ /dev/null @@ -1,166 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading; - -namespace Avalonia.Designer.Comm -{ - class ProcessHost : INotifyPropertyChanged - { - private CommChannel _comm; - private string _state; - public string State - { - get { return _state; } - set - { - if (_state == value) - return; - _state = value; - OnPropertyChanged(); - } - } - - private bool _isAlive; - private readonly SynchronizationContext _dispatcher; - private Process _proc; - - public bool IsAlive - { - get { return _isAlive; } - set - { - if (_isAlive == value) - return; - _isAlive = value; - OnPropertyChanged(); - } - } - - private IntPtr _windowHandle; - public IntPtr WindowHandle - { - get { return _windowHandle; } - set - { - if (_windowHandle == value) - return; - _windowHandle = value; - OnPropertyChanged(); - } - } - - public ProcessHost() - { - _dispatcher = SynchronizationContext.Current; - } - - void OnExited(object sender, EventArgs eventArgs) - { - if(_proc != sender) - return; - _proc = null; - _dispatcher.Post(_ => - { - - HandleExited(); - }, null); - } - - void HandleExited() - { - _comm.Dispose(); - IsAlive = false; - WindowHandle = IntPtr.Zero; - State = "Designer process crashed"; - } - - public void Start(string targetExe, string initialXaml, string sourceAssembly) - { - if (_proc != null) - { - _proc.Exited -= OnExited; - try - { - _comm?.Dispose(); - _proc.Kill(); - } - catch { } - HandleExited(); - State = "Restarting..."; - } - - var msg = new InitMessage(Path.GetFullPath(targetExe), initialXaml, sourceAssembly); - var exe = typeof (ProcessHost).Assembly.GetModules()[0].FullyQualifiedName; - _proc = new Process() - { - StartInfo = new ProcessStartInfo(exe, "--hosted") - { - UseShellExecute = false, - RedirectStandardInput = true, - RedirectStandardOutput = true, - RedirectStandardError = true, - CreateNoWindow = true - }, - EnableRaisingEvents = true - }; - _proc.Exited += OnExited; - try - { - _proc.Start(); - State = "Launching designer process..."; - _comm = new CommChannel(_proc.StandardOutput.BaseStream, _proc.StandardInput.BaseStream); - _comm.OnMessage += OnMessage; - _comm.Start(); - _comm.SendMessage(msg); - } - catch (Exception e) - { - State = e.ToString(); - HandleExited(); - } - IsAlive = true; - - } - - public void UpdateXaml(string xaml, string sourceAssembly) - { - _comm?.SendMessage(new UpdateXamlMessage(xaml, sourceAssembly)); - } - - private void OnMessage(object obj) - { - var stateMessage = obj as StateMessage; - if (stateMessage != null) - State = stateMessage.State; - var windowMessage = obj as WindowCreatedMessage; - if (windowMessage != null) - WindowHandle = windowMessage.Handle; - } - - public void Kill() - { - try - { - _proc?.Kill(); - _proc = null; - } - catch - { - // - } - } - - public event PropertyChangedEventHandler PropertyChanged; - - protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } - } -} diff --git a/src/Windows/Avalonia.Designer/Comm/StateMessage.cs b/src/Windows/Avalonia.Designer/Comm/StateMessage.cs deleted file mode 100644 index a5e8891949..0000000000 --- a/src/Windows/Avalonia.Designer/Comm/StateMessage.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Avalonia.Designer.Comm -{ - [Serializable] - class StateMessage - { - public StateMessage(string state) - { - State = state; - } - - public string State { get; private set; } - } -} diff --git a/src/Windows/Avalonia.Designer/Comm/UpdateXamlMessage.cs b/src/Windows/Avalonia.Designer/Comm/UpdateXamlMessage.cs deleted file mode 100644 index 2039a131f9..0000000000 --- a/src/Windows/Avalonia.Designer/Comm/UpdateXamlMessage.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Avalonia.Designer.Comm -{ - [Serializable] - class UpdateXamlMessage - { - public UpdateXamlMessage(string xaml, string assemblyPath) - { - Xaml = xaml; - AssemblyPath = assemblyPath; - } - - public string Xaml { get; private set; } - public string AssemblyPath { get; private set; } - } -} diff --git a/src/Windows/Avalonia.Designer/Comm/WindowCreatedMessage.cs b/src/Windows/Avalonia.Designer/Comm/WindowCreatedMessage.cs deleted file mode 100644 index 23a2b656b2..0000000000 --- a/src/Windows/Avalonia.Designer/Comm/WindowCreatedMessage.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Avalonia.Designer.Comm -{ - [Serializable] - class WindowCreatedMessage - { - public WindowCreatedMessage(IntPtr handle) - { - Handle = handle; - } - - public IntPtr Handle { get; private set; } - } -} diff --git a/src/Windows/Avalonia.Designer/DemoWindow.xaml b/src/Windows/Avalonia.Designer/DemoWindow.xaml deleted file mode 100644 index 1d7c710853..0000000000 --- a/src/Windows/Avalonia.Designer/DemoWindow.xaml +++ /dev/null @@ -1,30 +0,0 @@ - - - - Target Exe: - - - - - - - Source Assembly: - - - - - - - - - diff --git a/src/Windows/Avalonia.Designer/DemoWindow.xaml.cs b/src/Windows/Avalonia.Designer/DemoWindow.xaml.cs deleted file mode 100644 index fd42473ec8..0000000000 --- a/src/Windows/Avalonia.Designer/DemoWindow.xaml.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using Microsoft.Win32; - -namespace Avalonia.Designer -{ - - internal partial class DemoWindow - { - public DemoWindow() - { - InitializeComponent(); - } - - public DemoWindow(string targetExe, string targetPath, string sourceAssembly) : this() - { - - if (targetPath != null) - { - Xaml.Text = File.ReadAllText(targetPath); - } - SourceAssembly.Text = sourceAssembly ?? targetExe; - TargetExe.Text = targetExe; - } - - static string OpenFile(string filter) - { - var dlg = new OpenFileDialog {Filter = filter}; - if (dlg.ShowDialog() == true) - return dlg.FileName; - return null; - } - - private void SelectExeClicked(object sender, RoutedEventArgs e) - { - var exe = OpenFile("exe|*.exe"); - if (exe != null) - TargetExe.Text = exe; - } - - private void RestartClicked(object sender, RoutedEventArgs e) - { - Designer.RestartProcess(); - } - - private void SelectSourceClicked(object sender, RoutedEventArgs e) - { - var exe = OpenFile("assembly|*.exe,*.dll"); - if (exe != null) - SourceAssembly.Text = exe; - } - } -} diff --git a/src/Windows/Avalonia.Designer/InProcDesigner/InProcDesignerView.xaml b/src/Windows/Avalonia.Designer/InProcDesigner/InProcDesignerView.xaml deleted file mode 100644 index 8156c0185e..0000000000 --- a/src/Windows/Avalonia.Designer/InProcDesigner/InProcDesignerView.xaml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - 00% - - - - - - - - - - - (View details) - - - - - - - diff --git a/src/Windows/Avalonia.Designer/InProcDesigner/InProcDesignerView.xaml.cs b/src/Windows/Avalonia.Designer/InProcDesigner/InProcDesignerView.xaml.cs deleted file mode 100644 index bec2b7c7dc..0000000000 --- a/src/Windows/Avalonia.Designer/InProcDesigner/InProcDesignerView.xaml.cs +++ /dev/null @@ -1,98 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Forms; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using Avalonia.Designer.AppHost; -using TextBox = System.Windows.Controls.TextBox; -using UserControl = System.Windows.Controls.UserControl; - -namespace Avalonia.Designer.InProcDesigner -{ - /// - /// Interaction logic for InProcDesignerView.xaml - /// - public partial class InProcDesignerView : UserControl - { - private readonly HostedAppModel _appModel; - private readonly WindowHost _host; - - public InProcDesignerView(HostedAppModel appModel) - { - _appModel = appModel; - InitializeComponent(); - DataContext = _appModel; - _appModel.PropertyChanged += ModelPropertyChanged; - WindowHostControl.Child = _host = new WindowHost(true); - HandleVisibility(); - HandleWindow(); - - } - - private void ModelPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) - { - if (e.PropertyName == nameof(HostedAppModel.Error) || e.PropertyName == nameof(HostedAppModel.ErrorDetails)) - HandleVisibility(); - if (e.PropertyName == nameof(HostedAppModel.NativeWindowHandle)) - HandleWindow(); - } - - private void HandleWindow() - { - _host.SetWindow(_appModel.NativeWindowHandle); - } - - private void HandleVisibility() - { - ErrorPanel.Visibility = string.IsNullOrEmpty(_appModel.Error) - ? Visibility.Collapsed - : Visibility.Visible; - DetailsBlock.Visibility = string.IsNullOrWhiteSpace(_appModel.ErrorDetails) - ? Visibility.Collapsed - : Visibility.Visible; - } - - - - public InProcDesignerView() - { - - } - - private void Hyperlink_OnClick(object sender, RoutedEventArgs e) - { - var wnd = new Window() - { - Content = new TextBox() - { - IsReadOnly = true, - AcceptsReturn = true, - TextWrapping = TextWrapping.Wrap, - Text = _appModel.ErrorDetails - } - }; - wnd.ShowDialog(); - } - - private void ColorPicker_OnClick(object sender, MouseButtonEventArgs e) - { - var dlg = new ColorDialog() {Color = ColorTranslator.FromHtml(Settings.Background)}; - if (dlg.ShowDialog(_host) == DialogResult.OK) - { - var color = ColorTranslator.ToHtml(dlg.Color); - _appModel.Background = color; - Settings.Background = color; - } - } - } -} diff --git a/src/Windows/Avalonia.Designer/Program.cs b/src/Windows/Avalonia.Designer/Program.cs deleted file mode 100644 index 6c0dcdf372..0000000000 --- a/src/Windows/Avalonia.Designer/Program.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using System.Windows.Forms; -using System.Windows.Threading; -using Avalonia.Designer.AppHost; -using Avalonia.Designer.Comm; - -namespace Avalonia.Designer -{ - class Program - { - [STAThread] - static void Main(string[] args) - { - if (!args.Contains("--hosted")) - DemoMain(args); - else - HostedMain(); - - - } - - static void HostedMain() - { - //Initialize sync context - SynchronizationContext.SetSynchronizationContext(new WindowsFormsSynchronizationContext()); - var comm = new CommChannel(Console.OpenStandardInput(), Console.OpenStandardOutput()); - Console.SetOut(new NullTextWriter()); - Console.SetError(new NullTextWriter()); - comm.Disposed += () => Process.GetCurrentProcess().Kill(); - comm.SendMessage(new StateMessage("Staying awhile and listening...")); - var service = new AvaloniaAppHost(comm); - service.Start(); - Application.Run(); - } - - class NullTextWriter : TextWriter - { - public override Encoding Encoding => Encoding.UTF8; - public override void Write(char[] buffer, int index, int count) - { - } - - public override void Write(char value) - { - } - } - - private static void DemoMain(string[] args) - { - SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext()); - var app = new App(); - const string targetExe = "--exe="; - const string xaml = "--xaml="; - const string source = "--source="; - - app.Run(new DemoWindow( - args.Where(a => a.StartsWith(targetExe)).Select(a => a.Substring(targetExe.Length)).FirstOrDefault(), - args.Where(a => a.StartsWith(xaml)).Select(a => a.Substring(xaml.Length)).FirstOrDefault(), - args.Where(a => a.StartsWith(source)).Select(a => a.Substring(source.Length)).FirstOrDefault())); - } - } -} diff --git a/src/Windows/Avalonia.Designer/Properties/AssemblyInfo.cs b/src/Windows/Avalonia.Designer/Properties/AssemblyInfo.cs deleted file mode 100644 index 7a856bb111..0000000000 --- a/src/Windows/Avalonia.Designer/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Avalonia.Designer")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Avalonia.Designer")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("ec42600f-049b-43ff-aed1-8314d61b2749")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Windows/Avalonia.Designer/README.txt b/src/Windows/Avalonia.Designer/README.txt deleted file mode 100644 index 1dec6c88b0..0000000000 --- a/src/Windows/Avalonia.Designer/README.txt +++ /dev/null @@ -1,3 +0,0 @@ -To load data from XamlTestApplication run with: - ---exe=..\..\..\..\..\samples\XamlTestApplication\bin\Debug\XamlTestApplication.exe --xaml=..\..\..\..\..\samples\XamlTestApplication\Views\MainWindow.xaml \ No newline at end of file diff --git a/src/Windows/Avalonia.Designer/Settings.cs b/src/Windows/Avalonia.Designer/Settings.cs deleted file mode 100644 index fc5775ced3..0000000000 --- a/src/Windows/Avalonia.Designer/Settings.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.Win32; - -namespace Avalonia.Designer -{ - static class Settings - { - static readonly string Root = @"HKEY_CURRENT_USER\Software\AvaloniaUI\Designer"; - public static string Background - { - get { return Registry.GetValue(Root, "Background", "#f3f3f3")?.ToString() ?? "#f3f3f3"; } - set { Registry.SetValue(Root, "Background", value); } - } - } -} diff --git a/src/Windows/Avalonia.Designer/WinApi.cs b/src/Windows/Avalonia.Designer/WinApi.cs deleted file mode 100644 index 3f6ccce0bc..0000000000 --- a/src/Windows/Avalonia.Designer/WinApi.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; - -namespace Avalonia.Designer -{ - class WinApi - { - [DllImport("user32.dll", SetLastError = true)] - public static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint); - [DllImport("user32.dll")] - public static extern bool SetParent(IntPtr hWnd, IntPtr hWndNewParent); - [DllImport("user32.dll", CharSet = CharSet.Auto)] - public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam); - - public const uint WM_CLOSE = 0x0010; - - [DllImport("user32.dll", SetLastError = true)] - public static extern bool GetWindowRect(IntPtr hwnd, out RECT lpRect); - - [StructLayout(LayoutKind.Sequential)] - public struct RECT - { - public int Left; // x position of upper-left corner - public int Top; // y position of upper-left corner - public int Right; // x position of lower-right corner - public int Bottom; // y position of lower-right corner - } - } -} diff --git a/src/Windows/Avalonia.Designer/avalonia.designer.snk b/src/Windows/Avalonia.Designer/avalonia.designer.snk deleted file mode 100644 index 68df1b6e88..0000000000 Binary files a/src/Windows/Avalonia.Designer/avalonia.designer.snk and /dev/null differ diff --git a/tests/Avalonia.DesignerSupport.TestApp/App.config b/tests/Avalonia.DesignerSupport.TestApp/App.config deleted file mode 100644 index baef7524af..0000000000 --- a/tests/Avalonia.DesignerSupport.TestApp/App.config +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/tests/Avalonia.DesignerSupport.TestApp/App.xaml b/tests/Avalonia.DesignerSupport.TestApp/App.xaml deleted file mode 100644 index 214bcd8797..0000000000 --- a/tests/Avalonia.DesignerSupport.TestApp/App.xaml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/tests/Avalonia.DesignerSupport.TestApp/App.xaml.cs b/tests/Avalonia.DesignerSupport.TestApp/App.xaml.cs deleted file mode 100644 index 653a51232b..0000000000 --- a/tests/Avalonia.DesignerSupport.TestApp/App.xaml.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Avalonia.Markup.Xaml; - -namespace Avalonia.DesignerSupport.TestApp -{ - public class App : Application - { - public override void Initialize() - { - AvaloniaXamlLoader.Load(this); - } - } -} diff --git a/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj b/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj deleted file mode 100644 index fbbd5f0b28..0000000000 --- a/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj +++ /dev/null @@ -1,151 +0,0 @@ - - - - - Debug - AnyCPU - {F1381F98-4D24-409A-A6C5-1C5B1E08BB08} - WinExe - Properties - Avalonia.DesignerSupport.TestApp - Avalonia.DesignerSupport.TestApp - v4.7 - 512 - true - - ..\..\artifacts\designer-tests\ - - - AnyCPU - true - full - false - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - App.xaml - - - MainWindow.xaml - - - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - True - - - Designer - MSBuild:Compile - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - Designer - MSBuild:Compile - - - - - - - - {d211e587-d8bc-45b9-95a4-f297c8fa5200} - Avalonia.Animation - - - {b09b78d8-9b26-48b0-9149-d64a2f120f3f} - Avalonia.Base - - - {d2221c82-4a25-4583-9b43-d791e3f6820c} - Avalonia.Controls - - - {799a7bb5-3c2c-48b6-85a7-406a12c420da} - Avalonia.DesignerSupport - - - {4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0} - Avalonia.DotNetFrameworkRuntime - - - {62024b2d-53eb-4638-b26b-85eeaa54866e} - Avalonia.Input - - - {6b0ed19d-a08b-461c-a9d9-a9ee40b0c06b} - Avalonia.Interactivity - - - {42472427-4774-4c81-8aff-9f27b8e31721} - Avalonia.Layout - - - {eb582467-6abb-43a1-b052-e981ba910e3a} - Avalonia.Visuals - - - {f1baa01a-f176-4c6a-b39d-5b40bb1b148f} - Avalonia.Styling - - - {3e10a5fa-e8da-48b1-ad44-6a5b6cb7750f} - Avalonia.Themes.Default - - - {3e53a01a-b331-47f3-b828-4a5717e77a24} - Avalonia.Markup.Xaml - - - {6417e941-21bc-467b-a771-0de389353ce6} - Avalonia.Markup - - - {3e908f67-5543-4879-a1dc-08eace79b3cd} - Avalonia.Direct2D1 - - - {811a76cf-1cf6-440f-963b-bbe31bd72a82} - Avalonia.Win32 - - - - \ No newline at end of file diff --git a/tests/Avalonia.DesignerSupport.TestApp/MainWindow.xaml b/tests/Avalonia.DesignerSupport.TestApp/MainWindow.xaml deleted file mode 100644 index 6938bd8c49..0000000000 --- a/tests/Avalonia.DesignerSupport.TestApp/MainWindow.xaml +++ /dev/null @@ -1,5 +0,0 @@ - -