-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
Added IDialogService.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using Loxodon.Framework.Interactivity; | ||
using System; | ||
|
||
namespace Loxodon.Framework.Binding.Proxy.Targets | ||
{ | ||
public class InteractionTargetProxy : TargetProxyBase, IObtainable | ||
{ | ||
protected readonly EventHandler<InteractionEventArgs> handler; | ||
|
||
public InteractionTargetProxy(object target, IInteractionAction interactionAction) : base(target) | ||
{ | ||
this.handler = interactionAction.OnRequest; | ||
} | ||
|
||
public override Type Type { get { return typeof(EventHandler<InteractionEventArgs>); } } | ||
|
||
public override BindingMode DefaultMode { get { return BindingMode.OneWayToSource; } } | ||
|
||
public object GetValue() | ||
{ | ||
return handler; | ||
} | ||
|
||
public TValue GetValue<TValue>() | ||
{ | ||
return (TValue)GetValue(); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
using Loxodon.Framework.Asynchronous; | ||
using Loxodon.Framework.ViewModels; | ||
|
||
namespace Loxodon.Framework.Interactivity | ||
{ | ||
public interface IDialogService | ||
{ | ||
/// <summary> | ||
/// Displays information to the user. | ||
/// </summary> | ||
/// <param name="title">The title of the dialog box. This may be null.</param> | ||
/// <param name="message">The message to be shown to the user.</param> | ||
/// <returns>The result</returns> | ||
IAsyncResult<int> ShowDialog(string title, string message); | ||
|
||
/// <summary> | ||
/// Displays information to the user. | ||
/// </summary> | ||
/// <param name="title">The title of the dialog box. This may be null.</param> | ||
/// <param name="message">The message to be shown to the user.</param> | ||
/// <param name="buttonText">The text shown in the only button | ||
/// in the dialog box. If left null, the button will be invisible.</param> | ||
/// <returns>The result</returns> | ||
IAsyncResult<int> ShowDialog(string title, string message, string buttonText); | ||
|
||
/// <summary> | ||
/// Displays information to the user. | ||
/// </summary> | ||
/// <param name="title">The title of the dialog box. This may be null.</param> | ||
/// <param name="message">The message to be shown to the user.</param> | ||
/// <param name="confirmButtonText">The text shown in the "confirm" button | ||
/// in the dialog box. If left null, the button will be invisible.</param> | ||
/// <param name="cancelButtonText">The text shown in the "cancel" button | ||
/// in the dialog box. If left null, the button will be invisible.</param> | ||
/// <returns>The result</returns> | ||
IAsyncResult<int> ShowDialog(string title, string message, string confirmButtonText, string cancelButtonText); | ||
|
||
/// <summary> | ||
/// Displays information to the user. | ||
/// </summary> | ||
/// <param name="title">The title of the dialog box. This may be null.</param> | ||
/// <param name="message">The message to be shown to the user.</param> | ||
/// <param name="confirmButtonText">The text shown in the "confirm" button | ||
/// in the dialog box. If left null, the button will be invisible.</param> | ||
/// <param name="cancelButtonText">The text shown in the "cancel" button | ||
/// in the dialog box. If left null, the button will be invisible.</param> | ||
/// <param name="neutralButtonText">The text shown in the "neutral" button | ||
/// in the dialog box. If left null, the button will be invisible.</param> | ||
/// <returns>The result</returns> | ||
IAsyncResult<int> ShowDialog(string title, string message, string confirmButtonText, string cancelButtonText, string neutralButtonText); | ||
|
||
/// <summary> | ||
/// Displays information to the user. | ||
/// </summary> | ||
/// <param name="title">The title of the dialog box. This may be null.</param> | ||
/// <param name="message">The message to be shown to the user.</param> | ||
/// <param name="confirmButtonText">The text shown in the "confirm" button | ||
/// in the dialog box. If left null, the button will be invisible.</param> | ||
/// <param name="cancelButtonText">The text shown in the "cancel" button | ||
/// in the dialog box. If left null, the button will be invisible.</param> | ||
/// <param name="neutralButtonText">The text shown in the "neutral" button | ||
/// in the dialog box. If left null, the button will be invisible.</param> | ||
/// <param name="canceledOnTouchOutside">Whether the dialog box is canceled when | ||
/// touched outside the window's bounds. </param> | ||
/// <returns>The result</returns> | ||
IAsyncResult<int> ShowDialog(string title, string message, string confirmButtonText, string cancelButtonText, string neutralButtonText, bool canceledOnTouchOutside); | ||
|
||
/// <summary> | ||
/// Displays information to the user. | ||
/// </summary> | ||
/// <param name="viewName">The name of the dialog view, loading the dialog view based on the view name</param> | ||
/// <param name="viewModel">The view model of the dialog</param> | ||
/// <returns>The result</returns> | ||
IAsyncResult ShowDialog(string viewName, object viewModel); | ||
|
||
/// <summary> | ||
/// Displays information to the user. | ||
/// </summary> | ||
/// <param name="viewName">The name of the dialog view, loading the dialog view based on the view name</param> | ||
/// <param name="viewModel">The view model of the dialog</param> | ||
/// <returns>The result</returns> | ||
IAsyncResult<TViewModel> ShowDialog<TViewModel>(string viewName, TViewModel viewModel); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Loxodon.Framework.Interactivity | ||
{ | ||
public interface IInteractionAction | ||
{ | ||
void OnRequest(object sender, InteractionEventArgs args); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
|
||
namespace Loxodon.Framework.Interactivity | ||
{ | ||
public abstract class InteractionActionBase<TNotification> : IInteractionAction | ||
{ | ||
public void OnRequest(object sender, InteractionEventArgs args) | ||
{ | ||
Action callback = args.Callback; | ||
TNotification notification = (TNotification)args.Context; | ||
this.Action(notification, callback); | ||
} | ||
|
||
public abstract void Action(TNotification notification, Action callback); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
namespace Loxodon.Framework.Interactivity | ||
{ | ||
public class ToastNotification | ||
{ | ||
private readonly float duration; | ||
private readonly string message; | ||
|
||
public ToastNotification(string message) : this(message, 3f) | ||
{ | ||
} | ||
|
||
public ToastNotification(string message, float duration) | ||
{ | ||
this.duration = duration; | ||
this.message = message; | ||
} | ||
|
||
public float Duration | ||
{ | ||
get { return this.duration; } | ||
} | ||
|
||
public string Message | ||
{ | ||
get { return this.message; } | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.