public static TerminalRecorder GetRecorderWindow(Interfaces.VT.ITerminalConfig Config) { TerminalRecorder win = null; foreach (var session in RunPlugin.Sessions) { if (session is TerminalRecorder _win) { if (_win.Config.Hostname == Config.Hostname && _win.Config.Port == Config.Port && _win.Config.TermType == Config.TermType) { win = _win; } } } if (win == null) { win = new TerminalRecorder(); win.Config = Config; Sessions.Add(win); } return(win); }
private void Button_Click(object sender, RoutedEventArgs e) { Config = new termVB5250Config(); bool as400 = false; if (as400) { Config.Hostname = "PUB400.COM"; Config.Port = 23; Config.TermType = "IBM-3278-2"; } else { Config.Hostname = "localhost"; Config.Port = 3270; Config.TermType = "IBM-3179-2"; } var body = ModelItem.Properties["Body"].Value; var handler = body.Properties["Handler"].Value; global.OpenRPAClient.CurrentDesigner.SelectedActivity = handler; //body.Focus(20); //handler.Focus(20); string Hostname = ModelItem.GetValue <string>("Hostname"); string TermType = ModelItem.GetValue <string>("TermType"); int Port = ModelItem.GetValue <int>("Port"); bool UseSSL = ModelItem.GetValue <bool>("UseSSL"); if (!string.IsNullOrEmpty(Hostname)) { Config.Hostname = Hostname; } if (!string.IsNullOrEmpty(TermType)) { Config.TermType = TermType; } if (Port > 0) { Config.Port = Port; } Config.UseSSL = UseSSL; TerminalRecorder win = null; if (string.IsNullOrEmpty(Hostname) && string.IsNullOrEmpty(TermType)) { win = new TerminalRecorder(); win.Config = Config; RunPlugin.Sessions.Add(win); } else { win = RunPlugin.GetRecorderWindow(Config); } sessionid = Guid.NewGuid().ToString(); if (string.IsNullOrEmpty(win.WorkflowInstanceId)) { win.WorkflowInstanceId = sessionid; } win.Show(); //win.ShowDialog(); win.Focus(); win.Closed += Win_Closed; }