Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/ReactiveMarbles.Navigation.sln
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReactiveMarbles.ViewModel.M
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ViewModel.MAUI.Example", "ViewModel.MAUI.Example\ViewModel.MAUI.Example.csproj", "{DE39BF42-E055-4797-9807-6AAA44089FE5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ViewModelNav", "ViewModelNav", "{8EE96502-4F77-460E-89F5-5CD222CE0896}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ViewNav", "ViewNav", "{C11FB3F2-E114-448F-84AD-491EF1E0E7E8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactiveMarbles.View.Core", "ReactiveMarbles.View.Core\ReactiveMarbles.View.Core.csproj", "{F715B429-EF30-4716-ADDB-24BC99892336}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactiveMarbles.View.Wpf", "ReactiveMarbles.View.Wpf\ReactiveMarbles.View.Wpf.csproj", "{E4F89A0E-71D0-48D9-9865-1BCB98ADB1FD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -85,14 +93,32 @@ Global
{DE39BF42-E055-4797-9807-6AAA44089FE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DE39BF42-E055-4797-9807-6AAA44089FE5}.Release|Any CPU.Build.0 = Release|Any CPU
{DE39BF42-E055-4797-9807-6AAA44089FE5}.Release|Any CPU.Deploy.0 = Release|Any CPU
{F715B429-EF30-4716-ADDB-24BC99892336}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F715B429-EF30-4716-ADDB-24BC99892336}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F715B429-EF30-4716-ADDB-24BC99892336}.Design|Any CPU.ActiveCfg = Design|Any CPU
{F715B429-EF30-4716-ADDB-24BC99892336}.Design|Any CPU.Build.0 = Design|Any CPU
{F715B429-EF30-4716-ADDB-24BC99892336}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F715B429-EF30-4716-ADDB-24BC99892336}.Release|Any CPU.Build.0 = Release|Any CPU
{E4F89A0E-71D0-48D9-9865-1BCB98ADB1FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E4F89A0E-71D0-48D9-9865-1BCB98ADB1FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E4F89A0E-71D0-48D9-9865-1BCB98ADB1FD}.Design|Any CPU.ActiveCfg = Design|Any CPU
{E4F89A0E-71D0-48D9-9865-1BCB98ADB1FD}.Design|Any CPU.Build.0 = Design|Any CPU
{E4F89A0E-71D0-48D9-9865-1BCB98ADB1FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E4F89A0E-71D0-48D9-9865-1BCB98ADB1FD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{6B5A20B7-CAA7-4CBF-B48F-6EFFE9414610} = {8EE96502-4F77-460E-89F5-5CD222CE0896}
{990C0E6D-0C09-482D-8AFA-F135EC206C43} = {8EE96502-4F77-460E-89F5-5CD222CE0896}
{CD830D09-4558-403B-9504-C0CFD90FDC3B} = {8EE96502-4F77-460E-89F5-5CD222CE0896}
{5E67BC1D-9AD7-4DDA-B095-6EFE99AD2C2E} = {6E654C37-7F3A-4E17-83C1-CA8BC9B54476}
{67688407-5509-4158-B9C3-5C2076E4946C} = {6E654C37-7F3A-4E17-83C1-CA8BC9B54476}
{267783AB-7239-42A1-9596-22F53B8884D1} = {8EE96502-4F77-460E-89F5-5CD222CE0896}
{DE39BF42-E055-4797-9807-6AAA44089FE5} = {6E654C37-7F3A-4E17-83C1-CA8BC9B54476}
{F715B429-EF30-4716-ADDB-24BC99892336} = {C11FB3F2-E114-448F-84AD-491EF1E0E7E8}
{E4F89A0E-71D0-48D9-9865-1BCB98ADB1FD} = {C11FB3F2-E114-448F-84AD-491EF1E0E7E8}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {489B52FF-BC1B-435B-8412-301C8A46D473}
Expand Down
48 changes: 48 additions & 0 deletions src/ReactiveMarbles.View.Core/INotifiyRoutableView.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright (c) 2019-2023 ReactiveUI Association Incorporated. All rights reserved.
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Reactive.Disposables;
using ReactiveMarbles.ViewModel.Core;

namespace ReactiveMarbles.View.Core;

/// <summary>
/// INotifiy Routable ViewModel.
/// </summary>
/// <seealso cref="IUseHostedNavigation" />
public interface INotifiyRoutableView : Mvvm.IRxObject, IUseHostedNavigation
{
/// <summary>
/// Gets the name.
/// </summary>
/// <value>
/// The name.
/// </value>
string? Name { get; }

/// <summary>
/// Raises the <see cref="E:NavigatedFrom"/> event.
/// </summary>
/// <param name="e">
/// The <see cref="IViewNavigationEventArgs"/> instance containing the event data.
/// </param>
void WhenNavigatedFrom(IViewNavigationEventArgs e);

/// <summary>
/// Raises the <see cref="E:NavigatedTo"/> event.
/// </summary>
/// <param name="e">
/// The <see cref="IViewNavigationEventArgs"/> instance containing the event data.
/// </param>
/// <param name="disposables">The disposables.</param>
void WhenNavigatedTo(IViewNavigationEventArgs e, CompositeDisposable disposables);

/// <summary>
/// Raises the <see cref="E:Navigating"/> event.
/// </summary>
/// <param name="e">
/// The <see cref="IViewNavigatingEventArgs"/> instance containing the event data.
/// </param>
void WhenNavigating(IViewNavigatingEventArgs e);
}
16 changes: 16 additions & 0 deletions src/ReactiveMarbles.View.Core/IRxNavBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) 2019-2023 ReactiveUI Association Incorporated. All rights reserved.
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Reactive.Disposables;
using ReactiveMarbles.ViewModel.Core;

