c# - how to show a message box with ok and cancel button -


i building app windows phone 7 need show message box both ok , cancel button. when ok button pressed want navigate new page while when cancel button pressed want stay in same page:

the code wrote is:

 public donate()     {         initializecomponent();           messageboxresult result =             messagebox.show("this take out of app , forward our contribution website!",             "", messageboxbutton.okcancel);          if (result == messageboxresult.ok)         {             donation.source = new uri("http://mobiledonation.vzons.com/arvindkejriwal", urikind.absolute);              donation.loaded += (object sender, routedeventargs e) =>             {                 donation.navigate(new uri("http://mobiledonation.vzons.com/arvindkejriwal", urikind.absolute));             };         }          else             navigationservice.navigate(new uri("/aap.xaml", urikind.relative));       } 

now here problem when cancel button pressed null reference exception in statement

navigationservice.navigate(new uri("/aap.xaml", urikind.relative));

ok button working fine when cancel button pressed want stay in same page i.e aap.xaml. how can achieve this?


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -