private async void runTransition_Click(object sender, RoutedEventArgs e) { dynamic transition = e.OriginalSource; ObservableCollection <string> p = transition.DataContext as ObservableCollection <string>; //now we can search our transitions int i = choicesObservable.IndexOf(p); //List.IndexOf(currentState.options, p); try { game.choose(i); } catch { ContentDialog chooseErrorMsg = new ContentDialog { Title = "Transition Error", Content = "Error in trigger-expression of current transitions", CloseButtonText = "Ok" }; await chooseErrorMsg.ShowAsync(); return; } currentState = game.data.states[game.position]; refresh(); }
private void Option_Click(object sender, RoutedEventArgs e) { dynamic o = e.OriginalSource;//.Content.Text; string opt = o.Content.Text; int i = choices.FindIndex(a => a == opt); game.choose(i); refresh(); }