namespace ReactiveMarbles.View.Core;

/// <summary>
/// interface for RxBase.
/// </summary>
/// <seealso cref="System.IDisposable"/>
public interface IRxNavBase : INotifiyRoutableView, ICancelable, IAmBuilt
{
}
123 changes: 123 additions & 0 deletions src/ReactiveMarbles.View.Core/IViewRoutedViewModelHost.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
// Copyright (c) 2019-2023 ReactiveUI Association Incorporated. All rights reserved.
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Collections.ObjectModel;
using ReactiveMarbles.ViewModel.Core;

namespace ReactiveMarbles.View.Core;

/// <summary>
/// IViewModel Routed ViewHost.
/// </summary>
public interface IViewRoutedViewModelHost
{
/// <summary>
/// Gets the navigation stack.
/// </summary>
/// <value>
/// The navigation stack.
/// </value>
ObservableCollection<IAmViewFor?> NavigationStack { get; }

/// <summary>
/// Gets the current view model.
/// </summary>
/// <value>
/// The current view model.
/// </value>
IObservable<INotifiyRoutableView> CurrentView { get; }

/// <summary>
/// Gets or sets a value indicating whether [navigate back is enabled].
/// </summary>
/// <value>
/// <c>true</c> if [navigate back is enabled]; otherwise, <c>false</c>.
/// </value>
bool CanNavigateBack { get; set; }

/// <summary>
/// Gets the can navigate back observable.
/// </summary>
/// <value>
/// The can navigate back observable.
/// </value>
IObservable<bool> CanNavigateBackObservable { get; }

/// <summary>
/// Gets or sets a value indicating whether [navigate back is enabled].
/// </summary>
/// <value>
/// <c>true</c> if [navigate back is enabled]; otherwise, <c>false</c>.
/// </value>
bool NavigateBackIsEnabled { get; set; }

/// <summary>
/// Gets or sets the name of the host.
/// </summary>
/// <value>
/// The name of the host.
/// </value>
string Name { get; set; }

/// <summary>
/// Gets a value indicating whether [requires setup].
/// </summary>
/// <value>
/// <c>true</c> if [requires setup]; otherwise, <c>false</c>.
/// </value>
bool RequiresSetup { get; }

/// <summary>
/// Clears the history.
/// </summary>
void ClearHistory();

/// <summary>
/// Setups this instance.
/// </summary>
void Setup();

/// <summary>
/// Navigates the specified contract.
/// </summary>
/// <typeparam name="T">The Type.</typeparam>
/// <param name="contract">The contract.</param>
/// <param name="parameter">The parameter.</param>
void Navigate<T>(string? contract = null, object? parameter = null)
where T : class, IAmViewFor;

/// <summary>
/// Navigates the specified contract.
/// </summary>
/// <param name="viewModel">The view model.</param>
/// <param name="parameter">The parameter.</param>
void Navigate(IAmViewFor viewModel, object? parameter = null);

/// <summary>
/// Navigates the and reset.
/// </summary>
/// <typeparam name="T">The Type.</typeparam>
/// <param name="contract">The contract.</param>
/// <param name="parameter">The parameter.</param>
void NavigateAndReset<T>(string? contract = null, object? parameter = null)
where T : class, IAmViewFor;

/// <summary>
/// Navigates the and reset.
/// </summary>
/// <param name="viewModel">The view model.</param>
/// <param name="parameter">The parameter.</param>
void NavigateAndReset(IAmViewFor viewModel, object? parameter = null);

/// <summary>
/// Navigates the back.
/// </summary>
/// <param name="parameter">The parameter.</param>
void NavigateBack(object? parameter = null);

/// <summary>
/// Refreshes this instance.
/// </summary>
void Refresh();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) 2019-2023 ReactiveUI Association Incorporated. All rights reserved.
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

