public class DialogService : IDialogService
{
private SfPopupLayout popupLayout;
public void CreatePopup()
{
popupLayout = new SfPopupLayout
{
PopupView =
{
ShowHeader = true,
ShowFooter = true,
ShowCloseButton = false,
AppearanceMode = AppearanceMode.TwoButton
}
};
}
public void ShowConfirm(string title, string question, Action okCallback, Action noCallback)
{
var vm = new ConfirmDialogViewModel(okCallback, noCallback) {Question = question};
popupLayout.PopupView.HeaderTitle = title;
var templateView = new DataTemplate(() => new ConfirmDialogView
{
BindingContext = vm
});
popupLayout.PopupView.ContentTemplate = templateView;
popupLayout.Show();
}
public void HideConfirm()
{
popupLayout.IsOpen = false;
}
}
_ dialogService.CreatePopup();
_dialogService.ShowConfirm("title_1", "question_1", () => {}, ()=>{});
_dialogService.HideConfirm();
_dialogService.ShowConfirm("title_2", "question_2", () => { }, () => { });
|
public void Init()
{
popupLayout = new SfPopupLayout
{
PopupView =
{
ShowHeader = true,
ShowFooter = true,
ShowCloseButton = false,
AppearanceMode = AppearanceMode.TwoButton,
AnimationMode = AnimationMode.None,
}
};
} |
Close1PopupAndShow2 = new Command(async () =>
{
dialog.Show("Show Popup1", null, null, null);
await Task.Delay(100);
dialog.HideConfirm();
await Task.Delay(100);
dialog.Show("Show Popup2", null, null, null);
}); |