Skip to content

Commit

Permalink
Merge branch 'main' into feature/assembly-replacement-config
Browse files Browse the repository at this point in the history
  • Loading branch information
dpvreony committed Jun 3, 2024
2 parents 555b0f2 + c6600b1 commit 798f881
Show file tree
Hide file tree
Showing 19 changed files with 392 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Directory.build.props
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<PackageReference Include="Xunit.StaFact" Version="1.1.11" />
<PackageReference Include="NetTestRegimentation" Version="1.7.48" />
<!--<PackageReference Include="PublicApiGenerator" Version="8.1.0" />-->
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" />
<PackageReference Include="GitHubActionsTestLogger" Version="2.4.1" />
</ItemGroup>

<ItemGroup Condition="$(IsTestProject)">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.5" ReferenceOutputAssembly="true" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.6" ReferenceOutputAssembly="true" />
<PackageReference Include="ReactiveUI.Blazor" Version="20.1.1" ReferenceOutputAssembly="true" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.5" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.6" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.6" PrivateAssets="all" />
<PackageReference Include="System.Net.Http.Json" Version="8.0.0" />
</ItemGroup>

Expand Down
7 changes: 7 additions & 0 deletions src/Vetuviem.Core/AbstractControlBindingModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// See the LICENSE file in the project root for full license information.

using System;
using System.Reactive.Disposables;

namespace Vetuviem.Core
{
Expand Down Expand Up @@ -36,5 +37,11 @@ public abstract void ApplyBindings(
TView view,
TViewModel viewModel,
Action<IDisposable> disposeAction);

/// <inheritdoc/>
public abstract void ApplyBindings(
TView view,
TViewModel viewModel,
CompositeDisposable disposeAction);
}
}
17 changes: 17 additions & 0 deletions src/Vetuviem.Core/AbstractEnableViewToViewModelBindings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

using System;
using System.Collections.Generic;
using System.Reactive.Disposables;
using ReactiveUI;

namespace Vetuviem.Core
Expand Down Expand Up @@ -34,6 +35,22 @@ public void ApplyBindings(
}
}

/// <inheritdoc />
public void ApplyBindings(
CompositeDisposable compositeDisposable,
TView view,
TViewModel viewModel)
{
var bindings = GetBindings();
foreach (var viewBindingModel in bindings)
{
viewBindingModel.ApplyBindings(
view,
viewModel,
compositeDisposable);
}
}

/// <summary>
/// Gets the controls to be bound on the view.
/// </summary>
Expand Down
36 changes: 36 additions & 0 deletions src/Vetuviem.Core/CommandBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System;
using System.Linq.Expressions;
using System.Reactive;
using System.Reactive.Disposables;
using System.Windows.Input;
using ReactiveUI;

Expand Down Expand Up @@ -67,5 +68,40 @@ public void ApplyBinding<TView>(
viewBinding,
_toEvent));
}

/// <inheritdoc/>
public void ApplyBinding<TView>(
CompositeDisposable compositeDisposable,
TView view,
TViewModel viewModel,
Expression<Func<TView, ICommand>> viewBinding)
where TView : class, IViewFor<TViewModel>
{
if (compositeDisposable == null)
{
throw new ArgumentNullException(nameof(compositeDisposable));
}

if (view == null)
{
throw new ArgumentNullException(nameof(view));
}

if (viewModel == null)
{
throw new ArgumentNullException(nameof(viewModel));
}

if (viewBinding == null)
{
throw new ArgumentNullException(nameof(viewBinding));
}

view.BindCommand(
viewModel,
_viewModelBinding,
viewBinding,
_toEvent).DisposeWith(compositeDisposable);
}
}
}
16 changes: 16 additions & 0 deletions src/Vetuviem.Core/ICommandBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

using System;
using System.Linq.Expressions;
using System.Reactive.Disposables;
using ReactiveUI;

namespace Vetuviem.Core
Expand All @@ -30,5 +31,20 @@ void ApplyBinding<TView>(
TViewModel viewModel,
Expression<Func<TView, TViewProp>> viewBinding)
where TView : class, IViewFor<TViewModel>;

