private void btnGetGUID_Click(object sender, EventArgs e)
        {
            var successfulConnection = HttpServerClient.TestConnection(txtHttpsAddress.Text);

            if (successfulConnection)
            {
                var pulledNewGUID = HttpServerClient.GetGuid();

                if (pulledNewGUID)
                {
                    newAppSettings       = new ApplicationSettings();
                    newAppSettings       = newAppSettings.GetOrCreateApplicationSettings();
                    txtHttpsAddress.Text = newAppSettings.ServerSettings.HTTPGuid.ToString();
                    MessageBox.Show("Connected Successfully! GUID will be reloaded automatically the next time settings is loaded!");
                }
                MessageBox.Show("Connected Successfully!");
            }
            else
            {
                MessageBox.Show("Unable To Connect!");
            }
        }
        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 btnGetBotGUID_Click(object sender, EventArgs e)
 {
     var newGUID = HttpServerClient.GetGuid();
 }