Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed some CS1572, 1573, 1574 and 1591 warnings #2063

Merged
merged 16 commits into from
Apr 21, 2020
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public static class INavigationServiceExtensions
/// <summary>
/// Navigates to the most recent entry in the back navigation history by popping the calling Page off the navigation stack.
/// </summary>
/// <param name="navigationService">Service for handling navigation between views</param>
/// <param name="parameters">The navigation parameters</param>
/// <param name="useModalNavigation">If <c>true</c> uses PopModalAsync, if <c>false</c> uses PopAsync</param>
/// <param name="animated">If <c>true</c> the transition is animated, if <c>false</c> there is no animation on transition.</param>
Expand All @@ -37,6 +38,7 @@ public static Task<INavigationResult> GoBackToRootAsync(this INavigationService
/// <summary>
/// Initiates navigation to the target specified by the <paramref name="name"/>.
/// </summary>
/// <param name="navigationService">Service for handling navigation between views</param>
/// <param name="name">The name of the target to navigate to.</param>
/// <param name="parameters">The navigation parameters</param>
/// <param name="useModalNavigation">If <c>true</c> uses PushModalAsync, if <c>false</c> uses PushAsync</param>
Expand All @@ -50,6 +52,7 @@ public static Task<INavigationResult> NavigateAsync(this INavigationService navi
/// <summary>
/// Initiates navigation to the target specified by the <paramref name="uri"/>.
/// </summary>
/// <param name="navigationService">Service for handling navigation between views</param>
/// <param name="uri">The Uri to navigate to</param>
/// <param name="parameters">The navigation parameters</param>
/// <param name="useModalNavigation">If <c>true</c> uses PopModalAsync, if <c>false</c> uses PopAsync</param>
Expand Down Expand Up @@ -87,6 +90,7 @@ public static string GetNavigationUriPath(this INavigationService navigationServ
/// <summary>
/// Navigates to the most recent entry in the back navigation history by popping the calling Page off the navigation stack.
/// </summary>
/// <param name="navigationService">Service for handling navigation between views</param>
/// <param name="parameters">The navigation parameters</param>
/// <returns><see cref="INavigationResult"/> indicating whether the request was successful or if there was an encountered <see cref="Exception"/>.</returns>
public static Task<INavigationResult> GoBackAsync(this INavigationService navigationService, params (string Key, object Value)[] parameters)
Expand All @@ -97,6 +101,7 @@ public static Task<INavigationResult> GoBackAsync(this INavigationService naviga
/// <summary>
/// Initiates navigation to the target specified by the <paramref name="name"/>.
/// </summary>
/// <param name="navigationService">Service for handling navigation between views</param>
/// <param name="name">The Uri to navigate to</param>
/// <param name="parameters">The navigation parameters</param>
/// <returns><see cref="INavigationResult"/> indicating whether the request was successful or if there was an encountered <see cref="Exception"/>.</returns>
Expand All @@ -112,6 +117,7 @@ public static Task<INavigationResult> NavigateAsync(this INavigationService navi
/// <summary>
/// Initiates navigation to the target specified by the <paramref name="uri"/>.
/// </summary>
/// <param name="navigationService">Service for handling navigation between views</param>
/// <param name="uri">The Uri to navigate to</param>
/// <param name="parameters">The navigation parameters</param>
/// <returns><see cref="INavigationResult"/> indicating whether the request was successful or if there was an encountered <see cref="Exception"/>.</returns>
Expand Down
1 change: 0 additions & 1 deletion src/Forms/Prism.Forms/Navigation/PageNavigationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ Task<INavigationResult> IPlatformNavigationService.GoBackToRootAsync(INavigation
/// <summary>
/// When navigating inside a NavigationPage: Pops all but the root Page off the navigation stack
/// </summary>
/// <param name="navigationService">The INavigatinService instance</param>
/// <param name="parameters">The navigation parameters</param>
/// <remarks>Only works when called from a View within a NavigationPage</remarks>
protected async virtual Task<INavigationResult> GoBackToRootInternal(INavigationParameters parameters)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public static class INavigationServiceExtensions
/// <summary>
/// Selects a Tab of the TabbedPage parent.
/// </summary>
/// <param name="navigationService">Service for handling navigation between views</param>
/// <param name="name">The name of the tab to select</param>
/// <param name="parameters">The navigation parameters</param>
public static async Task<INavigationResult> SelectTabAsync(this INavigationService navigationService, string name, INavigationParameters parameters = null)
Expand Down
3 changes: 3 additions & 0 deletions src/Forms/Prism.Unity.Forms/PrismApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
[assembly: Xamarin.Forms.XmlnsDefinition("http://prismlibrary.com", "Prism.Unity")]
namespace Prism.Unity
{
/// <summary>
/// Base class for PrismApplication
/// </summary>
public abstract class PrismApplication : PrismApplicationBase
{
/// <summary>
Expand Down
64 changes: 63 additions & 1 deletion src/Prism.Core/Common/ParametersBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,24 @@

namespace Prism.Common
{
/// <summary>
/// This is a generic parameters base class used for Dialog Parameters and Navigation Parameters
/// </summary>
public abstract class ParametersBase : IEnumerable<KeyValuePair<string, object>>
{
private readonly List<KeyValuePair<string, object>> _entries = new List<KeyValuePair<string, object>>();

/// <summary>
/// Default constructor
/// </summary>
protected ParametersBase()
{
}

/// <summary>
/// Constructs a list of parameters
/// </summary>
/// <param name="query">Query string to be parsed</param>
protected ParametersBase(string query)
{
if (!string.IsNullOrWhiteSpace(query))
Expand Down Expand Up @@ -58,6 +68,12 @@ protected ParametersBase(string query)
}
}

/// <summary>
/// Searches Parameter collection and returns value if Collection contains key.
/// Otherswise returns null.
/// </summary>
/// <param name="key">The key for the value to be returned</param>
/// <returns>The value of the parameter referenced by the key; otherwise <c>null</c></returns>
public object this[string key]
{
get
Expand All @@ -74,32 +90,74 @@ public object this[string key]
}
}

/// <summary>
/// The count, or number, of parameters in collection
/// </summary>
public int Count => _entries.Count;

/// <summary>
/// Returns an IEnumerable of the Keys in the collection
/// </summary>
public IEnumerable<string> Keys =>
_entries.Select(x => x.Key);

/// <summary>
/// Adds the key and value to the KeyValuePair<string,object> collection
/// </summary>
/// <param name="key">The key to reference this value in the KeyValuePair<string, object></param>
/// <param name="value">The value of the parameter to store</param>
public void Add(string key, object value) =>
_entries.Add(new KeyValuePair<string, object>(key, value));

/// <summary>
/// Checks collection for presense of key
/// </summary>
/// <param name="key">The key to check in the collection</param>
/// <returns><c>true</c> if key exists; else returns <c>false</c>.</returns>
public bool ContainsKey(string key) =>
_entries.ContainsKey(key);

/// <summary>
/// Gets an enumerator for the KeyValuePairs in parameter collection
/// </summary>
/// <returns>Enumerator</returns>
public IEnumerator<KeyValuePair<string, object>> GetEnumerator() =>
_entries.GetEnumerator();


/// <summary>
/// Returns the value of the member referenced by key
/// </summary>
/// <typeparam name="T">The type of object to be returned</typeparam>
/// <param name="key">The key for the value to be returned</param>
/// <returns>Returns a matching parameter of <see cref="T" /> if one exists in the Collection</returns>
public T GetValue<T>(string key) =>
_entries.GetValue<T>(key);

/// <summary>
/// Returns an IEnumerable of all parameters
/// </summary>
/// <typeparam name="T">The type for the values to be returned</typeparam>
/// <param name="key">The key for the values to be returned</param>
///<returns>Returns a IEnumberable of all the instances of type <see cref="T"/></returns>
public IEnumerable<T> GetValues<T>(string key) =>
_entries.GetValues<T>(key);

/// <summary>
/// Checks to see if the parameter collection contains the value
/// </summary>
/// <typeparam name="T">The type for the values to be returned</typeparam>
/// <param name="key">The key for the value to be returned</param>
/// <param name="value">Value of the returned parameter if it exists</param>
public bool TryGetValue<T>(string key, out T value) =>
_entries.TryGetValue(key, out value);

IEnumerator IEnumerable.GetEnumerator() =>
GetEnumerator();

/// <summary>
/// Converts parameter collection to a parameter string
/// </summary>
/// <returns>A string representation of the parameters</returns>
public override string ToString()
{
var queryBuilder = new StringBuilder();
Expand Down Expand Up @@ -129,6 +187,10 @@ public override string ToString()
return queryBuilder.ToString();
}

/// <summary>
/// Adds a collection of parameters to the local parameter list
/// </summary>
/// <param name="parameters">An IEnumberable of KeyValuePairs to add to the current parameter list</param>
[EditorBrowsable(EditorBrowsableState.Never)]
public void FromParameters(IEnumerable<KeyValuePair<string, object>> parameters) =>
_entries.AddRange(parameters);
Expand Down
31 changes: 30 additions & 1 deletion src/Prism.Core/Modularity/IModuleInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,42 @@

namespace Prism.Modularity
{
/// <summary>
/// Set of properties for each Module
/// </summary>
public interface IModuleInfo : IModuleCatalogItem
{
/// <summary>
/// The module names this instance depends on.
/// </summary>
Collection<string> DependsOn { get; set; }

/// <summary>
/// Gets or Sets the <see cref="InitializationMode" />
/// </summary>
InitializationMode InitializationMode { get; set; }

/// <summary>
/// The name of the module
/// </summary>
string ModuleName { get; set; }

/// <summary>
/// The module's type
/// </summary>
string ModuleType { get; set; }

/// <summary>
/// A string ref is a location reference to load the module as it may not be already loaded in the Appdomain in some cases may need to be downloaded.
/// </summary>
/// <Remarks>
/// This is only used for WPF
/// </Remarks>
string Ref { get; set; }

/// <summary>
/// Gets or Sets the current <see cref="ModuleState" />
/// </summary>
ModuleState State { get; set; }
}
}
}
13 changes: 13 additions & 0 deletions src/Prism.Core/Modularity/IModuleInfoGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,23 @@
namespace Prism.Modularity
{
// IList must be supported in Silverlight 2 to be able to add items from XAML
/// <summary>
/// A collection of <see cref="ModuleInfo"/> for the Modules used by the application
/// </summary>
public interface IModuleInfoGroup : IModuleCatalogItem, IList<IModuleInfo>, IList
{
/// <summary>
/// When Prism should Initialize the module
/// <see cref="InitializationMode"/>
/// </summary>
InitializationMode InitializationMode { get; set; }

/// <summary>
/// A string ref is a location reference to load the module as it may not be already loaded in the Appdomain in some cases may need to be downloaded.
/// </summary>
/// <Remarks>
/// This is only used for WPF
/// </Remarks>
string Ref { get; set; }
}
}
1 change: 1 addition & 0 deletions src/Wpf/Prism.DryIoc.Wpf/Legacy/DryIocExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public static class DryIocExtensions
/// Registers an object for navigation.
/// </summary>
/// <typeparam name="T">The Type of the object to register</typeparam>
/// <param name="container">The container instance</param>
/// <param name="name">The unique name to register with the object</param>
public static void RegisterTypeForNavigation<T>(this IContainer container, string name = null)
{
Expand Down