| | | 1 | | // ----------------------------------------------------------------------- |
| | | 2 | | // <copyright file="NavigationContext.cs" company="Stéphane ANDRE"> |
| | | 3 | | // Copyright (c) Stéphane ANDRE. All rights reserved. |
| | | 4 | | // </copyright> |
| | | 5 | | // ----------------------------------------------------------------------- |
| | | 6 | | |
| | | 7 | | using System; |
| | | 8 | | |
| | | 9 | | namespace MyNet.UI.Navigation.Models; |
| | | 10 | | |
| | | 11 | | /// <summary> |
| | | 12 | | /// Represents the context of a navigation operation, including the source and destination pages, navigation mode, param |
| | | 13 | | /// </summary> |
| | | 14 | | /// <param name="From">The source page of the navigation.</param> |
| | | 15 | | /// <param name="To">The destination page of the navigation.</param> |
| | | 16 | | /// <param name="Mode">The mode of the navigation.</param> |
| | | 17 | | /// <param name="Parameters">The parameters associated with the navigation.</param> |
| | | 18 | | /// <param name="Timestamp">The timestamp when the navigation occurred.</param> |
| | | 19 | | public sealed record NavigationContext( |
| | | 20 | | INavigationPage? From, |
| | | 21 | | INavigationPage To, |
| | | 22 | | NavigationMode Mode, |
| | | 23 | | INavigationParameters? Parameters, |
| | | 24 | | DateTimeOffset Timestamp) |
| | | 25 | | { |
| | | 26 | | /// <summary> |
| | | 27 | | /// Creates a new instance of the NavigationContext record with the specified parameters and the current timestamp. |
| | | 28 | | /// </summary> |
| | | 29 | | /// <param name="from">The source page of the navigation.</param> |
| | | 30 | | /// <param name="to">The destination page of the navigation.</param> |
| | | 31 | | /// <param name="mode">The mode of the navigation.</param> |
| | | 32 | | /// <param name="parameters">The parameters associated with the navigation.</param> |
| | | 33 | | /// <returns>A new instance of the NavigationContext record with the specified parameters and the current timestamp. |
| | | 34 | | public static NavigationContext Create( |
| | | 35 | | INavigationPage? from, |
| | | 36 | | INavigationPage to, |
| | | 37 | | NavigationMode mode, |
| | | 38 | | INavigationParameters? parameters) |
| | 72 | 39 | | => new(from, to, mode, parameters, DateTimeOffset.UtcNow); |
| | | 40 | | } |
| | | 41 | | |