/// <summary>
/// Applies a View to View Model Binding.
/// </summary>
/// <typeparam name="TView">The type for the view.</typeparam>
/// <param name="compositeDisposable">The disposable action registration. Used to clean up when bindings fall out of scope.</param>
/// <param name="view">The instance of the View to bind.</param>
/// <param name="viewModel">The instance of the ViewModel to Bind.</param>
/// <param name="viewBinding">Expression of the View Property to Bind to.</param>
void ApplyBinding<TView>(
CompositeDisposable compositeDisposable,
TView view,
TViewModel viewModel,
Expression<Func<TView, TViewProp>> viewBinding)
where TView : class, IViewFor<TViewModel>;
}
}
9 changes: 9 additions & 0 deletions src/Vetuviem.Core/IControlBindingModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// See the LICENSE file in the project root for full license information.

using System;
using System.Reactive.Disposables;
using ReactiveUI;

namespace Vetuviem.Core
Expand All @@ -23,5 +24,13 @@ public interface IControlBindingModel<in TView, in TViewModel>
/// <param name="viewModel">The viewmodel.</param>
/// <param name="disposeAction">The action to register disposals against.</param>
void ApplyBindings(TView view, TViewModel viewModel, Action<IDisposable> disposeAction);

/// <summary>
/// Applies the binding between the view and the view model.
/// </summary>
/// <param name="view">The view.</param>
/// <param name="viewModel">The viewmodel.</param>
/// <param name="compositeDisposable">The disposable container to register disposals against.</param>
void ApplyBindings(TView view, TViewModel viewModel, CompositeDisposable compositeDisposable);
}
}
14 changes: 13 additions & 1 deletion src/Vetuviem.Core/IEnableViewToViewModelBindings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// See the LICENSE file in the project root for full license information.

using System;
using System.Reactive.Disposables;
using ReactiveUI;

namespace Vetuviem.Core
Expand All @@ -19,12 +20,23 @@ public interface IEnableViewToViewModelBindings<in TView, in TViewModel>
/// <summary>
/// Apply control bindings between a View and ViewModel.
/// </summary>
/// <param name="disposeWithAction">The ReactiveUI Disposal Tracker.</param>
/// <param name="disposeWithAction">The ReactiveUI Disposal Tracker. Used to discard binding registrations when the view is finished with them.</param>
/// <param name="view">Instance of the view.</param>
/// <param name="viewModel">Instance of the viewmodel.</param>
void ApplyBindings(
Action<IDisposable> disposeWithAction,
TView view,
TViewModel viewModel);

/// <summary>
/// Apply control bindings between a View and ViewModel.
/// </summary>
/// <param name="compositeDisposable">The Composite Disposable Tracker. Used to discard binding registrations when the view is finished with them.</param>
/// <param name="view">Instance of the view.</param>
/// <param name="viewModel">Instance of the viewmodel.</param>
void ApplyBindings(
CompositeDisposable compositeDisposable,
TView view,
TViewModel viewModel);
}
}
16 changes: 16 additions & 0 deletions src/Vetuviem.Core/IOneOrTwoWayBind{TViewModel,TViewProp}.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

using System;
using System.Linq.Expressions;
using System.Reactive.Disposables;
using ReactiveUI;

namespace Vetuviem.Core
Expand All @@ -30,5 +31,20 @@ void ApplyBinding<TView>(
TViewModel viewModel,
Expression<Func<TView, TViewProp>> viewBinding)
where TView : class, IViewFor<TViewModel>;

/// <summary>
/// Applies a View to View Model Binding.
/// </summary>
/// <typeparam name="TView">The type for the view.</typeparam>
/// <param name="compositeDisposable">The disposable action registration. Used to clean up when bindings fall out of scope.</param>
/// <param name="view">The instance of the View to bind.</param>
/// <param name="viewModel">The instance of the ViewModel to Bind.</param>
/// <param name="viewBinding">Expression of the View Property to Bind to.</param>
void ApplyBinding<TView>(
CompositeDisposable compositeDisposable,
TView view,
TViewModel viewModel,
Expression<Func<TView, TViewProp>> viewBinding)
where TView : class, IViewFor<TViewModel>;
}
}
16 changes: 16 additions & 0 deletions src/Vetuviem.Core/IOneWayBind{TViewModel,TViewProp}.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

