private void buttonUpdate_Click(object sender, EventArgs e) { Actions.Action action = panelActionParameters.GetActionFromParameters(); int index = listViewSteps.SelectedIndices[0]; actions[index] = action; listViewSteps.Items[index] = new ActionItem(index, action); listViewSteps.Items[index].Focused = true; listViewSteps.Items[index].Selected = true; }
public ActionItem(int index, Actions.Action action ) { this.action = action; Text = index.ToString(); SubItems.Add( action.ToString() ); StringBuilder parametersBuilder= new StringBuilder(); foreach ( ParameterContainer parameter in action.GetParameters() ) { parametersBuilder.Append( parameter.Name ).Append( ": " ).Append( parameter.Value ).Append( " " ); } SubItems.Add( parametersBuilder.ToString() ); }
public ActionItem(int index, Actions.Action action) { this.action = action; Text = index.ToString(); SubItems.Add(action.ToString()); StringBuilder parametersBuilder = new StringBuilder(); foreach (ParameterContainer parameter in action.GetParameters()) { parametersBuilder.Append(parameter.Name).Append(": ").Append(parameter.Value).Append(" "); } SubItems.Add(parametersBuilder.ToString()); }
private List <Control> buildControlsForAction(InputPlayback.Actions.Action action) { List <Control> controls = new List <Control>(); foreach (Tuple <string, object> parameter in action.GetParameters()) { Label label = new Label(); label.Text = parameter.Item1; label.Anchor = AnchorStyles.Left; label.TextAlign = ContentAlignment.MiddleLeft; label.AutoSize = true; controls.Add(label); Control control = getControlForType(parameter.Item2.GetType()); controls.Add(control); } return(controls); }
public Actions.Action GetActionFromParameters() { Dictionary <string, object> parameters = new Dictionary <string, object>(); foreach (Tuple <string, Control> entry in controlsForParameters) { object value; if (entry.Item2 is CheckBox) { value = ((CheckBox)entry.Item2).Checked; } else { value = entry.Item2.Text; } parameters.Add(entry.Item1, value); } Actions.Action action = (Actions.Action)Activator.CreateInstance(actionType); action.SetParameters(parameters); return(action); }
private void buttonAdd_Click(object sender, EventArgs e) { Actions.Action action = panelActionParameters.GetActionFromParameters(); actions.Add(action); listViewSteps.Items.Add(new ActionItem(listViewSteps.Items.Count, action)); }