Browse Source

Merge branch 'master' into fix-treeview-selectionmode

pull/2436/head
Dariusz Komosiński 7 years ago
committed by GitHub
parent
commit
3f12e8e977
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      samples/BindingDemo/App.xaml.cs
  2. 1
      samples/ControlCatalog.Desktop/Program.cs
  3. 1
      samples/ControlCatalog.NetCore/Program.cs
  4. 1
      samples/RenderDemo/App.xaml.cs
  5. 1
      samples/VirtualizationDemo/Program.cs
  6. 2
      src/Avalonia.Base/Utilities/WeakEventHandlerManager.cs
  7. 3
      src/Avalonia.Controls/Window.cs
  8. 7
      src/Avalonia.ReactiveUI/AppBuilderExtensions.cs
  9. 8
      src/Avalonia.ReactiveUI/Attributes.cs
  10. 18
      src/Avalonia.ReactiveUI/AvaloniaActivationForViewFetcher.cs
  11. 2
      src/Avalonia.ReactiveUI/ReactiveUserControl.cs
  12. 2
      src/Avalonia.ReactiveUI/ReactiveWindow.cs
  13. 8
      src/Avalonia.ReactiveUI/RoutedViewHost.cs
  14. 1
      src/Avalonia.Styling/StyledElement.cs
  15. 1
      tests/Avalonia.ReactiveUI.UnitTests/AvaloniaActivationForViewFetcherTest.cs
  16. 1
      tests/Avalonia.ReactiveUI.UnitTests/RoutedViewHostTest.cs

1
samples/BindingDemo/App.xaml.cs

@ -3,6 +3,7 @@ using Avalonia;
using Avalonia.Controls;
using Avalonia.Logging.Serilog;
using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
using Serilog;
namespace BindingDemo

1
samples/ControlCatalog.Desktop/Program.cs

@ -4,6 +4,7 @@ using Avalonia;
using Avalonia.Controls;
using Avalonia.Logging.Serilog;
using Avalonia.Platform;
using Avalonia.ReactiveUI;
using Serilog;
namespace ControlCatalog

1
samples/ControlCatalog.NetCore/Program.cs

