diff --git a/.gitignore b/.gitignore index d965a09574..c36f64e5de 100644 --- a/.gitignore +++ b/.gitignore @@ -105,6 +105,11 @@ csx # Windows Store app package directory AppPackages/ +# NCrunch +_NCrunch_*/ +*.ncrunchsolution.user +nCrunchTemp_*/ + # Others sql/ *.Cache diff --git a/.ncrunch/Avalonia.Android.v3.ncrunchproject b/.ncrunch/Avalonia.Android.v3.ncrunchproject new file mode 100644 index 0000000000..a4953e14f9 --- /dev/null +++ b/.ncrunch/Avalonia.Android.v3.ncrunchproject @@ -0,0 +1,6 @@ + + + True + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.AndroidTestApplication.v3.ncrunchproject b/.ncrunch/Avalonia.AndroidTestApplication.v3.ncrunchproject new file mode 100644 index 0000000000..319cd523ce --- /dev/null +++ b/.ncrunch/Avalonia.AndroidTestApplication.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Animation.v3.ncrunchproject b/.ncrunch/Avalonia.Animation.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.Animation.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Base.UnitTests.v3.ncrunchproject b/.ncrunch/Avalonia.Base.UnitTests.v3.ncrunchproject new file mode 100644 index 0000000000..13f78c1d4c --- /dev/null +++ b/.ncrunch/Avalonia.Base.UnitTests.v3.ncrunchproject @@ -0,0 +1,8 @@ + + + + LongTestTimesWithoutParallelExecution + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Base.v3.ncrunchproject b/.ncrunch/Avalonia.Base.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.Base.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Benchmarks.v3.ncrunchproject b/.ncrunch/Avalonia.Benchmarks.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.Benchmarks.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Cairo.RenderTests.v3.ncrunchproject b/.ncrunch/Avalonia.Cairo.RenderTests.v3.ncrunchproject new file mode 100644 index 0000000000..101c806e63 --- /dev/null +++ b/.ncrunch/Avalonia.Cairo.RenderTests.v3.ncrunchproject @@ -0,0 +1,8 @@ + + + + AbnormalReferenceResolution + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Cairo.v3.ncrunchproject b/.ncrunch/Avalonia.Cairo.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.Cairo.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Controls.UnitTests.v3.ncrunchproject b/.ncrunch/Avalonia.Controls.UnitTests.v3.ncrunchproject new file mode 100644 index 0000000000..13f78c1d4c --- /dev/null +++ b/.ncrunch/Avalonia.Controls.UnitTests.v3.ncrunchproject @@ -0,0 +1,8 @@ + + + + LongTestTimesWithoutParallelExecution + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Controls.v3.ncrunchproject b/.ncrunch/Avalonia.Controls.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.Controls.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Designer.v3.ncrunchproject b/.ncrunch/Avalonia.Designer.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.Designer.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.DesignerSupport.TestApp.v3.ncrunchproject b/.ncrunch/Avalonia.DesignerSupport.TestApp.v3.ncrunchproject new file mode 100644 index 0000000000..a4953e14f9 --- /dev/null +++ b/.ncrunch/Avalonia.DesignerSupport.TestApp.v3.ncrunchproject @@ -0,0 +1,6 @@ + + + True + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.DesignerSupport.Tests.v3.ncrunchproject b/.ncrunch/Avalonia.DesignerSupport.Tests.v3.ncrunchproject new file mode 100644 index 0000000000..a4953e14f9 --- /dev/null +++ b/.ncrunch/Avalonia.DesignerSupport.Tests.v3.ncrunchproject @@ -0,0 +1,6 @@ + + + True + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.DesignerSupport.v3.ncrunchproject b/.ncrunch/Avalonia.DesignerSupport.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.DesignerSupport.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Diagnostics.v3.ncrunchproject b/.ncrunch/Avalonia.Diagnostics.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.Diagnostics.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Direct2D1.RenderTests.v3.ncrunchproject b/.ncrunch/Avalonia.Direct2D1.RenderTests.v3.ncrunchproject new file mode 100644 index 0000000000..235da29767 --- /dev/null +++ b/.ncrunch/Avalonia.Direct2D1.RenderTests.v3.ncrunchproject @@ -0,0 +1,6 @@ + + + 1000 + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Direct2D1.UnitTests.v3.ncrunchproject b/.ncrunch/Avalonia.Direct2D1.UnitTests.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.Direct2D1.UnitTests.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Direct2D1.v3.ncrunchproject b/.ncrunch/Avalonia.Direct2D1.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.Direct2D1.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.DotNetCoreRuntime.v3.ncrunchproject b/.ncrunch/Avalonia.DotNetCoreRuntime.v3.ncrunchproject new file mode 100644 index 0000000000..319cd523ce --- /dev/null +++ b/.ncrunch/Avalonia.DotNetCoreRuntime.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.DotNetFrameworkRuntime.v3.ncrunchproject b/.ncrunch/Avalonia.DotNetFrameworkRuntime.v3.ncrunchproject new file mode 100644 index 0000000000..3cd9a982c9 --- /dev/null +++ b/.ncrunch/Avalonia.DotNetFrameworkRuntime.v3.ncrunchproject @@ -0,0 +1,6 @@ + + + False + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Gtk.v3.ncrunchproject b/.ncrunch/Avalonia.Gtk.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.Gtk.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Gtk3.v3.ncrunchproject b/.ncrunch/Avalonia.Gtk3.v3.ncrunchproject new file mode 100644 index 0000000000..319cd523ce --- /dev/null +++ b/.ncrunch/Avalonia.Gtk3.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.HtmlRenderer.v3.ncrunchproject b/.ncrunch/Avalonia.HtmlRenderer.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.HtmlRenderer.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Input.UnitTests.v3.ncrunchproject b/.ncrunch/Avalonia.Input.UnitTests.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.Input.UnitTests.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Input.v3.ncrunchproject b/.ncrunch/Avalonia.Input.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.Input.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Interactivity.UnitTests.v3.ncrunchproject b/.ncrunch/Avalonia.Interactivity.UnitTests.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.Interactivity.UnitTests.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Interactivity.v3.ncrunchproject b/.ncrunch/Avalonia.Interactivity.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.Interactivity.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Layout.UnitTests.v3.ncrunchproject b/.ncrunch/Avalonia.Layout.UnitTests.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.Layout.UnitTests.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Layout.v3.ncrunchproject b/.ncrunch/Avalonia.Layout.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.Layout.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.LeakTests.v3.ncrunchproject b/.ncrunch/Avalonia.LeakTests.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.LeakTests.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Logging.Serilog.v3.ncrunchproject b/.ncrunch/Avalonia.Logging.Serilog.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.Logging.Serilog.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Markup.UnitTests.v3.ncrunchproject b/.ncrunch/Avalonia.Markup.UnitTests.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.Markup.UnitTests.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Markup.Xaml.UnitTests.v3.ncrunchproject b/.ncrunch/Avalonia.Markup.Xaml.UnitTests.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.Markup.Xaml.UnitTests.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Markup.Xaml.v3.ncrunchproject b/.ncrunch/Avalonia.Markup.Xaml.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.Markup.Xaml.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Markup.v3.ncrunchproject b/.ncrunch/Avalonia.Markup.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.Markup.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.ReactiveUI.v3.ncrunchproject b/.ncrunch/Avalonia.ReactiveUI.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.ReactiveUI.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.RenderTests.v3.ncrunchproject b/.ncrunch/Avalonia.RenderTests.v3.ncrunchproject new file mode 100644 index 0000000000..95a483b433 --- /dev/null +++ b/.ncrunch/Avalonia.RenderTests.v3.ncrunchproject @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Skia.Android.v3.ncrunchproject b/.ncrunch/Avalonia.Skia.Android.v3.ncrunchproject new file mode 100644 index 0000000000..a4953e14f9 --- /dev/null +++ b/.ncrunch/Avalonia.Skia.Android.v3.ncrunchproject @@ -0,0 +1,6 @@ + + + True + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Skia.Desktop.NetStandard.v3.ncrunchproject b/.ncrunch/Avalonia.Skia.Desktop.NetStandard.v3.ncrunchproject new file mode 100644 index 0000000000..319cd523ce --- /dev/null +++ b/.ncrunch/Avalonia.Skia.Desktop.NetStandard.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Skia.Desktop.v3.ncrunchproject b/.ncrunch/Avalonia.Skia.Desktop.v3.ncrunchproject new file mode 100644 index 0000000000..ae3801f32b --- /dev/null +++ b/.ncrunch/Avalonia.Skia.Desktop.v3.ncrunchproject @@ -0,0 +1,8 @@ + + + True + False + True + x86 + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Skia.RenderTests.v3.ncrunchproject b/.ncrunch/Avalonia.Skia.RenderTests.v3.ncrunchproject new file mode 100644 index 0000000000..235da29767 --- /dev/null +++ b/.ncrunch/Avalonia.Skia.RenderTests.v3.ncrunchproject @@ -0,0 +1,6 @@ + + + 1000 + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Skia.iOS.v3.ncrunchproject b/.ncrunch/Avalonia.Skia.iOS.v3.ncrunchproject new file mode 100644 index 0000000000..a4953e14f9 --- /dev/null +++ b/.ncrunch/Avalonia.Skia.iOS.v3.ncrunchproject @@ -0,0 +1,6 @@ + + + True + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Skia.v3.ncrunchproject b/.ncrunch/Avalonia.Skia.v3.ncrunchproject new file mode 100644 index 0000000000..95a483b433 --- /dev/null +++ b/.ncrunch/Avalonia.Skia.v3.ncrunchproject @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Styling.UnitTests.v3.ncrunchproject b/.ncrunch/Avalonia.Styling.UnitTests.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.Styling.UnitTests.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Styling.v3.ncrunchproject b/.ncrunch/Avalonia.Styling.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.Styling.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Themes.Default.v3.ncrunchproject b/.ncrunch/Avalonia.Themes.Default.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.Themes.Default.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.UnitTests.v3.ncrunchproject b/.ncrunch/Avalonia.UnitTests.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.UnitTests.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Visuals.UnitTests.v3.ncrunchproject b/.ncrunch/Avalonia.Visuals.UnitTests.v3.ncrunchproject new file mode 100644 index 0000000000..ee655751a0 --- /dev/null +++ b/.ncrunch/Avalonia.Visuals.UnitTests.v3.ncrunchproject @@ -0,0 +1,9 @@ + + + + AbnormalReferenceResolution + LongTestTimesWithoutParallelExecution + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Visuals.v3.ncrunchproject b/.ncrunch/Avalonia.Visuals.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.Visuals.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Win32.NetStandard.v3.ncrunchproject b/.ncrunch/Avalonia.Win32.NetStandard.v3.ncrunchproject new file mode 100644 index 0000000000..319cd523ce --- /dev/null +++ b/.ncrunch/Avalonia.Win32.NetStandard.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Win32.Shared.v3.ncrunchproject b/.ncrunch/Avalonia.Win32.Shared.v3.ncrunchproject new file mode 100644 index 0000000000..95a483b433 --- /dev/null +++ b/.ncrunch/Avalonia.Win32.Shared.v3.ncrunchproject @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.Win32.v3.ncrunchproject b/.ncrunch/Avalonia.Win32.v3.ncrunchproject new file mode 100644 index 0000000000..6800b4a3fe --- /dev/null +++ b/.ncrunch/Avalonia.Win32.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.iOS.v3.ncrunchproject b/.ncrunch/Avalonia.iOS.v3.ncrunchproject new file mode 100644 index 0000000000..319cd523ce --- /dev/null +++ b/.ncrunch/Avalonia.iOS.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/Avalonia.iOSTestApplication.v3.ncrunchproject b/.ncrunch/Avalonia.iOSTestApplication.v3.ncrunchproject new file mode 100644 index 0000000000..319cd523ce --- /dev/null +++ b/.ncrunch/Avalonia.iOSTestApplication.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/BindingTest.v3.ncrunchproject b/.ncrunch/BindingTest.v3.ncrunchproject new file mode 100644 index 0000000000..a4953e14f9 --- /dev/null +++ b/.ncrunch/BindingTest.v3.ncrunchproject @@ -0,0 +1,6 @@ + + + True + True + + \ No newline at end of file diff --git a/.ncrunch/ControlCatalog.Android.v3.ncrunchproject b/.ncrunch/ControlCatalog.Android.v3.ncrunchproject new file mode 100644 index 0000000000..319cd523ce --- /dev/null +++ b/.ncrunch/ControlCatalog.Android.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/ControlCatalog.Desktop.v3.ncrunchproject b/.ncrunch/ControlCatalog.Desktop.v3.ncrunchproject new file mode 100644 index 0000000000..319cd523ce --- /dev/null +++ b/.ncrunch/ControlCatalog.Desktop.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/ControlCatalog.iOS.v3.ncrunchproject b/.ncrunch/ControlCatalog.iOS.v3.ncrunchproject new file mode 100644 index 0000000000..319cd523ce --- /dev/null +++ b/.ncrunch/ControlCatalog.iOS.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/ControlCatalog.v3.ncrunchproject b/.ncrunch/ControlCatalog.v3.ncrunchproject new file mode 100644 index 0000000000..a4953e14f9 --- /dev/null +++ b/.ncrunch/ControlCatalog.v3.ncrunchproject @@ -0,0 +1,6 @@ + + + True + True + + \ No newline at end of file diff --git a/.ncrunch/GtkInteropDemo.v3.ncrunchproject b/.ncrunch/GtkInteropDemo.v3.ncrunchproject new file mode 100644 index 0000000000..319cd523ce --- /dev/null +++ b/.ncrunch/GtkInteropDemo.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.ncrunch/PlatformSupport.v3.ncrunchproject b/.ncrunch/PlatformSupport.v3.ncrunchproject new file mode 100644 index 0000000000..95a483b433 --- /dev/null +++ b/.ncrunch/PlatformSupport.v3.ncrunchproject @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.ncrunch/RenderHelpers.v3.ncrunchproject b/.ncrunch/RenderHelpers.v3.ncrunchproject new file mode 100644 index 0000000000..95a483b433 --- /dev/null +++ b/.ncrunch/RenderHelpers.v3.ncrunchproject @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.ncrunch/RenderTest.v3.ncrunchproject b/.ncrunch/RenderTest.v3.ncrunchproject new file mode 100644 index 0000000000..e12537d535 --- /dev/null +++ b/.ncrunch/RenderTest.v3.ncrunchproject @@ -0,0 +1,8 @@ + + + + MissingOrIgnoredProjectReference + + True + + \ No newline at end of file diff --git a/.ncrunch/VirtualizationTest.v3.ncrunchproject b/.ncrunch/VirtualizationTest.v3.ncrunchproject new file mode 100644 index 0000000000..a4953e14f9 --- /dev/null +++ b/.ncrunch/VirtualizationTest.v3.ncrunchproject @@ -0,0 +1,6 @@ + + + True + True + + \ No newline at end of file diff --git a/.ncrunch/WindowsInteropTest.v3.ncrunchproject b/.ncrunch/WindowsInteropTest.v3.ncrunchproject new file mode 100644 index 0000000000..319cd523ce --- /dev/null +++ b/.ncrunch/WindowsInteropTest.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index af7d5dbebf..5740a5ecfd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,10 @@ language: csharp os: - linux - osx +dist: trusty mono: - latest +dotnet: 1.0.1 script: - ./build.sh --target "Travis" --platform "Mono" --configuration "Release" notifications: diff --git a/Avalonia.sln b/Avalonia.sln index 4e897b86c7..6f9e81b44a 100644 --- a/Avalonia.sln +++ b/Avalonia.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio 15 +VisualStudioVersion = 15.0.26228.4 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 @@ -15,9 +15,6 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Direct2D1", "src\Windows\Avalonia.Direct2D1\Avalonia.Direct2D1.csproj", "{3E908F67-5543-4879-A1DC-08EACE79B3CD}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Designer", "src\Windows\Avalonia.Designer\Avalonia.Designer.csproj", "{EC42600F-049B-43FF-AED1-8314D61B2749}" - ProjectSection(ProjectDependencies) = postProject - {2B888490-D14A-4BCA-AB4B-48676FA93C9B} = {2B888490-D14A-4BCA-AB4B-48676FA93C9B} - EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Input", "src\Avalonia.Input\Avalonia.Input.csproj", "{62024B2D-53EB-4638-B26B-85EEAA54866E}" EndProject @@ -34,6 +31,9 @@ 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 @@ -85,9 +85,6 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Markup.UnitTests", "tests\Avalonia.Markup.UnitTests\Avalonia.Markup.UnitTests.csproj", "{8EF392D5-1416-45AA-9956-7CBBC3229E8A}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BindingTest", "samples\BindingTest\BindingTest.csproj", "{08B3E6B9-1CD5-443C-9F61-6D49D1C5F162}" - ProjectSection(ProjectDependencies) = postProject - {B61B66A3-B82D-4875-8001-89D3394FE0C9} = {B61B66A3-B82D-4875-8001-89D3394FE0C9} - EndProjectSection EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "RenderHelpers", "src\Shared\RenderHelpers\RenderHelpers.shproj", "{3C4C0CB4-0C0F-4450-A37B-148C84FF905F}" EndProject @@ -99,8 +96,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Skia.Desktop", "sr EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Skia.Android", "src\Skia\Avalonia.Skia.Android\Avalonia.Skia.Android.csproj", "{BD43F7C0-396B-4AA1-BAD9-DFDE54D51298}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Skia.iOS.TestApp", "src\Skia\Avalonia.Skia.iOS.TestApp\Avalonia.Skia.iOS.TestApp.csproj", "{DA49C5F3-BE95-461C-B999-072128CCF59E}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Skia.iOS", "src\Skia\Avalonia.Skia.iOS\Avalonia.Skia.iOS.csproj", "{47BE08A7-5985-410B-9FFC-2264B8EA595F}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Android", "Android", "{7CF9789C-F1D3-4D0E-90E5-F1DF67A2753F}" @@ -128,9 +123,6 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ControlCatalog", "samples\ControlCatalog\ControlCatalog.csproj", "{D0A739B9-3C68-4BA6-A328-41606954B6BD}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ControlCatalog.Desktop", "samples\ControlCatalog.Desktop\ControlCatalog.Desktop.csproj", "{2B888490-D14A-4BCA-AB4B-48676FA93C9B}" - ProjectSection(ProjectDependencies) = postProject - {BB1F7BB5-6AD4-4776-94D9-C09D0A972658} = {BB1F7BB5-6AD4-4776-94D9-C09D0A972658} - EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ControlCatalog.iOS", "samples\ControlCatalog.iOS\ControlCatalog.iOS.csproj", "{57E0455D-D565-44BB-B069-EE1AA20F8337}" EndProject @@ -166,6 +158,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Skia.Desktop.NetSt EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Gtk3", "src\Gtk\Avalonia.Gtk3\Avalonia.Gtk3.csproj", "{BB1F7BB5-6AD4-4776-94D9-C09D0A972658}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ControlCatalog.NetCore", "samples\ControlCatalog.NetCore\ControlCatalog.NetCore.csproj", "{39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}" +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution src\Skia\Avalonia.Skia\Avalonia.Skia.projitems*{2f59f3d0-748d-4652-b01e-e0d954756308}*SharedItemsImports = 13 @@ -1486,34 +1480,6 @@ Global {BD43F7C0-396B-4AA1-BAD9-DFDE54D51298}.Release|Mono.ActiveCfg = Release|Any CPU {BD43F7C0-396B-4AA1-BAD9-DFDE54D51298}.Release|x86.ActiveCfg = Release|Any CPU {BD43F7C0-396B-4AA1-BAD9-DFDE54D51298}.Release|x86.Build.0 = Release|Any CPU - {DA49C5F3-BE95-461C-B999-072128CCF59E}.Ad-Hoc|Any CPU.ActiveCfg = Ad-Hoc|iPhone - {DA49C5F3-BE95-461C-B999-072128CCF59E}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone - {DA49C5F3-BE95-461C-B999-072128CCF59E}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone - {DA49C5F3-BE95-461C-B999-072128CCF59E}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Ad-Hoc|iPhoneSimulator - {DA49C5F3-BE95-461C-B999-072128CCF59E}.Ad-Hoc|iPhoneSimulator.Build.0 = Ad-Hoc|iPhoneSimulator - {DA49C5F3-BE95-461C-B999-072128CCF59E}.Ad-Hoc|Mono.ActiveCfg = Ad-Hoc|iPhoneSimulator - {DA49C5F3-BE95-461C-B999-072128CCF59E}.Ad-Hoc|x86.ActiveCfg = Ad-Hoc|iPhoneSimulator - {DA49C5F3-BE95-461C-B999-072128CCF59E}.AppStore|Any CPU.ActiveCfg = AppStore|iPhone - {DA49C5F3-BE95-461C-B999-072128CCF59E}.AppStore|iPhone.ActiveCfg = AppStore|iPhone - {DA49C5F3-BE95-461C-B999-072128CCF59E}.AppStore|iPhone.Build.0 = AppStore|iPhone - {DA49C5F3-BE95-461C-B999-072128CCF59E}.AppStore|iPhoneSimulator.ActiveCfg = AppStore|iPhoneSimulator - {DA49C5F3-BE95-461C-B999-072128CCF59E}.AppStore|iPhoneSimulator.Build.0 = AppStore|iPhoneSimulator - {DA49C5F3-BE95-461C-B999-072128CCF59E}.AppStore|Mono.ActiveCfg = AppStore|iPhoneSimulator - {DA49C5F3-BE95-461C-B999-072128CCF59E}.AppStore|x86.ActiveCfg = AppStore|iPhoneSimulator - {DA49C5F3-BE95-461C-B999-072128CCF59E}.Debug|Any CPU.ActiveCfg = Debug|iPhone - {DA49C5F3-BE95-461C-B999-072128CCF59E}.Debug|iPhone.ActiveCfg = Debug|iPhone - {DA49C5F3-BE95-461C-B999-072128CCF59E}.Debug|iPhone.Build.0 = Debug|iPhone - {DA49C5F3-BE95-461C-B999-072128CCF59E}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {DA49C5F3-BE95-461C-B999-072128CCF59E}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {DA49C5F3-BE95-461C-B999-072128CCF59E}.Debug|Mono.ActiveCfg = Debug|iPhoneSimulator - {DA49C5F3-BE95-461C-B999-072128CCF59E}.Debug|x86.ActiveCfg = Debug|iPhoneSimulator - {DA49C5F3-BE95-461C-B999-072128CCF59E}.Release|Any CPU.ActiveCfg = Release|iPhone - {DA49C5F3-BE95-461C-B999-072128CCF59E}.Release|iPhone.ActiveCfg = Release|iPhone - {DA49C5F3-BE95-461C-B999-072128CCF59E}.Release|iPhone.Build.0 = Release|iPhone - {DA49C5F3-BE95-461C-B999-072128CCF59E}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {DA49C5F3-BE95-461C-B999-072128CCF59E}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {DA49C5F3-BE95-461C-B999-072128CCF59E}.Release|Mono.ActiveCfg = Release|iPhoneSimulator - {DA49C5F3-BE95-461C-B999-072128CCF59E}.Release|x86.ActiveCfg = Release|iPhoneSimulator {47BE08A7-5985-410B-9FFC-2264B8EA595F}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU {47BE08A7-5985-410B-9FFC-2264B8EA595F}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU {47BE08A7-5985-410B-9FFC-2264B8EA595F}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU @@ -2472,6 +2438,46 @@ Global {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Release|Mono.Build.0 = Release|Any CPU {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Release|x86.ActiveCfg = Release|Any CPU {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Release|x86.Build.0 = Release|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Ad-Hoc|Mono.ActiveCfg = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Ad-Hoc|Mono.Build.0 = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Ad-Hoc|x86.Build.0 = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.AppStore|iPhone.Build.0 = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.AppStore|Mono.ActiveCfg = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.AppStore|Mono.Build.0 = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.AppStore|x86.ActiveCfg = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.AppStore|x86.Build.0 = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Debug|iPhone.Build.0 = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Debug|Mono.ActiveCfg = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Debug|Mono.Build.0 = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Debug|x86.ActiveCfg = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Debug|x86.Build.0 = Debug|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Release|Any CPU.Build.0 = Release|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Release|iPhone.ActiveCfg = Release|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Release|iPhone.Build.0 = Release|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Release|Mono.ActiveCfg = Release|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Release|Mono.Build.0 = Release|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Release|x86.ActiveCfg = Release|Any CPU + {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2502,7 +2508,6 @@ Global {2F59F3D0-748D-4652-B01E-E0D954756308} = {3743B0F2-CC41-4F14-A8C8-267F579BF91E} {925DD807-B651-475F-9F7C-CBEB974CE43D} = {3743B0F2-CC41-4F14-A8C8-267F579BF91E} {BD43F7C0-396B-4AA1-BAD9-DFDE54D51298} = {3743B0F2-CC41-4F14-A8C8-267F579BF91E} - {DA49C5F3-BE95-461C-B999-072128CCF59E} = {3743B0F2-CC41-4F14-A8C8-267F579BF91E} {47BE08A7-5985-410B-9FFC-2264B8EA595F} = {3743B0F2-CC41-4F14-A8C8-267F579BF91E} {7B92AF71-6287-4693-9DCB-BD5B6E927E23} = {7CF9789C-F1D3-4D0E-90E5-F1DF67A2753F} {FF69B927-C545-49AE-8E16-3D14D621AA12} = {7CF9789C-F1D3-4D0E-90E5-F1DF67A2753F} @@ -2528,5 +2533,6 @@ Global {40759A76-D0F2-464E-8000-6FF0F5C4BD7C} = {B39A8919-9F95-48FE-AD7B-76E08B509888} {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} EndGlobalSection EndGlobal diff --git a/Avalonia.v2.ncrunchsolution b/Avalonia.v2.ncrunchsolution deleted file mode 100644 index fe4feb2cb6..0000000000 Binary files a/Avalonia.v2.ncrunchsolution and /dev/null differ diff --git a/Avalonia.v3.ncrunchsolution b/Avalonia.v3.ncrunchsolution new file mode 100644 index 0000000000..1b5b0c8930 --- /dev/null +++ b/Avalonia.v3.ncrunchsolution @@ -0,0 +1,10 @@ + + + + tests\TestFiles\**.* + + True + .ncrunch + True + + \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index db7d129dd1..76f991d38e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -os: Visual Studio 2015 +os: Visual Studio 2017 RC platform: - Any CPU configuration: @@ -11,16 +11,17 @@ environment: secure: OtVfyN3ErqQrDTnWH2HDfJDlCiu/i4/X4wFmK3ZXXP7HmCiXYPSbTjMPwwdOxRaK MYGET_API_URL: https://www.myget.org/F/avalonia-ci/api/v2/package install: + - if not exist dotnet-1.0.1.exe appveyor DownloadFile https://go.microsoft.com/fwlink/?linkid=843448 -FileName "dotnet-1.0.1.exe" - if not exist gtk-sharp-2.12.26.msi appveyor DownloadFile http://download.xamarin.com/GTKforWindows/Windows/gtk-sharp-2.12.26.msi - msiexec /i gtk-sharp-2.12.26.msi /qn /norestart + - cmd: call dotnet-1.0.1.exe /quiet - cmd: set PATH=%programfiles(x86)%\GtkSharp\2.12\bin\;%PATH% before_build: - git submodule update --init build_script: - ps: .\build.ps1 -Target "AppVeyor" -Platform "$env:platform" -Configuration "$env:configuration" after_build: -- .\packages\JetBrains.dotMemoryUnit.2.1.20150828.125449\tools\dotMemoryUnit.exe -targetExecutable="%xunit20%\xunit.console.x86.exe" -returnTargetExitCode --"tests\Avalonia.LeakTests\bin\Release\Avalonia.LeakTests.dll" - +- tools\JetBrains.dotMemoryUnit\tools\dotMemoryUnit.exe -targetExecutable="%xunit20%\xunit.console.x86.exe" -returnTargetExitCode --"tests\Avalonia.LeakTests\bin\Release\Avalonia.LeakTests.dll" - "SET PATH=C:\\Python34;C:\\Python34\\Scripts;%PATH%" - pip install codecov - codecov -f "./artifacts/coverage.xml" @@ -31,3 +32,4 @@ artifacts: - path: artifacts\zip\*.zip cache: - gtk-sharp-2.12.26.msi + - dotnet-1.0.1.exe diff --git a/build.cake b/build.cake index ee68c74bb3..d803e89c9a 100644 --- a/build.cake +++ b/build.cake @@ -4,7 +4,8 @@ #addin "nuget:?package=Polly&version=4.2.0" #addin "nuget:?package=NuGet.Core&version=2.12.0" - +#tool "nuget:https://dotnet.myget.org/F/nuget-build/?package=NuGet.CommandLine&version=4.3.0-beta1-2361&prerelease" +#tool "nuget:?package=JetBrains.dotMemoryUnit&version=2.1.20150828.125449" /////////////////////////////////////////////////////////////////////////////// // TOOLS /////////////////////////////////////////////////////////////////////////////// @@ -96,46 +97,10 @@ Task("Clean") CleanDirectory(parameters.TestsRoot); }); -Task("Prepare-XBuild-Solution") - .Does(() => -{ - var blacklistedProjects = new[] - { - "Avalonia.Win32.NetStandard", - "Avalonia.DotNetCoreRuntime", - "Avalonia.Skia.Desktop.NetStandard", - "Avalonia.Gtk3" - }; - var blacklistedGuids = System.IO.File.ReadAllLines(parameters.MSBuildSolution) - .Where(l=>l.StartsWith("Project") && blacklistedProjects.Any(p=>l.Contains(p))) - .Select(l => l.Split(',').Select(part => part.Trim()).FirstOrDefault(part => part.StartsWith("\"{"))) - .Where(g=>g!=null) - .Select(l=>l.Trim(new[]{'"', '}', '{'}).ToLower()).ToArray(); - - Console.WriteLine("Blacklisted guids are: " + string.Join(",", blacklistedGuids)); - var removeUntilEndProject = false; - - System.IO.File.WriteAllLines(parameters.XBuildSolution, System.IO.File.ReadAllLines(parameters.MSBuildSolution) - .Where(l => - { - if(removeUntilEndProject) - { - if(l.StartsWith("EndProject")) - removeUntilEndProject = false; - return false; - } - - var blacklist = blacklistedGuids.Any(g => l.ToLower().Contains(g)); - if(blacklist && l.StartsWith("Project")) - removeUntilEndProject = true; - - return !blacklist; - })); -}); Task("Restore-NuGet-Packages") .IsDependentOn("Clean") - .IsDependentOn("Prepare-XBuild-Solution") + .WithCriteria(parameters.IsRunningOnWindows) .Does(() => { var maxRetryCount = 5; @@ -153,21 +118,23 @@ Task("Restore-NuGet-Packages") toolTimeout+=0.5; }}) .Execute(()=> { - if(parameters.IsRunningOnWindows) - { NuGetRestore(parameters.MSBuildSolution, new NuGetRestoreSettings { + ToolPath = "./tools/NuGet.CommandLine/tools/NuGet.exe", ToolTimeout = TimeSpan.FromMinutes(toolTimeout) }); - } - else - { - NuGetRestore(parameters.XBuildSolution, new NuGetRestoreSettings { - ToolTimeout = TimeSpan.FromMinutes(toolTimeout) - }); - } }); }); +void DotNetCoreBuild() +{ + DotNetCoreRestore("samples\\ControlCatalog.NetCore"); + DotNetBuild("samples\\ControlCatalog.NetCore"); +} + +Task("DotNetCoreBuild") + .IsDependentOn("Clean") + .Does(() => DotNetCoreBuild()); + Task("Build") .IsDependentOn("Restore-NuGet-Packages") .Does(() => @@ -177,27 +144,54 @@ Task("Build") MSBuild(parameters.MSBuildSolution, settings => { settings.SetConfiguration(parameters.Configuration); settings.WithProperty("Platform", "\"" + parameters.Platform + "\""); + settings.WithProperty("UseRoslynPathHack", "true"); settings.SetVerbosity(Verbosity.Minimal); settings.WithProperty("Windows", "True"); - settings.UseToolVersion(MSBuildToolVersion.VS2015); + settings.UseToolVersion(MSBuildToolVersion.VS2017); settings.SetNodeReuse(false); }); } else { - XBuild(parameters.XBuildSolution, settings => { - settings.SetConfiguration(parameters.Configuration); - settings.WithProperty("Platform", "\"" + parameters.Platform + "\""); - settings.SetVerbosity(Verbosity.Minimal); - }); + DotNetCoreBuild(); } }); +void RunCoreTest(string dir, Parameters parameters, bool net461Only) +{ + Information("Running tests from " + dir); + DotNetCoreRestore(dir); + var frameworks = new List(){"netcoreapp1.1"}; + if(parameters.IsRunningOnWindows) + frameworks.Add("net461"); + foreach(var fw in frameworks) + { + if(fw != "net461" && net461Only) + continue; + Information("Running for " + fw); + DotNetCoreTest(System.IO.Path.Combine(dir, System.IO.Path.GetFileName(dir)+".csproj"), + new DotNetCoreTestSettings{Framework = fw}); + } +} + + +Task("Run-Net-Core-Unit-Tests") + .IsDependentOn("Clean") + .Does(() => { + RunCoreTest("./tests/Avalonia.Base.UnitTests", parameters, false); + RunCoreTest("./tests/Avalonia.Controls.UnitTests", parameters, true); + RunCoreTest("./tests/Avalonia.Layout.UnitTests", parameters, true); + }); + Task("Run-Unit-Tests") + .IsDependentOn("Run-Net-Core-Unit-Tests") .IsDependentOn("Build") .WithCriteria(() => !parameters.SkipTests) .Does(() => { + if(!parameters.IsRunningOnWindows) + return; + var unitTests = GetDirectories("./tests/Avalonia.*.UnitTests") .Select(dir => System.IO.Path.GetFileName(dir.FullPath)) .Where(name => parameters.IsRunningOnWindows ? true : !(name.IndexOf("Direct2D", StringComparison.OrdinalIgnoreCase) >= 0)) @@ -236,7 +230,11 @@ Task("Run-Unit-Tests") { CopyDirectory(test.GetDirectory(), parameters.TestsRoot); } - + + CopyFile(System.IO.Path.Combine(packages.NugetPackagesDir, "SkiaSharp", packages.SkiaSharpVersion, + "runtimes", "win7-x86", "native", "libSkiaSharp.dll"), + System.IO.Path.Combine(parameters.TestsRoot.ToString(), "libSkiaSharp.dll")); + var testsInDirectoryToRun = new List(); if(parameters.IsRunningOnWindows) { @@ -363,16 +361,20 @@ Task("Publish-NuGet") Task("Package") .IsDependentOn("Create-NuGet-Packages"); -Task("Default") - .IsDependentOn("Package"); - +Task("Default").Does(() => +{ + if(parameters.IsRunningOnWindows) + RunTarget("Package"); + else + RunTarget("Run-Net-Core-Unit-Tests"); +}); Task("AppVeyor") .IsDependentOn("Zip-Files") .IsDependentOn("Publish-MyGet") .IsDependentOn("Publish-NuGet"); Task("Travis") - .IsDependentOn("Run-Unit-Tests"); + .IsDependentOn("Run-Net-Core-Unit-Tests"); /////////////////////////////////////////////////////////////////////////////// // EXECUTE diff --git a/packages.cake b/packages.cake index 67483c4579..9a3fab11f0 100644 --- a/packages.cake +++ b/packages.cake @@ -1,9 +1,12 @@ +using System.Xml.Linq; + public class Packages { public List NuspecNuGetSettings { get; private set; } public FilePath[] NugetPackages { get; private set; } public FilePath[] BinFiles { get; private set; } - + public string NugetPackagesDir {get; private set;} + public string SkiaSharpVersion {get; private set; } public Packages(ICakeContext context, Parameters parameters) { // NUGET NUSPECS @@ -23,21 +26,27 @@ public class Packages // Value is Tuple where Item1: Package Version, Item2: The packages.config file path. var packageVersions = new Dictionary>>(); - System.IO.Directory.EnumerateFiles(((DirectoryPath)context.Directory("./src")).FullPath, "packages.config", SearchOption.AllDirectories).ToList().ForEach(fileName => + System.IO.Directory.EnumerateFiles(((DirectoryPath)context.Directory("./src")).FullPath, + "*.csproj", SearchOption.AllDirectories).ToList().ForEach(fileName => { if (!ignoredSubModulesPaths.Any(i => normalizePath(fileName).Contains(normalizePath(i)))) { - var file = new PackageReferenceFile(fileName); - foreach (PackageReference packageReference in file.GetPackageReferences()) + var xdoc = XDocument.Load(fileName); + foreach (var reference in xdoc.Descendants().Where(x => x.Name.LocalName == "PackageReference")) { + var name = reference.Attribute("Include").Value; + var versionAttribute = reference.Attribute("Version"); + var version = versionAttribute != null + ? versionAttribute.Value + : reference.Elements().First(x=>x.Name.LocalName == "Version").Value; IList> versions; - packageVersions.TryGetValue(packageReference.Id, out versions); + packageVersions.TryGetValue(name, out versions); if (versions == null) { versions = new List>(); - packageVersions[packageReference.Id] = versions; + packageVersions[name] = versions; } - versions.Add(Tuple.Create(packageReference.Version.ToString(), fileName)); + versions.Add(Tuple.Create(version, fileName)); } } }); @@ -65,7 +74,7 @@ public class Packages var SplatVersion = packageVersions["Splat"].FirstOrDefault().Item1; var SpracheVersion = packageVersions["Sprache"].FirstOrDefault().Item1; var SystemReactiveVersion = packageVersions["System.Reactive"].FirstOrDefault().Item1; - var SkiaSharpVersion = packageVersions["SkiaSharp"].FirstOrDefault().Item1; + SkiaSharpVersion = packageVersions["SkiaSharp"].FirstOrDefault().Item1; var SharpDXVersion = packageVersions["SharpDX"].FirstOrDefault().Item1; var SharpDXDirect2D1Version = packageVersions["SharpDX.Direct2D1"].FirstOrDefault().Item1; var SharpDXDirect3D11Version = packageVersions["SharpDX.Direct3D11"].FirstOrDefault().Item1; @@ -81,6 +90,11 @@ public class Packages context.Information("Package: SharpDX.Direct3D11, version: {0}", SharpDXDirect3D11Version); context.Information("Package: SharpDX.DXGI, version: {0}", SharpDXDXGIVersion); + var nugetPackagesDir = System.Environment.GetEnvironmentVariable("NUGET_HOME") + ?? System.IO.Path.Combine(System.Environment.GetEnvironmentVariable("USERPROFILE") ?? System.Environment.GetEnvironmentVariable("HOME"), ".nuget"); + + NugetPackagesDir = System.IO.Path.Combine(nugetPackagesDir, "packages"); + var SetNuGetNuspecCommonProperties = new Action ((nuspec) => { nuspec.Version = parameters.Version; nuspec.Authors = new [] { "Avalonia Team" }; @@ -129,12 +143,12 @@ public class Packages }; var coreLibrariesFiles = coreLibraries.Select((lib) => { - return (FilePath)context.File(lib[0] + lib[1] + "/bin/" + parameters.DirSuffix + "/" + lib[1] + lib[2]); + return (FilePath)context.File(lib[0] + lib[1] + "/bin/" + parameters.DirSuffix + "/netstandard1.1/" + lib[1] + lib[2]); }).ToList(); var coreLibrariesNuSpecContent = coreLibrariesFiles.Select((file) => { return new NuSpecContent { - Source = file.FullPath, Target = "lib/portable-windows8+net45" + Source = file.FullPath, Target = "lib/netstandard1.1" }; }); @@ -161,7 +175,7 @@ public class Packages var netCoreRuntimePlatformExtensions = new [] {".xml", ".dll"}; var netCoreRuntimePlatform = netCoreRuntimePlatformExtensions.Select(libSuffix => { return new NuSpecContent { - Source = ((FilePath)context.File("./src/Avalonia.DotNetCoreRuntime/bin/" + parameters.DirSuffix + "/Avalonia.DotNetCoreRuntime" + libSuffix)).FullPath, + Source = ((FilePath)context.File("./src/Avalonia.DotNetCoreRuntime/bin/" + parameters.DirSuffix + "/netcoreapp1.0/Avalonia.DotNetCoreRuntime" + libSuffix)).FullPath, Target = "lib/netcoreapp1.0" }; }); @@ -180,12 +194,12 @@ public class Packages new NuSpecDependency() { Id = "Splat", Version = SplatVersion }, new NuSpecDependency() { Id = "Sprache", Version = SpracheVersion }, new NuSpecDependency() { Id = "System.Reactive", Version = SystemReactiveVersion }, - new NuSpecDependency() { Id = "System.Threading.ThreadPool", TargetFramework = "netcoreapp1.0", Version = "4.3.0" }, //.NET Core + new NuSpecDependency() { Id = "System.Threading.ThreadPool", TargetFramework = "netcoreapp1.0", Version = "4.3.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 = "2.0.0" }, - new NuSpecDependency() { Id = "Serilog", TargetFramework = "netcoreapp1.0", Version = "2.3.0" }, + new NuSpecDependency() { Id = "Splat", TargetFramework = "netcoreapp1.0", Version = SplatVersion }, + new NuSpecDependency() { Id = "Serilog", TargetFramework = "netcoreapp1.0", Version = SerilogVersion }, new NuSpecDependency() { Id = "Sprache", TargetFramework = "netcoreapp1.0", Version = SpracheVersion }, new NuSpecDependency() { Id = "System.Reactive", TargetFramework = "netcoreapp1.0", Version = SystemReactiveVersion } }, @@ -208,9 +222,9 @@ public class Packages }, Files = new [] { - new NuSpecContent { Source = "Avalonia.HtmlRenderer.dll", Target = "lib/portable-windows8+net45" } + new NuSpecContent { Source = "Avalonia.HtmlRenderer.dll", Target = "lib/netstandard1.1" } }, - BasePath = context.Directory("./src/Avalonia.HtmlRenderer/bin/" + parameters.DirSuffix), + BasePath = context.Directory("./src/Avalonia.HtmlRenderer/bin/" + parameters.DirSuffix + "/netstandard1.1"), OutputDirectory = parameters.NugetRoot } }; @@ -324,7 +338,7 @@ public class Packages Files = new [] { new NuSpecContent { Source = "Avalonia.Win32/bin/" + parameters.DirSuffix + "/Avalonia.Win32.dll", Target = "lib/net45" }, - new NuSpecContent { Source = "Avalonia.Win32.NetStandard/bin/" + parameters.DirSuffix + "/Avalonia.Win32.dll", Target = "lib/netstandard1.1" } + new NuSpecContent { Source = "Avalonia.Win32.NetStandard/bin/" + parameters.DirSuffix + "/netstandard1.1/Avalonia.Win32.dll", Target = "lib/netstandard1.1" } }, BasePath = context.Directory("./src/Windows"), OutputDirectory = parameters.NugetRoot @@ -381,7 +395,7 @@ public class Packages { new NuSpecContent { Source = "Avalonia.Gtk3.dll", Target = "lib/netstandard1.1" } }, - BasePath = context.Directory("./src/Gtk/Avalonia.Gtk3/bin/" + parameters.DirSuffix), + BasePath = context.Directory("./src/Gtk/Avalonia.Gtk3/bin/" + parameters.DirSuffix + "/netstandard1.1"), OutputDirectory = parameters.NugetRoot }, /////////////////////////////////////////////////////////////////////////////// @@ -411,16 +425,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 + "/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 2dc0cd445b..fe5bd3aa1d 100644 --- a/samples/BindingTest/BindingTest.csproj +++ b/samples/BindingTest/BindingTest.csproj @@ -1,5 +1,5 @@  - + Debug @@ -13,6 +13,7 @@ 512 true + PackageReference AnyCPU @@ -37,29 +38,9 @@ - - ..\..\packages\Serilog.1.5.14\lib\net45\Serilog.dll - True - - - ..\..\packages\Serilog.1.5.14\lib\net45\Serilog.FullNetFx.dll - True - - - ..\..\packages\Splat.1.6.2\lib\Net45\Splat.dll - True - - - ..\..\packages\System.Reactive.Core.3.0.0\lib\net45\System.Reactive.Core.dll - True - - - ..\..\packages\System.Reactive.Interfaces.3.0.0\lib\net45\System.Reactive.Interfaces.dll - True - @@ -92,7 +73,6 @@ Designer - @@ -185,4 +165,14 @@ --> + + + + 2.1.0 + + + + + + \ No newline at end of file diff --git a/samples/BindingTest/BindingTest.v2.ncrunchproject b/samples/BindingTest/BindingTest.v2.ncrunchproject deleted file mode 100644 index f744eecae0..0000000000 --- a/samples/BindingTest/BindingTest.v2.ncrunchproject +++ /dev/null @@ -1,26 +0,0 @@ - - true - 1000 - false - false - false - true - false - false - true - false - false - true - true - false - true - true - true - 60000 - - - - AutoDetect - STA - x86 - \ No newline at end of file diff --git a/samples/BindingTest/packages.config b/samples/BindingTest/packages.config deleted file mode 100644 index 3c5f85de81..0000000000 --- a/samples/BindingTest/packages.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/samples/ControlCatalog.Android/ControlCatalog.Android.csproj b/samples/ControlCatalog.Android/ControlCatalog.Android.csproj index fa29610b18..2f32a0b5ee 100644 --- a/samples/ControlCatalog.Android/ControlCatalog.Android.csproj +++ b/samples/ControlCatalog.Android/ControlCatalog.Android.csproj @@ -29,7 +29,7 @@ 4 True None - False + True False False armeabi;armeabi-v7a;x86 @@ -73,7 +73,6 @@ - @@ -112,10 +111,6 @@ {7062ae20-5dcc-4442-9645-8195bdece63e} Avalonia.Diagnostics - - {4a1abb09-9047-4bd5-a4ad-a055e52c5ee0} - Avalonia.DotNetFrameworkRuntime - {5fb2b005-0a7f-4dad-add4-3ed01444e63d} Avalonia.HtmlRenderer @@ -161,6 +156,11 @@ ControlCatalog + + + 3.0.0 + + + \ No newline at end of file diff --git a/samples/ControlCatalog.Android/ControlCatalog.Android.v2.ncrunchproject b/samples/ControlCatalog.Android/ControlCatalog.Android.v2.ncrunchproject deleted file mode 100644 index e1b4d7cf28..0000000000 --- a/samples/ControlCatalog.Android/ControlCatalog.Android.v2.ncrunchproject +++ /dev/null @@ -1,26 +0,0 @@ - - true - 1000 - false - false - false - true - false - false - true - false - false - false - true - false - true - true - true - 60000 - - - - AutoDetect - STA - x86 - \ No newline at end of file diff --git a/samples/ControlCatalog.Android/GettingStarted.Xamarin b/samples/ControlCatalog.Android/GettingStarted.Xamarin deleted file mode 100644 index e9d4f6a411..0000000000 --- a/samples/ControlCatalog.Android/GettingStarted.Xamarin +++ /dev/null @@ -1,4 +0,0 @@ - - GS\Android\CS\AndroidApp\GettingStarted.html - false - \ No newline at end of file diff --git a/samples/ControlCatalog.Android/Resources/Resource.Designer.cs b/samples/ControlCatalog.Android/Resources/Resource.Designer.cs index 96f0e76fd8..cee3331ba8 100644 --- a/samples/ControlCatalog.Android/Resources/Resource.Designer.cs +++ b/samples/ControlCatalog.Android/Resources/Resource.Designer.cs @@ -28,6 +28,8 @@ namespace ControlCatalog.Android { global::Avalonia.Android.Resource.String.ApplicationName = global::ControlCatalog.Android.Resource.String.ApplicationName; global::Avalonia.Android.Resource.String.Hello = global::ControlCatalog.Android.Resource.String.Hello; + global::Avalonia.Android.Resource.String.library_name = global::ControlCatalog.Android.Resource.String.library_name; + global::Splat.Resource.String.library_name = global::ControlCatalog.Android.Resource.String.library_name; } public partial class Attribute @@ -94,11 +96,14 @@ namespace ControlCatalog.Android public partial class String { + // aapt resource value: 0x7f040002 + public const int ApplicationName = 2130968578; + // aapt resource value: 0x7f040001 - public const int ApplicationName = 2130968577; + public const int Hello = 2130968577; // aapt resource value: 0x7f040000 - public const int Hello = 2130968576; + public const int library_name = 2130968576; static String() { diff --git a/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj b/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj index ca5743dd5c..73f50a18d6 100644 --- a/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj +++ b/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj @@ -1,5 +1,5 @@  - + Debug @@ -13,6 +13,7 @@ 512 true + PackageReference AnyCPU @@ -37,14 +38,6 @@ - - ..\..\packages\Serilog.1.5.14\lib\net45\Serilog.dll - True - - - ..\..\packages\Serilog.1.5.14\lib\net45\Serilog.FullNetFx.dll - True - @@ -57,7 +50,6 @@ - @@ -156,4 +148,11 @@ --> + + + + 2.1.0 + + + \ No newline at end of file diff --git a/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.v2.ncrunchproject b/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.v2.ncrunchproject deleted file mode 100644 index e1b4d7cf28..0000000000 --- a/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.v2.ncrunchproject +++ /dev/null @@ -1,26 +0,0 @@ - - true - 1000 - false - false - false - true - false - false - true - false - false - false - true - false - true - true - true - 60000 - - - - AutoDetect - STA - x86 - \ No newline at end of file diff --git a/samples/ControlCatalog.Desktop/packages.config b/samples/ControlCatalog.Desktop/packages.config deleted file mode 100644 index b3abe6f487..0000000000 --- a/samples/ControlCatalog.Desktop/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj b/samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj new file mode 100644 index 0000000000..d43c3a060e --- /dev/null +++ b/samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj @@ -0,0 +1,13 @@ + + + + Exe + netcoreapp1.1 + + + + + + + + \ No newline at end of file diff --git a/samples/ControlCatalog.NetCore/Program.cs b/samples/ControlCatalog.NetCore/Program.cs new file mode 100644 index 0000000000..57a508f923 --- /dev/null +++ b/samples/ControlCatalog.NetCore/Program.cs @@ -0,0 +1,15 @@ +using System; +using Avalonia; + +namespace ControlCatalog.NetCore +{ + class Program + { + static void Main(string[] args) + { + AppBuilder.Configure() + .UsePlatformDetect() + .Start(); + } + } +} \ No newline at end of file diff --git a/samples/ControlCatalog.iOS/AppDelegate.cs b/samples/ControlCatalog.iOS/AppDelegate.cs index 1871facf55..a8fc6b30a0 100644 --- a/samples/ControlCatalog.iOS/AppDelegate.cs +++ b/samples/ControlCatalog.iOS/AppDelegate.cs @@ -2,6 +2,8 @@ using Foundation; using UIKit; using Avalonia; using Avalonia.Controls; +using Avalonia.iOS; +using Avalonia.Media; namespace ControlCatalog { @@ -11,6 +13,8 @@ namespace ControlCatalog [Register("AppDelegate")] public partial class AppDelegate : UIApplicationDelegate { + public override UIWindow Window { get; set; } + // // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window @@ -22,10 +26,9 @@ namespace ControlCatalog { AppBuilder.Configure() .UseiOS() - .UseSkiaViewHost() - .UseSkia() - .Start(); - + .UseSkia().SetupWithoutStarting(); + Window = new AvaloniaWindow() {Content = new MainView(), StatusBarColor = Colors.LightSteelBlue}; + Window.MakeKeyAndVisible(); return true; } } diff --git a/samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj b/samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj index 1c4d31b62c..01d287ea83 100644 --- a/samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj +++ b/samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj @@ -20,8 +20,21 @@ 4 false i386 - None - true + SdkOnly + True + 9.1 + False + False + False + False + False + False + False + False + True + Default + HttpClientHandler + False none @@ -168,4 +181,5 @@ + \ No newline at end of file diff --git a/samples/ControlCatalog.iOS/ControlCatalog.iOS.v2.ncrunchproject b/samples/ControlCatalog.iOS/ControlCatalog.iOS.v2.ncrunchproject deleted file mode 100644 index e1b4d7cf28..0000000000 --- a/samples/ControlCatalog.iOS/ControlCatalog.iOS.v2.ncrunchproject +++ /dev/null @@ -1,26 +0,0 @@ - - true - 1000 - false - false - false - true - false - false - true - false - false - false - true - false - true - true - true - 60000 - - - - AutoDetect - STA - x86 - \ No newline at end of file diff --git a/samples/ControlCatalog/ControlCatalog.csproj b/samples/ControlCatalog/ControlCatalog.csproj index f4a0915dd1..4741c8b35d 100644 --- a/samples/ControlCatalog/ControlCatalog.csproj +++ b/samples/ControlCatalog/ControlCatalog.csproj @@ -1,20 +1,8 @@ - - - + - 10.0 - Debug - AnyCPU - {D0A739B9-3C68-4BA6-A328-41606954B6BD} - Library - Properties - ControlCatalog - ControlCatalog - en-US - 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Profile7 - v4.5 + netstandard1.1 + False + false true @@ -153,62 +141,20 @@ - - {3E53A01A-B331-47F3-B828-4A5717E77A24} - Avalonia.Markup.Xaml - - - {6417E941-21BC-467B-A771-0DE389353CE6} - Avalonia.Markup - - - {D211E587-D8BC-45B9-95A4-F297C8FA5200} - Avalonia.Animation - - - {B09B78D8-9B26-48B0-9149-D64A2F120F3F} - Avalonia.Base - - - {D2221C82-4A25-4583-9B43-D791E3F6820C} - Avalonia.Controls - - - {7062AE20-5DCC-4442-9645-8195BDECE63E} - Avalonia.Diagnostics - - - {5FB2B005-0A7F-4DAD-ADD4-3ED01444E63D} - Avalonia.HtmlRenderer - - - {62024B2D-53EB-4638-B26B-85EEAA54866E} - Avalonia.Input - - - {6B0ED19D-A08B-461C-A9D9-A9EE40B0C06B} - Avalonia.Interactivity - - - {42472427-4774-4C81-8AFF-9F27B8E31721} - Avalonia.Layout - - - {6417B24E-49C2-4985-8DB2-3AB9D898EC91} - Avalonia.ReactiveUI - - - {EB582467-6ABB-43A1-B052-E981BA910E3A} - Avalonia.Visuals - - - {F1BAA01A-F176-4C6A-B39D-5B40BB1B148F} - Avalonia.Styling - - - {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F} - Avalonia.Themes.Default - + + + + + + + + + + + + + + @@ -225,12 +171,7 @@ - - + + + \ No newline at end of file diff --git a/samples/ControlCatalog/ControlCatalog.v2.ncrunchproject b/samples/ControlCatalog/ControlCatalog.v2.ncrunchproject deleted file mode 100644 index f744eecae0..0000000000 --- a/samples/ControlCatalog/ControlCatalog.v2.ncrunchproject +++ /dev/null @@ -1,26 +0,0 @@ - - true - 1000 - false - false - false - true - false - false - true - false - false - true - true - false - true - true - true - 60000 - - - - AutoDetect - STA - x86 - \ No newline at end of file diff --git a/samples/ControlCatalog/packages.config b/samples/ControlCatalog/packages.config deleted file mode 100644 index 44ff0f0628..0000000000 --- a/samples/ControlCatalog/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/samples/RenderTest/App.config b/samples/RenderTest/App.config index 2231c71e63..10a06d8258 100644 --- a/samples/RenderTest/App.config +++ b/samples/RenderTest/App.config @@ -9,6 +9,14 @@ + + + + + + + + diff --git a/samples/RenderTest/App.xaml b/samples/RenderTest/App.xaml index d9630eef58..c119f54915 100644 --- a/samples/RenderTest/App.xaml +++ b/samples/RenderTest/App.xaml @@ -2,5 +2,6 @@ + \ No newline at end of file diff --git a/samples/RenderTest/MainWindow.xaml b/samples/RenderTest/MainWindow.xaml index ab233fd90b..1d3001f1b1 100644 --- a/samples/RenderTest/MainWindow.xaml +++ b/samples/RenderTest/MainWindow.xaml @@ -1,3 +1,32 @@ + Title="Avalonia Render Test" + xmlns:pages="clr-namespace:RenderTest.Pages;assembly=RenderTest"> + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/RenderTest/MainWindow.xaml.cs b/samples/RenderTest/MainWindow.xaml.cs index feb121186f..c6c0eafd25 100644 --- a/samples/RenderTest/MainWindow.xaml.cs +++ b/samples/RenderTest/MainWindow.xaml.cs @@ -2,15 +2,11 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; -using System.Reactive.Linq; using Avalonia; -using Avalonia.Animation; using Avalonia.Controls; -using Avalonia.Controls.Shapes; -using Avalonia.Data; -using Avalonia.Layout; using Avalonia.Markup.Xaml; -using Avalonia.Media; +using RenderTest.ViewModels; +using ReactiveUI; using Avalonia.Rendering; namespace RenderTest @@ -20,63 +16,16 @@ namespace RenderTest public MainWindow() { this.InitializeComponent(); - this.CreateAnimations(); this.AttachDevTools(); - RendererMixin.DrawFpsCounter = true; + + var vm = new MainWindowViewModel(); + vm.WhenAnyValue(x => x.DrawFps).Subscribe(x => RendererMixin.DrawFpsCounter = x); + this.DataContext = vm; } private void InitializeComponent() { AvaloniaXamlLoader.Load(this); } - - private void CreateAnimations() - { - const int Count = 100; - var panel = new WrapPanel(); - - for (var i = 0; i < Count; ++i) - { - var element = new Panel - { - Children = - { - new Ellipse - { - Width = 100, - Height = 100, - Fill = Brushes.Blue, - }, - new Path - { - Data = StreamGeometry.Parse( - "F1 M 16.6309,18.6563C 17.1309,8.15625 29.8809,14.1563 29.8809,14.1563C 30.8809,11.1563 34.1308,11.4063 34.1308,11.4063C 33.5,12 34.6309,13.1563 34.6309,13.1563C 32.1309,13.1562 31.1309,14.9062 31.1309,14.9062C 41.1309,23.9062 32.6309,27.9063 32.6309,27.9062C 24.6309,24.9063 21.1309,22.1562 16.6309,18.6563 Z M 16.6309,19.9063C 21.6309,24.1563 25.1309,26.1562 31.6309,28.6562C 31.6309,28.6562 26.3809,39.1562 18.3809,36.1563C 18.3809,36.1563 18,38 16.3809,36.9063C 15,36 16.3809,34.9063 16.3809,34.9063C 16.3809,34.9063 10.1309,30.9062 16.6309,19.9063 Z"), - Fill = Brushes.Green, - HorizontalAlignment = HorizontalAlignment.Center, - VerticalAlignment = VerticalAlignment.Center, - RenderTransform = new ScaleTransform(2, 2), - } - }, - Margin = new Thickness(4), - RenderTransform = new ScaleTransform(), - }; - - var start = Animate.Stopwatch.Elapsed; - var index = i; - var degrees = Animate.Timer - .Select(x => (x - start).TotalSeconds) - .Where(x => (x % Count) >= index && (x % Count) < index + 1) - .Select(x => (x % 1) / 1); - - element.RenderTransform.Bind( - ScaleTransform.ScaleXProperty, - degrees, - BindingPriority.Animation); - - panel.Children.Add(element); - } - - Content = panel; - } } } diff --git a/samples/RenderTest/Pages/AnimationsPage.xaml b/samples/RenderTest/Pages/AnimationsPage.xaml new file mode 100644 index 0000000000..6eb7067245 --- /dev/null +++ b/samples/RenderTest/Pages/AnimationsPage.xaml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/samples/RenderTest/Pages/AnimationsPage.xaml.cs b/samples/RenderTest/Pages/AnimationsPage.xaml.cs new file mode 100644 index 0000000000..991896c3b5 --- /dev/null +++ b/samples/RenderTest/Pages/AnimationsPage.xaml.cs @@ -0,0 +1,90 @@ +using System.Reactive.Linq; +using Avalonia; +using Avalonia.Animation; +using Avalonia.Controls; +using Avalonia.Controls.Shapes; +using Avalonia.Data; +using Avalonia.Input; +using Avalonia.Markup.Xaml; +using Avalonia.Media; + +namespace RenderTest.Pages +{ + public class AnimationsPage : UserControl + { + public AnimationsPage() + { + this.InitializeComponent(); + this.CreateAnimations(); + } + + private void InitializeComponent() + { + AvaloniaXamlLoader.Load(this); + } + + private void CreateAnimations() + { + const int Count = 100; + var panel = new WrapPanel(); + + for (var i = 0; i < Count; ++i) + { + Ellipse ellipse; + var element = new Panel + { + Children = + { + (ellipse = new Ellipse + { + Name = $"ellipse{i}", + Width = 100, + Height = 100, + Fill = Brushes.Blue, + }), + new Path + { + Data = StreamGeometry.Parse( + "F1 M 16.6309,18.6563C 17.1309,8.15625 29.8809,14.1563 29.8809,14.1563C 30.8809,11.1563 34.1308,11.4063 34.1308,11.4063C 33.5,12 34.6309,13.1563 34.6309,13.1563C 32.1309,13.1562 31.1309,14.9062 31.1309,14.9062C 41.1309,23.9062 32.6309,27.9063 32.6309,27.9062C 24.6309,24.9063 21.1309,22.1562 16.6309,18.6563 Z M 16.6309,19.9063C 21.6309,24.1563 25.1309,26.1562 31.6309,28.6562C 31.6309,28.6562 26.3809,39.1562 18.3809,36.1563C 18.3809,36.1563 18,38 16.3809,36.9063C 15,36 16.3809,34.9063 16.3809,34.9063C 16.3809,34.9063 10.1309,30.9062 16.6309,19.9063 Z"), + Fill = Brushes.Green, + HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Center, + VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center, + RenderTransform = new ScaleTransform(2, 2), + } + }, + Margin = new Thickness(4), + RenderTransform = new ScaleTransform(), + }; + + var start = Animate.Stopwatch.Elapsed; + var index = i % (Count / 2); + var degrees = Animate.Timer + .Select(x => (x - start).TotalSeconds) + .Where(x => (x % Count) >= index && (x % Count) < index + 1) + .Select(x => (x % 1) / 1); + + element.RenderTransform.Bind( + ScaleTransform.ScaleXProperty, + degrees, + BindingPriority.Animation); + + ellipse.PointerEnter += Ellipse_PointerEnter; + ellipse.PointerLeave += Ellipse_PointerLeave; + + panel.Children.Add(element); + } + + Content = panel; + } + + private void Ellipse_PointerEnter(object sender, PointerEventArgs e) + { + ((Ellipse)sender).Fill = Brushes.Red; + } + + private void Ellipse_PointerLeave(object sender, PointerEventArgs e) + { + ((Ellipse)sender).Fill = Brushes.Blue; + } + } +} diff --git a/samples/RenderTest/Pages/ClippingPage.xaml b/samples/RenderTest/Pages/ClippingPage.xaml new file mode 100644 index 0000000000..47e9d51e3c --- /dev/null +++ b/samples/RenderTest/Pages/ClippingPage.xaml @@ -0,0 +1,15 @@ + + + + + + + + + Apply Geometry Clip + + \ No newline at end of file diff --git a/samples/RenderTest/Pages/ClippingPage.xaml.cs b/samples/RenderTest/Pages/ClippingPage.xaml.cs new file mode 100644 index 0000000000..b416f12943 --- /dev/null +++ b/samples/RenderTest/Pages/ClippingPage.xaml.cs @@ -0,0 +1,48 @@ +using System; +using System.Reactive.Linq; +using Avalonia; +using Avalonia.Animation; +using Avalonia.Controls; +using Avalonia.Data; +using Avalonia.Markup.Xaml; +using Avalonia.Media; + +namespace RenderTest.Pages +{ + public class ClippingPage : UserControl + { + private Geometry _clip; + + public ClippingPage() + { + InitializeComponent(); + CreateAnimations(); + WireUpCheckbox(); + } + + private void InitializeComponent() + { + AvaloniaXamlLoader.Load(this); + } + + private void CreateAnimations() + { + var clipped = this.FindControl("clipChild"); + var degrees = Animate.Timer.Select(x => x.TotalMilliseconds / 5); + clipped.RenderTransform = new RotateTransform(); + clipped.RenderTransform.Bind(RotateTransform.AngleProperty, degrees, BindingPriority.Animation); + clipped.Bind( + Border.BackgroundProperty, + clipped.GetObservable(Control.IsPointerOverProperty) + .Select(x => x ? Brushes.Crimson : AvaloniaProperty.UnsetValue)); + } + + private void WireUpCheckbox() + { + var useMask = this.FindControl("useMask"); + var clipped = this.FindControl("clipped"); + _clip = clipped.Clip; + useMask.Click += (s, e) => clipped.Clip = clipped.Clip == null ? _clip : null; + } + } +} diff --git a/samples/RenderTest/RenderTest.csproj b/samples/RenderTest/RenderTest.csproj index f117c76342..fdebadb444 100644 --- a/samples/RenderTest/RenderTest.csproj +++ b/samples/RenderTest/RenderTest.csproj @@ -1,5 +1,5 @@  - + Debug @@ -37,36 +37,8 @@ - - ..\..\packages\Serilog.1.5.14\lib\net45\Serilog.dll - True - - - ..\..\packages\Serilog.1.5.14\lib\net45\Serilog.FullNetFx.dll - True - - - ..\..\packages\System.Reactive.Core.3.0.0\lib\net45\System.Reactive.Core.dll - True - - - ..\..\packages\System.Reactive.Interfaces.3.0.0\lib\net45\System.Reactive.Interfaces.dll - True - - - ..\..\packages\System.Reactive.Linq.3.0.0\lib\net45\System.Reactive.Linq.dll - True - - - ..\..\packages\System.Reactive.PlatformServices.3.0.0\lib\net45\System.Reactive.PlatformServices.dll - True - - - ..\..\packages\System.Reactive.Windows.Threading.3.0.0\lib\net45\System.Reactive.Windows.Threading.dll - True - @@ -79,15 +51,21 @@ App.xaml + + ClippingPage.xaml + + + AnimationsPage.xaml + MainWindow.xaml + - @@ -167,6 +145,10 @@ {6417e941-21bc-467b-a771-0de389353ce6} Avalonia.Markup + + {925dd807-b651-475f-9f7c-cbeb974ce43d} + Avalonia.Skia.Desktop + {3e908f67-5543-4879-a1dc-08eace79b3cd} Avalonia.Direct2D1 @@ -181,6 +163,21 @@ Designer + + + Designer + + + + + Designer + + + + + Designer + + + + + + 2.1.0 + + + + + + + + + + \ No newline at end of file diff --git a/samples/RenderTest/RenderTest.v2.ncrunchproject b/samples/RenderTest/RenderTest.v2.ncrunchproject deleted file mode 100644 index 30815b1937..0000000000 --- a/samples/RenderTest/RenderTest.v2.ncrunchproject +++ /dev/null @@ -1,26 +0,0 @@ - - true - 1000 - false - false - false - true - false - false - false - false - false - true - true - false - true - true - true - 60000 - - - - AutoDetect - STA - x86 - \ No newline at end of file diff --git a/samples/RenderTest/SideBar.xaml b/samples/RenderTest/SideBar.xaml new file mode 100644 index 0000000000..950de71e2b --- /dev/null +++ b/samples/RenderTest/SideBar.xaml @@ -0,0 +1,40 @@ + + + + + + + diff --git a/samples/RenderTest/ViewModels/MainWindowViewModel.cs b/samples/RenderTest/ViewModels/MainWindowViewModel.cs new file mode 100644 index 0000000000..bd68752f66 --- /dev/null +++ b/samples/RenderTest/ViewModels/MainWindowViewModel.cs @@ -0,0 +1,34 @@ +using System; +using ReactiveUI; + +namespace RenderTest.ViewModels +{ + public class MainWindowViewModel : ReactiveObject + { + private bool drawDirtyRects = true; + private bool drawFps = true; + + public MainWindowViewModel() + { + ToggleDrawDirtyRects = ReactiveCommand.Create(); + ToggleDrawDirtyRects.Subscribe(_ => DrawDirtyRects = !DrawDirtyRects); + ToggleDrawFps = ReactiveCommand.Create(); + ToggleDrawFps.Subscribe(_ => DrawFps = !DrawFps); + } + + public bool DrawDirtyRects + { + get { return drawDirtyRects; } + set { this.RaiseAndSetIfChanged(ref drawDirtyRects, value); } + } + + public bool DrawFps + { + get { return drawFps; } + set { this.RaiseAndSetIfChanged(ref drawFps, value); } + } + + public ReactiveCommand ToggleDrawDirtyRects { get; } + public ReactiveCommand ToggleDrawFps { get; } + } +} diff --git a/samples/RenderTest/packages.config b/samples/RenderTest/packages.config deleted file mode 100644 index 3c79dde8c3..0000000000 --- a/samples/RenderTest/packages.config +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/samples/VirtualizationTest/VirtualizationTest.csproj b/samples/VirtualizationTest/VirtualizationTest.csproj index 9e80dfdc8f..5065d70737 100644 --- a/samples/VirtualizationTest/VirtualizationTest.csproj +++ b/samples/VirtualizationTest/VirtualizationTest.csproj @@ -1,5 +1,5 @@  - + Debug @@ -37,28 +37,8 @@ - - ..\..\packages\Serilog.1.5.14\lib\net45\Serilog.dll - True - - - ..\..\packages\Serilog.1.5.14\lib\net45\Serilog.FullNetFx.dll - True - - - ..\..\packages\Splat.1.6.2\lib\Net45\Splat.dll - True - - - ..\..\packages\System.Reactive.Core.3.0.0\lib\net45\System.Reactive.Core.dll - True - - - ..\..\packages\System.Reactive.Interfaces.3.0.0\lib\net45\System.Reactive.Interfaces.dll - True - @@ -80,7 +60,6 @@ - @@ -182,4 +161,14 @@ --> + + + + 2.1.0 + + + + + + \ No newline at end of file diff --git a/samples/VirtualizationTest/VirtualizationTest.v2.ncrunchproject b/samples/VirtualizationTest/VirtualizationTest.v2.ncrunchproject deleted file mode 100644 index f744eecae0..0000000000 --- a/samples/VirtualizationTest/VirtualizationTest.v2.ncrunchproject +++ /dev/null @@ -1,26 +0,0 @@ - - true - 1000 - false - false - false - true - false - false - true - false - false - true - true - false - true - true - true - 60000 - - - - AutoDetect - STA - x86 - \ No newline at end of file diff --git a/samples/VirtualizationTest/packages.config b/samples/VirtualizationTest/packages.config deleted file mode 100644 index f2da2367fa..0000000000 --- a/samples/VirtualizationTest/packages.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/samples/interop/GtkInteropDemo/GtkInteropDemo.csproj b/samples/interop/GtkInteropDemo/GtkInteropDemo.csproj index 738a1e776c..9ae6063876 100644 --- a/samples/interop/GtkInteropDemo/GtkInteropDemo.csproj +++ b/samples/interop/GtkInteropDemo/GtkInteropDemo.csproj @@ -157,4 +157,5 @@ --> + \ No newline at end of file diff --git a/samples/interop/GtkInteropDemo/GtkInteropDemo.v2.ncrunchproject b/samples/interop/GtkInteropDemo/GtkInteropDemo.v2.ncrunchproject deleted file mode 100644 index e1b4d7cf28..0000000000 --- a/samples/interop/GtkInteropDemo/GtkInteropDemo.v2.ncrunchproject +++ /dev/null @@ -1,26 +0,0 @@ - - true - 1000 - false - false - false - true - false - false - true - false - false - false - true - false - true - true - true - 60000 - - - - AutoDetect - STA - x86 - \ No newline at end of file diff --git a/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj b/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj index 671ebd0020..9ebe588fd1 100644 --- a/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj +++ b/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj @@ -187,4 +187,5 @@ --> + \ No newline at end of file diff --git a/samples/interop/WindowsInteropTest/WindowsInteropTest.v2.ncrunchproject b/samples/interop/WindowsInteropTest/WindowsInteropTest.v2.ncrunchproject deleted file mode 100644 index e1b4d7cf28..0000000000 --- a/samples/interop/WindowsInteropTest/WindowsInteropTest.v2.ncrunchproject +++ /dev/null @@ -1,26 +0,0 @@ - - true - 1000 - false - false - false - true - false - false - true - false - false - false - true - false - true - true - true - 60000 - - - - AutoDetect - STA - x86 - \ No newline at end of file diff --git a/src/Android/Avalonia.Android/ActivityTracker.cs b/src/Android/Avalonia.Android/ActivityTracker.cs new file mode 100644 index 0000000000..2ad1d9e361 --- /dev/null +++ b/src/Android/Avalonia.Android/ActivityTracker.cs @@ -0,0 +1,47 @@ +using Android.App; +using Android.OS; + +namespace Avalonia.Android +{ + internal class ActivityTracker : Java.Lang.Object, global::Android.App.Application.IActivityLifecycleCallbacks + { + public static Activity Current { get; private set; } + public void OnActivityCreated(Activity activity, Bundle savedInstanceState) + { + Current = activity; + } + + public void OnActivityDestroyed(Activity activity) + { + if (Current == activity) + Current = null; + } + + public void OnActivityPaused(Activity activity) + { + if (Current == activity) + Current = null; + } + + public void OnActivityResumed(Activity activity) + { + Current = activity; + } + + public void OnActivitySaveInstanceState(Activity activity, Bundle outState) + { + Current = activity; + } + + public void OnActivityStarted(Activity activity) + { + Current = activity; + } + + public void OnActivityStopped(Activity activity) + { + if (Current == activity) + Current = null; + } + } +} \ No newline at end of file diff --git a/src/Android/Avalonia.Android/AndroidPlatform.cs b/src/Android/Avalonia.Android/AndroidPlatform.cs index 5b3170a0c7..2089359c26 100644 --- a/src/Android/Avalonia.Android/AndroidPlatform.cs +++ b/src/Android/Avalonia.Android/AndroidPlatform.cs @@ -62,6 +62,8 @@ namespace Avalonia.Android .Bind().ToConstant(new AssetLoader(app.GetType().Assembly)); SkiaPlatform.Initialize(); + ((global::Android.App.Application) global::Android.App.Application.Context.ApplicationContext) + .RegisterActivityLifecycleCallbacks(new ActivityTracker()); } public IWindowImpl CreateWindow() @@ -76,7 +78,7 @@ namespace Avalonia.Android public IPopupImpl CreatePopup() { - throw new NotImplementedException(); + return new PopupImpl(); } } } \ No newline at end of file diff --git a/src/Android/Avalonia.Android/AppBuilder.cs b/src/Android/Avalonia.Android/AppBuilder.cs new file mode 100644 index 0000000000..6078e3bb98 --- /dev/null +++ b/src/Android/Avalonia.Android/AppBuilder.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using Android.App; +using Android.Content; +using Android.OS; +using Android.Runtime; +using Android.Views; +using Android.Widget; +using Avalonia.Controls; +using Avalonia.Platform; +using Avalonia.Shared.PlatformSupport; + +namespace Avalonia +{ + public sealed class AppBuilder : AppBuilderBase + { + public AppBuilder() : base(new StandardRuntimePlatform(), + builder => StandardRuntimePlatformServices.Register(builder.Instance?.GetType()?.Assembly)) + { + + } + } +} \ 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 0dfab3f518..f22d592544 100644 --- a/src/Android/Avalonia.Android/Avalonia.Android.csproj +++ b/src/Android/Avalonia.Android/Avalonia.Android.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -41,18 +41,6 @@ - - ..\..\..\packages\System.Reactive.Core.3.0.0\lib\netstandard1.3\System.Reactive.Core.dll - True - - - ..\..\..\packages\System.Reactive.Interfaces.3.0.0\lib\netstandard1.0\System.Reactive.Interfaces.dll - True - - - ..\..\..\packages\System.Reactive.PlatformServices.3.0.0\lib\netstandard1.3\System.Reactive.PlatformServices.dll - True - @@ -61,8 +49,10 @@ + + @@ -72,6 +62,7 @@ + @@ -83,7 +74,6 @@ - @@ -149,4 +139,26 @@ --> + + + + + + + + + + + + + + + + + + + + + $(MSBuildToolsPath)\Roslyn + \ No newline at end of file diff --git a/src/Android/Avalonia.Android/Avalonia.Android.v2.ncrunchproject b/src/Android/Avalonia.Android/Avalonia.Android.v2.ncrunchproject deleted file mode 100644 index f744eecae0..0000000000 --- a/src/Android/Avalonia.Android/Avalonia.Android.v2.ncrunchproject +++ /dev/null @@ -1,26 +0,0 @@ - - true - 1000 - false - false - false - true - false - false - true - false - false - true - true - false - true - true - true - 60000 - - - - AutoDetect - STA - x86 - \ No newline at end of file diff --git a/src/Android/Avalonia.Android/AvaloniaActivity.cs b/src/Android/Avalonia.Android/AvaloniaActivity.cs index a9b04c882b..21ce555086 100644 --- a/src/Android/Avalonia.Android/AvaloniaActivity.cs +++ b/src/Android/Avalonia.Android/AvaloniaActivity.cs @@ -14,16 +14,17 @@ namespace Avalonia.Android { public abstract class AvaloniaActivity : Activity { - AvaloniaView _view; + + internal AvaloniaView View; object _content; protected override void OnCreate(Bundle savedInstanceState) { RequestWindowFeature(WindowFeatures.NoTitle); - _view = new AvaloniaView(this); + View = new AvaloniaView(this); if(_content != null) - _view.Content = _content; - SetContentView(_view); + View.Content = _content; + SetContentView(View); TakeKeyEvents(true); base.OnCreate(savedInstanceState); } @@ -37,14 +38,14 @@ namespace Avalonia.Android set { _content = value; - if (_view != null) - _view.Content = value; + if (View != null) + View.Content = value; } } public override bool DispatchKeyEvent(KeyEvent e) { - return _view.DispatchKeyEvent(e); + return View.DispatchKeyEvent(e); } } } \ No newline at end of file diff --git a/src/Android/Avalonia.Android/AvaloniaView.cs b/src/Android/Avalonia.Android/AvaloniaView.cs index 71eea14a1d..6c4274a6e4 100644 --- a/src/Android/Avalonia.Android/AvaloniaView.cs +++ b/src/Android/Avalonia.Android/AvaloniaView.cs @@ -10,6 +10,7 @@ using Android.Runtime; using Android.Views; using Android.Widget; using Avalonia.Android.Platform.SkiaPlatform; +using Avalonia.Controls; using Avalonia.Controls.Embedding; using Avalonia.Platform; @@ -23,7 +24,7 @@ namespace Avalonia.Android public AvaloniaView(Context context) : base(context) { _view = new ViewImpl(context); - AddView(_view); + AddView(_view.View); _root = new EmbeddableControlRoot(_view); _root.Prepare(); } @@ -36,7 +37,7 @@ namespace Avalonia.Android public override bool DispatchKeyEvent(KeyEvent e) { - return _view.DispatchKeyEvent(e); + return _view.View.DispatchKeyEvent(e); } class ViewImpl : TopLevelImpl, IEmbeddableWindowImpl @@ -45,8 +46,8 @@ namespace Avalonia.Android public ViewImpl(Context context) : base(context) { - Focusable = true; - FocusChange += ViewImpl_FocusChange; + View.Focusable = true; + View.FocusChange += ViewImpl_FocusChange; } private void ViewImpl_FocusChange(object sender, FocusChangeEventArgs e) @@ -54,6 +55,15 @@ namespace Avalonia.Android if(!e.HasFocus) LostFocus?.Invoke(); } + + protected override void OnResized(Size size) + { + MaxClientSize = size; + base.OnResized(size); + } + + public WindowState WindowState { get; set; } + public IDisposable ShowDialog() => null; } } } \ No newline at end of file diff --git a/src/Android/Avalonia.Android/Platform/SkiaPlatform/AndroidFramebuffer.cs b/src/Android/Avalonia.Android/Platform/SkiaPlatform/AndroidFramebuffer.cs index 982c79560b..64dbeb89cc 100644 --- a/src/Android/Avalonia.Android/Platform/SkiaPlatform/AndroidFramebuffer.cs +++ b/src/Android/Avalonia.Android/Platform/SkiaPlatform/AndroidFramebuffer.cs @@ -2,7 +2,7 @@ using System; using System.Runtime.InteropServices; using Android.Runtime; using Android.Views; -using Avalonia.Controls.Platform.Surfaces; +using Avalonia.Platform; namespace Avalonia.Android.Platform.SkiaPlatform { @@ -12,7 +12,11 @@ namespace Avalonia.Android.Platform.SkiaPlatform public AndroidFramebuffer(Surface surface) { + if(surface == null) + throw new ArgumentNullException(nameof(surface)); _window = ANativeWindow_fromSurface(JNIEnv.Handle, surface.Handle); + if (_window == IntPtr.Zero) + throw new Exception("Unable to obtain ANativeWindow"); ANativeWindow_Buffer buffer; var rc = new ARect() { diff --git a/src/Android/Avalonia.Android/Platform/SkiaPlatform/InvalidationAwareSurfaceView.cs b/src/Android/Avalonia.Android/Platform/SkiaPlatform/InvalidationAwareSurfaceView.cs index 2213ebddcc..d2d5909815 100644 --- a/src/Android/Avalonia.Android/Platform/SkiaPlatform/InvalidationAwareSurfaceView.cs +++ b/src/Android/Avalonia.Android/Platform/SkiaPlatform/InvalidationAwareSurfaceView.cs @@ -18,14 +18,13 @@ namespace Avalonia.Android { public abstract class InvalidationAwareSurfaceView : SurfaceView, ISurfaceHolderCallback, IPlatformHandle { - private readonly Context _context; bool _invalidateQueued; readonly object _lock = new object(); private readonly Handler _handler; + public InvalidationAwareSurfaceView(Context context) : base(context) { - _context = context; Holder.AddCallback(this); _handler = new Handler(context.MainLooper); } @@ -38,13 +37,11 @@ namespace Avalonia.Android return; _handler.Post(() => { - lock (_lock) - { - _invalidateQueued = false; - } + if (Holder.Surface?.IsValid != true) + return; try { - Draw(); + DoDraw(); } catch (Exception e) { @@ -67,20 +64,29 @@ namespace Avalonia.Android public void SurfaceChanged(ISurfaceHolder holder, Format format, int width, int height) { Log.Info("AVALONIA", "Surface Changed"); - Draw(); + DoDraw(); } public void SurfaceCreated(ISurfaceHolder holder) { Log.Info("AVALONIA", "Surface Created"); - Draw(); + DoDraw(); } public void SurfaceDestroyed(ISurfaceHolder holder) { Log.Info("AVALONIA", "Surface Destroyed"); + } + protected void DoDraw() + { + lock (_lock) + { + _invalidateQueued = false; + } + Draw(); + } protected abstract void Draw(); public string HandleDescriptor => "SurfaceView"; } diff --git a/src/Android/Avalonia.Android/Platform/SkiaPlatform/PopupImpl.cs b/src/Android/Avalonia.Android/Platform/SkiaPlatform/PopupImpl.cs new file mode 100644 index 0000000000..efbc71b808 --- /dev/null +++ b/src/Android/Avalonia.Android/Platform/SkiaPlatform/PopupImpl.cs @@ -0,0 +1,110 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using Android.App; +using Android.Content; +using Android.Graphics; +using Android.OS; +using Android.Runtime; +using Android.Views; +using Android.Widget; +using Avalonia.Controls; +using Avalonia.Platform; + +namespace Avalonia.Android.Platform.SkiaPlatform +{ + class PopupImpl : TopLevelImpl, IPopupImpl + { + private Point _position; + private bool _isAdded; + Action IWindowBaseImpl.Activated { get; set; } + public Action PositionChanged { get; set; } + public Action Deactivated { get; set; } + + public PopupImpl() : base(ActivityTracker.Current, true) + { + } + + private Size _clientSize = new Size(1, 1); + + public void Resize(Size value) + { + if (View == null) + return; + _clientSize = value; + UpdateParams(); + } + + public Point Position + { + get { return _position; } + set + { + _position = value; + PositionChanged?.Invoke(_position); + UpdateParams(); + } + } + + WindowManagerLayoutParams CreateParams() => new WindowManagerLayoutParams(0, + WindowManagerFlags.NotTouchModal, Format.Translucent) + { + Gravity = GravityFlags.Left | GravityFlags.Top, + WindowAnimations = 0, + X = (int) _position.X, + Y = (int) _position.Y, + Width = Math.Max(1, (int) _clientSize.Width), + Height = Math.Max(1, (int) _clientSize.Height) + }; + + void UpdateParams() + { + if (_isAdded) + ActivityTracker.Current?.WindowManager?.UpdateViewLayout(View, CreateParams()); + } + + public override void Show() + { + if (_isAdded) + return; + ActivityTracker.Current.WindowManager.AddView(View, CreateParams()); + _isAdded = true; + } + + public override void Hide() + { + if (_isAdded) + { + var wm = View.Context.ApplicationContext.GetSystemService(Context.WindowService) + .JavaCast(); + wm.RemoveView(View); + _isAdded = false; + } + } + + public override void Dispose() + { + Hide(); + base.Dispose(); + } + + + public void Activate() + { + } + + public void BeginMoveDrag() + { + //Not supported + } + + public void BeginResizeDrag(WindowEdge edge) + { + //Not supported + } + + + } +} \ No newline at end of file diff --git a/src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs b/src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs index 26d2b0aad9..75772be171 100644 --- a/src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs +++ b/src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs @@ -9,42 +9,32 @@ using Avalonia.Input.Raw; using Avalonia.Platform; using System; using System.Collections.Generic; +using System.Reactive.Disposables; using Avalonia.Controls; using Avalonia.Controls.Platform.Surfaces; namespace Avalonia.Android.Platform.SkiaPlatform { - class TopLevelImpl : InvalidationAwareSurfaceView, IAndroidView, ITopLevelImpl, - ISurfaceHolderCallback, IFramebufferPlatformSurface + class TopLevelImpl : IAndroidView, ITopLevelImpl, IFramebufferPlatformSurface { - protected AndroidKeyboardEventsHelper _keyboardHelper; + private readonly AndroidKeyboardEventsHelper _keyboardHelper; + private readonly AndroidTouchEventsHelper _touchHelper; + private ViewImpl _view; - private AndroidTouchEventsHelper _touchHelper; - - public TopLevelImpl(Context context) : base(context) + public TopLevelImpl(Context context, bool placeOnTop = false) { + _view = new ViewImpl(context, this, placeOnTop); _keyboardHelper = new AndroidKeyboardEventsHelper(this); - _touchHelper = new AndroidTouchEventsHelper(this, () => InputRoot, p => GetAvaloniaPointFromEvent(p)); + _touchHelper = new AndroidTouchEventsHelper(this, () => InputRoot, + p => GetAvaloniaPointFromEvent(p)); - MaxClientSize = new Size(Resources.DisplayMetrics.WidthPixels, Resources.DisplayMetrics.HeightPixels); - ClientSize = MaxClientSize; + MaxClientSize = new Size(_view.Resources.DisplayMetrics.WidthPixels, + _view.Resources.DisplayMetrics.HeightPixels); } - - void ISurfaceHolderCallback.SurfaceChanged(ISurfaceHolder holder, Format format, int width, int height) - { - var newSize = new Size(width, height); - if (newSize != ClientSize) - { - MaxClientSize = newSize; - ClientSize = newSize; - Resized?.Invoke(ClientSize); - } - base.SurfaceChanged(holder, format, width, height); - } - + private bool _handleEvents; public bool HandleEvents @@ -56,25 +46,30 @@ namespace Avalonia.Android.Platform.SkiaPlatform _keyboardHelper.HandleEvents = _handleEvents; } } - public WindowState WindowState - { - get { return WindowState.Normal; } - set { } - } - + public virtual Point GetAvaloniaPointFromEvent(MotionEvent e) => new Point(e.GetX(), e.GetY()); public IInputRoot InputRoot { get; private set; } - public Size ClientSize { get; set; } + public virtual Size ClientSize + { + get + { + if (_view == null) + return new Size(0, 0); + return new Size(_view.Width, _view.Height); + } + set + { + + } + } public Action Closed { get; set; } - public Action Deactivated { get; set; } - public Action Input { get; set; } - public Size MaxClientSize { get; private set; } + public Size MaxClientSize { get; protected set; } public Action Paint { get; set; } @@ -82,32 +77,20 @@ namespace Avalonia.Android.Platform.SkiaPlatform public Action ScalingChanged { get; set; } - public Action PositionChanged { get; set; } - - public View View => this; - - Action ITopLevelImpl.Activated { get; set; } - - IPlatformHandle ITopLevelImpl.Handle => this; - - public IEnumerable Surfaces => new object[] { this }; + public View View => _view; - public void Activate() - { - } - - public void Hide() - { - this.Visibility = ViewStates.Invisible; - } + public IPlatformHandle Handle => _view; - public void SetSystemDecorations(bool enabled) + public IEnumerable Surfaces => new object[] {this}; + + public virtual void Hide() { + _view.Visibility = ViewStates.Invisible; } - + public void Invalidate(Rect rect) { - if (Holder?.Surface?.IsValid == true) base.Invalidate(); + if (_view.Holder?.Surface?.IsValid == true) _view.Invalidate(); } public Point PointToClient(Point point) @@ -129,63 +112,79 @@ namespace Avalonia.Android.Platform.SkiaPlatform { InputRoot = inputRoot; } - - public void SetTitle(string title) + + public virtual void Show() { + _view.Visibility = ViewStates.Visible; } - public void Show() + public double Scaling => 1; + + void Draw() { - this.Visibility = ViewStates.Visible; + Paint?.Invoke(new Rect(new Point(0, 0), ClientSize)); } - - public void BeginMoveDrag() + + public virtual void Dispose() { - //Not supported + _view.Dispose(); + _view = null; } - public void BeginResizeDrag(WindowEdge edge) + protected virtual void OnResized(Size size) { - //Not supported + Resized?.Invoke(size); } - public Point Position { get; set; } + class ViewImpl : InvalidationAwareSurfaceView, ISurfaceHolderCallback + { + private readonly TopLevelImpl _tl; + private Size _oldSize; + public ViewImpl(Context context, TopLevelImpl tl, bool placeOnTop) : base(context) + { + _tl = tl; + if (placeOnTop) + SetZOrderOnTop(true); + } - public double Scaling => 1; + protected override void Draw() + { + _tl.Draw(); + } - public IDisposable ShowDialog() - { - throw new NotImplementedException(); - } + public override bool DispatchTouchEvent(MotionEvent e) + { + bool callBase; + bool? result = _tl._touchHelper.DispatchTouchEvent(e, out callBase); + bool baseResult = callBase ? base.DispatchTouchEvent(e) : false; - public override bool DispatchTouchEvent(MotionEvent e) - { - bool callBase; - bool? result = _touchHelper.DispatchTouchEvent(e, out callBase); - bool baseResult = callBase ? base.DispatchTouchEvent(e) : false; + return result != null ? result.Value : baseResult; + } - return result != null ? result.Value : baseResult; - } + public override bool DispatchKeyEvent(KeyEvent e) + { + bool callBase; + bool? res = _tl._keyboardHelper.DispatchKeyEvent(e, out callBase); + bool baseResult = callBase ? base.DispatchKeyEvent(e) : false; - public override bool DispatchKeyEvent(KeyEvent e) - { - bool callBase; - bool? res = _keyboardHelper.DispatchKeyEvent(e, out callBase); - bool baseResult = callBase ? base.DispatchKeyEvent(e) : false; + return res != null ? res.Value : baseResult; + } - return res != null ? res.Value : baseResult; - } - - protected override void Draw() - { - Paint?.Invoke(new Rect(new Point(0, 0), ClientSize)); - } - public void SetIcon(IWindowIconImpl icon) - { - // No window icons for mobile platforms + void ISurfaceHolderCallback.SurfaceChanged(ISurfaceHolder holder, Format format, int width, int height) + { + var newSize = new Size(width, height); + + if (newSize != _oldSize) + { + _oldSize = newSize; + _tl.OnResized(newSize); + } + + base.SurfaceChanged(holder, format, width, height); + } } - ILockedFramebuffer IFramebufferPlatformSurface.Lock()=>new AndroidFramebuffer(Holder.Surface); + ILockedFramebuffer IFramebufferPlatformSurface.Lock()=>new AndroidFramebuffer(_view.Holder.Surface); } } \ No newline at end of file diff --git a/src/Android/Avalonia.Android/Platform/Specific/Helpers/AndroidKeyboardEventsHelper.cs b/src/Android/Avalonia.Android/Platform/Specific/Helpers/AndroidKeyboardEventsHelper.cs index 7bac0ff814..ab990066de 100644 --- a/src/Android/Avalonia.Android/Platform/Specific/Helpers/AndroidKeyboardEventsHelper.cs +++ b/src/Android/Avalonia.Android/Platform/Specific/Helpers/AndroidKeyboardEventsHelper.cs @@ -12,7 +12,7 @@ using System.ComponentModel; namespace Avalonia.Android.Platform.Specific.Helpers { - public class AndroidKeyboardEventsHelper : IDisposable where TView : View, ITopLevelImpl, IAndroidView + public class AndroidKeyboardEventsHelper : IDisposable where TView :ITopLevelImpl, IAndroidView { private TView _view; private IInputElement _lastFocusedElement; @@ -90,7 +90,7 @@ namespace Avalonia.Android.Platform.Specific.Helpers private void TryShowHideKeyboard(IInputElement element, bool value) { - var input = _view.Context.GetSystemService(Context.InputMethodService).JavaCast(); + var input = _view.View.Context.GetSystemService(Context.InputMethodService).JavaCast(); if (value) { @@ -102,7 +102,7 @@ namespace Avalonia.Android.Platform.Specific.Helpers else { //hide keyboard - input.HideSoftInputFromWindow(_view.WindowToken, HideSoftInputFlags.None); + input.HideSoftInputFromWindow(_view.View.WindowToken, HideSoftInputFlags.None); } } diff --git a/src/Android/Avalonia.Android/Platform/Specific/Helpers/AndroidTouchEventsHelper.cs b/src/Android/Avalonia.Android/Platform/Specific/Helpers/AndroidTouchEventsHelper.cs index a448044ee6..702829b91c 100644 --- a/src/Android/Avalonia.Android/Platform/Specific/Helpers/AndroidTouchEventsHelper.cs +++ b/src/Android/Avalonia.Android/Platform/Specific/Helpers/AndroidTouchEventsHelper.cs @@ -8,7 +8,7 @@ using System; namespace Avalonia.Android.Platform.Specific.Helpers { - public class AndroidTouchEventsHelper : IDisposable where TView : View, ITopLevelImpl, IAndroidView + public class AndroidTouchEventsHelper : IDisposable where TView : ITopLevelImpl, IAndroidView { private TView _view; public bool HandleEvents { get; set; } @@ -63,10 +63,10 @@ namespace Avalonia.Android.Platform.Specific.Helpers //if point is in view otherwise it's possible avalonia not to find the proper window to dispatch the event _point = _getPointFunc(e); - double x = _view.GetX(); - double y = _view.GetY(); - double r = x + _view.Width; - double b = y + _view.Height; + double x = _view.View.GetX(); + double y = _view.View.GetY(); + double r = x + _view.View.Width; + double b = y + _view.View.Height; if (x <= _point.X && r >= _point.X && y <= _point.Y && b >= _point.Y) { diff --git a/src/Android/Avalonia.Android/Resources/Resource.Designer.cs b/src/Android/Avalonia.Android/Resources/Resource.Designer.cs index 80cbbc51ec..e66c2800d3 100644 --- a/src/Android/Avalonia.Android/Resources/Resource.Designer.cs +++ b/src/Android/Avalonia.Android/Resources/Resource.Designer.cs @@ -40,11 +40,14 @@ namespace Avalonia.Android public partial class String { + // aapt resource value: 0x7f020002 + public static int ApplicationName = 2130837506; + // aapt resource value: 0x7f020001 - public static int ApplicationName = 2130837505; + public static int Hello = 2130837505; // aapt resource value: 0x7f020000 - public static int Hello = 2130837504; + public static int library_name = 2130837504; static String() { diff --git a/src/Android/Avalonia.Android/packages.config b/src/Android/Avalonia.Android/packages.config deleted file mode 100644 index 057d0855b8..0000000000 --- a/src/Android/Avalonia.Android/packages.config +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Android/Avalonia.AndroidTestApplication/Avalonia.AndroidTestApplication.csproj b/src/Android/Avalonia.AndroidTestApplication/Avalonia.AndroidTestApplication.csproj index 0e94cecc2d..156b2b1fe3 100644 --- a/src/Android/Avalonia.AndroidTestApplication/Avalonia.AndroidTestApplication.csproj +++ b/src/Android/Avalonia.AndroidTestApplication/Avalonia.AndroidTestApplication.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -64,35 +64,8 @@ - - ..\..\..\packages\Serilog.1.5.14\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+MonoTouch10\Serilog.dll - True - - - ..\..\..\packages\Splat.1.6.2\lib\monoandroid\Splat.dll - True - - - ..\..\..\packages\Sprache.2.1.0\lib\netstandard1.0\Sprache.dll - - - ..\..\..\packages\System.Reactive.Core.3.0.0\lib\netstandard1.3\System.Reactive.Core.dll - True - - - ..\..\..\packages\System.Reactive.Interfaces.3.0.0\lib\netstandard1.0\System.Reactive.Interfaces.dll - True - - - ..\..\..\packages\System.Reactive.Linq.3.0.0\lib\netstandard1.3\System.Reactive.Linq.dll - True - - - ..\..\..\packages\System.Reactive.PlatformServices.3.0.0\lib\netstandard1.3\System.Reactive.PlatformServices.dll - True - @@ -103,7 +76,6 @@ - @@ -171,10 +143,6 @@ {3e10a5fa-e8da-48b1-ad44-6a5b6cb7750f} Avalonia.Themes.Default - - {4a1abb09-9047-4bd5-a4ad-a055e52c5ee0} - Avalonia.DotNetFrameworkRuntime - {5fb2b005-0a7f-4dad-add4-3ed01444e63d} Avalonia.HtmlRenderer @@ -192,4 +160,29 @@ --> + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Android/Avalonia.AndroidTestApplication/Avalonia.AndroidTestApplication.v2.ncrunchproject b/src/Android/Avalonia.AndroidTestApplication/Avalonia.AndroidTestApplication.v2.ncrunchproject deleted file mode 100644 index e1b4d7cf28..0000000000 --- a/src/Android/Avalonia.AndroidTestApplication/Avalonia.AndroidTestApplication.v2.ncrunchproject +++ /dev/null @@ -1,26 +0,0 @@ - - true - 1000 - false - false - false - true - false - false - true - false - false - false - true - false - true - true - true - 60000 - - - - AutoDetect - STA - x86 - \ No newline at end of file diff --git a/src/Android/Avalonia.AndroidTestApplication/Resources/Resource.Designer.cs b/src/Android/Avalonia.AndroidTestApplication/Resources/Resource.Designer.cs index 3fa0707176..91327cf941 100644 --- a/src/Android/Avalonia.AndroidTestApplication/Resources/Resource.Designer.cs +++ b/src/Android/Avalonia.AndroidTestApplication/Resources/Resource.Designer.cs @@ -28,6 +28,7 @@ namespace Avalonia.AndroidTestApplication { global::Avalonia.Android.Resource.String.ApplicationName = global::Avalonia.AndroidTestApplication.Resource.String.ApplicationName; global::Avalonia.Android.Resource.String.Hello = global::Avalonia.AndroidTestApplication.Resource.String.Hello; + global::Avalonia.Android.Resource.String.library_name = global::Avalonia.AndroidTestApplication.Resource.String.library_name; global::Splat.Resource.String.library_name = global::Avalonia.AndroidTestApplication.Resource.String.library_name; } diff --git a/src/Android/Avalonia.AndroidTestApplication/packages.config b/src/Android/Avalonia.AndroidTestApplication/packages.config deleted file mode 100644 index d353146747..0000000000 --- a/src/Android/Avalonia.AndroidTestApplication/packages.config +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Avalonia.Animation/Avalonia.Animation.csproj b/src/Avalonia.Animation/Avalonia.Animation.csproj index 46aac81b5a..27f948b447 100644 --- a/src/Avalonia.Animation/Avalonia.Animation.csproj +++ b/src/Avalonia.Animation/Avalonia.Animation.csproj @@ -1,20 +1,7 @@ - - - + - 11.0 - Debug - AnyCPU - {D211E587-D8BC-45B9-95A4-F297C8FA5200} - Library - Properties - Avalonia.Animation - Avalonia.Animation - en-US - 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Profile7 - v4.5 + netstandard1.1 + false true @@ -38,57 +25,19 @@ CS1591 true - - - - {B09B78D8-9B26-48B0-9149-D64A2F120F3F} - Avalonia.Base - - Properties\SharedAssemblyInfo.cs - - - - - - - - - - - - - - ..\..\packages\System.Reactive.Core.3.0.0\lib\netstandard1.1\System.Reactive.Core.dll - True - - - ..\..\packages\System.Reactive.Interfaces.3.0.0\lib\netstandard1.0\System.Reactive.Interfaces.dll - True - - - ..\..\packages\System.Reactive.Linq.3.0.0\lib\netstandard1.1\System.Reactive.Linq.dll - True - - - ..\..\packages\System.Reactive.PlatformServices.3.0.0\lib\netstandard1.0\System.Reactive.PlatformServices.dll - True - + - + + + + + - - \ No newline at end of file diff --git a/src/Avalonia.Animation/Avalonia.Animation.v2.ncrunchproject b/src/Avalonia.Animation/Avalonia.Animation.v2.ncrunchproject deleted file mode 100644 index 30815b1937..0000000000 --- a/src/Avalonia.Animation/Avalonia.Animation.v2.ncrunchproject +++ /dev/null @@ -1,26 +0,0 @@ - - true - 1000 - false - false - false - true - false - false - false - false - false - true - true - false - true - true - true - 60000 - - - - AutoDetect - STA - x86 - \ No newline at end of file diff --git a/src/Avalonia.Animation/packages.config b/src/Avalonia.Animation/packages.config deleted file mode 100644 index 9f732f1bcb..0000000000 --- a/src/Avalonia.Animation/packages.config +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/src/Avalonia.Base/Avalonia.Base.csproj b/src/Avalonia.Base/Avalonia.Base.csproj index 90550a12f2..1bcfd813c8 100644 --- a/src/Avalonia.Base/Avalonia.Base.csproj +++ b/src/Avalonia.Base/Avalonia.Base.csproj @@ -1,22 +1,7 @@ - - - + - 11.0 - Debug - AnyCPU - {B09B78D8-9B26-48B0-9149-D64A2F120F3F} - Library - Properties - Avalonia - Avalonia.Base - en-US - 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Profile7 - v4.5 - - + netstandard1.1 + false true @@ -44,118 +29,13 @@ Properties\SharedAssemblyInfo.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ..\..\packages\JetBrains.Annotations.10.0.0\lib\portable-net4+sl5+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\JetBrains.Annotations.PCL328.dll - True - - - ..\..\packages\System.Reactive.Core.3.0.0\lib\netstandard1.1\System.Reactive.Core.dll - True - - - ..\..\packages\System.Reactive.Interfaces.3.0.0\lib\netstandard1.0\System.Reactive.Interfaces.dll - True - - - ..\..\packages\System.Reactive.Linq.3.0.0\lib\netstandard1.1\System.Reactive.Linq.dll - True - - - ..\..\packages\System.Reactive.PlatformServices.3.0.0\lib\netstandard1.0\System.Reactive.PlatformServices.dll - True - + + + + + + - - - - - \ No newline at end of file diff --git a/src/Avalonia.Base/Avalonia.Base.v2.ncrunchproject b/src/Avalonia.Base/Avalonia.Base.v2.ncrunchproject deleted file mode 100644 index 30815b1937..0000000000 --- a/src/Avalonia.Base/Avalonia.Base.v2.ncrunchproject +++ /dev/null @@ -1,26 +0,0 @@ - - true - 1000 - false - false - false - true - false - false - false - false - false - true - true - false - true - true - true - 60000 - - - - AutoDetect - STA - x86 - \ No newline at end of file diff --git a/src/Avalonia.Base/AvaloniaObject.cs b/src/Avalonia.Base/AvaloniaObject.cs index 409abfe8fa..7359dceae1 100644 --- a/src/Avalonia.Base/AvaloniaObject.cs +++ b/src/Avalonia.Base/AvaloniaObject.cs @@ -181,6 +181,7 @@ namespace Avalonia public void ClearValue(AvaloniaProperty property) { Contract.Requires(property != null); + VerifyAccess(); SetValue(property, AvaloniaProperty.UnsetValue); } @@ -193,6 +194,7 @@ namespace Avalonia public object GetValue(AvaloniaProperty property) { Contract.Requires(property != null); + VerifyAccess(); if (property.IsDirect) { @@ -234,7 +236,8 @@ namespace Avalonia public bool IsSet(AvaloniaProperty property) { Contract.Requires(property != null); - + VerifyAccess(); + PriorityValue value; if (_values.TryGetValue(property, out value)) diff --git a/src/Avalonia.Base/IPriorityValueOwner.cs b/src/Avalonia.Base/IPriorityValueOwner.cs index 57f98c0717..aeec720920 100644 --- a/src/Avalonia.Base/IPriorityValueOwner.cs +++ b/src/Avalonia.Base/IPriorityValueOwner.cs @@ -25,5 +25,10 @@ namespace Avalonia /// The source of the change. /// The notification. void BindingNotificationReceived(PriorityValue sender, BindingNotification notification); + + /// + /// Ensures that the current thread is the UI thread. + /// + void VerifyAccess(); } } diff --git a/src/Avalonia.Base/PriorityBindingEntry.cs b/src/Avalonia.Base/PriorityBindingEntry.cs index 25b7bede7e..eb7cf5414c 100644 --- a/src/Avalonia.Base/PriorityBindingEntry.cs +++ b/src/Avalonia.Base/PriorityBindingEntry.cs @@ -92,6 +92,8 @@ namespace Avalonia private void ValueChanged(object value) { + _owner.Owner.Owner?.VerifyAccess(); + var notification = value as BindingNotification; if (notification != null) diff --git a/src/Avalonia.Base/PriorityLevel.cs b/src/Avalonia.Base/PriorityLevel.cs index 122a6df821..b25247deaf 100644 --- a/src/Avalonia.Base/PriorityLevel.cs +++ b/src/Avalonia.Base/PriorityLevel.cs @@ -33,7 +33,6 @@ namespace Avalonia /// internal class PriorityLevel { - private PriorityValue _owner; private object _directValue; private int _nextIndex; @@ -48,13 +47,18 @@ namespace Avalonia { Contract.Requires(owner != null); - _owner = owner; + Owner = owner; Priority = priority; Value = _directValue = AvaloniaProperty.UnsetValue; ActiveBindingIndex = -1; Bindings = new LinkedList(); } + /// + /// Gets the owner of the level. + /// + public PriorityValue Owner { get; } + /// /// Gets the priority of this level. /// @@ -73,7 +77,7 @@ namespace Avalonia set { Value = _directValue = value; - _owner.LevelValueChanged(this); + Owner.LevelValueChanged(this); } } @@ -131,7 +135,7 @@ namespace Avalonia { Value = entry.Value; ActiveBindingIndex = entry.Index; - _owner.LevelValueChanged(this); + Owner.LevelValueChanged(this); } else { @@ -161,7 +165,7 @@ namespace Avalonia /// The error. public void Error(PriorityBindingEntry entry, BindingNotification error) { - _owner.LevelError(this, error); + Owner.LevelError(this, error); } /// @@ -175,14 +179,14 @@ namespace Avalonia { Value = binding.Value; ActiveBindingIndex = binding.Index; - _owner.LevelValueChanged(this); + Owner.LevelValueChanged(this); return; } } Value = DirectValue; ActiveBindingIndex = -1; - _owner.LevelValueChanged(this); + Owner.LevelValueChanged(this); } } } diff --git a/src/Avalonia.Base/PriorityValue.cs b/src/Avalonia.Base/PriorityValue.cs index 3f4b405de9..57e2854014 100644 --- a/src/Avalonia.Base/PriorityValue.cs +++ b/src/Avalonia.Base/PriorityValue.cs @@ -26,7 +26,6 @@ namespace Avalonia /// internal class PriorityValue { - private readonly IPriorityValueOwner _owner; private readonly Type _valueType; private readonly SingleOrDictionary _levels = new SingleOrDictionary(); private object _value; @@ -45,7 +44,7 @@ namespace Avalonia Type valueType, Func validate = null) { - _owner = owner; + Owner = owner; Property = property; _valueType = valueType; _value = AvaloniaProperty.UnsetValue; @@ -53,6 +52,11 @@ namespace Avalonia _validate = validate; } + /// + /// Gets the owner of the value. + /// + public IPriorityValueOwner Owner { get; } + /// /// Gets the property that the value represents. /// @@ -188,9 +192,9 @@ namespace Avalonia Logger.Log( LogEventLevel.Error, LogArea.Binding, - _owner, + Owner, "Error in binding to {Target}.{Property}: {Message}", - _owner, + Owner, Property, error.Error.Message); } @@ -264,19 +268,19 @@ namespace Avalonia if (notification == null || notification.HasValue) { - _owner?.Changed(this, old, _value); + Owner?.Changed(this, old, _value); } if (notification != null) { - _owner?.BindingNotificationReceived(this, notification); + Owner?.BindingNotificationReceived(this, notification); } } else { Logger.Error( LogArea.Binding, - _owner, + Owner, "Binding produced invalid value for {$Property} ({$PropertyType}): {$Value} ({$ValueType})", Property.Name, _valueType, diff --git a/src/Avalonia.Base/Properties/AssemblyInfo.cs b/src/Avalonia.Base/Properties/AssemblyInfo.cs index f57afcdd70..2ee7378413 100644 --- a/src/Avalonia.Base/Properties/AssemblyInfo.cs +++ b/src/Avalonia.Base/Properties/AssemblyInfo.cs @@ -6,4 +6,5 @@ using System.Runtime.CompilerServices; [assembly: AssemblyTitle("Avalonia.Base")] [assembly: InternalsVisibleTo("Avalonia.Base.UnitTests")] +[assembly: InternalsVisibleTo("Avalonia.UnitTests")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] \ No newline at end of file diff --git a/src/Avalonia.Base/Threading/Dispatcher.cs b/src/Avalonia.Base/Threading/Dispatcher.cs index aee6a02e73..a8ce1b8115 100644 --- a/src/Avalonia.Base/Threading/Dispatcher.cs +++ b/src/Avalonia.Base/Threading/Dispatcher.cs @@ -17,8 +17,8 @@ namespace Avalonia.Threading /// public class Dispatcher { - private readonly IPlatformThreadingInterface _platform; private readonly JobRunner _jobRunner; + private IPlatformThreadingInterface _platform; public static Dispatcher UIThread { get; } = new Dispatcher(AvaloniaLocator.Current.GetService()); @@ -26,22 +26,31 @@ namespace Avalonia.Threading public Dispatcher(IPlatformThreadingInterface platform) { _platform = platform; - if(_platform == null) - //TODO: Unit test mode, fix that somehow - return; _jobRunner = new JobRunner(platform); - _platform.Signaled += _jobRunner.RunJobs; + + if (_platform != null) + { + _platform.Signaled += _jobRunner.RunJobs; + } } + /// + /// Checks that the current thread is the UI thread. + /// public bool CheckAccess() => _platform?.CurrentThreadIsLoopThread ?? true; + /// + /// Checks that the current thread is the UI thread and throws if not. + /// + /// + /// The current thread is not the UI thread. + /// public void VerifyAccess() { if (!CheckAccess()) throw new InvalidOperationException("Call from invalid thread"); } - /// /// Runs the dispatcher's main loop. /// @@ -83,5 +92,24 @@ namespace Avalonia.Threading { _jobRunner?.Post(action, priority); } + + /// + /// Allows unit tests to change the platform threading interface. + /// + internal void UpdateServices() + { + if (_platform != null) + { + _platform.Signaled -= _jobRunner.RunJobs; + } + + _platform = AvaloniaLocator.Current.GetService(); + _jobRunner.UpdateServices(); + + if (_platform != null) + { + _platform.Signaled += _jobRunner.RunJobs; + } + } } } \ No newline at end of file diff --git a/src/Avalonia.Base/Threading/JobRunner.cs b/src/Avalonia.Base/Threading/JobRunner.cs index 655ef34288..e212cd9a2e 100644 --- a/src/Avalonia.Base/Threading/JobRunner.cs +++ b/src/Avalonia.Base/Threading/JobRunner.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Threading; using System.Threading.Tasks; using Avalonia.Platform; @@ -14,8 +13,8 @@ namespace Avalonia.Threading /// internal class JobRunner { - private readonly IPlatformThreadingInterface _platform; private readonly Queue _queue = new Queue(); + private IPlatformThreadingInterface _platform; public JobRunner(IPlatformThreadingInterface platform) { @@ -82,6 +81,14 @@ namespace Avalonia.Threading AddJob(new Job(action, priority, true)); } + /// + /// Allows unit tests to change the platform threading interface. + /// + internal void UpdateServices() + { + _platform = AvaloniaLocator.Current.GetService(); + } + private void AddJob(Job job) { var needWake = false; @@ -91,7 +98,7 @@ namespace Avalonia.Threading _queue.Enqueue(job); } if (needWake) - _platform.Signal(); + _platform?.Signal(); } /// diff --git a/src/Avalonia.Base/packages.config b/src/Avalonia.Base/packages.config deleted file mode 100644 index c372c92f3f..0000000000 --- a/src/Avalonia.Base/packages.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/Avalonia.Controls/AppBuilderBase.cs b/src/Avalonia.Controls/AppBuilderBase.cs index c53cca19d1..97de093a59 100644 --- a/src/Avalonia.Controls/AppBuilderBase.cs +++ b/src/Avalonia.Controls/AppBuilderBase.cs @@ -60,10 +60,10 @@ namespace Avalonia.Controls /// public Action BeforeStartCallback { get; private set; } = builder => { }; - protected AppBuilderBase(IRuntimePlatform platform, Action platformSevices) + protected AppBuilderBase(IRuntimePlatform platform, Action platformSevices) { RuntimePlatform = platform; - RuntimePlatformServicesInitializer = platformSevices; + RuntimePlatformServicesInitializer = () => platformSevices((TAppBuilder)this); } /// @@ -115,13 +115,16 @@ namespace Avalonia.Controls /// Starts the application with an instance of . /// /// The window type. - public void Start() + /// A delegate that will be called to create a data context for the window (optional). + public void Start(Func dataContextProvider = null) where TMainWindow : Window, new() { Setup(); BeforeStartCallback(Self); var window = new TMainWindow(); + if (dataContextProvider != null) + window.DataContext = dataContextProvider(); window.Show(); Instance.Run(window); } diff --git a/src/Avalonia.Controls/Avalonia.Controls.csproj b/src/Avalonia.Controls/Avalonia.Controls.csproj index c05e44b357..72a78b0738 100644 --- a/src/Avalonia.Controls/Avalonia.Controls.csproj +++ b/src/Avalonia.Controls/Avalonia.Controls.csproj @@ -1,22 +1,7 @@ - - - + - 11.0 - Debug - AnyCPU - {D2221C82-4A25-4583-9B43-D791E3F6820C} - Library - Properties - Avalonia.Controls - Avalonia.Controls - en-US - 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Profile7 - v4.5 - - + netstandard1.1 + false true @@ -44,237 +29,22 @@ Properties\SharedAssemblyInfo.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ..\..\packages\JetBrains.Annotations.10.0.0\lib\portable-net4+sl5+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\JetBrains.Annotations.PCL328.dll - True - - - ..\..\packages\System.Reactive.Core.3.0.0\lib\netstandard1.1\System.Reactive.Core.dll - True - - - ..\..\packages\System.Reactive.Interfaces.3.0.0\lib\netstandard1.0\System.Reactive.Interfaces.dll - True - - - ..\..\packages\System.Reactive.Linq.3.0.0\lib\netstandard1.1\System.Reactive.Linq.dll - True - - - ..\..\packages\System.Reactive.PlatformServices.3.0.0\lib\netstandard1.0\System.Reactive.PlatformServices.dll - True - + + + + + + + - + + + + + + - - - {D211E587-D8BC-45B9-95A4-F297C8FA5200} - Avalonia.Animation - - - {B09B78D8-9B26-48B0-9149-D64A2F120F3F} - Avalonia.Base - - - {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 - - - - - \ No newline at end of file diff --git a/src/Avalonia.Controls/Avalonia.Controls.v2.ncrunchproject b/src/Avalonia.Controls/Avalonia.Controls.v2.ncrunchproject deleted file mode 100644 index 30815b1937..0000000000 --- a/src/Avalonia.Controls/Avalonia.Controls.v2.ncrunchproject +++ /dev/null @@ -1,26 +0,0 @@ - - true - 1000 - false - false - false - true - false - false - false - false - false - true - true - false - true - true - true - 60000 - - - - AutoDetect - STA - x86 - \ No newline at end of file diff --git a/src/Avalonia.Controls/Embedding/EmbeddableControlRoot.cs b/src/Avalonia.Controls/Embedding/EmbeddableControlRoot.cs index fc58e751f4..4688017187 100644 --- a/src/Avalonia.Controls/Embedding/EmbeddableControlRoot.cs +++ b/src/Avalonia.Controls/Embedding/EmbeddableControlRoot.cs @@ -11,12 +11,11 @@ namespace Avalonia.Controls.Embedding { public EmbeddableControlRoot(IEmbeddableWindowImpl impl) : base(impl) { - PlatformImpl.Show(); + } public EmbeddableControlRoot() : base(PlatformManager.CreateEmbeddableWindow()) { - PlatformImpl.Show(); } public new IEmbeddableWindowImpl PlatformImpl => (IEmbeddableWindowImpl) base.PlatformImpl; @@ -25,7 +24,6 @@ namespace Avalonia.Controls.Embedding { EnsureInitialized(); ApplyTemplate(); - PlatformImpl.Show(); LayoutManager.Instance.ExecuteInitialLayoutPass(this); } diff --git a/src/Avalonia.Controls/Image.cs b/src/Avalonia.Controls/Image.cs index 43c8fbcbb4..f6f11aa9ad 100644 --- a/src/Avalonia.Controls/Image.cs +++ b/src/Avalonia.Controls/Image.cs @@ -63,10 +63,10 @@ namespace Avalonia.Controls Vector scale = Stretch.CalculateScaling(Bounds.Size, sourceSize); Size scaledSize = sourceSize * scale; Rect destRect = viewPort - .CenterIn(new Rect(scaledSize)) + .CenterRect(new Rect(scaledSize)) .Intersect(viewPort); Rect sourceRect = new Rect(sourceSize) - .CenterIn(new Rect(destRect.Size / scale)); + .CenterRect(new Rect(destRect.Size / scale)); context.DrawImage(source, 1, sourceRect, destRect); } diff --git a/src/Avalonia.Controls/Menu.cs b/src/Avalonia.Controls/Menu.cs index 2185fd982b..e919275d4f 100644 --- a/src/Avalonia.Controls/Menu.cs +++ b/src/Avalonia.Controls/Menu.cs @@ -103,9 +103,11 @@ namespace Avalonia.Controls { base.OnAttachedToVisualTree(e); - var topLevel = e.Root as TopLevel; + var topLevel = (TopLevel)e.Root; + var window = e.Root as Window; - topLevel.Deactivated += Deactivated; + if (window != null) + window.Deactivated += Deactivated; var pointerPress = topLevel.AddHandler( PointerPressedEvent, @@ -114,7 +116,11 @@ namespace Avalonia.Controls _subscription = new CompositeDisposable( pointerPress, - Disposable.Create(() => topLevel.Deactivated -= Deactivated), + Disposable.Create(() => + { + if (window != null) + window.Deactivated -= Deactivated; + }), InputManager.Instance.Process.Subscribe(ListenForNonClientClick)); var inputRoot = e.Root as IInputRoot; diff --git a/src/Avalonia.Controls/Platform/ExportWindowingSubsystemAttribute.cs b/src/Avalonia.Controls/Platform/ExportWindowingSubsystemAttribute.cs index 628f73ca80..420c56111f 100644 --- a/src/Avalonia.Controls/Platform/ExportWindowingSubsystemAttribute.cs +++ b/src/Avalonia.Controls/Platform/ExportWindowingSubsystemAttribute.cs @@ -9,16 +9,19 @@ namespace Avalonia.Platform [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] public class ExportWindowingSubsystemAttribute : Attribute { - public ExportWindowingSubsystemAttribute(OperatingSystemType requiredRuntimePlatform, int priority, string name, Type initializationType, string initializationMethod) + public ExportWindowingSubsystemAttribute(OperatingSystemType requiredRuntimePlatform, int priority, string name, Type initializationType, + string initializationMethod, Type environmentChecker = null) { Name = name; InitializationType = initializationType; InitializationMethod = initializationMethod; + EnvironmentChecker = environmentChecker; RequiredOS = requiredRuntimePlatform; Priority = priority; } public string InitializationMethod { get; private set; } + public Type EnvironmentChecker { get; } public Type InitializationType { get; private set; } public string Name { get; private set; } public int Priority { get; private set; } diff --git a/src/Avalonia.Controls/Platform/IEmbeddableWindowImpl.cs b/src/Avalonia.Controls/Platform/IEmbeddableWindowImpl.cs index 45b15e5f45..3f974f3748 100644 --- a/src/Avalonia.Controls/Platform/IEmbeddableWindowImpl.cs +++ b/src/Avalonia.Controls/Platform/IEmbeddableWindowImpl.cs @@ -8,7 +8,7 @@ namespace Avalonia.Platform /// /// Defines a platform-specific embeddable window implementation. /// - public interface IEmbeddableWindowImpl : IWindowImpl + public interface IEmbeddableWindowImpl : ITopLevelImpl { event Action LostFocus; } diff --git a/src/Avalonia.Controls/Platform/IPopupImpl.cs b/src/Avalonia.Controls/Platform/IPopupImpl.cs index 34b3b8b557..1b606f550b 100644 --- a/src/Avalonia.Controls/Platform/IPopupImpl.cs +++ b/src/Avalonia.Controls/Platform/IPopupImpl.cs @@ -6,7 +6,7 @@ namespace Avalonia.Platform /// /// Defines a platform-specific popup window implementation. /// - public interface IPopupImpl : ITopLevelImpl + public interface IPopupImpl : IWindowBaseImpl { } diff --git a/src/Avalonia.Controls/Platform/ITopLevelImpl.cs b/src/Avalonia.Controls/Platform/ITopLevelImpl.cs index 77884acf73..16f436fd45 100644 --- a/src/Avalonia.Controls/Platform/ITopLevelImpl.cs +++ b/src/Avalonia.Controls/Platform/ITopLevelImpl.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using Avalonia.Controls; using Avalonia.Input; using Avalonia.Input.Raw; @@ -19,25 +18,15 @@ namespace Avalonia.Platform public interface ITopLevelImpl : IDisposable { /// - /// Gets or sets the client size of the window. + /// Gets the client size of the toplevel. /// - Size ClientSize { get; set; } + Size ClientSize { get; } /// - /// Gets the maximum size of a window on the system. - /// - Size MaxClientSize { get; } - - /// - /// Gets the scaling factor for the window. + /// Gets the scaling factor for the toplevel. /// double Scaling { get; } - /// - /// Gets the platform window handle. - /// - IPlatformHandle Handle { get; } - /// /// The list of native platform's surfaces that can be consumed by rendering subsystems. /// @@ -51,57 +40,32 @@ namespace Avalonia.Platform IEnumerable Surfaces { get; } /// - /// Gets or sets a method called when the window is activated (receives focus). - /// - Action Activated { get; set; } - - /// - /// Gets or sets a method called when the window is closed. - /// - Action Closed { get; set; } - - /// - /// Gets or sets a method called when the window is deactivated (loses focus). - /// - Action Deactivated { get; set; } - - /// - /// Gets or sets a method called when the window receives input. + /// Gets or sets a method called when the toplevel receives input. /// Action Input { get; set; } /// - /// Gets or sets a method called when the window requires painting. + /// Gets or sets a method called when the toplevel requires painting. /// Action Paint { get; set; } /// - /// Gets or sets a method called when the window is resized. + /// Gets or sets a method called when the toplevel is resized. /// Action Resized { get; set; } /// - /// Gets or sets a method called when the window's scaling changes. + /// Gets or sets a method called when the toplevel's scaling changes. /// Action ScalingChanged { get; set; } /// - /// Gets or sets a method called when the window's position changes. - /// - Action PositionChanged { get; set; } - - /// - /// Activates the window. - /// - void Activate(); - - /// - /// Invalidates a rect on the window. + /// Invalidates a rect on the toplevel. /// void Invalidate(Rect rect); /// - /// Sets the for the window. + /// Sets the for the toplevel. /// void SetInputRoot(IInputRoot inputRoot); @@ -120,32 +84,14 @@ namespace Avalonia.Platform Point PointToScreen(Point point); /// - /// Sets the cursor associated with the window. + /// Sets the cursor associated with the toplevel. /// /// The cursor. Use null for default cursor void SetCursor(IPlatformHandle cursor); /// - /// Shows the toplevel. - /// - void Show(); - - /// - /// Hides the window. - /// - void Hide(); - - /// - /// Starts moving a window with left button being held. Should be called from left mouse button press event handler. - /// - void BeginMoveDrag(); - - /// - /// Starts resizing a window. This function is used if an application has window resizing controls. - /// Should be called from left mouse button press event handler + /// Gets or sets a method called when the underlying implementation is destroyed. /// - void BeginResizeDrag(WindowEdge edge); - - Point Position { get; set; } + Action Closed { get; set; } } } diff --git a/src/Avalonia.Controls/Platform/IWindowBaseImpl.cs b/src/Avalonia.Controls/Platform/IWindowBaseImpl.cs new file mode 100644 index 0000000000..a5c7c60843 --- /dev/null +++ b/src/Avalonia.Controls/Platform/IWindowBaseImpl.cs @@ -0,0 +1,69 @@ +using System; +using Avalonia.Controls; + +namespace Avalonia.Platform +{ + public interface IWindowBaseImpl : ITopLevelImpl + { + /// + /// Shows the toplevel. + /// + void Show(); + + /// + /// Hides the window. + /// + void Hide(); + + /// + /// Starts moving a window with left button being held. Should be called from left mouse button press event handler. + /// + void BeginMoveDrag(); + + /// + /// Starts resizing a window. This function is used if an application has window resizing controls. + /// Should be called from left mouse button press event handler + /// + void BeginResizeDrag(WindowEdge edge); + + /// + /// Gets position of the window relatively to the screen + /// + Point Position { get; set; } + + /// + /// Gets or sets a method called when the window's position changes. + /// + Action PositionChanged { get; set; } + + /// + /// Activates the window. + /// + void Activate(); + + /// + /// Gets or sets a method called when the window is deactivated (loses focus). + /// + Action Deactivated { get; set; } + + /// + /// Gets or sets a method called when the window is activated (receives focus). + /// + Action Activated { get; set; } + + /// + /// Gets the platform window handle. + /// + IPlatformHandle Handle { get; } + + /// + /// Gets the maximum size of a window on the system. + /// + Size MaxClientSize { get; } + + /// + /// Sets the client size of the toplevel. + /// + void Resize(Size clientSize); + } +} \ No newline at end of file diff --git a/src/Avalonia.Controls/Platform/IWindowImpl.cs b/src/Avalonia.Controls/Platform/IWindowImpl.cs index 609e9834cb..69b946346e 100644 --- a/src/Avalonia.Controls/Platform/IWindowImpl.cs +++ b/src/Avalonia.Controls/Platform/IWindowImpl.cs @@ -9,7 +9,7 @@ namespace Avalonia.Platform /// /// Defines a platform-specific window implementation. /// - public interface IWindowImpl : ITopLevelImpl + public interface IWindowImpl : IWindowBaseImpl { /// /// Gets or sets the minimized/maximized state of the window. diff --git a/src/Avalonia.Controls/Platform/PlatformManager.cs b/src/Avalonia.Controls/Platform/PlatformManager.cs index 8f069a3ab2..fa01b9e839 100644 --- a/src/Avalonia.Controls/Platform/PlatformManager.cs +++ b/src/Avalonia.Controls/Platform/PlatformManager.cs @@ -31,7 +31,7 @@ namespace Avalonia.Controls.Platform throw new Exception("Could not CreateWindow(): IWindowingPlatform is not registered."); } - return s_designerMode ? platform.CreateEmbeddableWindow() : platform.CreateWindow(); + return s_designerMode ? (IWindowImpl)platform.CreateEmbeddableWindow() : platform.CreateWindow(); } public static IEmbeddableWindowImpl CreateEmbeddableWindow() diff --git a/src/Avalonia.Controls/Platform/Surfaces/IFramebufferPlatformSurface.cs b/src/Avalonia.Controls/Platform/Surfaces/IFramebufferPlatformSurface.cs index 84988e912f..4dc96a074d 100644 --- a/src/Avalonia.Controls/Platform/Surfaces/IFramebufferPlatformSurface.cs +++ b/src/Avalonia.Controls/Platform/Surfaces/IFramebufferPlatformSurface.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Avalonia.Platform; namespace Avalonia.Controls.Platform.Surfaces { diff --git a/src/Avalonia.Controls/Platform/Surfaces/PixelFormat.cs b/src/Avalonia.Controls/Platform/Surfaces/PixelFormat.cs deleted file mode 100644 index c9f8eabe97..0000000000 --- a/src/Avalonia.Controls/Platform/Surfaces/PixelFormat.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Avalonia.Controls.Platform.Surfaces -{ - public enum PixelFormat - { - Rgb565, - Rgba8888, - Bgra8888 - } -} diff --git a/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs b/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs index 228ad65ffa..96190720ae 100644 --- a/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs +++ b/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs @@ -97,7 +97,9 @@ namespace Avalonia.Controls.Presenters /// public override Size MeasureOverride(Size availableSize) { - var window = Owner.GetVisualRoot() as TopLevel; + var visualRoot = Owner.GetVisualRoot(); + var maxAvailableSize = (visualRoot as WindowBase)?.PlatformImpl?.MaxClientSize + ?? (visualRoot as TopLevel)?.ClientSize; // If infinity is passed as the available size and we're virtualized then we need to // fill the available space, but to do that we *don't* want to materialize all our @@ -107,9 +109,9 @@ namespace Avalonia.Controls.Presenters { if (availableSize.Height == double.PositiveInfinity) { - if (window != null) + if (maxAvailableSize.HasValue) { - availableSize = availableSize.WithHeight(window.PlatformImpl.MaxClientSize.Height); + availableSize = availableSize.WithHeight(maxAvailableSize.Value.Height); } } @@ -119,9 +121,9 @@ namespace Avalonia.Controls.Presenters { if (availableSize.Width == double.PositiveInfinity) { - if (window != null) + if (maxAvailableSize.HasValue) { - availableSize = availableSize.WithWidth(window.PlatformImpl.MaxClientSize.Width); + availableSize = availableSize.WithWidth(maxAvailableSize.Value.Width); } } diff --git a/src/Avalonia.Controls/Presenters/ScrollContentPresenter.cs b/src/Avalonia.Controls/Presenters/ScrollContentPresenter.cs index d9f0260e39..c217290226 100644 --- a/src/Avalonia.Controls/Presenters/ScrollContentPresenter.cs +++ b/src/Avalonia.Controls/Presenters/ScrollContentPresenter.cs @@ -133,7 +133,7 @@ namespace Avalonia.Controls.Presenters return false; } - var rect = targetRect * transform.Value; + var rect = targetRect.TransformToAABB(transform.Value); var offset = Offset; var result = false; diff --git a/src/Avalonia.Controls/Primitives/Popup.cs b/src/Avalonia.Controls/Primitives/Popup.cs index 63f3fb647b..bb2a61c024 100644 --- a/src/Avalonia.Controls/Primitives/Popup.cs +++ b/src/Avalonia.Controls/Primitives/Popup.cs @@ -213,7 +213,9 @@ namespace Avalonia.Controls.Primitives if (_topLevel != null) { - _topLevel.Deactivated += TopLevelDeactivated; + var window = _topLevel as Window; + if (window != null) + window.Deactivated += WindowDeactivated; _topLevel.AddHandler(PointerPressedEvent, PointerPressedOutside, RoutingStrategies.Tunnel); _nonClientListener = InputManager.Instance.Process.Subscribe(ListenForNonClientClick); } @@ -239,7 +241,9 @@ namespace Avalonia.Controls.Primitives if (_topLevel != null) { _topLevel.RemoveHandler(PointerPressedEvent, PointerPressedOutside); - _topLevel.Deactivated -= TopLevelDeactivated; + var window = _topLevel as Window; + if (window != null) + window.Deactivated -= WindowDeactivated; _nonClientListener?.Dispose(); _nonClientListener = null; } @@ -381,7 +385,7 @@ namespace Avalonia.Controls.Primitives } } - private void TopLevelDeactivated(object sender, EventArgs e) + private void WindowDeactivated(object sender, EventArgs e) { if (!StaysOpen) { diff --git a/src/Avalonia.Controls/Primitives/PopupRoot.cs b/src/Avalonia.Controls/Primitives/PopupRoot.cs index f67bbef5e1..5e5177b29d 100644 --- a/src/Avalonia.Controls/Primitives/PopupRoot.cs +++ b/src/Avalonia.Controls/Primitives/PopupRoot.cs @@ -15,7 +15,7 @@ namespace Avalonia.Controls.Primitives /// /// The root window of a . /// - public class PopupRoot : TopLevel, IInteractive, IHostedVisualTreeRoot, IDisposable + public class PopupRoot : WindowBase, IInteractive, IHostedVisualTreeRoot, IDisposable { private IDisposable _presenterSubscription; diff --git a/src/Avalonia.Controls/TopLevel.cs b/src/Avalonia.Controls/TopLevel.cs index 1853d67019..4de0256a7d 100644 --- a/src/Avalonia.Controls/TopLevel.cs +++ b/src/Avalonia.Controls/TopLevel.cs @@ -18,12 +18,12 @@ using Avalonia.VisualTree; namespace Avalonia.Controls { /// - /// Base class for top-level windows. + /// Base class for top-level widgets. /// /// - /// This class acts as a base for top level windows such as and - /// . It handles scheduling layout, styling and rendering as well as - /// tracking the window and state. + /// This class acts as a base for top level widget. + /// It handles scheduling layout, styling and rendering as well as + /// tracking the widget's . /// public abstract class TopLevel : ContentControl, IInputRoot, ILayoutRoot, IRenderRoot, ICloseable, IStyleRoot { @@ -33,12 +33,6 @@ namespace Avalonia.Controls public static readonly DirectProperty ClientSizeProperty = AvaloniaProperty.RegisterDirect(nameof(ClientSize), o => o.ClientSize); - /// - /// Defines the property. - /// - public static readonly DirectProperty IsActiveProperty = - AvaloniaProperty.RegisterDirect(nameof(IsActive), o => o.IsActive); - /// /// Defines the property. /// @@ -51,7 +45,6 @@ namespace Avalonia.Controls private readonly IApplicationLifecycle _applicationLifecycle; private readonly IPlatformRenderInterface _renderInterface; private Size _clientSize; - private bool _isActive; /// /// Initializes static members of the class. @@ -100,21 +93,20 @@ namespace Avalonia.Controls Renderer = rendererFactory?.CreateRenderer(this, renderLoop); PlatformImpl.SetInputRoot(this); - PlatformImpl.Activated = HandleActivated; - PlatformImpl.Deactivated = HandleDeactivated; + PlatformImpl.Closed = HandleClosed; PlatformImpl.Input = HandleInput; PlatformImpl.Paint = Renderer != null ? (Action)Renderer.Render : null; PlatformImpl.Resized = HandleResized; PlatformImpl.ScalingChanged = HandleScalingChanged; - PlatformImpl.PositionChanged = HandlePositionChanged; + _keyboardNavigationHandler?.SetOwner(this); _accessKeyHandler?.SetOwner(this); styler?.ApplyStyles(this); ClientSize = PlatformImpl.ClientSize; - this.GetObservable(ClientSizeProperty).Skip(1).Subscribe(x => PlatformImpl.ClientSize = x); + this.GetObservable(PointerOverElementProperty) .Select( x => (x as InputElement)?.GetObservable(CursorProperty) ?? Observable.Empty()) @@ -126,51 +118,18 @@ namespace Avalonia.Controls } } - /// - /// Fired when the window is activated. - /// - public event EventHandler Activated; - /// /// Fired when the window is closed. /// public event EventHandler Closed; - /// - /// Fired when the window is deactivated. - /// - public event EventHandler Deactivated; - - /// - /// Fired when the window position is changed. - /// - public event EventHandler PositionChanged; - /// /// Gets or sets the client size of the window. /// public Size ClientSize { get { return _clientSize; } - private set { SetAndRaise(ClientSizeProperty, ref _clientSize, value); } - } - - /// - /// Gets a value that indicates whether the window is active. - /// - public bool IsActive - { - get { return _isActive; } - private set { SetAndRaise(IsActiveProperty, ref _isActive, value); } - } - - /// - /// Gets or sets the window position in screen coordinates. - /// - public Point Position - { - get { return PlatformImpl.Position; } - set { PlatformImpl.Position = value; } + protected set { SetAndRaise(ClientSizeProperty, ref _clientSize, value); } } /// @@ -225,15 +184,6 @@ namespace Avalonia.Controls get { return AvaloniaLocator.Current.GetService(); } } - /// - /// Whether an auto-size operation is in progress. - /// - protected bool AutoSizing - { - get; - private set; - } - /// IRenderTarget IRenderRoot.CreateRenderTarget() { @@ -258,43 +208,6 @@ namespace Avalonia.Controls return PlatformImpl.PointToScreen(p); } - /// - /// Activates the window. - /// - public void Activate() - { - PlatformImpl.Activate(); - } - - /// - /// Begins an auto-resize operation. - /// - /// A disposable used to finish the operation. - /// - /// When an auto-resize operation is in progress any resize events received will not be - /// cause the new size to be written to the and - /// properties. - /// - protected IDisposable BeginAutoSizing() - { - AutoSizing = true; - return Disposable.Create(() => AutoSizing = false); - } - - /// - /// Carries out the arrange pass of the window. - /// - /// The final window size. - /// The parameter unchanged. - protected override Size ArrangeOverride(Size finalSize) - { - using (BeginAutoSizing()) - { - PlatformImpl.ClientSize = finalSize; - } - - return base.ArrangeOverride(PlatformImpl.ClientSize); - } /// /// Handles a resize notification from . @@ -302,13 +215,9 @@ namespace Avalonia.Controls /// The new client size. protected virtual void HandleResized(Size clientSize) { - if (!AutoSizing) - { - Width = clientSize.Width; - Height = clientSize.Height; - } - ClientSize = clientSize; + Width = clientSize.Width; + Height = clientSize.Height; LayoutManager.Instance.ExecuteLayoutPass(); PlatformImpl.Invalidate(new Rect(clientSize)); } @@ -358,23 +267,6 @@ namespace Avalonia.Controls return result; } - /// - /// Handles an activated notification from . - /// - private void HandleActivated() - { - Activated?.Invoke(this, EventArgs.Empty); - - var scope = this as IFocusScope; - - if (scope != null) - { - FocusManager.Instance.SetFocusScope(scope); - } - - IsActive = true; - } - /// /// Handles a closed notification from . /// @@ -398,16 +290,6 @@ namespace Avalonia.Controls { } - /// - /// Handles a deactivated notification from . - /// - private void HandleDeactivated() - { - IsActive = false; - - Deactivated?.Invoke(this, EventArgs.Empty); - } - /// /// Handles input from . /// @@ -416,26 +298,5 @@ namespace Avalonia.Controls { _inputManager.ProcessInput(e); } - - /// - /// Handles a window position change notification from - /// . - /// - /// The window position. - private void HandlePositionChanged(Point pos) - { - PositionChanged?.Invoke(this, new PointEventArgs(pos)); - } - - /// - /// Starts moving a window with left button being held. Should be called from left mouse button press event handler - /// - public void BeginMoveDrag() => PlatformImpl.BeginMoveDrag(); - - /// - /// Starts resizing a window. This function is used if an application has window resizing controls. - /// Should be called from left mouse button press event handler - /// - public void BeginResizeDrag(WindowEdge edge) => PlatformImpl.BeginResizeDrag(edge); } } diff --git a/src/Avalonia.Controls/Utils/UndoRedoHelper.cs b/src/Avalonia.Controls/Utils/UndoRedoHelper.cs index 71ba3793d1..be4c1aa6c4 100644 --- a/src/Avalonia.Controls/Utils/UndoRedoHelper.cs +++ b/src/Avalonia.Controls/Utils/UndoRedoHelper.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using JetBrains.Annotations; using Avalonia.Utilities; namespace Avalonia.Controls.Utils diff --git a/src/Avalonia.Controls/Window.cs b/src/Avalonia.Controls/Window.cs index 4a1f6d2c5e..57470aa60e 100644 --- a/src/Avalonia.Controls/Window.cs +++ b/src/Avalonia.Controls/Window.cs @@ -44,7 +44,7 @@ namespace Avalonia.Controls /// /// A top-level window. /// - public class Window : TopLevel, IStyleable, IFocusScope, ILayoutRoot, INameScope + public class Window : WindowBase, IStyleable, IFocusScope, ILayoutRoot, INameScope { private static IList s_windows = new List(); diff --git a/src/Avalonia.Controls/WindowBase.cs b/src/Avalonia.Controls/WindowBase.cs new file mode 100644 index 0000000000..ac6eea8641 --- /dev/null +++ b/src/Avalonia.Controls/WindowBase.cs @@ -0,0 +1,194 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reactive.Disposables; +using System.Reactive.Linq; +using System.Text; +using System.Threading.Tasks; +using Avalonia.Controls.Primitives; +using Avalonia.Input; +using Avalonia.Layout; +using Avalonia.Platform; + +namespace Avalonia.Controls +{ + /// + /// Base class for top-level windows. + /// + /// + /// This class acts as a base for top level windows such as and + /// . It handles scheduling layout, styling and rendering as well as + /// tracking the window and state. + /// + public class WindowBase : TopLevel + { + /// + /// Defines the property. + /// + public static readonly DirectProperty IsActiveProperty = + AvaloniaProperty.RegisterDirect(nameof(IsActive), o => o.IsActive); + + private bool _isActive; + + public WindowBase(IWindowBaseImpl impl) : this(impl, AvaloniaLocator.Current) + { + } + + public WindowBase(IWindowBaseImpl impl, IAvaloniaDependencyResolver dependencyResolver) : base(impl, dependencyResolver) + { + PlatformImpl.Activated = HandleActivated; + PlatformImpl.Deactivated = HandleDeactivated; + PlatformImpl.PositionChanged = HandlePositionChanged; + this.GetObservable(ClientSizeProperty).Skip(1).Subscribe(x => PlatformImpl.Resize(x)); + } + + /// + /// Fired when the window is activated. + /// + public event EventHandler Activated; + + /// + /// Fired when the window is deactivated. + /// + public event EventHandler Deactivated; + + /// + /// Fired when the window position is changed. + /// + public event EventHandler PositionChanged; + + public new IWindowBaseImpl PlatformImpl => (IWindowBaseImpl) base.PlatformImpl; + + + /// + /// Gets a value that indicates whether the window is active. + /// + public bool IsActive + { + get { return _isActive; } + private set { SetAndRaise(IsActiveProperty, ref _isActive, value); } + } + + /// + /// Gets or sets the window position in screen coordinates. + /// + public Point Position + { + get { return PlatformImpl.Position; } + set { PlatformImpl.Position = value; } + } + + /// + /// Whether an auto-size operation is in progress. + /// + protected bool AutoSizing + { + get; + private set; + } + + /// + /// Activates the window. + /// + public void Activate() + { + PlatformImpl.Activate(); + } + + + /// + /// Begins an auto-resize operation. + /// + /// A disposable used to finish the operation. + /// + /// When an auto-resize operation is in progress any resize events received will not be + /// cause the new size to be written to the and + /// properties. + /// + protected IDisposable BeginAutoSizing() + { + AutoSizing = true; + return Disposable.Create(() => AutoSizing = false); + } + + /// + /// Carries out the arrange pass of the window. + /// + /// The final window size. + /// The parameter unchanged. + protected override Size ArrangeOverride(Size finalSize) + { + using (BeginAutoSizing()) + { + PlatformImpl.Resize(finalSize); + } + + return base.ArrangeOverride(PlatformImpl.ClientSize); + } + + /// + /// Handles a resize notification from . + /// + /// The new client size. + protected override void HandleResized(Size clientSize) + { + if (!AutoSizing) + { + Width = clientSize.Width; + Height = clientSize.Height; + } + ClientSize = clientSize; + LayoutManager.Instance.ExecuteLayoutPass(); + PlatformImpl.Invalidate(new Rect(clientSize)); + + } + + /// + /// Handles a window position change notification from + /// . + /// + /// The window position. + private void HandlePositionChanged(Point pos) + { + PositionChanged?.Invoke(this, new PointEventArgs(pos)); + } + + /// + /// Handles an activated notification from . + /// + private void HandleActivated() + { + Activated?.Invoke(this, EventArgs.Empty); + + var scope = this as IFocusScope; + + if (scope != null) + { + FocusManager.Instance.SetFocusScope(scope); + } + + IsActive = true; + } + + /// + /// Handles a deactivated notification from . + /// + private void HandleDeactivated() + { + IsActive = false; + + Deactivated?.Invoke(this, EventArgs.Empty); + } + + /// + /// Starts moving a window with left button being held. Should be called from left mouse button press event handler + /// + public void BeginMoveDrag() => PlatformImpl.BeginMoveDrag(); + + /// + /// Starts resizing a window. This function is used if an application has window resizing controls. + /// Should be called from left mouse button press event handler + /// + public void BeginResizeDrag(WindowEdge edge) => PlatformImpl.BeginResizeDrag(edge); + } +} diff --git a/src/Avalonia.Controls/packages.config b/src/Avalonia.Controls/packages.config deleted file mode 100644 index c372c92f3f..0000000000 --- a/src/Avalonia.Controls/packages.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/Avalonia.DesignerSupport/Avalonia.DesignerSupport.csproj b/src/Avalonia.DesignerSupport/Avalonia.DesignerSupport.csproj index d9174d6f36..3bb74451e7 100644 --- a/src/Avalonia.DesignerSupport/Avalonia.DesignerSupport.csproj +++ b/src/Avalonia.DesignerSupport/Avalonia.DesignerSupport.csproj @@ -1,22 +1,7 @@ - - - + - 11.0 - Debug - AnyCPU - {799A7BB5-3C2C-48B6-85A7-406A12C420DA} - Library - Properties - Avalonia - Avalonia.DesignerSupport - en-US - 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Profile7 - v4.5 - - + netstandard1.1 + false true @@ -40,87 +25,29 @@ CS1591 - - - {3e53a01a-b331-47f3-b828-4a5717e77a24} - Avalonia.Markup.Xaml - - - {6417e941-21bc-467b-a771-0de389353ce6} - Avalonia.Markup - - - {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 - - - {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F} - Avalonia.Themes.Default - + + + + + + + + + + + Properties\SharedAssemblyInfo.cs - - - - + + + + + + - - - ..\..\packages\System.Reactive.Core.3.0.0\lib\netstandard1.1\System.Reactive.Core.dll - True - - - ..\..\packages\System.Reactive.Interfaces.3.0.0\lib\netstandard1.0\System.Reactive.Interfaces.dll - True - - - ..\..\packages\System.Reactive.Linq.3.0.0\lib\netstandard1.1\System.Reactive.Linq.dll - True - - - ..\..\packages\System.Reactive.PlatformServices.3.0.0\lib\netstandard1.0\System.Reactive.PlatformServices.dll - True - - - - \ No newline at end of file diff --git a/src/Avalonia.DesignerSupport/Avalonia.DesignerSupport.v2.ncrunchproject b/src/Avalonia.DesignerSupport/Avalonia.DesignerSupport.v2.ncrunchproject deleted file mode 100644 index 30815b1937..0000000000 --- a/src/Avalonia.DesignerSupport/Avalonia.DesignerSupport.v2.ncrunchproject +++ /dev/null @@ -1,26 +0,0 @@ - - true - 1000 - false - false - false - true - false - false - false - false - false - true - true - false - true - true - true - 60000 - - - - AutoDetect - STA - x86 - \ No newline at end of file diff --git a/src/Avalonia.DesignerSupport/DesignerAssist.cs b/src/Avalonia.DesignerSupport/DesignerAssist.cs index 95e7345227..c9ae89354c 100644 --- a/src/Avalonia.DesignerSupport/DesignerAssist.cs +++ b/src/Avalonia.DesignerSupport/DesignerAssist.cs @@ -75,8 +75,7 @@ namespace Avalonia.DesignerSupport private static void SetScalingFactor(double factor) { PlatformManager.SetDesignerScalingFactor(factor); - if (s_currentWindow != null) - s_currentWindow.PlatformImpl.ClientSize = s_currentWindow.ClientSize; + s_currentWindow?.PlatformImpl.Resize(s_currentWindow.ClientSize); } static Window s_currentWindow; diff --git a/src/Avalonia.DesignerSupport/packages.config b/src/Avalonia.DesignerSupport/packages.config deleted file mode 100644 index 9f732f1bcb..0000000000 --- a/src/Avalonia.DesignerSupport/packages.config +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj b/src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj index a56575dab7..04499c7df3 100644 --- a/src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj +++ b/src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj @@ -1,22 +1,7 @@ - - - + - 11.0 - Debug - AnyCPU - {7062AE20-5DCC-4442-9645-8195BDECE63E} - Library - Properties - Avalonia.Diagnostics - Avalonia.Diagnostics - en-US - 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Profile7 - v4.5 - - + netstandard1.1 + false true @@ -41,117 +26,40 @@ true - - - {3e53a01a-b331-47f3-b828-4a5717e77a24} - Avalonia.Markup.Xaml - - - {6417e941-21bc-467b-a771-0de389353ce6} - Avalonia.Markup - - - {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 - - - {6417B24E-49C2-4985-8DB2-3AB9D898EC91} - Avalonia.ReactiveUI - - - {EB582467-6ABB-43A1-B052-E981BA910E3A} - Avalonia.Visuals - - - {F1BAA01A-F176-4C6A-B39D-5B40BB1B148F} - Avalonia.Styling - - - {3e10a5fa-e8da-48b1-ad44-6a5b6cb7750f} - Avalonia.Themes.Default - + + + + + + + + + + + + Properties\SharedAssemblyInfo.cs - - - - - - - - - - - - - - TreePageView.xaml + + %(Filename) - - DevTools.xaml - - - - - - - ..\..\packages\Splat.1.6.2\lib\Portable-net45+win+wpa81+wp80\Splat.dll - - - ..\..\packages\System.Reactive.Core.3.0.0\lib\netstandard1.1\System.Reactive.Core.dll - True - - - ..\..\packages\System.Reactive.Interfaces.3.0.0\lib\netstandard1.0\System.Reactive.Interfaces.dll - True - - - ..\..\packages\System.Reactive.Linq.3.0.0\lib\netstandard1.1\System.Reactive.Linq.dll - True - - - ..\..\packages\System.Reactive.PlatformServices.3.0.0\lib\netstandard1.0\System.Reactive.PlatformServices.dll - True - - - - - - Designer - - + Designer - - + + + + + + + + \ No newline at end of file diff --git a/src/Avalonia.Diagnostics/Avalonia.Diagnostics.v2.ncrunchproject b/src/Avalonia.Diagnostics/Avalonia.Diagnostics.v2.ncrunchproject deleted file mode 100644 index 30815b1937..0000000000 --- a/src/Avalonia.Diagnostics/Avalonia.Diagnostics.v2.ncrunchproject +++ /dev/null @@ -1,26 +0,0 @@ - - true - 1000 - false - false - false - true - false - false - false - false - false - true - true - false - true - true - true - 60000 - - - - AutoDetect - STA - x86 - \ No newline at end of file diff --git a/src/Avalonia.Diagnostics/packages.config b/src/Avalonia.Diagnostics/packages.config deleted file mode 100644 index df107dc625..0000000000 --- a/src/Avalonia.Diagnostics/packages.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/Avalonia.DotNetCoreRuntime/AppBuilder.cs b/src/Avalonia.DotNetCoreRuntime/AppBuilder.cs index 5a6b82573b..2b9b3083b1 100644 --- a/src/Avalonia.DotNetCoreRuntime/AppBuilder.cs +++ b/src/Avalonia.DotNetCoreRuntime/AppBuilder.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using System.Text; using System.Threading.Tasks; using Avalonia.Controls; @@ -15,7 +16,9 @@ namespace Avalonia /// Initializes a new instance of the class. /// public AppBuilder() - : base(new StandardRuntimePlatform(), () => StandardRuntimePlatformServices.Register()) + : base(new StandardRuntimePlatform(), + builder => StandardRuntimePlatformServices.Register(builder.Instance?.GetType() + ?.GetTypeInfo().Assembly)) { } diff --git a/src/Avalonia.DotNetCoreRuntime/Avalonia.DotNetCoreRuntime.csproj b/src/Avalonia.DotNetCoreRuntime/Avalonia.DotNetCoreRuntime.csproj index 8a60d5d9c7..257e27b043 100644 --- a/src/Avalonia.DotNetCoreRuntime/Avalonia.DotNetCoreRuntime.csproj +++ b/src/Avalonia.DotNetCoreRuntime/Avalonia.DotNetCoreRuntime.csproj @@ -1,21 +1,7 @@ - - - + - 14.0 - Debug - AnyCPU - {7863EA94-F0FB-4386-BF8C-E5BFA761560A} - Library - Properties - Avalonia.DotNetCoreRuntime - Avalonia.DotNetCoreRuntime - en-US - 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - - - v5.0 + netcoreapp1.0 + false true @@ -36,54 +22,21 @@ 4 bin\Release\Avalonia.DotNetCoreRuntime.XML - - - - - SharedAssemblyInfo.cs + Properties\SharedAssemblyInfo.cs - - - - - {b09b78d8-9b26-48b0-9149-d64a2f120f3f} - Avalonia.Base - - - {d2221c82-4a25-4583-9b43-d791e3f6820c} - Avalonia.Controls - - - {eb582467-6abb-43a1-b052-e981ba910e3a} - Avalonia.Visuals - - - {bb1f7bb5-6ad4-4776-94d9-c09d0a972658} - Avalonia.Gtk3 - - - {7d2d3083-71dd-4cc9-8907-39a0d86fb322} - Avalonia.Skia.Desktop.NetStandard - - - {40759a76-d0f2-464e-8000-6ff0f5c4bd7c} - Avalonia.Win32.NetStandard - + + + + + + - + - - \ No newline at end of file diff --git a/src/Avalonia.DotNetCoreRuntime/Properties/AssemblyInfo.cs b/src/Avalonia.DotNetCoreRuntime/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..51ec3975c9 --- /dev/null +++ b/src/Avalonia.DotNetCoreRuntime/Properties/AssemblyInfo.cs @@ -0,0 +1,6 @@ +// 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 System.Reflection; + +[assembly: AssemblyTitle("Avalonia.DotNetCoreRuntime")] diff --git a/src/Avalonia.DotNetCoreRuntime/project.json b/src/Avalonia.DotNetCoreRuntime/project.json deleted file mode 100644 index d6ae90b33b..0000000000 --- a/src/Avalonia.DotNetCoreRuntime/project.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "supports": {}, - "dependencies": { - "Microsoft.NETCore.Portable.Compatibility": "1.0.1", - "NETStandard.Library": "1.6.0", - "System.Threading.ThreadPool": "4.3.0" - }, - "frameworks": { - "netstandard1.5": {} - } -} \ No newline at end of file diff --git a/src/Avalonia.DotNetFrameworkRuntime/AppBuilder.cs b/src/Avalonia.DotNetFrameworkRuntime/AppBuilder.cs index 3385e25d4f..fc7fdd2431 100644 --- a/src/Avalonia.DotNetFrameworkRuntime/AppBuilder.cs +++ b/src/Avalonia.DotNetFrameworkRuntime/AppBuilder.cs @@ -17,7 +17,8 @@ namespace Avalonia /// Initializes a new instance of the class. /// public AppBuilder() - : base(new StandardRuntimePlatform(), () => StandardRuntimePlatformServices.Register()) + : base(new StandardRuntimePlatform(), + builder => StandardRuntimePlatformServices.Register(builder.Instance?.GetType()?.Assembly)) { } @@ -30,6 +31,20 @@ namespace Avalonia Instance = app; } + bool CheckEnvironment(Type checkerType) + { + if (checkerType == null) + return true; + try + { + return ((IModuleEnvironmentChecker) Activator.CreateInstance(checkerType)).IsCompatible; + } + catch + { + return false; + } + } + /// /// Instructs the to use the best settings for the platform. /// @@ -42,13 +57,13 @@ namespace Avalonia var windowingSubsystemAttribute = (from assembly in RuntimePlatform.GetLoadedAssemblies() from attribute in assembly.GetCustomAttributes() - where attribute.RequiredOS == os + where attribute.RequiredOS == os && CheckEnvironment(attribute.EnvironmentChecker) orderby attribute.Priority ascending select attribute).First(); var renderingSubsystemAttribute = (from assembly in RuntimePlatform.GetLoadedAssemblies() from attribute in assembly.GetCustomAttributes() - where attribute.RequiredOS == os + where attribute.RequiredOS == os && CheckEnvironment(attribute.EnvironmentChecker) where attribute.RequiresWindowingSubsystem == null || attribute.RequiresWindowingSubsystem == windowingSubsystemAttribute.Name orderby attribute.Priority ascending diff --git a/src/Avalonia.DotNetFrameworkRuntime/Avalonia.DotNetFrameworkRuntime.csproj b/src/Avalonia.DotNetFrameworkRuntime/Avalonia.DotNetFrameworkRuntime.csproj index e87ec0b5a7..5c84f88d7e 100644 --- a/src/Avalonia.DotNetFrameworkRuntime/Avalonia.DotNetFrameworkRuntime.csproj +++ b/src/Avalonia.DotNetFrameworkRuntime/Avalonia.DotNetFrameworkRuntime.csproj @@ -1,5 +1,5 @@  - + Debug @@ -36,14 +36,6 @@ - - ..\..\packages\System.Reactive.Core.3.0.0\lib\net45\System.Reactive.Core.dll - True - - - ..\..\packages\System.Reactive.Interfaces.3.0.0\lib\net45\System.Reactive.Interfaces.dll - True - @@ -74,9 +66,6 @@ Avalonia.Styling - - - + + + + + \ No newline at end of file diff --git a/src/Avalonia.DotNetFrameworkRuntime/Avalonia.DotNetFrameworkRuntime.v2.ncrunchproject b/src/Avalonia.DotNetFrameworkRuntime/Avalonia.DotNetFrameworkRuntime.v2.ncrunchproject deleted file mode 100644 index 30815b1937..0000000000 --- a/src/Avalonia.DotNetFrameworkRuntime/Avalonia.DotNetFrameworkRuntime.v2.ncrunchproject +++ /dev/null @@ -1,26 +0,0 @@ - - true - 1000 - false - false - false - true - false - false - false - false - false - true - true - false - true - true - true - 60000 - - - - AutoDetect - STA - x86 - \ No newline at end of file diff --git a/src/Avalonia.DotNetFrameworkRuntime/packages.config b/src/Avalonia.DotNetFrameworkRuntime/packages.config deleted file mode 100644 index 1e93a8c9e7..0000000000 --- a/src/Avalonia.DotNetFrameworkRuntime/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/Avalonia.HtmlRenderer/Adapters/AvaloniaAdapter.cs b/src/Avalonia.HtmlRenderer/Adapters/AvaloniaAdapter.cs index 12c040fab3..aab65fcbc7 100644 --- a/src/Avalonia.HtmlRenderer/Adapters/AvaloniaAdapter.cs +++ b/src/Avalonia.HtmlRenderer/Adapters/AvaloniaAdapter.cs @@ -80,7 +80,7 @@ namespace TheArtOfDev.HtmlRenderer.Avalonia.Adapters { StartPoint = new RelativePoint(x, y, RelativeUnit.Relative), EndPoint = new RelativePoint(1 - x, 1 - y, RelativeUnit.Relative), - GradientStops = + GradientStops = new[] { new GradientStop(startColor, 0), new GradientStop(endColor, 1) diff --git a/src/Avalonia.HtmlRenderer/Avalonia.HtmlRenderer.csproj b/src/Avalonia.HtmlRenderer/Avalonia.HtmlRenderer.csproj index 8f16bad64a..7cb66d588a 100644 --- a/src/Avalonia.HtmlRenderer/Avalonia.HtmlRenderer.csproj +++ b/src/Avalonia.HtmlRenderer/Avalonia.HtmlRenderer.csproj @@ -1,22 +1,9 @@ - - - + - 10.0 - Debug - AnyCPU - {5FB2B005-0A7F-4DAD-ADD4-3ED01444E63D} - Library - Properties - Avalonia.HtmlRenderer - Avalonia.HtmlRenderer - en-US - 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Profile7 - v4.5 - - + netstandard1.1 + False + False + false true @@ -36,7 +23,6 @@ 4 - @@ -51,6 +37,7 @@ + @@ -137,65 +124,17 @@ - - {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 - + + + + + + + + - + + - - - ..\..\packages\System.Reactive.Core.3.0.0\lib\netstandard1.1\System.Reactive.Core.dll - True - - - ..\..\packages\System.Reactive.Interfaces.3.0.0\lib\netstandard1.0\System.Reactive.Interfaces.dll - True - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - \ No newline at end of file diff --git a/src/Avalonia.HtmlRenderer/Avalonia.HtmlRenderer.v2.ncrunchproject b/src/Avalonia.HtmlRenderer/Avalonia.HtmlRenderer.v2.ncrunchproject deleted file mode 100644 index 30815b1937..0000000000 --- a/src/Avalonia.HtmlRenderer/Avalonia.HtmlRenderer.v2.ncrunchproject +++ /dev/null @@ -1,26 +0,0 @@ - - true - 1000 - false - false - false - true - false - false - false - false - false - true - true - false - true - true - true - 60000 - - - - AutoDetect - STA - x86 - \ No newline at end of file diff --git a/src/Avalonia.HtmlRenderer/Compat/Api.cs b/src/Avalonia.HtmlRenderer/Compat/Api.cs new file mode 100644 index 0000000000..798b697277 --- /dev/null +++ b/src/Avalonia.HtmlRenderer/Compat/Api.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace System.Net +{ + internal class AsyncCompletedEventArgs + { + public object UserState { get; set; } + public Exception Error { get; set; } + public bool Cancelled { get; set; } + + public AsyncCompletedEventArgs(Exception error, bool cancelled, object userState) + { + + } + } + + class WebException : Exception + { + public object Response { get; set; } + } + + class HttpWebResponse + { + public HttpStatusCode StatusCode { get; set; } + } +} diff --git a/src/Avalonia.HtmlRenderer/packages.config b/src/Avalonia.HtmlRenderer/packages.config deleted file mode 100644 index b6a9c7823c..0000000000 --- a/src/Avalonia.HtmlRenderer/packages.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/src/Avalonia.Input/Avalonia.Input.csproj b/src/Avalonia.Input/Avalonia.Input.csproj index c1ed34c1c7..c3b30bb435 100644 --- a/src/Avalonia.Input/Avalonia.Input.csproj +++ b/src/Avalonia.Input/Avalonia.Input.csproj @@ -1,22 +1,7 @@ - - - + - 11.0 - Debug - AnyCPU - {62024B2D-53EB-4638-B26B-85EEAA54866E} - Library - Properties - Avalonia.Input - Avalonia.Input - en-US - 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Profile7 - v4.5 - - + netstandard1.1 + false true @@ -41,109 +26,22 @@ true - - - {D211E587-D8BC-45B9-95A4-F297C8FA5200} - Avalonia.Animation - - - {B09B78D8-9B26-48B0-9149-D64A2F120F3F} - Avalonia.Base - - - {6B0ED19D-A08B-461C-A9D9-A9EE40B0C06B} - Avalonia.Interactivity - - - {42472427-4774-4C81-8AFF-9F27B8E31721} - Avalonia.Layout - - - {EB582467-6ABB-43A1-B052-E981BA910E3A} - Avalonia.Visuals - + + + + + Properties\SharedAssemblyInfo.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - - - ..\..\packages\System.Reactive.Core.3.0.0\lib\netstandard1.1\System.Reactive.Core.dll - True - - - ..\..\packages\System.Reactive.Interfaces.3.0.0\lib\netstandard1.0\System.Reactive.Interfaces.dll - True - - - ..\..\packages\System.Reactive.Linq.3.0.0\lib\netstandard1.1\System.Reactive.Linq.dll - True - - - ..\..\packages\System.Reactive.PlatformServices.3.0.0\lib\netstandard1.0\System.Reactive.PlatformServices.dll - True - - - - \ No newline at end of file diff --git a/src/Avalonia.Input/Avalonia.Input.v2.ncrunchproject b/src/Avalonia.Input/Avalonia.Input.v2.ncrunchproject deleted file mode 100644 index 30815b1937..0000000000 --- a/src/Avalonia.Input/Avalonia.Input.v2.ncrunchproject +++ /dev/null @@ -1,26 +0,0 @@ - - true - 1000 - false - false - false - true - false - false - false - false - false - true - true - false - true - true - true - 60000 - - - - AutoDetect - STA - x86 - \ No newline at end of file diff --git a/src/Avalonia.Input/IInputElement.cs b/src/Avalonia.Input/IInputElement.cs index 72f03d3ae5..786353f05c 100644 --- a/src/Avalonia.Input/IInputElement.cs +++ b/src/Avalonia.Input/IInputElement.cs @@ -1,7 +1,5 @@ // 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 System.Diagnostics.Contracts; using System; using System.Collections.Generic; using Avalonia.Interactivity; diff --git a/src/Avalonia.Input/packages.config b/src/Avalonia.Input/packages.config deleted file mode 100644 index 9f732f1bcb..0000000000 --- a/src/Avalonia.Input/packages.config +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/src/Avalonia.Interactivity/Avalonia.Interactivity.csproj b/src/Avalonia.Interactivity/Avalonia.Interactivity.csproj index 0d81690de0..154c8d35d0 100644 --- a/src/Avalonia.Interactivity/Avalonia.Interactivity.csproj +++ b/src/Avalonia.Interactivity/Avalonia.Interactivity.csproj @@ -1,22 +1,7 @@ - - - + - 11.0 - Debug - AnyCPU - {6B0ED19D-A08B-461C-A9D9-A9EE40B0C06B} - Library - Properties - Avalonia.Interactivity - Avalonia.Interactivity - en-US - 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Profile7 - v4.5 - - + netstandard1.1 + false true @@ -41,63 +26,21 @@ true - - - {D211E587-D8BC-45B9-95A4-F297C8FA5200} - Avalonia.Animation - - - {B09B78D8-9B26-48B0-9149-D64A2F120F3F} - Avalonia.Base - - - {42472427-4774-4C81-8AFF-9F27B8E31721} - Avalonia.Layout - - - {EB582467-6ABB-43A1-B052-E981BA910E3A} - Avalonia.Visuals - + + + + Properties\SharedAssemblyInfo.cs - - - - - - - - + + + + + - - - ..\..\packages\System.Reactive.Core.3.0.0\lib\netstandard1.1\System.Reactive.Core.dll - True - - - ..\..\packages\System.Reactive.Interfaces.3.0.0\lib\netstandard1.0\System.Reactive.Interfaces.dll - True - - - ..\..\packages\System.Reactive.Linq.3.0.0\lib\netstandard1.1\System.Reactive.Linq.dll - True - - - ..\..\packages\System.Reactive.PlatformServices.3.0.0\lib\netstandard1.0\System.Reactive.PlatformServices.dll - True - - - - \ No newline at end of file diff --git a/src/Avalonia.Interactivity/Avalonia.Interactivity.v2.ncrunchproject b/src/Avalonia.Interactivity/Avalonia.Interactivity.v2.ncrunchproject deleted file mode 100644 index 30815b1937..0000000000 --- a/src/Avalonia.Interactivity/Avalonia.Interactivity.v2.ncrunchproject +++ /dev/null @@ -1,26 +0,0 @@ - - true - 1000 - false - false - false - true - false - false - false - false - false - true - true - false - true - true - true - 60000 - - - - AutoDetect - STA - x86 - \ No newline at end of file diff --git a/src/Avalonia.Interactivity/InteractiveExtensions.cs b/src/Avalonia.Interactivity/InteractiveExtensions.cs index 2507fc6866..b03590951b 100644 --- a/src/Avalonia.Interactivity/InteractiveExtensions.cs +++ b/src/Avalonia.Interactivity/InteractiveExtensions.cs @@ -1,8 +1,10 @@ // 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 System; using System.Collections.Generic; using System.Linq; +using System.Reactive.Linq; namespace Avalonia.Interactivity { @@ -11,12 +13,36 @@ namespace Avalonia.Interactivity /// public static class InteractiveExtensions { + /// + /// Gets an observable for a . + /// + /// The object to listen for events on. + /// The routed event. + /// The routing strategies to listen to. + /// Whether handled events should also be listened for. + /// + /// An observable which fires each time the event is raised. + /// + public static IObservable GetObservable( + this IInteractive o, + RoutedEvent routedEvent, + RoutingStrategies routes = RoutingStrategies.Direct | RoutingStrategies.Bubble, + bool handledEventsToo = false) + where TEventArgs : RoutedEventArgs + { + return Observable.Create(x => o.AddHandler( + routedEvent, + (_, e) => x.OnNext(e), + routes, + handledEventsToo)); + } + /// /// Gets the route for bubbling events from the specified interactive. /// /// The interactive. /// The event route. - public static IEnumerable GetBubbleEventRoute(this IInteractive interactive) + internal static IEnumerable GetBubbleEventRoute(this IInteractive interactive) { while (interactive != null) { @@ -30,7 +56,7 @@ namespace Avalonia.Interactivity /// /// The interactive. /// The event route. - public static IEnumerable GetTunnelEventRoute(this IInteractive interactive) + internal static IEnumerable GetTunnelEventRoute(this IInteractive interactive) { return interactive.GetBubbleEventRoute().Reverse(); } diff --git a/src/Avalonia.Interactivity/packages.config b/src/Avalonia.Interactivity/packages.config deleted file mode 100644 index 9f732f1bcb..0000000000 --- a/src/Avalonia.Interactivity/packages.config +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/src/Avalonia.Layout/Avalonia.Layout.csproj b/src/Avalonia.Layout/Avalonia.Layout.csproj index 41b545b5cb..d034004428 100644 --- a/src/Avalonia.Layout/Avalonia.Layout.csproj +++ b/src/Avalonia.Layout/Avalonia.Layout.csproj @@ -1,22 +1,7 @@ - - - + - 11.0 - Debug - AnyCPU - {42472427-4774-4C81-8AFF-9F27B8E31721} - Library - Properties - Avalonia - Avalonia.Layout - en-US - 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Profile7 - v4.5 - - + netstandard1.1 + false true @@ -41,59 +26,20 @@ true - - - {D211E587-D8BC-45B9-95A4-F297C8FA5200} - Avalonia.Animation - - - {B09B78D8-9B26-48B0-9149-D64A2F120F3F} - Avalonia.Base - - - {EB582467-6ABB-43A1-B052-E981BA910E3A} - Avalonia.Visuals - + + + Properties\SharedAssemblyInfo.cs - - - - - - - - + + + + + - - - ..\..\packages\System.Reactive.Core.3.0.0\lib\netstandard1.1\System.Reactive.Core.dll - True - - - ..\..\packages\System.Reactive.Interfaces.3.0.0\lib\netstandard1.0\System.Reactive.Interfaces.dll - True - - - ..\..\packages\System.Reactive.Linq.3.0.0\lib\netstandard1.1\System.Reactive.Linq.dll - True - - - ..\..\packages\System.Reactive.PlatformServices.3.0.0\lib\netstandard1.0\System.Reactive.PlatformServices.dll - True - - - - \ No newline at end of file diff --git a/src/Avalonia.Layout/Avalonia.Layout.v2.ncrunchproject b/src/Avalonia.Layout/Avalonia.Layout.v2.ncrunchproject deleted file mode 100644 index 30815b1937..0000000000 --- a/src/Avalonia.Layout/Avalonia.Layout.v2.ncrunchproject +++ /dev/null @@ -1,26 +0,0 @@ - - true - 1000 - false - false - false - true - false - false - false - false - false - true - true - false - true - true - true - 60000 - - - - AutoDetect - STA - x86 - \ No newline at end of file diff --git a/src/Avalonia.Layout/Layoutable.cs b/src/Avalonia.Layout/Layoutable.cs index 7624928e4b..5abd6c52f7 100644 --- a/src/Avalonia.Layout/Layoutable.cs +++ b/src/Avalonia.Layout/Layoutable.cs @@ -154,6 +154,11 @@ namespace Avalonia.Layout VerticalAlignmentProperty); } + /// + /// Occurs when a layout pass completes for the control. + /// + public event EventHandler LayoutUpdated; + /// /// Gets or sets the width of the element. /// @@ -357,6 +362,8 @@ namespace Avalonia.Layout IsArrangeValid = true; ArrangeCore(rect); _previousArrange = rect; + + LayoutUpdated?.Invoke(this, EventArgs.Empty); } } diff --git a/src/Avalonia.Layout/packages.config b/src/Avalonia.Layout/packages.config deleted file mode 100644 index 9f732f1bcb..0000000000 --- a/src/Avalonia.Layout/packages.config +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ 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 0fb85db795..7905e5270d 100644 --- a/src/Avalonia.Logging.Serilog/Avalonia.Logging.Serilog.csproj +++ b/src/Avalonia.Logging.Serilog/Avalonia.Logging.Serilog.csproj @@ -1,20 +1,7 @@ - - - + - 10.0 - Debug - AnyCPU - {B61B66A3-B82D-4875-8001-89D3394FE0C9} - Library - Properties - Avalonia.Logging.Serilog - Avalonia.Logging.Serilog - en-US - 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Profile7 - v4.5 + netstandard1.1 + false true @@ -37,30 +24,9 @@ true - - + - - ..\..\packages\Serilog.1.5.14\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+MonoTouch10\Serilog.dll - True - + - - - - - - {b09b78d8-9b26-48b0-9149-d64a2f120f3f} - Avalonia.Base - - - - \ No newline at end of file diff --git a/src/Avalonia.Logging.Serilog/Avalonia.Logging.Serilog.v2.ncrunchproject b/src/Avalonia.Logging.Serilog/Avalonia.Logging.Serilog.v2.ncrunchproject deleted file mode 100644 index 30815b1937..0000000000 --- a/src/Avalonia.Logging.Serilog/Avalonia.Logging.Serilog.v2.ncrunchproject +++ /dev/null @@ -1,26 +0,0 @@ - - true - 1000 - false - false - false - true - false - false - false - false - false - true - true - false - true - true - true - 60000 - - - - AutoDetect - STA - x86 - \ No newline at end of file diff --git a/src/Avalonia.Logging.Serilog/packages.config b/src/Avalonia.Logging.Serilog/packages.config deleted file mode 100644 index dbc72b5331..0000000000 --- a/src/Avalonia.Logging.Serilog/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/Avalonia.ReactiveUI/Avalonia.ReactiveUI.csproj b/src/Avalonia.ReactiveUI/Avalonia.ReactiveUI.csproj index 98cf115eaf..74a931f8c6 100644 --- a/src/Avalonia.ReactiveUI/Avalonia.ReactiveUI.csproj +++ b/src/Avalonia.ReactiveUI/Avalonia.ReactiveUI.csproj @@ -1,27 +1,15 @@ - - - + - 10.0 - Debug - AnyCPU - {6417B24E-49C2-4985-8DB2-3AB9D898EC91} - Library - Properties - Avalonia.ReactiveUI - Avalonia.ReactiveUI - en-US - 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Profile259 - v4.5 + netstandard1.1 + False + false true full false bin\Debug\ - TRACE;DEBUG;MONO PORTABLE + TRACE;DEBUG;MONO PORTABLE;NETSTANDARD1_1 prompt 4 @@ -29,15 +17,19 @@ pdbonly true bin\Release\ - TRACE;MONO PORTABLE + TRACE;MONO PORTABLE;RELEASE;NETSTANDARD1_1 prompt 4 + + + + @@ -65,9 +57,7 @@ - - Code - + @@ -86,36 +76,26 @@ - - - ..\..\packages\Splat.1.6.2\lib\Portable-net45+win+wpa81+wp80\Splat.dll - - - ..\..\packages\System.Reactive.Core.3.0.0\lib\netstandard1.0\System.Reactive.Core.dll - True - - - ..\..\packages\System.Reactive.Interfaces.3.0.0\lib\netstandard1.0\System.Reactive.Interfaces.dll - True - - - ..\..\packages\System.Reactive.Linq.3.0.0\lib\netstandard1.0\System.Reactive.Linq.dll - True - - - ..\..\packages\System.Reactive.PlatformServices.3.0.0\lib\netstandard1.0\System.Reactive.PlatformServices.dll - True - - - - - - - + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Avalonia.ReactiveUI/Avalonia.ReactiveUI.v2.ncrunchproject b/src/Avalonia.ReactiveUI/Avalonia.ReactiveUI.v2.ncrunchproject deleted file mode 100644 index 30815b1937..0000000000 --- a/src/Avalonia.ReactiveUI/Avalonia.ReactiveUI.v2.ncrunchproject +++ /dev/null @@ -1,26 +0,0 @@ - - true - 1000 - false - false - false - true - false - false - false - false - false - true - true - false - true - true - true - 60000 - - - - AutoDetect - STA - x86 - \ No newline at end of file diff --git a/src/Avalonia.ReactiveUI/Shims.cs b/src/Avalonia.ReactiveUI/Shims.cs new file mode 100644 index 0000000000..2729a68d6f --- /dev/null +++ b/src/Avalonia.ReactiveUI/Shims.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace System.Runtime.Serialization +{ + class IgnoreDataMemberAttribute : Attribute + { + } + + class DataMemberAttribute : Attribute + { + } + class OnDeserializedAttribute : Attribute + { + } + + class DataContractAttribute : Attribute + { + } + + class StreamingContext { } +} + +namespace System.Diagnostics.Contracts +{ + static class Contract + { + public static void Requires(bool condition) + { + + } + } +} diff --git a/src/Avalonia.ReactiveUI/packages.config b/src/Avalonia.ReactiveUI/packages.config deleted file mode 100644 index f10d6d8873..0000000000 --- a/src/Avalonia.ReactiveUI/packages.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/Avalonia.Styling/Avalonia.Styling.csproj b/src/Avalonia.Styling/Avalonia.Styling.csproj index d38406caa7..bc51b4c843 100644 --- a/src/Avalonia.Styling/Avalonia.Styling.csproj +++ b/src/Avalonia.Styling/Avalonia.Styling.csproj @@ -1,22 +1,7 @@ - - - + - 11.0 - Debug - AnyCPU - {F1BAA01A-F176-4C6A-B39D-5B40BB1B148F} - Library - Properties - Avalonia - Avalonia.Styling - en-US - 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Profile7 - v4.5 - - + netstandard1.1 + false true @@ -44,84 +29,17 @@ Properties\SharedAssemblyInfo.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ..\..\packages\System.Reactive.Core.3.0.0\lib\netstandard1.1\System.Reactive.Core.dll - True - - - ..\..\packages\System.Reactive.Interfaces.3.0.0\lib\netstandard1.0\System.Reactive.Interfaces.dll - True - - - ..\..\packages\System.Reactive.Linq.3.0.0\lib\netstandard1.1\System.Reactive.Linq.dll - True - - - ..\..\packages\System.Reactive.PlatformServices.3.0.0\lib\netstandard1.0\System.Reactive.PlatformServices.dll - True - + + + - - - + + + + + - - - {d211e587-d8bc-45b9-95a4-f297c8fa5200} - Avalonia.Animation - - - {B09B78D8-9B26-48B0-9149-D64A2F120F3F} - Avalonia.Base - - - {EB582467-6ABB-43A1-B052-E981BA910E3A} - Avalonia.Visuals - - - - \ No newline at end of file diff --git a/src/Avalonia.Styling/Avalonia.Styling.v2.ncrunchproject b/src/Avalonia.Styling/Avalonia.Styling.v2.ncrunchproject deleted file mode 100644 index 30815b1937..0000000000 --- a/src/Avalonia.Styling/Avalonia.Styling.v2.ncrunchproject +++ /dev/null @@ -1,26 +0,0 @@ - - true - 1000 - false - false - false - true - false - false - false - false - false - true - true - false - true - true - true - 60000 - - - - AutoDetect - STA - x86 - \ No newline at end of file diff --git a/src/Avalonia.Styling/packages.config b/src/Avalonia.Styling/packages.config deleted file mode 100644 index 9f732f1bcb..0000000000 --- a/src/Avalonia.Styling/packages.config +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/src/Avalonia.Themes.Default/Accents/BaseLight.xaml b/src/Avalonia.Themes.Default/Accents/BaseLight.xaml index 38786f54d3..cb86598a42 100644 --- a/src/Avalonia.Themes.Default/Accents/BaseLight.xaml +++ b/src/Avalonia.Themes.Default/Accents/BaseLight.xaml @@ -1,6 +1,5 @@ \ No newline at end of file diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/StyleTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/StyleTests.cs index 308a65dcd4..dc15074445 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/StyleTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/StyleTests.cs @@ -124,13 +124,12 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml { var xaml = @" @@ -139,12 +138,12 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml var loader = new AvaloniaXamlLoader(); var window = (Window)loader.Load(xaml); - var brush = (Avalonia.Media.Mutable.SolidColorBrush)window.FindStyleResource("brush"); + var brush = (ISolidColorBrush)window.FindStyleResource("brush"); var button = window.FindControl