Wired up DisplayAlert results so we can now specify an accept/cancel action and retrieve the result
This commit is contained in:
parent
404201d876
commit
2b8ce39a5c
|
@ -59,6 +59,7 @@ namespace Ooui.Forms
|
||||||
{
|
{
|
||||||
ClassName = "btn btn-default"
|
ClassName = "btn btn-default"
|
||||||
};
|
};
|
||||||
|
_cancelButton.Clicked += (s, e) => SetResult(false);
|
||||||
|
|
||||||
footer.AppendChild(_cancelButton);
|
footer.AppendChild(_cancelButton);
|
||||||
|
|
||||||
|
@ -68,14 +69,21 @@ namespace Ooui.Forms
|
||||||
{
|
{
|
||||||
ClassName = "btn btn-default"
|
ClassName = "btn btn-default"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_acceptButton.Clicked += (s, e) => SetResult(true);
|
||||||
footer.AppendChild(_acceptButton);
|
footer.AppendChild(_acceptButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
content.AppendChild(footer);
|
content.AppendChild(footer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Element.AppendChild(content);
|
Element.AppendChild(content);
|
||||||
|
|
||||||
|
void SetResult(bool result)
|
||||||
|
{
|
||||||
|
arguments.SetResult(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public event TargetEventHandler Clicked
|
public event TargetEventHandler Clicked
|
||||||
|
|
|
@ -15,7 +15,8 @@ namespace Samples
|
||||||
|
|
||||||
public async void OnButtonClicked(object sender, EventArgs args)
|
public async void OnButtonClicked(object sender, EventArgs args)
|
||||||
{
|
{
|
||||||
await DisplayAlert("Alert Message", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa.", "OK");
|
var result = await DisplayAlert("Alert Message", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa.", "YES", "NO");
|
||||||
|
await DisplayAlert("Alert Response", $"You selected value: {result}", "OK");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue