public override Action GetCopy() { var sendRequest = new SendRequest(Id, CodeOrActionName) { Direction = this.Direction, Enabled = this.Enabled, IsAddContent = this.IsAddContent, LocalIp = this.LocalIp, LocalPort = this.LocalPort, LocalTerminal = this.LocalTerminal, Optional = this.Optional, RemoteIp = this.RemoteIp, RemotePort = this.RemotePort, RemoteTerminal = this.RemoteTerminal, Transport = this.Transport, CodeOrActionName = this.CodeOrActionName, Id = this.Id }; return sendRequest; }
public static Action CreateFromActionName(IEnumerable<string> lines) { Action action = null; foreach (var line in lines) { if (line.StartsWith(Strings.ActionName)) { if (line.EndsWith(Strings.Label)) { action = new Label(); } else if (line.EndsWith(Strings.Pause)) { action = new Pause(); } else if (line.EndsWith(Strings.ReceiveRequest)) { action = new ReceiveRequest(); } else if (line.EndsWith(Strings.ReceiveResponse)) { action = new ReceiveResponse(); } else if (line.EndsWith(Strings.SendResponse)) { action = new SendResponse(); } else if (line.EndsWith(Strings.SendRequest)) { action = new SendRequest(); } else if (line.EndsWith(Strings.SendRequestRegister)) { action = new SendRequestRegister(); } break; } } if (action != null) { action.LoadFromStringList(lines); } return action; }
private void AddSendRequest(string name) { var sendRequest = new SendRequest((ushort) _actions.Count, name) { LocalIp = textBoxLocalIP.Text.Trim(), LocalPort = (int)numericUpDownLocalPort.Value, LocalTerminal = textBoxLocalTerminal.Text.Trim(), RemoteIp = textBoxRemoteIp.Text.Trim(), RemotePort = (int)numericUpDownRemotePort.Value, RemoteTerminal = textBoxRemoteTerminal.Text.Trim(), Transport = comboBoxTransport.Text }; var dialogResult = sendRequest.Edit(); if (dialogResult == DialogResult.OK) { _actions.Add(sendRequest); dataGridViewActions.Invalidate(); dataGridViewActions.Refresh(); } }