c# - windows store app message dialog box -



c# - windows store app message dialog box -

i want open stdinfopage page after clicking go admin button on message box how can that? here button coding

private void button_login_click(object sender, routedeventargs e) { if (myreader.hasrows && this.frame != null) { while (myreader.read()) { if (privilege == 1) { displaymsgbox("click open admin page ", "go admin"); this.frame.navigate(typeof(stdinfopage)); } else { displaymsgbox("privilege 0", "ok"); } } } else { displaymsgbox("sucess else", "ok"); } conn.close(); } }

here message box code

private async void displaymsgbox(string displaymsg, string displaybtn) { seek { // create message dialog , set content var messagedialog = new messagedialog(displaymsg); // add together commands , set callbacks; both buttons utilize same callback function instead of inline event handlers messagedialog.commands.add(new uicommand(displaybtn, new uicommandinvokedhandler(this.commandinvokedhandler))); messagedialog.commands.add(new uicommand("close", new uicommandinvokedhandler(this.commandinvokedhandler))); // set command invoked default messagedialog.defaultcommandindex = 0; // set command invoked when escape pressed messagedialog.cancelcommandindex = 1; // show message dialog await messagedialog.showasync(); } grab (exception) { } }

based on illustration here: http://msdn.microsoft.com/library/windows/apps/windows.ui.popups.messagedialog.aspx, need create method executed when go admin or close button clicked

private void commandinvokedhandler(iuicommand command) { // check button clicked if (command.label == "go admin") { // open stdinfopage this.frame.navigate(typeof(stdinfopage)); } }

and delete this.frame.navigate(typeof(stdinfopage)); within if (privilege == 1) block

if (privilege == 1) { displaymsgbox("click open admin page ", "go admin"); }

c# asynchronous popup windows-store-apps messagebox

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -