private void _onAction(object sender, ActionEventArgs e) { if (e.Action is AC.OpenUrlAction) { AC.OpenUrlAction action = (AC.OpenUrlAction)e.Action; Process.Start(action.Url); } else if (e.Action is AC.ShowCardAction) { ShowCardAction action = (AC.ShowCardAction)e.Action; if (HostConfig.Actions.ShowCard.ActionMode == AC.Rendering.Config.ShowCardActionMode.Popup) { ShowCardWindow dialog = new ShowCardWindow(action.Title, action, this.Resources); dialog.Owner = this; dialog.ShowDialog(); } } else if (e.Action is AC.SubmitAction) { AC.SubmitAction action = (AC.SubmitAction)e.Action; System.Windows.MessageBox.Show(this, JsonConvert.SerializeObject(e.Data, Newtonsoft.Json.Formatting.Indented), "SubmitAction"); } else if (e.Action is AC.HttpAction) { AC.HttpAction action = (AC.HttpAction)e.Action; StringBuilder sb = new StringBuilder(); sb.AppendLine($"HEADERS={JsonConvert.SerializeObject(action.Headers)}"); sb.AppendLine($"BODY={action.Body}"); sb.AppendLine($"DATA={e.Data}"); System.Windows.MessageBox.Show(this, sb.ToString(), $"HttpAction {action.Method} {action.Url}"); } }
private void OnAction(object sender, ActionEventArgs e) { if (e.Action is AC.OpenUrlAction) { AC.OpenUrlAction action = (AC.OpenUrlAction)e.Action; Process.Start(action.Url); } else if (e.Action is AC.ShowCardAction) { MessageBox.Show("Action.ShowCard is not alloed from within a sub-card"); } else if (e.Action is AC.SubmitAction) { AC.SubmitAction action = (AC.SubmitAction)e.Action; System.Windows.MessageBox.Show(this, JsonConvert.SerializeObject(e.Data, Newtonsoft.Json.Formatting.Indented), "SubmitAction"); this.Close(); } else if (e.Action is AC.HttpAction) { AC.HttpAction action = (AC.HttpAction)e.Action; StringBuilder sb = new StringBuilder(); sb.AppendLine($"HEADERS={JsonConvert.SerializeObject(action.Headers)}"); sb.AppendLine($"BODY={action.Body}"); sb.AppendLine($"DATA={e.Data}"); System.Windows.MessageBox.Show(this, sb.ToString(), $"HttpAction {action.Method} {action.Url}"); this.Close(); } }