c# - UWP, Content Dialog for Login -
how use content dialog simple login screen. when try use this:
contentdialog d = new contentdialog(); d.content = contentgrid; d.primarybuttontext = "aaa"; d.primarybuttonclick += async delegate { }; await dlg.showasync();
on button click can run logic, hide entiredialog. want show processing animation, , show "check" results. possible?
yeah, possible. key point here using contentdialogbuttonclickeventargs.getdeferral method contentdialogbuttonclickdeferral before performe async operations , complete deferral when async operation complete. example:
contentdialog contentdialog = new contentdialog(); contentdialog.content = "login test"; contentdialog.primarybuttontext = "login"; contentdialog.primarybuttonclick += async (s, args) => { contentdialogbuttonclickdeferral deferral = args.getdeferral(); //do async sign in operation await task.delay(3000); //here wait 3 seconds deferral.complete(); }; await contentdialog.showasync();
and there example shows how create , use custom dialog (signincontentdialog) derived contentdialog
under examples section in contentdialog class. can have check.