namespace ReactiveMarbles.View.Core;

/// <summary>
/// IView Model Navigating EventArgs.
/// </summary>
public interface IViewNavigatingEventArgs : IViewNavigationEventArgs
{
/// <summary>
/// Gets or sets a value indicating whether this <see cref="IViewNavigatingEventArgs"/> is cancel.
/// </summary>
/// <value>
/// <c>true</c> if cancel; otherwise, <c>false</c>.
/// </value>
bool Cancel { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright (c) 2019-2023 ReactiveUI Association Incorporated. All rights reserved.
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using ReactiveMarbles.ViewModel.Core;

namespace ReactiveMarbles.View.Core;

/// <summary>
/// IView Model Navigation Base Event Args.
/// </summary>
public interface IViewNavigationBaseEventArgs
{
/// <summary>
/// Gets from.
/// </summary>
/// <value>
/// From.
/// </value>
IRxNavBase? From { get; }

/// <summary>
/// Gets the navigation parameter.
/// </summary>
/// <value>
/// The navigation parameter.
/// </value>
object? NavigationParameter { get; }

/// <summary>
/// Gets to.
/// </summary>
/// <value>
/// To.
/// </value>
IRxNavBase? To { get; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright (c) 2019-2023 ReactiveUI Association Incorporated. All rights reserved.
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using ReactiveMarbles.ViewModel.Core;

namespace ReactiveMarbles.View.Core;

/// <summary>
/// I View Model Navigation EventArgs.
/// </summary>
public interface IViewNavigationEventArgs : IViewNavigationBaseEventArgs
{
/// <summary>
/// Gets or sets the name of the host.
/// </summary>
/// <value>
/// The name of the host.
/// </value>
string HostName { get; set; }

/// <summary>
/// Gets the type of the navigation.
/// </summary>
/// <value>
/// The type of the navigation.
/// </value>
NavigationType NavigationType { get; }

/// <summary>
/// Gets or sets the view.
/// </summary>
/// <value>
/// The view.
/// </value>
IAmViewFor? View { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright (c) 2019-2023 ReactiveUI Association Incorporated. All rights reserved.
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Runtime.Serialization;
using ReactiveMarbles.ViewModel.Core;

namespace ReactiveMarbles.View.Core;

/// <summary>
/// View Model Navigating Event Args.
/// </summary>
/// <remarks>
/// Initializes a new instance of the <see cref="ViewNavigatingEventArgs" /> class.
/// </remarks>
/// <param name="from">From.</param>
/// <param name="to">To.</param>
/// <param name="navType">Type of the nav.</param>
/// <param name="view">The view.</param>
/// <param name="hostName">The hostName.</param>
/// <param name="parmeter">The parmeter.</param>
[DataContract]
public class ViewNavigatingEventArgs(IRxNavBase? from, IRxNavBase? to, NavigationType navType, IAmViewFor? view, string hostName, object? parmeter = null)
: ViewNavigationEventArgs(from, to, navType, view, hostName, parmeter), IViewNavigatingEventArgs
{
/// <summary>
/// Gets or sets a value indicating whether this <see cref="ViewNavigatingEventArgs"/>
/// is canceled.
/// </summary>
/// <value><c>true</c> if cancel; otherwise, <c>false</c>.</value>
[DataMember]
public bool Cancel { get; set; }
}
Loading