@ -4,6 +4,7 @@ using System.Linq;
using System.Threading;
using Avalonia;
using Avalonia.Skia;
using Avalonia.ReactiveUI;
namespace ControlCatalog.NetCore
{

1
samples/RenderDemo/App.xaml.cs

@ -4,6 +4,7 @@
using Avalonia;
using Avalonia.Logging.Serilog;
using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
namespace RenderDemo
{

1
samples/VirtualizationDemo/Program.cs

@ -5,6 +5,7 @@ using System;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Logging.Serilog;
using Avalonia.ReactiveUI;
using Serilog;
namespace VirtualizationDemo

2
src/Avalonia.Base/Utilities/WeakEventHandlerManager.cs

@ -19,6 +19,7 @@ namespace Avalonia.Utilities
/// </summary>
/// <typeparam name="TTarget">The type of the target.</typeparam>
/// <typeparam name="TEventArgs">The type of the event arguments.</typeparam>
/// <typeparam name="TSubscriber">The type of the subscriber.</typeparam>
/// <param name="target">The event source.</param>
/// <param name="eventName">The name of the event.</param>
/// <param name="subscriber">The subscriber.</param>
@ -40,6 +41,7 @@ namespace Avalonia.Utilities
/// Unsubscribes from an event.
/// </summary>
/// <typeparam name="TEventArgs">The type of the event arguments.</typeparam>
/// <typeparam name="TSubscriber">The type of the subscriber.</typeparam>
/// <param name="target">The event source.</param>
/// <param name="eventName">The name of the event.</param>
/// <param name="subscriber">The subscriber.</param>

3
src/Avalonia.Controls/Window.cs

@ -291,7 +291,8 @@ namespace Avalonia.Controls
/// </summary>
/// <param name="dialogResult">The dialog result.</param>
/// <remarks>
/// When the window is shown with the <see cref="ShowDialog{TResult}"/> method, the
/// When the window is shown with the <see cref="ShowDialog{TResult}(IWindowImpl)"/>
/// or <see cref="ShowDialog{TResult}(Window)"/> method, the
/// resulting task will produce the <see cref="_dialogResult"/> value when the window
/// is closed.
/// </remarks>

7
src/Avalonia.ReactiveUI/AppBuilderExtensions.cs

@ -6,10 +6,15 @@ using Avalonia.Threading;
using ReactiveUI;
using Splat;
namespace Avalonia
namespace Avalonia.ReactiveUI
{
public static class AppBuilderExtensions
{
/// <summary>
/// Initializes ReactiveUI framework to use with Avalonia. Registers Avalonia
/// scheduler and Avalonia activation for view fetcher. Always remember to
/// call this method if you are using ReactiveUI in your application.
/// </summary>
public static TAppBuilder UseReactiveUI<TAppBuilder>(this TAppBuilder builder)
where TAppBuilder : AppBuilderBase<TAppBuilder>, new()
{

8
src/Avalonia.ReactiveUI/Attributes.cs

@ -0,0 +1,8 @@
// 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;
using System.Runtime.CompilerServices;
using Avalonia.Metadata;
[assembly: XmlnsDefinition("http://reactiveui.net", "Avalonia.ReactiveUI")]

18
src/Avalonia.ReactiveUI/AvaloniaActivationForViewFetcher.cs

@ -9,15 +9,24 @@ using Avalonia.VisualTree;
using Avalonia.Controls;
using ReactiveUI;
namespace Avalonia
namespace Avalonia.ReactiveUI
{
/// <summary>
/// Determines when Avalonia IVisuals get activated.
/// </summary>
public class AvaloniaActivationForViewFetcher : IActivationForViewFetcher
{
/// <summary>
/// Returns affinity for view.
/// </summary>
public int GetAffinityForView(Type view)
{
return typeof(IVisual).GetTypeInfo().IsAssignableFrom(view.GetTypeInfo()) ? 10 : 0;
}
/// <summary>
/// Returns activation observable for activatable Avalonia view.
/// </summary>
public IObservable<bool> GetActivationForView(IActivatable view)
{
if (!(view is IVisual visual)) return Observable.Return(false);
@ -25,6 +34,9 @@ namespace Avalonia
return GetActivationForVisual(visual);
}
/// <summary>
/// Listens to Opened and Closed events for Avalonia windows.
/// </summary>
private IObservable<bool> GetActivationForWindowBase(WindowBase window)
{
var windowLoaded = Observable
@ -42,6 +54,10 @@ namespace Avalonia
.DistinctUntilChanged();
}
/// <summary>
/// Listens to AttachedToVisualTree and DetachedFromVisualTree
/// events for Avalonia IVisuals.
/// </summary>
private IObservable<bool> GetActivationForVisual(IVisual visual)
{
var visualLoaded = Observable

2
src/Avalonia.ReactiveUI/ReactiveUserControl.cs

@ -6,7 +6,7 @@ using Avalonia.VisualTree;
using Avalonia.Controls;
using ReactiveUI;
namespace Avalonia
namespace Avalonia.ReactiveUI
{
/// <summary>
/// A ReactiveUI UserControl that implements <see cref="IViewFor{TViewModel}"/>

2
src/Avalonia.ReactiveUI/ReactiveWindow.cs

@ -6,7 +6,7 @@ using Avalonia.VisualTree;
using Avalonia.Controls;
using ReactiveUI;
namespace Avalonia
namespace Avalonia.ReactiveUI
{
/// <summary>
/// A ReactiveUI Window that implements <see cref="IViewFor{TViewModel}"/>

8
src/Avalonia.ReactiveUI/RoutedViewHost.cs

@ -1,13 +1,17 @@
// 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.Reactive.Disposables;
using System.Reactive.Linq;
using Avalonia.Animation;
using Avalonia.Controls;
using Avalonia.Styling;
using Avalonia;
using ReactiveUI;
using Splat;
namespace Avalonia
namespace Avalonia.ReactiveUI
{
/// <summary>
/// This control hosts the View associated with ReactiveUI RoutingState,
@ -157,7 +161,7 @@ namespace Avalonia
return;
}
var viewLocator = ViewLocator ?? ReactiveUI.ViewLocator.Current;
var viewLocator = ViewLocator ?? global::ReactiveUI.ViewLocator.Current;
var view = viewLocator.ResolveView(viewModel);
if (view == null) throw new Exception($"Couldn't find view for '{viewModel}'. Is it registered?");

1
src/Avalonia.Styling/StyledElement.cs

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Reactive.Linq;
using System.Reactive.Subjects;

1
tests/Avalonia.ReactiveUI.UnitTests/AvaloniaActivationForViewFetcherTest.cs

@ -11,6 +11,7 @@ using DynamicData;
using Xunit;
using Splat;
using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
namespace Avalonia
{

1
tests/Avalonia.ReactiveUI.UnitTests/RoutedViewHostTest.cs

@ -14,6 +14,7 @@ using Avalonia.Markup.Xaml;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Reactive;
using Avalonia.ReactiveUI;
namespace Avalonia
{

Loading…
Cancel
Save