private async void AddButton(object sender, RoutedEventArgs e) { var choice = new Choice(); var msgbox = new MessageDialog("What do you want to add ? "); msgbox.Commands.Clear(); msgbox.Commands.Add(new UICommand { Label = "Borrow", Id = 0 }); msgbox.Commands.Add(new UICommand { Label = "Lend", Id = 1 }); msgbox.Commands.Add(new UICommand { Label = "Cancel", Id = 2 }); var res = await msgbox.ShowAsync(); if ((int)res.Id == 0) { msgbox.Commands.Clear(); var msgbox2 = new MessageDialog("What did you borrowed ?", ""); msgbox2.Commands.Add(new UICommand { Label = "Object", Id = 0 }); msgbox2.Commands.Add(new UICommand { Label = "Money", Id = 1 }); msgbox2.Commands.Add(new UICommand { Label = "Cancel", Id = 2 }); var res2 = await msgbox2.ShowAsync(); if ((int)res2.Id == 0) { choice.Object = true; choice.Borrowed = true; Frame.Navigate(typeof(AddDebt), choice); } if ((int)res2.Id == 1) { choice.Object = false; choice.Borrowed = true; Frame.Navigate(typeof(AddDebt), choice); } if ((int)res.Id == 2) { var msgbox4 = new MessageDialog("Nevermind then... :|", ""); await msgbox2.ShowAsync(); } } if ((int)res.Id == 1) { msgbox.Commands.Clear(); var msgbox3 = new MessageDialog("What did you Lend ?", ""); msgbox3.Commands.Add(new UICommand { Label = "Object", Id = 0 }); msgbox3.Commands.Add(new UICommand { Label = "Money", Id = 1 }); msgbox3.Commands.Add(new UICommand { Label = "Cancel", Id = 2 }); var res2 = await msgbox3.ShowAsync(); if ((int)res2.Id == 0) { choice.Object = true; choice.Borrowed = false; Frame.Navigate(typeof(AddDebt), choice); } if ((int)res2.Id == 1) { choice.Object = false; choice.Borrowed = false; Frame.Navigate(typeof(AddDebt), choice); } if ((int)res.Id == 2) { var msgbox2 = new MessageDialog("Nevermind then... :|", ""); await msgbox2.ShowAsync(); } } }
public AddDebt(Choice choice) { InitializeComponent(); _isObject = choice.Object; _isBorrowed = choice.Borrowed; }