callback action can be fired when user closes infobox

This commit is contained in:
Michael 2017-03-09 09:53:00 -05:00
parent 8db3a2e11c
commit 02fd7a883b
3 changed files with 10 additions and 6 deletions

View file

@ -76,12 +76,16 @@ namespace ShiftOS.WinForms.Applications
btnok.Click += (o, a) =>
{
AppearanceManager.Close(this);
OpenCallback?.Invoke();
};
}
public void Open(string title, string msg)
private Action OpenCallback = null;
public void Open(string title, string msg, Action c = null)
{
OpenCallback = c;
new Dialog().OpenInternal(title, msg);
}

View file

@ -55,11 +55,11 @@ namespace ShiftOS.Engine
/// </summary>
/// <param name="title">Infobox title</param>
/// <param name="message">Infobox message</param>
public static void Show(string title, string message)
public static void Show(string title, string message, Action callback = null)
{
title = Localization.Parse(title);
message = Localization.Parse(message);
_infobox.Open(title, message);
_infobox.Open(title, message, callback);
}
public static void PromptText(string title, string message, Action<string> callback)
@ -89,7 +89,7 @@ namespace ShiftOS.Engine
// Infobox Interface
public interface IInfobox
{
void Open(string title, string msg);
void Open(string title, string msg, Action callback = null);
void PromptText(string title, string message, Action<string> callback);
void PromptYesNo(string title, string message, Action<bool> callback);
}

View file

@ -357,9 +357,9 @@ end");
[Exposed("infobox")]
public class InfoboxFunctions
{
public void show(string title, string message)
public void show(string title, string message, Action callback = null)
{
Infobox.Show(title, message);
Infobox.Show(title, message, callback);
}
public void question(string title, string message, Action<bool> callback)