-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-added the UI dispatcher component for Android and Windows (iOS to …
…come) and re-added the app dialog service.
- Loading branch information
1 parent
54e59ae
commit 9482d16
Showing
22 changed files
with
1,194 additions
and
12 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
// <copyright file="DialogButton.cs" company="MADE Apps"> | ||
// Copyright (c) MADE Apps. | ||
// </copyright> | ||
// <summary> | ||
// Defines a button to be used within a application system alert dialog. | ||
// </summary> | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
|
||
namespace MADE.App.Views.Dialogs.Buttons | ||
{ | ||
/// <summary> | ||
/// Defines a button to be used within a application system alert dialog. | ||
/// </summary> | ||
public class DialogButton | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="DialogButton"/> class. | ||
/// </summary> | ||
/// <param name="type"> | ||
/// The type of button. | ||
/// </param> | ||
public DialogButton(DialogButtonType type) | ||
{ | ||
this.Type = type; | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="DialogButton"/> class with content text. | ||
/// </summary> | ||
/// <param name="type"> | ||
/// The type of button. | ||
/// </param> | ||
/// <param name="content"> | ||
/// The content text to display on the button. | ||
/// </param> | ||
public DialogButton(DialogButtonType type, string content) | ||
{ | ||
this.Type = type; | ||
this.Content = content; | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="DialogButton"/> class with content text and an invoke action. | ||
/// </summary> | ||
/// <param name="type"> | ||
/// The type of button. | ||
/// </param> | ||
/// <param name="content"> | ||
/// The content text to display on the button. | ||
/// </param> | ||
/// <param name="invokeAction"> | ||
/// The action to perform when the button is invoked. | ||
/// </param> | ||
public DialogButton(DialogButtonType type, string content, DialogButtonInvokedHandler invokeAction) | ||
{ | ||
this.Type = type; | ||
this.Content = content; | ||
this.InvokeAction = invokeAction; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the type of button. | ||
/// </summary> | ||
public DialogButtonType Type { get; } | ||
|
||
/// <summary> | ||
/// Gets or sets the content text to display on the button. | ||
/// </summary> | ||
public string Content { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the action to perform when the button is invoked. | ||
/// </summary> | ||
public DialogButtonInvokedHandler InvokeAction { get; set; } | ||
|
||
/// <summary> | ||
/// Invokes the specified <see cref="InvokeAction"/>. | ||
/// </summary> | ||
public void Invoke() | ||
{ | ||
this.InvokeAction?.Invoke(this); | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
MADE.App.Views.Dialogs/Buttons/DialogButtonInvokedHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
// <copyright file="DialogButtonInvokedHandler.cs" company="MADE Apps"> | ||
// Copyright (c) MADE Apps. | ||
// </copyright> | ||
// <summary> | ||
// The event handler for handling when a dialog button has been invoked. | ||
// </summary> | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
|
||
namespace MADE.App.Views.Dialogs.Buttons | ||
{ | ||
/// <summary> | ||
/// The event handler for handling when a dialog button has been invoked. | ||
/// </summary> | ||
/// <param name="button"> | ||
/// The button. | ||
/// </param> | ||
public delegate void DialogButtonInvokedHandler(DialogButton button); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
// <copyright file="DialogButtonType.cs" company="MADE Apps"> | ||
// Copyright (c) MADE Apps. | ||
// </copyright> | ||
// <summary> | ||
// Defines values associated with the type of a dialog button. | ||
// </summary> | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
|
||
namespace MADE.App.Views.Dialogs.Buttons | ||
{ | ||
/// <summary> | ||
/// Defines values associated with the type of a dialog button. | ||
/// </summary> | ||
public enum DialogButtonType | ||
{ | ||
/// <summary> | ||
/// The button is neutral and can be used to perform any action. | ||
/// </summary> | ||
Neutral, | ||
|
||
/// <summary> | ||
/// The button is positive and can be used to perform positive actions, such as saving. | ||
/// </summary> | ||
Positive, | ||
|
||
/// <summary> | ||
/// The button is negative and can be used to perform negative actions, such as cancelling. | ||
/// </summary> | ||
Negative | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
// <copyright file="IAppDialog.cs" company="MADE Apps"> | ||
// Copyright (c) MADE Apps. | ||
// </copyright> | ||
// <summary> | ||
// Defines an interface for handling application system alert dialogs. | ||
// </summary> | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
|
||
namespace MADE.App.Views.Dialogs | ||
{ | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
using MADE.App.Views.Dialogs.Buttons; | ||
|
||
/// <summary> | ||
/// Defines an interface for handling application system alert dialogs. | ||
/// </summary> | ||
public interface IAppDialog | ||
{ | ||
/// <summary> | ||
/// Shows an application system alert dialog with the specified message. | ||
/// </summary> | ||
/// <param name="message"> | ||
/// The message to display. | ||
/// </param> | ||
void Show(string message); | ||
|
||
/// <summary> | ||
/// Shows an application system alert dialog with the specified message and dialog buttons. | ||
/// </summary> | ||
/// <param name="message"> | ||
/// The message to display. | ||
/// </param> | ||
/// <param name="buttons"> | ||
/// The button definitions for performing actions. | ||
/// </param> | ||
void Show(string message, params DialogButton[] buttons); | ||
|
||
/// <summary> | ||
/// Shows an application system alert dialog with the specified message, cancellation action and dialog buttons. | ||
/// </summary> | ||
/// <param name="message"> | ||
/// The message to display. | ||
/// </param> | ||
/// <param name="cancelAction"> | ||
/// The action to perform when the dialog has been cancelled/dismissed. | ||
/// </param> | ||
/// <param name="buttons"> | ||
/// The button definitions for performing actions. | ||
/// </param> | ||
void Show(string message, Action cancelAction, params DialogButton[] buttons); | ||
|
||
/// <summary> | ||
/// Shows an application system alert dialog with the specified title and message. | ||
/// </summary> | ||
/// <param name="title"> | ||
/// The title to display. | ||
/// </param> | ||
/// <param name="message"> | ||
/// The message to display. | ||
/// </param> | ||
void Show(string title, string message); | ||
|
||
/// <summary> | ||
/// Shows an application system alert dialog with the specified title, message and dialog buttons. | ||
/// </summary> | ||
/// <param name="title"> | ||
/// The title to display. | ||
/// </param> | ||
/// <param name="message"> | ||
/// The message to display. | ||
/// </param> | ||
/// <param name="buttons"> | ||
/// The button definitions for performing actions. | ||
/// </param> | ||
void Show(string title, string message, params DialogButton[] buttons); | ||
|
||
/// <summary> | ||
/// Shows an application system alert dialog with the specified title, message, cancellation action and dialog buttons. | ||
/// </summary> | ||
/// <param name="title"> | ||
/// The title to display. | ||
/// </param> | ||
/// <param name="message"> | ||
/// The message to display. | ||
/// </param> | ||
/// <param name="cancelAction"> | ||
/// The action to perform when the dialog has been cancelled/dismissed. | ||
/// </param> | ||
/// <param name="buttons"> | ||
/// The button definitions for performing actions. | ||
/// </param> | ||
void Show(string title, string message, Action cancelAction, params DialogButton[] buttons); | ||
|
||
/// <summary> | ||
/// Shows an application system alert dialog with the specified message. | ||
/// </summary> | ||
/// <param name="message"> | ||
/// The message to display. | ||
/// </param> | ||
/// <returns> | ||
/// An asynchronous operation. | ||
/// </returns> | ||
Task ShowAsync(string message); | ||
|
||
/// <summary> | ||
/// Shows an application system alert dialog with the specified message and dialog buttons. | ||
/// </summary> | ||
/// <param name="message"> | ||
/// The message to display. | ||
/// </param> | ||
/// <param name="buttons"> | ||
/// The button definitions for performing actions. | ||
/// </param> | ||
/// <returns> | ||
/// An asynchronous operation. | ||
/// </returns> | ||
Task ShowAsync(string message, params DialogButton[] buttons); | ||
|
||
/// <summary> | ||
/// Shows an application system alert dialog with the specified message, cancellation action and dialog buttons. | ||
/// </summary> | ||
/// <param name="message"> | ||
/// The message to display. | ||
/// </param> | ||
/// <param name="cancelAction"> | ||
/// The action to perform when the dialog has been cancelled/dismissed. | ||
/// </param> | ||
/// <param name="buttons"> | ||
/// The button definitions for performing actions. | ||
/// </param> | ||
/// <returns> | ||
/// An asynchronous operation. | ||
/// </returns> | ||
Task ShowAsync(string message, Action cancelAction, params DialogButton[] buttons); | ||
|
||
/// <summary> | ||
/// Shows an application system alert dialog with the specified title and message. | ||
/// </summary> | ||
/// <param name="title"> | ||
/// The title to display. | ||
/// </param> | ||
/// <param name="message"> | ||
/// The message to display. | ||
/// </param> | ||
/// <returns> | ||
/// An asynchronous operation. | ||
/// </returns> | ||
Task ShowAsync(string title, string message); | ||
|
||
/// <summary> | ||
/// Shows an application system alert dialog with the specified title, message and dialog buttons. | ||
/// </summary> | ||
/// <param name="title"> | ||
/// The title to display. | ||
/// </param> | ||
/// <param name="message"> | ||
/// The message to display. | ||
/// </param> | ||
/// <param name="buttons"> | ||
/// The button definitions for performing actions. | ||
/// </param> | ||
/// <returns> | ||
/// An asynchronous operation. | ||
/// </returns> | ||
Task ShowAsync(string title, string message, params DialogButton[] buttons); | ||
|
||
/// <summary> | ||
/// Shows an application system alert dialog with the specified title, message, cancellation action and dialog buttons. | ||
/// </summary> | ||
/// <param name="title"> | ||
/// The title to display. | ||
/// </param> | ||
/// <param name="message"> | ||
/// The message to display. | ||
/// </param> | ||
/// <param name="cancelAction"> | ||
/// The action to perform when the dialog has been cancelled/dismissed. | ||
/// </param> | ||
/// <param name="buttons"> | ||
/// The button definitions for performing actions. | ||
/// </param> | ||
/// <returns> | ||
/// An asynchronous operation. | ||
/// </returns> | ||
Task ShowAsync(string title, string message, Action cancelAction, params DialogButton[] buttons); | ||
} | ||
} |
Oops, something went wrong.