private void btnStartListening_Click(object sender, EventArgs e) { if (int.TryParse(txtListeningPort.Text, out var portNumber)) { DisableListenerButtons(); LocalTCPClient.InitializeScriptEngine(new frmScriptEngine()); LocalTCPClient.StartListening(portNumber); } }
private void SetupListeningUI() { if (LocalTCPClient.IsListening) { lblListeningStatus.Text = $"Client is Listening at Endpoint '{LocalTCPClient.GetListeningAddress()}'."; btnStopListening.Enabled = true; btnStartListening.Enabled = false; } else { lblListeningStatus.Text = $"Client is Not Listening!"; btnStopListening.Enabled = false; btnStartListening.Enabled = true; } lblListeningStatus.Show(); }
public override void RunCommand(object sender) { var engine = (AutomationEngineInstance)sender; try { var server = v_BaseURL.ConvertUserVariableToString(engine); var paramType = v_ParameterType.ConvertUserVariableToString(engine); var timeout = v_RequestTimeout.ConvertUserVariableToString(engine); var response = LocalTCPClient.SendAutomationTask(server, paramType, timeout); response.StoreInUserVariable(engine, v_OutputUserVariableName); } catch (Exception ex) { throw ex; } }
private void frmScriptBuilder_Load(object sender, EventArgs e) { //load all commands _automationCommands = CommandControls.GenerateCommandsandControls(); //set controls double buffered foreach (Control control in Controls) { typeof(Control).InvokeMember("DoubleBuffered", BindingFlags.SetProperty | BindingFlags.Instance | BindingFlags.NonPublic, null, control, new object[] { true }); } //get app settings _appSettings = new ApplicationSettings(); _appSettings = _appSettings.GetOrCreateApplicationSettings(); if (_appSettings.ServerSettings.ServerConnectionEnabled && _appSettings.ServerSettings.HTTPGuid == Guid.Empty) { HttpServerClient.GetGuid(); } else if (_appSettings.ServerSettings.ServerConnectionEnabled && _appSettings.ServerSettings.HTTPGuid != Guid.Empty) { HttpServerClient.InitializeScriptEngine(new frmScriptEngine()); HttpServerClient.CheckIn(); } HttpServerClient.InitializeScriptEngine(new frmScriptEngine()); HttpServerClient.AssociatedBuilder = this; string clientLoggerFilePath = Path.Combine(Folders.GetFolder(FolderType.LogFolder), "taskt Automation Client Logs.txt"); Logger automationClientLogger = new Logging().CreateFileLogger(clientLoggerFilePath, Serilog.RollingInterval.Day); LocalTCPClient.InitializeAutomationEngine(new AutomationEngineInstance(automationClientLogger)); LocalTCPClient.Initialize(this, new AutomationEngineInstance(automationClientLogger)); //Core.Sockets.SocketClient.Initialize(); //Core.Sockets.SocketClient.associatedBuilder = this; //handle action bar preference //hide action panel if (_editMode) { tlpControls.RowStyles[1].SizeType = SizeType.Absolute; tlpControls.RowStyles[1].Height = 0; tlpControls.RowStyles[2].SizeType = SizeType.Absolute; tlpControls.RowStyles[2].Height = 81; } else if (_appSettings.ClientSettings.UseSlimActionBar) { tlpControls.RowStyles[2].SizeType = SizeType.Absolute; tlpControls.RowStyles[2].Height = 0; } else { tlpControls.RowStyles[1].SizeType = SizeType.Absolute; tlpControls.RowStyles[1].Height = 0; } //get scripts folder var rpaScriptsFolder = Folders.GetFolder(FolderType.ScriptsFolder); if (!Directory.Exists(rpaScriptsFolder)) { frmDialog userDialog = new frmDialog("Would you like to create a folder to save your scripts in now? " + "A script folder is required to save scripts generated with this application. " + "The new script folder path would be '" + rpaScriptsFolder + "'.", "Unable to locate Script Folder!", DialogType.YesNo, 0); if (userDialog.ShowDialog() == DialogResult.OK) { Directory.CreateDirectory(rpaScriptsFolder); } } //get latest files for recent files list on load GenerateRecentFiles(); //no height for status bar HideNotificationRow(); //instantiate for script variables if (!_editMode) { _scriptVariables = new List <ScriptVariable>(); _scriptElements = new List <ScriptElement>(); } //pnlHeader.BackColor = Color.FromArgb(255, 214, 88); //instantiate and populate display icons for commands _uiImages = UIImage.UIImageList(); //set image list _selectedTabScriptActions.SmallImageList = _uiImages; //set listview column size frmScriptBuilder_SizeChanged(null, null); var groupedCommands = _automationCommands.GroupBy(f => f.DisplayGroup); foreach (var cmd in groupedCommands) { TreeNode newGroup = new TreeNode(cmd.Key); foreach (var subcmd in cmd) { TreeNode subNode = new TreeNode(subcmd.ShortName); if (!subcmd.Command.CustomRendering) { subNode.ForeColor = Color.Red; } newGroup.Nodes.Add(subNode); } tvCommands.Nodes.Add(newGroup); } tvCommands.Sort(); //tvCommands.ImageList = uiImages; _tvCommandsCopy = new TreeView(); CopyTreeView(tvCommands, _tvCommandsCopy); txtCommandSearch.Text = _txtCommandWatermark; //start attended mode if selected if (_appSettings.ClientSettings.StartupMode == "Attended Task Mode") { WindowState = FormWindowState.Minimized; var frmAttended = new frmAttendedMode(); frmAttended.Show(); } }
private void btnStopListening_Click(object sender, EventArgs e) { DisableListenerButtons(); LocalTCPClient.StopAutomationListener(); }