using System;
using System.Linq.Expressions;
using System.Reactive.Disposables;
using ReactiveUI;

namespace Vetuviem.Core
Expand Down Expand Up @@ -35,5 +36,20 @@ void ApplyBinding<TView>(
TViewModel viewModel,
Expression<Func<TView, TViewProp>> viewBinding)
where TView : class, IViewFor<TViewModel>;

/// <summary>
/// Applies a View to View Model Binding.
/// </summary>
/// <typeparam name="TView">The type for the view.</typeparam>
/// <param name="compositeDisposable">The disposable action registration. Used to clean up when bindings fall out of scope.</param>
/// <param name="view">The instance of the View to bind.</param>
/// <param name="viewModel">The instance of the ViewModel to Bind.</param>
/// <param name="viewBinding">Expression of the View Property to Bind to.</param>
void ApplyBinding<TView>(
CompositeDisposable compositeDisposable,
TView view,
TViewModel viewModel,
Expression<Func<TView, TViewProp>> viewBinding)
where TView : class, IViewFor<TViewModel>;
}
}
20 changes: 20 additions & 0 deletions src/Vetuviem.Core/OneWayBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

using System;
using System.Linq.Expressions;
using System.Reactive.Disposables;
using ReactiveUI;

namespace Vetuviem.Core
Expand Down Expand Up @@ -49,5 +50,24 @@ public void ApplyBinding<TView>(
ViewModelBinding,
viewBinding));
}

/// <inheritdoc/>
public void ApplyBinding<TView>(
CompositeDisposable compositeDisposable,
TView view,
TViewModel viewModel,
Expression<Func<TView, TViewProp>> viewBinding)
where TView : class, IViewFor<TViewModel>
{
if (compositeDisposable == null)
{
throw new ArgumentNullException(nameof(compositeDisposable));
}

view.OneWayBind(
viewModel,
ViewModelBinding,
viewBinding).DisposeWith(compositeDisposable);
}
}
}
21 changes: 21 additions & 0 deletions src/Vetuviem.Core/OneWayBindingOnOneOrTwoWayBind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

using System;
using System.Linq.Expressions;
using System.Reactive.Disposables;
using ReactiveUI;

namespace Vetuviem.Core
Expand Down Expand Up @@ -51,5 +52,25 @@ public void ApplyBinding<TView>(
viewBinding,
_vmToViewConverter));
}

/// <inheritdoc/>
public void ApplyBinding<TView>(
CompositeDisposable compositeDisposable,
TView view,
TViewModel viewModel,
Expression<Func<TView, TViewProp>> viewBinding)
where TView : class, IViewFor<TViewModel>
{
if (compositeDisposable == null)
{
throw new ArgumentNullException(nameof(compositeDisposable));
}

view.OneWayBind(
viewModel,
_viewModelBinding,
viewBinding,
_vmToViewConverter).DisposeWith(compositeDisposable);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

using System;
using System.Linq.Expressions;
using System.Reactive.Disposables;
using ReactiveUI;

namespace Vetuviem.Core
Expand Down Expand Up @@ -53,5 +54,25 @@ public void ApplyBinding<TView>(
viewBinding,
_converterBinding));
}

/// <inheritdoc/>
public void ApplyBinding<TView>(
CompositeDisposable compositeDisposable,
TView view,
TViewModel viewModel,
Expression<Func<TView, TOut>> viewBinding)
where TView : class, IViewFor<TViewModel>
{
if (compositeDisposable == null)
{
throw new ArgumentNullException(nameof(compositeDisposable));
}

view.OneWayBind(
viewModel,
_viewModelBinding,
viewBinding,
_converterBinding).DisposeWith(compositeDisposable);
}
}
}
Loading

0 comments on commit 798f881

Please sign in to comment.