diff --git a/Avalonia.sln b/Avalonia.sln
index 6f9e81b44a..3fb5ec2693 100644
--- a/Avalonia.sln
+++ b/Avalonia.sln
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
-VisualStudioVersion = 15.0.26228.4
+VisualStudioVersion = 15.0.26228.9
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Base", "src\Avalonia.Base\Avalonia.Base.csproj", "{B09B78D8-9B26-48B0-9149-D64A2F120F3F}"
EndProject
@@ -31,9 +31,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Animation", "src\Avalonia.Animation\Avalonia.Animation.csproj", "{D211E587-D8BC-45B9-95A4-F297C8FA5200}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B}"
- ProjectSection(SolutionItems) = preProject
- tests\coretests.props = tests\coretests.props
- EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Styling.UnitTests", "tests\Avalonia.Styling.UnitTests\Avalonia.Styling.UnitTests.csproj", "{47ECDF59-DEF8-4C53-87B1-2098A3429059}"
EndProject
@@ -160,6 +157,34 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Gtk3", "src\Gtk\Av
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ControlCatalog.NetCore", "samples\ControlCatalog.NetCore\ControlCatalog.NetCore.csproj", "{39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{74487168-7D91-487E-BF93-055F2251461E}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Props", "Props", "{F3AC8BC1-27F5-4255-9AFC-04ABFD11683A}"
+ ProjectSection(SolutionItems) = preProject
+ build\JetBrains.Annotations.props = build\JetBrains.Annotations.props
+ build\JetBrains.dotMemoryUnit.props = build\JetBrains.dotMemoryUnit.props
+ build\Magick.NET-Q16-AnyCPU.props = build\Magick.NET-Q16-AnyCPU.props
+ build\Markup.props = build\Markup.props
+ build\Microsoft.CSharp.props = build\Microsoft.CSharp.props
+ build\Microsoft.Reactive.Testing.props = build\Microsoft.Reactive.Testing.props
+ build\Moq.props = build\Moq.props
+ build\NetCore.props = build\NetCore.props
+ build\Rx.props = build\Rx.props
+ build\Serilog.props = build\Serilog.props
+ build\Serilog.Sinks.Trace.props = build\Serilog.Sinks.Trace.props
+ build\SharpDX.props = build\SharpDX.props
+ build\SkiaSharp.Desktop.props = build\SkiaSharp.Desktop.props
+ build\SkiaSharp.props = build\SkiaSharp.props
+ build\Splat.props = build\Splat.props
+ build\Sprache.props = build\Sprache.props
+ build\XUnit.props = build\XUnit.props
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Targets", "Targets", "{4D6FAF79-58B4-482F-9122-0668C346364C}"
+ ProjectSection(SolutionItems) = preProject
+ build\UnitTests.NetCore.targets = build\UnitTests.NetCore.targets
+ EndProjectSection
+EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
src\Skia\Avalonia.Skia\Avalonia.Skia.projitems*{2f59f3d0-748d-4652-b01e-e0d954756308}*SharedItemsImports = 13
@@ -2534,5 +2559,7 @@ Global
{7D2D3083-71DD-4CC9-8907-39A0D86FB322} = {3743B0F2-CC41-4F14-A8C8-267F579BF91E}
{BB1F7BB5-6AD4-4776-94D9-C09D0A972658} = {B9894058-278A-46B5-B6ED-AD613FCC03B3}
{39D7B147-1A5B-47C2-9D01-21FB7C47C4B3} = {9B9E3891-2366-4253-A952-D08BCEB71098}
+ {F3AC8BC1-27F5-4255-9AFC-04ABFD11683A} = {74487168-7D91-487E-BF93-055F2251461E}
+ {4D6FAF79-58B4-482F-9122-0668C346364C} = {74487168-7D91-487E-BF93-055F2251461E}
EndGlobalSection
EndGlobal
diff --git a/build.cake b/build.cake
index d803e89c9a..a36a3bb536 100644
--- a/build.cake
+++ b/build.cake
@@ -180,7 +180,13 @@ Task("Run-Net-Core-Unit-Tests")
.Does(() => {
RunCoreTest("./tests/Avalonia.Base.UnitTests", parameters, false);
RunCoreTest("./tests/Avalonia.Controls.UnitTests", parameters, true);
+ RunCoreTest("./tests/Avalonia.Input.UnitTests", parameters, true);
+ RunCoreTest("./tests/Avalonia.Interactivity.UnitTests", parameters, true);
RunCoreTest("./tests/Avalonia.Layout.UnitTests", parameters, true);
+ //RunCoreTest("./tests/Avalonia.Markup.UnitTests", parameters, true);
+ //RunCoreTest("./tests/Avalonia.Markup.Xaml.UnitTests", parameters, true);
+ RunCoreTest("./tests/Avalonia.Styling.UnitTests", parameters, true);
+ RunCoreTest("./tests/Avalonia.Visuals.UnitTests", parameters, true);
});
Task("Run-Unit-Tests")
diff --git a/build/JetBrains.Annotations.props b/build/JetBrains.Annotations.props
new file mode 100644
index 0000000000..7bc12cbd84
--- /dev/null
+++ b/build/JetBrains.Annotations.props
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/build/JetBrains.dotMemoryUnit.props b/build/JetBrains.dotMemoryUnit.props
new file mode 100644
index 0000000000..b4cf4def5b
--- /dev/null
+++ b/build/JetBrains.dotMemoryUnit.props
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/build/Magick.NET-Q16-AnyCPU.props b/build/Magick.NET-Q16-AnyCPU.props
new file mode 100644
index 0000000000..ec747a17d8
--- /dev/null
+++ b/build/Magick.NET-Q16-AnyCPU.props
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/build/Markup.props b/build/Markup.props
new file mode 100644
index 0000000000..36c4cb28d8
--- /dev/null
+++ b/build/Markup.props
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/build/Microsoft.CSharp.props b/build/Microsoft.CSharp.props
new file mode 100644
index 0000000000..d0fa63bc3e
--- /dev/null
+++ b/build/Microsoft.CSharp.props
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/build/Microsoft.Reactive.Testing.props b/build/Microsoft.Reactive.Testing.props
new file mode 100644
index 0000000000..5ee6df708e
--- /dev/null
+++ b/build/Microsoft.Reactive.Testing.props
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/build/Moq.props b/build/Moq.props
new file mode 100644
index 0000000000..c8544b8309
--- /dev/null
+++ b/build/Moq.props
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/build/NetCore.props b/build/NetCore.props
new file mode 100644
index 0000000000..cebb02c7f5
--- /dev/null
+++ b/build/NetCore.props
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/build/Rx.props b/build/Rx.props
new file mode 100644
index 0000000000..5d74a6b214
--- /dev/null
+++ b/build/Rx.props
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build/Serilog.Sinks.Trace.props b/build/Serilog.Sinks.Trace.props
new file mode 100644
index 0000000000..ef79fd7669
--- /dev/null
+++ b/build/Serilog.Sinks.Trace.props
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/build/Serilog.props b/build/Serilog.props
new file mode 100644
index 0000000000..e9bd39f6af
--- /dev/null
+++ b/build/Serilog.props
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/build/SharpDX.props b/build/SharpDX.props
new file mode 100644
index 0000000000..e381bc03e6
--- /dev/null
+++ b/build/SharpDX.props
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/build/SkiaSharp.Desktop.props b/build/SkiaSharp.Desktop.props
new file mode 100644
index 0000000000..bb6b29cfa6
--- /dev/null
+++ b/build/SkiaSharp.Desktop.props
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/build/SkiaSharp.props b/build/SkiaSharp.props
new file mode 100644
index 0000000000..bd6b4ebc53
--- /dev/null
+++ b/build/SkiaSharp.props
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/build/Splat.props b/build/Splat.props
new file mode 100644
index 0000000000..bc3367be01
--- /dev/null
+++ b/build/Splat.props
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/build/Sprache.props b/build/Sprache.props
new file mode 100644
index 0000000000..8ea84de163
--- /dev/null
+++ b/build/Sprache.props
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/build/UnitTests.NetCore.targets b/build/UnitTests.NetCore.targets
new file mode 100644
index 0000000000..a8886fe028
--- /dev/null
+++ b/build/UnitTests.NetCore.targets
@@ -0,0 +1,29 @@
+
+
+ false
+ true
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ MinimumRecommendedRules.ruleset
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ MinimumRecommendedRules.ruleset
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build/XUnit.props b/build/XUnit.props
new file mode 100644
index 0000000000..58df7e8d3c
--- /dev/null
+++ b/build/XUnit.props
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build/readme.md b/build/readme.md
new file mode 100644
index 0000000000..aed508a508
--- /dev/null
+++ b/build/readme.md
@@ -0,0 +1,27 @@
+### MSBuild Props
+
+```XML
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
+
+### MSBuild Targets
+
+```XML
+
+```
\ No newline at end of file
diff --git a/packages.cake b/packages.cake
index ac65c26727..c3d0eb0bab 100644
--- a/packages.cake
+++ b/packages.cake
@@ -23,11 +23,11 @@ public class Packages
path => path.Replace(System.IO.Path.DirectorySeparatorChar, System.IO.Path.AltDirectorySeparatorChar).ToUpperInvariant());
// Key: Package Id
- // Value is Tuple where Item1: Package Version, Item2: The packages.config file path.
+ // Value is Tuple where Item1: Package Version, Item2: The *.csproj/*.props file path.
var packageVersions = new Dictionary>>();
- System.IO.Directory.EnumerateFiles(((DirectoryPath)context.Directory("./src")).FullPath,
- "*.csproj", SearchOption.AllDirectories).ToList().ForEach(fileName =>
+ System.IO.Directory.EnumerateFiles(((DirectoryPath)context.Directory("./build")).FullPath,
+ "*.props", SearchOption.AllDirectories).ToList().ForEach(fileName =>
{
if (!ignoredSubModulesPaths.Any(i => normalizePath(fileName).Contains(normalizePath(i))))
{
@@ -196,6 +196,7 @@ public class Packages
new NuSpecDependency() { Id = "System.Reactive", Version = SystemReactiveVersion },
//.NET Core
new NuSpecDependency() { Id = "System.Threading.ThreadPool", TargetFramework = "netcoreapp1.0", Version = "4.3.0" },
+ new NuSpecDependency() { Id = "Microsoft.Extensions.DependencyModel", TargetFramework = "netcoreapp1.0", Version = "1.1.0" },
new NuSpecDependency() { Id = "NETStandard.Library", TargetFramework = "netcoreapp1.0", Version = "1.6.0" },
new NuSpecDependency() { Id = "Microsoft.NETCore.Portable.Compatibility", TargetFramework = "netcoreapp1.0", Version = "1.0.1" },
new NuSpecDependency() { Id = "Splat", TargetFramework = "netcoreapp1.0", Version = SplatVersion },
@@ -425,16 +426,16 @@ public class Packages
{
new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version },
new NuSpecDependency() { Id = "SkiaSharp", Version = SkiaSharpVersion },
- //.NET Core
- new NuSpecDependency() { Id = "Avalonia", TargetFramework = "netcoreapp1.0", Version = parameters.Version },
- new NuSpecDependency() { Id = "SkiaSharp", TargetFramework = "netcoreapp1.0", Version = SkiaSharpVersion },
- new NuSpecDependency() { Id = "NETStandard.Library", TargetFramework = "netcoreapp1.0", Version = "1.6.0" },
- new NuSpecDependency() { Id = "Microsoft.NETCore.Portable.Compatibility", TargetFramework = "netcoreapp1.0", Version = "1.0.1" }
+ //netstandard1.3
+ new NuSpecDependency() { Id = "Avalonia", TargetFramework = "netstandard1.3", Version = parameters.Version },
+ new NuSpecDependency() { Id = "SkiaSharp", TargetFramework = "netstandard1.3", Version = SkiaSharpVersion },
+ new NuSpecDependency() { Id = "NETStandard.Library", TargetFramework = "netstandard1.3", Version = "1.6.0" },
+ new NuSpecDependency() { Id = "Microsoft.NETCore.Portable.Compatibility", TargetFramework = "netstandard1.3", Version = "1.0.1" }
},
Files = new []
{
new NuSpecContent { Source = "Avalonia.Skia.Desktop/bin/" + parameters.DirSuffixSkia + "/Avalonia.Skia.Desktop.dll", Target = "lib/net45" },
- new NuSpecContent { Source = "Avalonia.Skia.Desktop.NetStandard/bin/" + parameters.DirSuffix + "/netstandard1.3/Avalonia.Skia.Desktop.dll", Target = "lib/netcoreapp1.0" }
+ new NuSpecContent { Source = "Avalonia.Skia.Desktop.NetStandard/bin/" + parameters.DirSuffix + "/netstandard1.3/Avalonia.Skia.Desktop.dll", Target = "lib/netstandard1.3" }
},
BasePath = context.Directory("./src/Skia/"),
OutputDirectory = parameters.NugetRoot
diff --git a/samples/BindingTest/BindingTest.csproj b/samples/BindingTest/BindingTest.csproj
index fe5bd3aa1d..1c4e4f8169 100644
--- a/samples/BindingTest/BindingTest.csproj
+++ b/samples/BindingTest/BindingTest.csproj
@@ -158,21 +158,9 @@
-
-
-
-
- 2.1.0
-
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/samples/ControlCatalog.Android/ControlCatalog.Android.csproj b/samples/ControlCatalog.Android/ControlCatalog.Android.csproj
index 2f32a0b5ee..4db67a8b60 100644
--- a/samples/ControlCatalog.Android/ControlCatalog.Android.csproj
+++ b/samples/ControlCatalog.Android/ControlCatalog.Android.csproj
@@ -156,18 +156,7 @@
ControlCatalog
-
-
- 3.0.0
-
-
+
-
\ No newline at end of file
diff --git a/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj b/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj
index 73f50a18d6..3ca8640d40 100644
--- a/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj
+++ b/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj
@@ -141,18 +141,7 @@
-
-
-
-
- 2.1.0
-
-
+
+
\ No newline at end of file
diff --git a/samples/ControlCatalog/ControlCatalog.csproj b/samples/ControlCatalog/ControlCatalog.csproj
index 4741c8b35d..2a9f8f70de 100644
--- a/samples/ControlCatalog/ControlCatalog.csproj
+++ b/samples/ControlCatalog/ControlCatalog.csproj
@@ -171,7 +171,5 @@
-
-
-
+
\ No newline at end of file
diff --git a/samples/RenderTest/RenderTest.csproj b/samples/RenderTest/RenderTest.csproj
index fdebadb444..cf32316086 100644
--- a/samples/RenderTest/RenderTest.csproj
+++ b/samples/RenderTest/RenderTest.csproj
@@ -179,25 +179,9 @@
-
-
-
-
- 2.1.0
-
-
-
-
-
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/samples/VirtualizationTest/VirtualizationTest.csproj b/samples/VirtualizationTest/VirtualizationTest.csproj
index 5065d70737..9b9d8a94c6 100644
--- a/samples/VirtualizationTest/VirtualizationTest.csproj
+++ b/samples/VirtualizationTest/VirtualizationTest.csproj
@@ -154,21 +154,9 @@
-
-
-
-
- 2.1.0
-
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/samples/interop/GtkInteropDemo/GtkInteropDemo.csproj b/samples/interop/GtkInteropDemo/GtkInteropDemo.csproj
index 9ae6063876..044b96c865 100644
--- a/samples/interop/GtkInteropDemo/GtkInteropDemo.csproj
+++ b/samples/interop/GtkInteropDemo/GtkInteropDemo.csproj
@@ -150,12 +150,5 @@
-
\ No newline at end of file
diff --git a/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj b/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj
index 9ebe588fd1..c787ab76ee 100644
--- a/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj
+++ b/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj
@@ -180,12 +180,5 @@
-
\ No newline at end of file
diff --git a/src/Android/Avalonia.Android/Avalonia.Android.csproj b/src/Android/Avalonia.Android/Avalonia.Android.csproj
index f22d592544..4babdc8bff 100644
--- a/src/Android/Avalonia.Android/Avalonia.Android.csproj
+++ b/src/Android/Avalonia.Android/Avalonia.Android.csproj
@@ -132,31 +132,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
$(MSBuildToolsPath)\Roslyn
diff --git a/src/Android/Avalonia.AndroidTestApplication/Avalonia.AndroidTestApplication.csproj b/src/Android/Avalonia.AndroidTestApplication/Avalonia.AndroidTestApplication.csproj
index 156b2b1fe3..826f1f0132 100644
--- a/src/Android/Avalonia.AndroidTestApplication/Avalonia.AndroidTestApplication.csproj
+++ b/src/Android/Avalonia.AndroidTestApplication/Avalonia.AndroidTestApplication.csproj
@@ -153,36 +153,9 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/src/Avalonia.Animation/Avalonia.Animation.csproj b/src/Avalonia.Animation/Avalonia.Animation.csproj
index 27f948b447..f02ec2f31c 100644
--- a/src/Avalonia.Animation/Avalonia.Animation.csproj
+++ b/src/Avalonia.Animation/Avalonia.Animation.csproj
@@ -33,11 +33,5 @@
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/src/Avalonia.Base/Avalonia.Base.csproj b/src/Avalonia.Base/Avalonia.Base.csproj
index 1bcfd813c8..95be67c98c 100644
--- a/src/Avalonia.Base/Avalonia.Base.csproj
+++ b/src/Avalonia.Base/Avalonia.Base.csproj
@@ -30,12 +30,6 @@
Properties\SharedAssemblyInfo.cs
-
-
-
-
-
-
-
-
+
+
\ No newline at end of file
diff --git a/src/Avalonia.Controls/Avalonia.Controls.csproj b/src/Avalonia.Controls/Avalonia.Controls.csproj
index 72a78b0738..37f348340c 100644
--- a/src/Avalonia.Controls/Avalonia.Controls.csproj
+++ b/src/Avalonia.Controls/Avalonia.Controls.csproj
@@ -39,12 +39,6 @@
-
-
-
-
-
-
-
-
+
+
\ No newline at end of file
diff --git a/src/Avalonia.Controls/Primitives/PopupRoot.cs b/src/Avalonia.Controls/Primitives/PopupRoot.cs
index 0826694e39..86c1b47521 100644
--- a/src/Avalonia.Controls/Primitives/PopupRoot.cs
+++ b/src/Avalonia.Controls/Primitives/PopupRoot.cs
@@ -70,32 +70,12 @@ namespace Avalonia.Controls.Primitives
this.PlatformImpl.Dispose();
}
- ///
- /// Hides the popup.
- ///
- public void Hide()
- {
- PlatformImpl.Hide();
- IsVisible = false;
- }
-
- ///
- /// Shows the popup.
- ///
- public void Show()
- {
- EnsureInitialized();
- PlatformImpl.Show();
- IsVisible = true;
- LayoutManager.Instance.ExecuteInitialLayoutPass(this);
- }
-
///
protected override void OnTemplateApplied(TemplateAppliedEventArgs e)
{
base.OnTemplateApplied(e);
- if (Parent.TemplatedParent != null)
+ if (Parent?.TemplatedParent != null)
{
if (_presenterSubscription != null)
{
@@ -109,16 +89,6 @@ namespace Avalonia.Controls.Primitives
}
}
- private void EnsureInitialized()
- {
- if (!this.IsInitialized)
- {
- var init = (ISupportInitialize)this;
- init.BeginInit();
- init.EndInit();
- }
- }
-
private void SetTemplatedParentAndApplyChildTemplates(IControl control)
{
var templatedParent = Parent.TemplatedParent;
diff --git a/src/Avalonia.Controls/TopLevel.cs b/src/Avalonia.Controls/TopLevel.cs
index f15a6b8fd5..4dcd2d0533 100644
--- a/src/Avalonia.Controls/TopLevel.cs
+++ b/src/Avalonia.Controls/TopLevel.cs
@@ -221,6 +221,17 @@ namespace Avalonia.Controls
Renderer?.Paint(rect);
}
+ ///
+ /// Handles a closed notification from .
+ ///
+ protected virtual void HandleClosed()
+ {
+ Closed?.Invoke(this, EventArgs.Empty);
+ Renderer?.Dispose();
+ Renderer = null;
+ _applicationLifecycle.OnExit -= OnApplicationExiting;
+ }
+
///
/// Handles a resize notification from .
///
@@ -279,18 +290,6 @@ namespace Avalonia.Controls
return result;
}
- ///
- /// Handles a closed notification from .
- ///
- private void HandleClosed()
- {
- IsVisible = false;
- Closed?.Invoke(this, EventArgs.Empty);
- Renderer?.Dispose();
- Renderer = null;
- _applicationLifecycle.OnExit -= OnApplicationExiting;
- }
-
private void OnApplicationExiting(object sender, EventArgs args)
{
HandleApplicationExiting();
diff --git a/src/Avalonia.Controls/Window.cs b/src/Avalonia.Controls/Window.cs
index 10d285b234..43d9ddcc1c 100644
--- a/src/Avalonia.Controls/Window.cs
+++ b/src/Avalonia.Controls/Window.cs
@@ -11,6 +11,7 @@ using Avalonia.Media;
using Avalonia.Platform;
using Avalonia.Styling;
using System.Collections.Generic;
+using System.Linq;
namespace Avalonia.Controls
{
@@ -216,7 +217,7 @@ namespace Avalonia.Controls
///
/// Hides the window but does not close it.
///
- public void Hide()
+ public override void Hide()
{
using (BeginAutoSizing())
{
@@ -229,11 +230,12 @@ namespace Avalonia.Controls
///
/// Shows the window.
///
- public void Show()
+ public override void Show()
{
s_windows.Add(this);
EnsureInitialized();
+ IsVisible = true;
LayoutManager.Instance.ExecuteInitialLayoutPass(this);
using (BeginAutoSizing())
@@ -269,10 +271,15 @@ namespace Avalonia.Controls
s_windows.Add(this);
EnsureInitialized();
+ IsVisible = true;
LayoutManager.Instance.ExecuteInitialLayoutPass(this);
using (BeginAutoSizing())
{
+ var affectedWindows = s_windows.Where(w => w.IsEnabled && w != this).ToList();
+ var activated = affectedWindows.Where(w => w.IsActive).FirstOrDefault();
+ SetIsEnabled(affectedWindows, false);
+
var modal = PlatformImpl.ShowDialog();
var result = new TaskCompletionSource();
@@ -281,6 +288,8 @@ namespace Avalonia.Controls
.Subscribe(_ =>
{
modal.Dispose();
+ SetIsEnabled(affectedWindows, true);
+ activated?.Activate();
result.SetResult((TResult)_dialogResult);
});
@@ -289,6 +298,14 @@ namespace Avalonia.Controls
}
}
+ void SetIsEnabled(IEnumerable windows, bool isEnabled)
+ {
+ foreach (var window in windows)
+ {
+ window.IsEnabled = isEnabled;
+ }
+ }
+
///
void INameScope.Register(string name, object element)
{
@@ -335,6 +352,12 @@ namespace Avalonia.Controls
return size;
}
+ protected override void HandleClosed()
+ {
+ IsVisible = false;
+ base.HandleClosed();
+ }
+
///
protected override void HandleResized(Size clientSize)
{
@@ -345,16 +368,6 @@ namespace Avalonia.Controls
base.HandleResized(clientSize);
}
-
- private void EnsureInitialized()
- {
- if (!this.IsInitialized)
- {
- var init = (ISupportInitialize)this;
- init.BeginInit();
- init.EndInit();
- }
- }
}
}
diff --git a/src/Avalonia.Controls/WindowBase.cs b/src/Avalonia.Controls/WindowBase.cs
index 6830e30781..21c248db0c 100644
--- a/src/Avalonia.Controls/WindowBase.cs
+++ b/src/Avalonia.Controls/WindowBase.cs
@@ -29,6 +29,13 @@ namespace Avalonia.Controls
AvaloniaProperty.RegisterDirect(nameof(IsActive), o => o.IsActive);
private bool _isActive;
+ private bool _ignoreVisibilityChange;
+
+ static WindowBase()
+ {
+ IsVisibleProperty.OverrideDefaultValue(false);
+ IsVisibleProperty.Changed.AddClassHandler(x => x.IsVisibleChanged);
+ }
public WindowBase(IWindowBaseImpl impl) : this(impl, AvaloniaLocator.Current)
{
@@ -59,7 +66,6 @@ namespace Avalonia.Controls
public new IWindowBaseImpl PlatformImpl => (IWindowBaseImpl) base.PlatformImpl;
-
///
/// Gets a value that indicates whether the window is active.
///
@@ -95,6 +101,43 @@ namespace Avalonia.Controls
PlatformImpl.Activate();
}
+ ///
+ /// Hides the popup.
+ ///
+ public virtual void Hide()
+ {
+ _ignoreVisibilityChange = true;
+
+ try
+ {
+ PlatformImpl.Hide();
+ IsVisible = false;
+ }
+ finally
+ {
+ _ignoreVisibilityChange = false;
+ }
+ }
+
+ ///
+ /// Shows the popup.
+ ///
+ public virtual void Show()
+ {
+ _ignoreVisibilityChange = true;
+
+ try
+ {
+ EnsureInitialized();
+ IsVisible = true;
+ LayoutManager.Instance.ExecuteInitialLayoutPass(this);
+ PlatformImpl.Show();
+ }
+ finally
+ {
+ _ignoreVisibilityChange = false;
+ }
+ }
///
/// Begins an auto-resize operation.
@@ -126,6 +169,34 @@ namespace Avalonia.Controls
return base.ArrangeOverride(PlatformImpl.ClientSize);
}
+ ///
+ /// Ensures that the window is initialized.
+ ///
+ protected void EnsureInitialized()
+ {
+ if (!this.IsInitialized)
+ {
+ var init = (ISupportInitialize)this;
+ init.BeginInit();
+ init.EndInit();
+ }
+ }
+
+ protected override void HandleClosed()
+ {
+ _ignoreVisibilityChange = true;
+
+ try
+ {
+ IsVisible = false;
+ base.HandleClosed();
+ }
+ finally
+ {
+ _ignoreVisibilityChange = false;
+ }
+ }
+
///
/// Handles a resize notification from .
///
@@ -179,6 +250,21 @@ namespace Avalonia.Controls
Deactivated?.Invoke(this, EventArgs.Empty);
}
+ private void IsVisibleChanged(AvaloniaPropertyChangedEventArgs e)
+ {
+ if (!_ignoreVisibilityChange)
+ {
+ if ((bool)e.NewValue)
+ {
+ Show();
+ }
+ else
+ {
+ Hide();
+ }
+ }
+ }
+
///
/// Starts moving a window with left button being held. Should be called from left mouse button press event handler
///
diff --git a/src/Avalonia.DesignerSupport/Avalonia.DesignerSupport.csproj b/src/Avalonia.DesignerSupport/Avalonia.DesignerSupport.csproj
index 3bb74451e7..be0b98b24c 100644
--- a/src/Avalonia.DesignerSupport/Avalonia.DesignerSupport.csproj
+++ b/src/Avalonia.DesignerSupport/Avalonia.DesignerSupport.csproj
@@ -42,12 +42,6 @@
Properties\SharedAssemblyInfo.cs
-
-
-
-
-
-
-
-
+
+
\ No newline at end of file
diff --git a/src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj b/src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj
index 04499c7df3..a060827f27 100644
--- a/src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj
+++ b/src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj
@@ -50,16 +50,6 @@
Designer
-
-
-
-
-
-
-
-
-
-
-
-
+
+
\ No newline at end of file
diff --git a/src/Avalonia.DotNetCoreRuntime/Avalonia.DotNetCoreRuntime.csproj b/src/Avalonia.DotNetCoreRuntime/Avalonia.DotNetCoreRuntime.csproj
index 257e27b043..9d5436b2b9 100644
--- a/src/Avalonia.DotNetCoreRuntime/Avalonia.DotNetCoreRuntime.csproj
+++ b/src/Avalonia.DotNetCoreRuntime/Avalonia.DotNetCoreRuntime.csproj
@@ -35,8 +35,6 @@
-
-
-
+
\ No newline at end of file
diff --git a/src/Avalonia.DotNetCoreRuntime/NetCoreRuntimePlatform.cs b/src/Avalonia.DotNetCoreRuntime/NetCoreRuntimePlatform.cs
index b131488109..6aab8e0243 100644
--- a/src/Avalonia.DotNetCoreRuntime/NetCoreRuntimePlatform.cs
+++ b/src/Avalonia.DotNetCoreRuntime/NetCoreRuntimePlatform.cs
@@ -5,6 +5,8 @@ using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
+using Microsoft.DotNet.PlatformAbstractions;
+using Microsoft.Extensions.DependencyModel;
namespace Avalonia.Shared.PlatformSupport
{
@@ -15,33 +17,26 @@ namespace Avalonia.Shared.PlatformSupport
static Assembly[] LoadAssemblies()
{
+ var assemblies = new List();
+ // Mostly copy-pasted from (MIT):
+ // https://github.com/StefH/System.AppDomain.Core/blob/0b35e676c2721aa367b96e62eb52c97ee0b43a70/src/System.AppDomain.NetCoreApp/AppDomain.cs
- var rv = new List();
- var entry = Assembly.GetEntryAssembly();
- rv.Add(entry);
- var queue = new Queue(entry.GetReferencedAssemblies());
- var aset = new HashSet(queue.Select(r => r.ToString()));
-
- while (queue.Count > 0)
+ foreach (var assemblyName in
+ DependencyContext.Default.GetRuntimeAssemblyNames(RuntimeEnvironment.GetRuntimeIdentifier()))
{
- Assembly asm;
try
{
- asm = Assembly.Load(queue.Dequeue());
- }
- catch (Exception e)
- {
- Debug.Write(e.ToString());
- continue;
+ var assembly = Assembly.Load(assemblyName);
+ // just load all types and skip this assembly if one or more types cannot be resolved
+ assembly.DefinedTypes.ToArray();
+ assemblies.Add(assembly);
}
- rv.Add(asm);
- foreach (var r in asm.GetReferencedAssemblies())
+ catch (Exception ex)
{
- if (aset.Add(r.ToString()))
- queue.Enqueue(r);
+ Debug.Write(ex.Message);
}
}
- return rv.Distinct().ToArray();
+ return assemblies.ToArray();
}
}
}
diff --git a/src/Avalonia.DotNetFrameworkRuntime/Avalonia.DotNetFrameworkRuntime.csproj b/src/Avalonia.DotNetFrameworkRuntime/Avalonia.DotNetFrameworkRuntime.csproj
index 5c84f88d7e..b475c4b3ff 100644
--- a/src/Avalonia.DotNetFrameworkRuntime/Avalonia.DotNetFrameworkRuntime.csproj
+++ b/src/Avalonia.DotNetFrameworkRuntime/Avalonia.DotNetFrameworkRuntime.csproj
@@ -68,16 +68,6 @@
-
-
-
-
-
+
\ No newline at end of file
diff --git a/src/Avalonia.HtmlRenderer/Avalonia.HtmlRenderer.csproj b/src/Avalonia.HtmlRenderer/Avalonia.HtmlRenderer.csproj
index 7cb66d588a..b1fc7a4278 100644
--- a/src/Avalonia.HtmlRenderer/Avalonia.HtmlRenderer.csproj
+++ b/src/Avalonia.HtmlRenderer/Avalonia.HtmlRenderer.csproj
@@ -133,8 +133,5 @@
-
-
-
-
+
\ No newline at end of file
diff --git a/src/Avalonia.Input/Avalonia.Input.csproj b/src/Avalonia.Input/Avalonia.Input.csproj
index c3b30bb435..e9e74e24fe 100644
--- a/src/Avalonia.Input/Avalonia.Input.csproj
+++ b/src/Avalonia.Input/Avalonia.Input.csproj
@@ -37,11 +37,5 @@
Properties\SharedAssemblyInfo.cs
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/src/Avalonia.Input/MouseDevice.cs b/src/Avalonia.Input/MouseDevice.cs
index 4d54e44fc8..cbcb4382ec 100644
--- a/src/Avalonia.Input/MouseDevice.cs
+++ b/src/Avalonia.Input/MouseDevice.cs
@@ -377,4 +377,4 @@ namespace Avalonia.Input
root.PointerOverElement = element;
}
}
-}
+}
\ No newline at end of file
diff --git a/src/Avalonia.Interactivity/Avalonia.Interactivity.csproj b/src/Avalonia.Interactivity/Avalonia.Interactivity.csproj
index 154c8d35d0..ab9ab88a37 100644
--- a/src/Avalonia.Interactivity/Avalonia.Interactivity.csproj
+++ b/src/Avalonia.Interactivity/Avalonia.Interactivity.csproj
@@ -36,11 +36,5 @@
Properties\SharedAssemblyInfo.cs
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/src/Avalonia.Layout/Avalonia.Layout.csproj b/src/Avalonia.Layout/Avalonia.Layout.csproj
index d034004428..45a40d2fd4 100644
--- a/src/Avalonia.Layout/Avalonia.Layout.csproj
+++ b/src/Avalonia.Layout/Avalonia.Layout.csproj
@@ -35,11 +35,5 @@
Properties\SharedAssemblyInfo.cs
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/src/Avalonia.Logging.Serilog/Avalonia.Logging.Serilog.csproj b/src/Avalonia.Logging.Serilog/Avalonia.Logging.Serilog.csproj
index 7905e5270d..9aa81c19f9 100644
--- a/src/Avalonia.Logging.Serilog/Avalonia.Logging.Serilog.csproj
+++ b/src/Avalonia.Logging.Serilog/Avalonia.Logging.Serilog.csproj
@@ -26,7 +26,5 @@
-
-
-
+
\ No newline at end of file
diff --git a/src/Avalonia.ReactiveUI/Avalonia.ReactiveUI.csproj b/src/Avalonia.ReactiveUI/Avalonia.ReactiveUI.csproj
index 74a931f8c6..28522d8849 100644
--- a/src/Avalonia.ReactiveUI/Avalonia.ReactiveUI.csproj
+++ b/src/Avalonia.ReactiveUI/Avalonia.ReactiveUI.csproj
@@ -76,18 +76,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
@@ -98,4 +86,6 @@
+
+
\ No newline at end of file
diff --git a/src/Avalonia.Styling/Avalonia.Styling.csproj b/src/Avalonia.Styling/Avalonia.Styling.csproj
index bc51b4c843..5965645391 100644
--- a/src/Avalonia.Styling/Avalonia.Styling.csproj
+++ b/src/Avalonia.Styling/Avalonia.Styling.csproj
@@ -35,11 +35,5 @@
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj b/src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj
index ddf5857ce1..be1d798e2d 100644
--- a/src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj
+++ b/src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj
@@ -45,11 +45,5 @@
Designer
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/src/Avalonia.Visuals/Avalonia.Visuals.csproj b/src/Avalonia.Visuals/Avalonia.Visuals.csproj
index 5f879682c2..c820a83c2a 100644
--- a/src/Avalonia.Visuals/Avalonia.Visuals.csproj
+++ b/src/Avalonia.Visuals/Avalonia.Visuals.csproj
@@ -34,11 +34,5 @@
Properties\SharedAssemblyInfo.cs
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/src/Gtk/Avalonia.Cairo/Avalonia.Cairo.csproj b/src/Gtk/Avalonia.Cairo/Avalonia.Cairo.csproj
index c2e6aa69ce..cc6684f622 100644
--- a/src/Gtk/Avalonia.Cairo/Avalonia.Cairo.csproj
+++ b/src/Gtk/Avalonia.Cairo/Avalonia.Cairo.csproj
@@ -102,16 +102,6 @@
-
-
-
-
-
+
\ No newline at end of file
diff --git a/src/Gtk/Avalonia.Gtk/Avalonia.Gtk.csproj b/src/Gtk/Avalonia.Gtk/Avalonia.Gtk.csproj
index 9a31693ec1..837b83bdd7 100644
--- a/src/Gtk/Avalonia.Gtk/Avalonia.Gtk.csproj
+++ b/src/Gtk/Avalonia.Gtk/Avalonia.Gtk.csproj
@@ -97,9 +97,6 @@
Avalonia.Interactivity
-
-
-
-
+
\ No newline at end of file
diff --git a/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj b/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj
index 3fa460170f..036639ee54 100644
--- a/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj
+++ b/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj
@@ -284,20 +284,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
\ No newline at end of file
diff --git a/src/Markup/Avalonia.Markup/Avalonia.Markup.csproj b/src/Markup/Avalonia.Markup/Avalonia.Markup.csproj
index 38070a3655..831c0384d3 100644
--- a/src/Markup/Avalonia.Markup/Avalonia.Markup.csproj
+++ b/src/Markup/Avalonia.Markup/Avalonia.Markup.csproj
@@ -39,12 +39,6 @@
-
-
-
-
-
-
-
-
+
+
\ No newline at end of file
diff --git a/src/Skia/Avalonia.Skia.Android/Avalonia.Skia.Android.csproj b/src/Skia/Avalonia.Skia.Android/Avalonia.Skia.Android.csproj
index 11c6595fce..aab791cd8f 100644
--- a/src/Skia/Avalonia.Skia.Android/Avalonia.Skia.Android.csproj
+++ b/src/Skia/Avalonia.Skia.Android/Avalonia.Skia.Android.csproj
@@ -85,15 +85,6 @@
-
-
-
-
+
\ No newline at end of file
diff --git a/src/Skia/Avalonia.Skia.Desktop.NetStandard/Avalonia.Skia.Desktop.NetStandard.csproj b/src/Skia/Avalonia.Skia.Desktop.NetStandard/Avalonia.Skia.Desktop.NetStandard.csproj
index df2af71ded..1a6b574e7b 100644
--- a/src/Skia/Avalonia.Skia.Desktop.NetStandard/Avalonia.Skia.Desktop.NetStandard.csproj
+++ b/src/Skia/Avalonia.Skia.Desktop.NetStandard/Avalonia.Skia.Desktop.NetStandard.csproj
@@ -30,10 +30,6 @@
Properties\SharedAssemblyInfo.cs
-
-
-
-
@@ -43,6 +39,8 @@
+
+
\ No newline at end of file
diff --git a/src/Skia/Avalonia.Skia.Desktop/Avalonia.Skia.Desktop.csproj b/src/Skia/Avalonia.Skia.Desktop/Avalonia.Skia.Desktop.csproj
index ad2c35f922..ca1c6508f2 100644
--- a/src/Skia/Avalonia.Skia.Desktop/Avalonia.Skia.Desktop.csproj
+++ b/src/Skia/Avalonia.Skia.Desktop/Avalonia.Skia.Desktop.csproj
@@ -105,12 +105,6 @@
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/src/Skia/Avalonia.Skia.iOS/Avalonia.Skia.iOS.csproj b/src/Skia/Avalonia.Skia.iOS/Avalonia.Skia.iOS.csproj
index 17f01f377d..6b6604b88c 100644
--- a/src/Skia/Avalonia.Skia.iOS/Avalonia.Skia.iOS.csproj
+++ b/src/Skia/Avalonia.Skia.iOS/Avalonia.Skia.iOS.csproj
@@ -89,8 +89,6 @@
-
-
-
+
\ No newline at end of file
diff --git a/src/Windows/Avalonia.Designer/Avalonia.Designer.csproj b/src/Windows/Avalonia.Designer/Avalonia.Designer.csproj
index e99c4dc5ab..71fb024d89 100644
--- a/src/Windows/Avalonia.Designer/Avalonia.Designer.csproj
+++ b/src/Windows/Avalonia.Designer/Avalonia.Designer.csproj
@@ -122,17 +122,6 @@
-
-
-
- 10.3.0
-
-
+
\ No newline at end of file
diff --git a/src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj b/src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj
index 805eb32bae..48ffb34a8f 100644
--- a/src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj
+++ b/src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj
@@ -139,18 +139,6 @@
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/src/Windows/Avalonia.Win32.NetStandard/Avalonia.Win32.NetStandard.csproj b/src/Windows/Avalonia.Win32.NetStandard/Avalonia.Win32.NetStandard.csproj
index a685afe2f2..2c6efb56e2 100644
--- a/src/Windows/Avalonia.Win32.NetStandard/Avalonia.Win32.NetStandard.csproj
+++ b/src/Windows/Avalonia.Win32.NetStandard/Avalonia.Win32.NetStandard.csproj
@@ -26,7 +26,6 @@
true
-
diff --git a/src/Windows/Avalonia.Win32/Avalonia.Win32.csproj b/src/Windows/Avalonia.Win32/Avalonia.Win32.csproj
index a7ddb3768f..b134f4666e 100644
--- a/src/Windows/Avalonia.Win32/Avalonia.Win32.csproj
+++ b/src/Windows/Avalonia.Win32/Avalonia.Win32.csproj
@@ -101,16 +101,6 @@
-
-
-
-
-
+
\ No newline at end of file
diff --git a/src/Windows/Avalonia.Win32/WindowImpl.cs b/src/Windows/Avalonia.Win32/WindowImpl.cs
index f80e62ee2d..f2d7e0e043 100644
--- a/src/Windows/Avalonia.Win32/WindowImpl.cs
+++ b/src/Windows/Avalonia.Win32/WindowImpl.cs
@@ -33,7 +33,6 @@ namespace Avalonia.Win32
private IntPtr _hwnd;
private IInputRoot _owner;
private bool _trackingMouse;
- private bool _isActive;
private bool _decorated = true;
private double _scaling = 1;
private WindowState _showWindowState;
@@ -344,30 +343,9 @@ namespace Avalonia.Win32
public virtual IDisposable ShowDialog()
{
- var disabled = s_instances.Where(x => x != this && x.IsEnabled).ToList();
- WindowImpl activated = null;
-
- foreach (var window in disabled)
- {
- if (window._isActive)
- {
- activated = window;
- }
-
- window.IsEnabled = false;
- }
-
Show();
- return Disposable.Create(() =>
- {
- foreach (var window in disabled)
- {
- window.IsEnabled = true;
- }
-
- activated?.Activate();
- });
+ return Disposable.Empty;
}
public void SetCursor(IPlatformHandle cursor)
@@ -414,12 +392,10 @@ namespace Avalonia.Win32
{
case UnmanagedMethods.WindowActivate.WA_ACTIVE:
case UnmanagedMethods.WindowActivate.WA_CLICKACTIVE:
- _isActive = true;
Activated?.Invoke();
break;
case UnmanagedMethods.WindowActivate.WA_INACTIVE:
- _isActive = false;
Deactivated?.Invoke();
break;
}
diff --git a/src/iOS/Avalonia.iOS/Avalonia.iOS.csproj b/src/iOS/Avalonia.iOS/Avalonia.iOS.csproj
index 05fb99e3ef..d915b67cd0 100644
--- a/src/iOS/Avalonia.iOS/Avalonia.iOS.csproj
+++ b/src/iOS/Avalonia.iOS/Avalonia.iOS.csproj
@@ -104,26 +104,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/src/iOS/Avalonia.iOSTestApplication/Avalonia.iOSTestApplication.csproj b/src/iOS/Avalonia.iOSTestApplication/Avalonia.iOSTestApplication.csproj
index b66546c591..050d61376a 100644
--- a/src/iOS/Avalonia.iOSTestApplication/Avalonia.iOSTestApplication.csproj
+++ b/src/iOS/Avalonia.iOSTestApplication/Avalonia.iOSTestApplication.csproj
@@ -186,26 +186,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/tests/Avalonia.Base.UnitTests/Avalonia.Base.UnitTests.csproj b/tests/Avalonia.Base.UnitTests/Avalonia.Base.UnitTests.csproj
index 6f2007e8b1..d55dc8d544 100644
--- a/tests/Avalonia.Base.UnitTests/Avalonia.Base.UnitTests.csproj
+++ b/tests/Avalonia.Base.UnitTests/Avalonia.Base.UnitTests.csproj
@@ -2,7 +2,11 @@
net461;netcoreapp1.1
-
+
+
+
+
+
diff --git a/tests/Avalonia.Benchmarks/Avalonia.Benchmarks.csproj b/tests/Avalonia.Benchmarks/Avalonia.Benchmarks.csproj
index 75f2bbde89..1f5ebac203 100644
--- a/tests/Avalonia.Benchmarks/Avalonia.Benchmarks.csproj
+++ b/tests/Avalonia.Benchmarks/Avalonia.Benchmarks.csproj
@@ -99,16 +99,8 @@
-
-
\ No newline at end of file
diff --git a/tests/Avalonia.Controls.UnitTests/Avalonia.Controls.UnitTests.csproj b/tests/Avalonia.Controls.UnitTests/Avalonia.Controls.UnitTests.csproj
index ff72edab11..f8235f7d68 100644
--- a/tests/Avalonia.Controls.UnitTests/Avalonia.Controls.UnitTests.csproj
+++ b/tests/Avalonia.Controls.UnitTests/Avalonia.Controls.UnitTests.csproj
@@ -2,7 +2,11 @@
net461;netcoreapp1.1
-
+
+
+
+
+
@@ -16,21 +20,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/Avalonia.Controls.UnitTests/WindowBaseTests.cs b/tests/Avalonia.Controls.UnitTests/WindowBaseTests.cs
index 5e0372d03b..bafd4d69ef 100644
--- a/tests/Avalonia.Controls.UnitTests/WindowBaseTests.cs
+++ b/tests/Avalonia.Controls.UnitTests/WindowBaseTests.cs
@@ -98,6 +98,93 @@ namespace Avalonia.Controls.UnitTests
}
}
+ [Fact]
+ public void IsVisible_Should_Initially_Be_False()
+ {
+ using (UnitTestApplication.Start(TestServices.MockWindowingPlatform))
+ {
+ var target = new TestWindowBase();
+
+ Assert.False(target.IsVisible);
+ }
+ }
+
+ [Fact]
+ public void IsVisible_Should_Be_True_After_Show()
+ {
+ using (UnitTestApplication.Start(TestServices.StyledWindow))
+ {
+ var target = new TestWindowBase();
+
+ target.Show();
+
+ Assert.True(target.IsVisible);
+ }
+ }
+
+ [Fact]
+ public void IsVisible_Should_Be_False_Atfer_Hide()
+ {
+ using (UnitTestApplication.Start(TestServices.StyledWindow))
+ {
+ var target = new TestWindowBase();
+
+ target.Show();
+ target.Hide();
+
+ Assert.False(target.IsVisible);
+ }
+ }
+
+ [Fact]
+ public void IsVisible_Should_Be_False_Atfer_Impl_Signals_Close()
+ {
+ var windowImpl = new Mock();
+ windowImpl.Setup(x => x.Scaling).Returns(1);
+ windowImpl.SetupProperty(x => x.Closed);
+
+ using (UnitTestApplication.Start(TestServices.StyledWindow))
+ {
+ var target = new TestWindowBase(windowImpl.Object);
+
+ target.Show();
+ windowImpl.Object.Closed();
+
+ Assert.False(target.IsVisible);
+ }
+ }
+
+ [Fact]
+ public void Setting_IsVisible_True_Shows_Window()
+ {
+ var windowImpl = new Mock();
+ windowImpl.Setup(x => x.Scaling).Returns(1);
+
+ using (UnitTestApplication.Start(TestServices.StyledWindow))
+ {
+ var target = new TestWindowBase(windowImpl.Object);
+ target.IsVisible = true;
+
+ windowImpl.Verify(x => x.Show());
+ }
+ }
+
+ [Fact]
+ public void Setting_IsVisible_False_Hides_Window()
+ {
+ var windowImpl = new Mock();
+ windowImpl.Setup(x => x.Scaling).Returns(1);
+
+ using (UnitTestApplication.Start(TestServices.StyledWindow))
+ {
+ var target = new TestWindowBase(windowImpl.Object);
+ target.Show();
+ target.IsVisible = false;
+
+ windowImpl.Verify(x => x.Hide());
+ }
+ }
+
private FuncControlTemplate CreateTemplate()
{
return new FuncControlTemplate(x =>
@@ -112,6 +199,11 @@ namespace Avalonia.Controls.UnitTests
{
public bool IsClosed { get; private set; }
+ public TestWindowBase()
+ : base(Mock.Of(x => x.Scaling == 1))
+ {
+ }
+
public TestWindowBase(IWindowBaseImpl impl)
: base(impl)
{
diff --git a/tests/Avalonia.Controls.UnitTests/WindowTests.cs b/tests/Avalonia.Controls.UnitTests/WindowTests.cs
index 6a2aa4d03c..96afecc966 100644
--- a/tests/Avalonia.Controls.UnitTests/WindowTests.cs
+++ b/tests/Avalonia.Controls.UnitTests/WindowTests.cs
@@ -99,6 +99,7 @@ namespace Avalonia.Controls.UnitTests
{
var windowImpl = new Mock();
windowImpl.SetupProperty(x => x.Closed);
+ windowImpl.Setup(x => x.Scaling).Returns(1);
var services = TestServices.StyledWindow.With(
windowingPlatform: new MockWindowingPlatform(() => windowImpl.Object));
diff --git a/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj b/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj
index 316f7975db..2bf962bfa5 100644
--- a/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj
+++ b/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj
@@ -147,12 +147,5 @@
-
\ No newline at end of file
diff --git a/tests/Avalonia.DesignerSupport.Tests/Avalonia.DesignerSupport.Tests.csproj b/tests/Avalonia.DesignerSupport.Tests/Avalonia.DesignerSupport.Tests.csproj
index 19db3178a7..efca582573 100644
--- a/tests/Avalonia.DesignerSupport.Tests/Avalonia.DesignerSupport.Tests.csproj
+++ b/tests/Avalonia.DesignerSupport.Tests/Avalonia.DesignerSupport.Tests.csproj
@@ -57,20 +57,6 @@
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/tests/Avalonia.Direct2D1.UnitTests/Avalonia.Direct2D1.UnitTests.csproj b/tests/Avalonia.Direct2D1.UnitTests/Avalonia.Direct2D1.UnitTests.csproj
index 17657b88ff..035d5b6c3e 100644
--- a/tests/Avalonia.Direct2D1.UnitTests/Avalonia.Direct2D1.UnitTests.csproj
+++ b/tests/Avalonia.Direct2D1.UnitTests/Avalonia.Direct2D1.UnitTests.csproj
@@ -91,21 +91,6 @@
-
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/tests/Avalonia.Input.UnitTests/Avalonia.Input.UnitTests.csproj b/tests/Avalonia.Input.UnitTests/Avalonia.Input.UnitTests.csproj
index 353033b6f6..d52bcd7a2b 100644
--- a/tests/Avalonia.Input.UnitTests/Avalonia.Input.UnitTests.csproj
+++ b/tests/Avalonia.Input.UnitTests/Avalonia.Input.UnitTests.csproj
@@ -1,18 +1,6 @@
-
-
-
+
- Debug
- AnyCPU
- {AC18926A-E784-40FE-B09D-BB0FE2B599F0}
- Library
- Properties
- Avalonia.Input.UnitTests
- Avalonia.Input.UnitTests
- v4.6.1
- 512
-
-
+ net461;netcoreapp1.1
true
@@ -43,81 +31,23 @@
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
- {D211E587-D8BC-45B9-95A4-F297C8FA5200}
- Avalonia.Animation
-
-
- {B09B78D8-9B26-48B0-9149-D64A2F120F3F}
- Avalonia.Base
-
-
- {D2221C82-4A25-4583-9B43-D791E3F6820C}
- Avalonia.Controls
-
-
- {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
-
-
- {88060192-33D5-4932-B0F9-8BD2763E857D}
- Avalonia.UnitTests
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/tests/Avalonia.Input.UnitTests/InputElement_HitTesting.cs b/tests/Avalonia.Input.UnitTests/InputElement_HitTesting.cs
deleted file mode 100644
index a70130990a..0000000000
--- a/tests/Avalonia.Input.UnitTests/InputElement_HitTesting.cs
+++ /dev/null
@@ -1,494 +0,0 @@
-// Copyright (c) The Avalonia Project. All rights reserved.
-// Licensed under the MIT license. See licence.md file in the project root for full license information.
-
-using Avalonia.Controls;
-using Avalonia.Controls.Presenters;
-using Avalonia.Layout;
-using Avalonia.Media;
-using Avalonia.Platform;
-using Avalonia.Rendering;
-using Avalonia.UnitTests;
-using Moq;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using Xunit;
-
-namespace Avalonia.Input.UnitTests
-{
- public class InputElement_HitTesting
- {
- [Fact]
- public void InputHitTest_Should_Find_Control_At_Point()
- {
- using (var application = UnitTestApplication.Start(new TestServices(renderInterface: new MockRenderInterface())))
- {
- var container = new Decorator
- {
- Width = 200,
- Height = 200,
- Child = new Border
- {
- Width = 100,
- Height = 100,
- HorizontalAlignment = HorizontalAlignment.Center,
- VerticalAlignment = VerticalAlignment.Center
- }
- };
-
- container.Measure(Size.Infinity);
- container.Arrange(new Rect(container.DesiredSize));
-
- var context = new DrawingContext(Mock.Of());
- context.Render(container);
-
- var result = container.InputHitTest(new Point(100, 100));
-
- Assert.Equal(container.Child, result);
- }
- }
-
- [Fact]
- public void InputHitTest_Should_Not_Find_Control_Outside_Point()
- {
- using (UnitTestApplication.Start(new TestServices(renderInterface: new MockRenderInterface())))
- {
- var container = new Decorator
- {
- Width = 200,
- Height = 200,
- Child = new Border
- {
- Width = 100,
- Height = 100,
- HorizontalAlignment = HorizontalAlignment.Center,
- VerticalAlignment = VerticalAlignment.Center
- }
- };
-
- container.Measure(Size.Infinity);
- container.Arrange(new Rect(container.DesiredSize));
-
- var context = new DrawingContext(Mock.Of());
- context.Render(container);
-
- var result = container.InputHitTest(new Point(10, 10));
-
- Assert.Equal(container, result);
- }
- }
-
- [Fact]
- public void InputHitTest_Should_Find_Top_Control_At_Point()
- {
- using (UnitTestApplication.Start(new TestServices(renderInterface: new MockRenderInterface())))
- {
- var container = new Panel
- {
- Width = 200,
- Height = 200,
- Children = new Controls.Controls
- {
- new Border
- {
- Width = 100,
- Height = 100,
- HorizontalAlignment = HorizontalAlignment.Center,
- VerticalAlignment = VerticalAlignment.Center
- },
- new Border
- {
- Width = 50,
- Height = 50,
- HorizontalAlignment = HorizontalAlignment.Center,
- VerticalAlignment = VerticalAlignment.Center
- }
- }
- };
-
- container.Measure(Size.Infinity);
- container.Arrange(new Rect(container.DesiredSize));
-
- var context = new DrawingContext(Mock.Of());
- context.Render(container);
-
- var result = container.InputHitTest(new Point(100, 100));
-
- Assert.Equal(container.Children[1], result);
- }
- }
-
- [Fact]
- public void InputHitTest_Should_Find_Top_Control_At_Point_With_ZOrder()
- {
- using (UnitTestApplication.Start(new TestServices(renderInterface: new MockRenderInterface())))
- {
- var container = new Panel
- {
- Width = 200,
- Height = 200,
- Children = new Controls.Controls
- {
- new Border
- {
- Width = 100,
- Height = 100,
- ZIndex = 1,
- HorizontalAlignment = HorizontalAlignment.Center,
- VerticalAlignment = VerticalAlignment.Center
- },
- new Border
- {
- Width = 50,
- Height = 50,
- HorizontalAlignment = HorizontalAlignment.Center,
- VerticalAlignment = VerticalAlignment.Center
- }
- }
- };
-
- container.Measure(Size.Infinity);
- container.Arrange(new Rect(container.DesiredSize));
-
- var context = new DrawingContext(Mock.Of());
- context.Render(container);
-
- var result = container.InputHitTest(new Point(100, 100));
-
- Assert.Equal(container.Children[0], result);
- }
- }
-
- [Fact]
- public void InputHitTest_Should_Find_Control_Translated_Outside_Parent_Bounds()
- {
- using (UnitTestApplication.Start(new TestServices(renderInterface: new MockRenderInterface())))
- {
- Border target;
- var container = new Panel
- {
- Width = 200,
- Height = 200,
- ClipToBounds = false,
- Children = new Controls.Controls
- {
- new Border
- {
- Width = 100,
- Height = 100,
- ZIndex = 1,
- HorizontalAlignment = HorizontalAlignment.Left,
- VerticalAlignment = VerticalAlignment.Top,
- Child = target = new Border
- {
- Width = 50,
- Height = 50,
- HorizontalAlignment = HorizontalAlignment.Left,
- VerticalAlignment = VerticalAlignment.Top,
- RenderTransform = new TranslateTransform(110, 110),
- }
- },
- }
- };
-
- container.Measure(Size.Infinity);
- container.Arrange(new Rect(container.DesiredSize));
-
- var context = new DrawingContext(Mock.Of());
- context.Render(container);
-
- var result = container.InputHitTest(new Point(120, 120));
-
- Assert.Equal(target, result);
- }
- }
-
- [Fact]
- public void InputHitTest_Should_Not_Find_Control_Outside_Parent_Bounds_When_Clipped()
- {
- using (UnitTestApplication.Start(new TestServices(renderInterface: new MockRenderInterface())))
- {
- Border target;
-
- var container = new Panel
- {
- Width = 100,
- Height = 200,
- Children = new Controls.Controls
- {
- new Panel()
- {
- Width = 100,
- Height = 100,
- Margin = new Thickness(0, 100, 0, 0),
- ClipToBounds = true,
- Children = new Controls.Controls
- {
- (target = new Border()
- {
- Width = 100,
- Height = 100,
- Margin = new Thickness(0, -100, 0, 0)
- })
- }
- }
- }
- };
-
- container.Measure(Size.Infinity);
- container.Arrange(new Rect(container.DesiredSize));
-
- var context = new DrawingContext(Mock.Of());
- context.Render(container);
-
- var result = container.InputHitTest(new Point(50, 50));
-
- Assert.NotEqual(target, result);
- Assert.Equal(container, result);
- }
- }
-
- [Fact]
- public void InputHitTest_Should_Not_Find_Control_Outside_Scroll_ViewPort()
- {
- using (UnitTestApplication.Start(new TestServices(renderInterface: new MockRenderInterface())))
- {
- Border target;
- Border item1;
- Border item2;
- ScrollContentPresenter scroll;
-
- var container = new Panel
- {
- Width = 100,
- Height = 200,
- Children = new Controls.Controls
- {
- (target = new Border()
- {
- Width = 100,
- Height = 100
- }),
- new Border()
- {
- Width = 100,
- Height = 100,
- Margin = new Thickness(0, 100, 0, 0),
- Child = scroll = new ScrollContentPresenter()
- {
- Content = new StackPanel()
- {
- Children = new Controls.Controls
- {
- (item1 = new Border()
- {
- Width = 100,
- Height = 100,
- }),
- (item2 = new Border()
- {
- Width = 100,
- Height = 100,
- }),
- }
- }
- }
- }
- }
- };
-
- scroll.UpdateChild();
-
- container.Measure(Size.Infinity);
- container.Arrange(new Rect(container.DesiredSize));
-
- var context = new DrawingContext(Mock.Of());
- context.Render(container);
-
- var result = container.InputHitTest(new Point(50, 150));
-
- Assert.Equal(item1, result);
-
- result = container.InputHitTest(new Point(50, 50));
-
- Assert.Equal(target, result);
-
- scroll.Offset = new Vector(0, 100);
-
- //we don't have setup LayoutManager so we will make it manually
- scroll.Parent.InvalidateArrange();
- container.InvalidateArrange();
-
- container.Arrange(new Rect(container.DesiredSize));
- context.Render(container);
-
- result = container.InputHitTest(new Point(50, 150));
-
- Assert.Equal(item2, result);
-
- result = container.InputHitTest(new Point(50, 50));
-
- Assert.NotEqual(item1, result);
- Assert.Equal(target, result);
- }
- }
-
- class MockRenderInterface : IPlatformRenderInterface
- {
- public IFormattedTextImpl CreateFormattedText(string text, string fontFamilyName, double fontSize, FontStyle fontStyle, TextAlignment textAlignment, FontWeight fontWeight, TextWrapping wrapping)
- {
- throw new NotImplementedException();
- }
-
- public IRenderTarget CreateRenderTarget(IEnumerable