/// <summary> /// Loads Settings used for the Socket Client /// </summary> public static void LoadSettings() { socketLogger.Information("Socket Client Loading Settings"); //setup heartbeat to the server reconnectTimer = new System.Timers.Timer(); reconnectTimer.Interval = 60000; reconnectTimer.Elapsed += ReconnectTimer_Elapsed; //get app settings var appSettings = new Core.ApplicationSettings(); appSettings = appSettings.GetOrCreateApplicationSettings(); //pull server settings var serverSettings = appSettings.ServerSettings; serverURI = serverSettings.ServerURL; retryOnFail = serverSettings.RetryServerConnectionOnFail; publicKey = serverSettings.ServerPublicKey; bypassCertificationValidation = serverSettings.BypassCertificateValidation; //try to connect to server if ((serverSettings.ServerConnectionEnabled) && (serverSettings.ConnectToServerOnStartup)) { socketLogger.Information("Socket Client Connecting on Startup"); Connect(serverSettings.ServerURL); } }
/// <summary> /// Loads Settings used for the Socket Client /// </summary> public static void LoadSettings() { Logging.log.Info("Loading Socket Client Settings"); //setup heartbeat to the server heartbeatTimer = new System.Timers.Timer(); heartbeatTimer.Interval = 10000; heartbeatTimer.Elapsed += HeartbeatTimer_Elapsed; //get app settings var appSettings = new Core.ApplicationSettings(); appSettings = appSettings.GetOrCreateApplicationSettings(); //pull server settings var serverSettings = appSettings.ServerSettings; serverURI = serverSettings.ServerURL; retryOnFail = serverSettings.RetryServerConnectionOnFail; publicKey = serverSettings.ServerPublicKey; bypassCertificationValidation = serverSettings.BypassCertificateValidation; Logging.log.Info("Socket Client - URI: " + serverURI); Logging.log.Info("Socket Client - Retry On Fail: " + retryOnFail); Logging.log.Info("Socket Client - Public Key: " + publicKey); //try to connect to server if ((serverSettings.ServerConnectionEnabled) && (serverSettings.ConnectToServerOnStartup)) { Connect(serverSettings.ServerURL); } }
public static void Initialize(UI.Forms.frmScriptBuilder builder) { associatedBuilder = builder; automationLogger.Information("Automation Listener Initializing"); automationInstance = new Automation.Engine.AutomationEngineInstance(); var appSettings = new Core.ApplicationSettings(); appSettings = appSettings.GetOrCreateApplicationSettings(); listenerSettings = appSettings.ListenerSettings; if (listenerSettings.LocalListeningEnabled) { automationLogger.Information("Local Listening is Enabled"); } else { automationLogger.Information("Local Listening is Disabled"); } if ((listenerSettings.StartListenerOnStartup) && (listenerSettings.LocalListeningEnabled)) { automationLogger.Information("Automatically Starting Listening Service"); StartListening(listenerSettings.ListeningPort); } else if ((listenerSettings.StartListenerOnStartup) && (!listenerSettings.LocalListeningEnabled)) { automationLogger.Information("Listening Service is not Enabled! Unable to Automatically Start Listening!"); } automationLogger.Information("Automation Listener Finished Initializing"); }
private void frmSettings_Load(object sender, EventArgs e) { newAppSettings = new Core.ApplicationSettings(); newAppSettings = newAppSettings.GetOrCreateApplicationSettings(); var serverSettings = newAppSettings.ServerSettings; chkServerEnabled.DataBindings.Add("Checked", serverSettings, "ServerConnectionEnabled", false, DataSourceUpdateMode.OnPropertyChanged); chkAutomaticallyConnect.DataBindings.Add("Checked", serverSettings, "ConnectToServerOnStartup", false, DataSourceUpdateMode.OnPropertyChanged); chkRetryOnDisconnect.DataBindings.Add("Checked", serverSettings, "RetryServerConnectionOnFail", false, DataSourceUpdateMode.OnPropertyChanged); chkBypassValidation.DataBindings.Add("Checked", serverSettings, "BypassCertificateValidation", false, DataSourceUpdateMode.OnPropertyChanged); txtPublicKey.DataBindings.Add("Text", serverSettings, "ServerPublicKey", false, DataSourceUpdateMode.OnPropertyChanged); txtServerURL.DataBindings.Add("Text", serverSettings, "ServerURL", false, DataSourceUpdateMode.OnPropertyChanged); var engineSettings = newAppSettings.EngineSettings; chkShowDebug.DataBindings.Add("Checked", engineSettings, "ShowDebugWindow", false, DataSourceUpdateMode.OnPropertyChanged); chkAutoCloseWindow.DataBindings.Add("Checked", engineSettings, "AutoCloseDebugWindow", false, DataSourceUpdateMode.OnPropertyChanged); chkEnableLogging.DataBindings.Add("Checked", engineSettings, "EnableDiagnosticLogging", false, DataSourceUpdateMode.OnPropertyChanged); chkAdvancedDebug.DataBindings.Add("Checked", engineSettings, "ShowAdvancedDebugOutput", false, DataSourceUpdateMode.OnPropertyChanged); chkCreateMissingVariables.DataBindings.Add("Checked", engineSettings, "CreateMissingVariablesDuringExecution", false, DataSourceUpdateMode.OnPropertyChanged); chkTrackMetrics.DataBindings.Add("Checked", engineSettings, "TrackExecutionMetrics", false, DataSourceUpdateMode.OnPropertyChanged); txtVariableStartMarker.DataBindings.Add("Text", engineSettings, "VariableStartMarker", false, DataSourceUpdateMode.OnPropertyChanged); txtVariableEndMarker.DataBindings.Add("Text", engineSettings, "VariableEndMarker", false, DataSourceUpdateMode.OnPropertyChanged); var clientSettings = newAppSettings.ClientSettings; chkAntiIdle.DataBindings.Add("Checked", clientSettings, "AntiIdleWhileOpen", false, DataSourceUpdateMode.OnPropertyChanged); txtAppFolderPath.DataBindings.Add("Text", clientSettings, "RootFolder", false, DataSourceUpdateMode.OnPropertyChanged); chkInsertCommandsInline.DataBindings.Add("Checked", clientSettings, "InsertCommandsInline", false, DataSourceUpdateMode.OnPropertyChanged); //get metrics bgwMetrics.RunWorkerAsync(); }
public static string GetFolder(FolderType folderType) { switch (folderType) { case FolderType.RootFolder: //return folder from settings var settings = new Core.ApplicationSettings().GetOrCreateApplicationSettings(); var rootFolder = settings.ClientSettings.RootFolder; return(rootFolder); case FolderType.SettingsFolder: //return app data taskt folder return(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\taskt\\"); case FolderType.ScriptsFolder: //return scripts folder return(System.IO.Path.Combine(GetFolder(FolderType.RootFolder), "My Scripts\\")); case FolderType.LogFolder: //return logs folder return(System.IO.Path.Combine(GetFolder(FolderType.RootFolder), "Logs\\")); case FolderType.TempFolder: //return temp folder return(System.IO.Path.GetTempPath() + "\\taskt\\"); default: //enum is not implemented throw new NotImplementedException("FolderType " + folderType.ToString() + " Not Supported"); } }
/// <summary> /// Occurs when a message is received from taskt server. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void MessageReceived(object sender, WebSocket4Net.MessageReceivedEventArgs e) { socketLogger.Information("Socket Message Received: " + e.Message); //server responded with script if (e.Message.Contains("?xml")) { //execute scripts RunXMLScript(e.Message); } //server wants the client status else if (e.Message.Contains("CLIENT_STATUS")) { SendMessage("CLIENT_STATUS=Ping Request Received, " + Client.ClientStatus); } //server send a new public key else if (e.Message.Contains("ACCEPT_KEY")) { var authPublicKey = e.Message.Replace("ACCEPT_KEY=", ""); publicKey = authPublicKey; //add public key to app settings and save var appSettings = new Core.ApplicationSettings().GetOrCreateApplicationSettings(); appSettings.ServerSettings.ConnectToServerOnStartup = true; appSettings.ServerSettings.ServerConnectionEnabled = true; appSettings.ServerSettings.ServerPublicKey = authPublicKey; appSettings.Save(appSettings); } }
private void uiBtnSettings_Click(object sender, EventArgs e) { //show settings dialog frmSettings newSettings = new frmSettings(this); newSettings.ShowDialog(); //reload app settings appSettings = new Core.ApplicationSettings(); appSettings = appSettings.GetOrCreateApplicationSettings(); }
private void frmSettings_Load(object sender, EventArgs e) { newAppSettings = new Core.ApplicationSettings(); newAppSettings = newAppSettings.GetOrCreateApplicationSettings(); var serverSettings = newAppSettings.ServerSettings; chkServerEnabled.DataBindings.Add("Checked", serverSettings, "ServerConnectionEnabled"); chkAutomaticallyConnect.DataBindings.Add("Checked", serverSettings, "ConnectToServerOnStartup"); chkRetryOnDisconnect.DataBindings.Add("Checked", serverSettings, "RetryServerConnectionOnFail"); txtServerURL.DataBindings.Add("Text", serverSettings, "ServerURL"); }
private void frmAttendedMode_Load(object sender, EventArgs e) { //get app settings appSettings = new Core.ApplicationSettings().GetOrCreateApplicationSettings(); //setup file system watcher attendedScriptWatcher.Path = appSettings.ClientSettings.AttendedTasksFolder; //move form to default location MoveToDefaultFormLocation(); //load scripts to be used for attended automation LoadAttendedScripts(); }
public AutomationEngineInstance() { //initialize logger engineLogger = new Logging().CreateLogger("Engine", Serilog.RollingInterval.Day); engineLogger.Information("Engine Class has been initialized"); //initialize error tracking list ErrorsOccured = new List <ScriptError>(); //set to initialized CurrentStatus = EngineStatus.Loaded; //get engine settings engineSettings = new Core.ApplicationSettings().GetOrCreateApplicationSettings().EngineSettings; }
private void frmSettings_Load(object sender, EventArgs e) { newAppSettings = new Core.ApplicationSettings(); newAppSettings = newAppSettings.GetOrCreateApplicationSettings(); var serverSettings = newAppSettings.ServerSettings; chkServerEnabled.DataBindings.Add("Checked", serverSettings, "ServerConnectionEnabled", false, DataSourceUpdateMode.OnPropertyChanged); chkAutomaticallyConnect.DataBindings.Add("Checked", serverSettings, "ConnectToServerOnStartup", false, DataSourceUpdateMode.OnPropertyChanged); chkRetryOnDisconnect.DataBindings.Add("Checked", serverSettings, "RetryServerConnectionOnFail", false, DataSourceUpdateMode.OnPropertyChanged); chkBypassValidation.DataBindings.Add("Checked", serverSettings, "BypassCertificateValidation", false, DataSourceUpdateMode.OnPropertyChanged); txtPublicKey.DataBindings.Add("Text", serverSettings, "ServerPublicKey", false, DataSourceUpdateMode.OnPropertyChanged); txtServerURL.DataBindings.Add("Text", serverSettings, "ServerURL", false, DataSourceUpdateMode.OnPropertyChanged); txtHttpsAddress.DataBindings.Add("Text", serverSettings, "HTTPServerURL", false, DataSourceUpdateMode.OnPropertyChanged); txtGUID.DataBindings.Add("Text", serverSettings, "HTTPGuid", false, DataSourceUpdateMode.OnPropertyChanged); var engineSettings = newAppSettings.EngineSettings; chkShowDebug.DataBindings.Add("Checked", engineSettings, "ShowDebugWindow", false, DataSourceUpdateMode.OnPropertyChanged); chkAutoCloseWindow.DataBindings.Add("Checked", engineSettings, "AutoCloseDebugWindow", false, DataSourceUpdateMode.OnPropertyChanged); chkEnableLogging.DataBindings.Add("Checked", engineSettings, "EnableDiagnosticLogging", false, DataSourceUpdateMode.OnPropertyChanged); chkAdvancedDebug.DataBindings.Add("Checked", engineSettings, "ShowAdvancedDebugOutput", false, DataSourceUpdateMode.OnPropertyChanged); chkCreateMissingVariables.DataBindings.Add("Checked", engineSettings, "CreateMissingVariablesDuringExecution", false, DataSourceUpdateMode.OnPropertyChanged); chkTrackMetrics.DataBindings.Add("Checked", engineSettings, "TrackExecutionMetrics", false, DataSourceUpdateMode.OnPropertyChanged); txtVariableStartMarker.DataBindings.Add("Text", engineSettings, "VariableStartMarker", false, DataSourceUpdateMode.OnPropertyChanged); txtVariableEndMarker.DataBindings.Add("Text", engineSettings, "VariableEndMarker", false, DataSourceUpdateMode.OnPropertyChanged); txtCommandDelay.DataBindings.Add("Text", engineSettings, "DelayBetweenCommands", false, DataSourceUpdateMode.OnPropertyChanged); chkOverrideInstances.DataBindings.Add("Checked", engineSettings, "OverrideExistingAppInstances", false, DataSourceUpdateMode.OnPropertyChanged); var clientSettings = newAppSettings.ClientSettings; chkAntiIdle.DataBindings.Add("Checked", clientSettings, "AntiIdleWhileOpen", false, DataSourceUpdateMode.OnPropertyChanged); txtAppFolderPath.DataBindings.Add("Text", clientSettings, "RootFolder", false, DataSourceUpdateMode.OnPropertyChanged); txtAttendedTaskFolder.DataBindings.Add("Text", clientSettings, "AttendedTasksFolder", false, DataSourceUpdateMode.OnPropertyChanged); chkInsertCommandsInline.DataBindings.Add("Checked", clientSettings, "InsertCommandsInline", false, DataSourceUpdateMode.OnPropertyChanged); chkSequenceDragDrop.DataBindings.Add("Checked", clientSettings, "EnableSequenceDragDrop", false, DataSourceUpdateMode.OnPropertyChanged); chkMinimizeToTray.DataBindings.Add("Checked", clientSettings, "MinimizeToTray", false, DataSourceUpdateMode.OnPropertyChanged); cboStartUpMode.DataBindings.Add("Text", clientSettings, "StartupMode", false, DataSourceUpdateMode.OnPropertyChanged); chkPreloadCommands.DataBindings.Add("Checked", clientSettings, "PreloadBuilderCommands", false, DataSourceUpdateMode.OnPropertyChanged); chkSlimActionBar.DataBindings.Add("Checked", clientSettings, "UseSlimActionBar", false, DataSourceUpdateMode.OnPropertyChanged); //get metrics bgwMetrics.RunWorkerAsync(); }
/// <summary> /// Initializes/Reinitializes settings and sets up the check in with tasktServer /// </summary> public static void Initialize() { var settingClass = new Core.ApplicationSettings(); appSettings = settingClass.GetOrCreateApplicationSettings(); if (appSettings.ServerSettings.ServerConnectionEnabled) { //handle for reinitialization if (heartbeatTimer != null) { heartbeatTimer.Elapsed -= Heartbeat_Elapsed; } //setup heartbeat to the server heartbeatTimer = new System.Timers.Timer(); heartbeatTimer.Interval = 5000; heartbeatTimer.Elapsed += Heartbeat_Elapsed; heartbeatTimer.Enabled = true; } }
private static void ShowImageCapture(object sender, EventArgs e) { ApplicationSettings settings = new Core.ApplicationSettings().GetOrCreateApplicationSettings(); var minimizePreference = settings.ClientSettings.MinimizeToTray; if (minimizePreference) { settings.ClientSettings.MinimizeToTray = false; settings.Save(settings); } HideAllForms(); var userAcceptance = MessageBox.Show("The image capture process will now begin and display a screenshot of the current desktop in a custom full-screen window. You may stop the capture process at any time by pressing the 'ESC' key, or selecting 'Close' at the top left. Simply create the image by clicking once to start the rectangle and clicking again to finish. The image will be cropped to the boundary within the red rectangle. Shall we proceed?", "Image Capture", MessageBoxButtons.YesNo); if (userAcceptance == DialogResult.Yes) { Forms.Supplement_Forms.frmImageCapture imageCaptureForm = new Forms.Supplement_Forms.frmImageCapture(); if (imageCaptureForm.ShowDialog() == DialogResult.OK) { CustomControls.CommandItemControl inputBox = (CustomControls.CommandItemControl)sender; UIPictureBox targetPictureBox = (UIPictureBox)inputBox.Tag; targetPictureBox.Image = imageCaptureForm.userSelectedBitmap; var convertedImage = Core.Common.ImageToBase64(imageCaptureForm.userSelectedBitmap); var convertedLength = convertedImage.Length; targetPictureBox.EncodedImage = convertedImage; imageCaptureForm.Show(); } } ShowAllForms(); if (minimizePreference) { settings.ClientSettings.MinimizeToTray = true; settings.Save(settings); } }
private void frmSettings_Load(object sender, EventArgs e) { newAppSettings = new Core.ApplicationSettings(); newAppSettings = newAppSettings.GetOrCreateApplicationSettings(); var serverSettings = newAppSettings.ServerSettings; chkServerEnabled.DataBindings.Add("Checked", serverSettings, "ServerConnectionEnabled", false, DataSourceUpdateMode.OnPropertyChanged); chkAutomaticallyConnect.DataBindings.Add("Checked", serverSettings, "ConnectToServerOnStartup", false, DataSourceUpdateMode.OnPropertyChanged); chkRetryOnDisconnect.DataBindings.Add("Checked", serverSettings, "RetryServerConnectionOnFail", false, DataSourceUpdateMode.OnPropertyChanged); txtServerURL.DataBindings.Add("Text", serverSettings, "ServerURL"); var engineSettings = newAppSettings.EngineSettings; chkShowDebug.DataBindings.Add("Checked", engineSettings, "ShowDebugWindow", false, DataSourceUpdateMode.OnPropertyChanged); chkAutoCloseWindow.DataBindings.Add("Checked", engineSettings, "AutoCloseDebugWindow", false, DataSourceUpdateMode.OnPropertyChanged); chkEnableLogging.DataBindings.Add("Checked", engineSettings, "EnableDiagnosticLogging", false, DataSourceUpdateMode.OnPropertyChanged); var clientSettings = newAppSettings.ClientSettings; chkAntiIdle.DataBindings.Add("Checked", clientSettings, "AntiIdleWhileOpen", false, DataSourceUpdateMode.OnPropertyChanged); }
private void btnGetGUID_Click(object sender, EventArgs e) { var successfulConnection = Core.Server.HttpServerClient.TestConnection(txtHttpsAddress.Text); if (successfulConnection) { var pulledNewGUID = Core.Server.HttpServerClient.GetGuid(); if (pulledNewGUID) { newAppSettings = new Core.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!"); } }
public static void ShowVariableSelector(object sender, EventArgs e) { //create variable selector form UI.Forms.Supplemental.frmItemSelector newVariableSelector = new Forms.Supplemental.frmItemSelector(); //get copy of user variables and append system variables, then load to combobox var variableList = CurrentEditor.scriptVariables.Select(f => f.VariableName).ToList(); variableList.AddRange(Core.Common.GenerateSystemVariables().Select(f => f.VariableName)); newVariableSelector.lstVariables.Items.AddRange(variableList.ToArray()); //if user pressed "OK" if (newVariableSelector.ShowDialog() == DialogResult.OK) { //ensure that a variable was actually selected if (newVariableSelector.lstVariables.SelectedItem == null) { //return out as nothing was selected MessageBox.Show("There were no variables selected!"); return; } //grab the referenced input assigned to the 'insert variable' button instance CustomControls.CommandItemControl inputBox = (CustomControls.CommandItemControl)sender; //currently variable insertion is only available for simply textboxes //load settings var settings = new Core.ApplicationSettings().GetOrCreateApplicationSettings(); if (inputBox.Tag is TextBox) { TextBox targetTextbox = (TextBox)inputBox.Tag; //concat variable name with brackets [vVariable] as engine searches for the same targetTextbox.Text = targetTextbox.Text + string.Concat(settings.EngineSettings.VariableStartMarker, newVariableSelector.lstVariables.SelectedItem.ToString(), settings.EngineSettings.VariableEndMarker); } else if (inputBox.Tag is ComboBox) { ComboBox targetCombobox = (ComboBox)inputBox.Tag; //concat variable name with brackets [vVariable] as engine searches for the same targetCombobox.Text = targetCombobox.Text + string.Concat(settings.EngineSettings.VariableStartMarker, newVariableSelector.lstVariables.SelectedItem.ToString(), settings.EngineSettings.VariableEndMarker); } else if (inputBox.Tag is DataGridView) { DataGridView targetDGV = (DataGridView)inputBox.Tag; if (targetDGV.SelectedCells.Count == 0) { MessageBox.Show("Please make sure you have selected an action and selected a cell before attempting to insert a variable!", "No Cell Found", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (targetDGV.SelectedCells[0].ColumnIndex == 0) { MessageBox.Show("Invalid Cell Selected!", "Invalid Cell Selected", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } targetDGV.SelectedCells[0].Value = targetDGV.SelectedCells[0].Value + string.Concat(settings.EngineSettings.VariableStartMarker, newVariableSelector.lstVariables.SelectedItem.ToString(), settings.EngineSettings.VariableEndMarker); } } }
private void frmScriptBuilder_Load(object sender, EventArgs e) { //detect latest release //HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create("https://api.github.com/repos/saucepleez/sharpRPA/releases"); //myHttpWebRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2;)"; //HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse(); //StreamReader reader = new StreamReader(myHttpWebResponse.GetResponseStream(), Encoding.UTF8); //String responseString = reader.ReadToEnd(); //Newtonsoft.Json.Linq.JArray jsonArray = Newtonsoft.Json.Linq.JArray.Parse(responseString); //dynamic data = Newtonsoft.Json.Linq.JObject.Parse(jsonArray[0].ToString()); //create undo list undoList = new List <List <ListViewItem> >(); //get app settings var appSettingClass = new Core.ApplicationSettings(); appSettings = appSettingClass.GetOrCreateApplicationSettings(); //get server setting preferences var serverSettings = appSettings.ServerSettings; //try to connect to server if ((serverSettings.ServerConnectionEnabled) && (serverSettings.ConnectToServerOnStartup)) { CreateSocketConnection(serverSettings.ServerURL); } //create folder to store scripts var rpaScriptsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\sharpRPA\\My Scripts\\"; if (!System.IO.Directory.Exists(rpaScriptsFolder)) { UI.Forms.Supplemental.frmDialog userDialog = new UI.Forms.Supplemental.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!", UI.Forms.Supplemental.frmDialog.DialogType.YesNo, 0); if (userDialog.ShowDialog() == DialogResult.OK) { System.IO.Directory.CreateDirectory(rpaScriptsFolder); } } //get latest files for recent files list on load GenerateRecentFiles(); //get current version lblCurrentVersion.Text = "v" + new Version(System.Windows.Forms.Application.ProductVersion); //no height for status bar tlpControls.RowStyles[3].Height = 0; //instantiate for script variables scriptVariables = new List <Core.Script.ScriptVariable>(); //pnlHeader.BackColor = Color.FromArgb(255, 214, 88); //instantiate and populate display icons for commands uiImages = UI.Images.UIImageList(); lstScriptActions.SmallImageList = uiImages; // tvCommands.ImageList = uiImages; // tvCommands.ImageList.Images.Add(new Bitmap(1,1)); //get commands var groupedCommands = Core.Common.GetGroupedCommands(); foreach (var cmd in groupedCommands) { var group = cmd.Key as Core.AutomationCommands.Attributes.ClassAttributes.Group; TreeNode newGroup = new TreeNode(group.groupName); // newGroup.ImageIndex = tvCommands.ImageList.Images.Count - 1; // newGroup.SelectedImageIndex = tvCommands.ImageList.Images.Count - 1; foreach (var subcmd in cmd) { Core.AutomationCommands.ScriptCommand newCommand = (Core.AutomationCommands.ScriptCommand)Activator.CreateInstance(subcmd); TreeNode subNode = new TreeNode(newCommand.SelectionName); //subNode.ImageIndex = uiImages.Images.IndexOfKey(newCommand.GetType().Name); // subNode.SelectedImageIndex = uiImages.Images.IndexOfKey(newCommand.GetType().Name); newGroup.Nodes.Add(subNode); } tvCommands.Nodes.Add(newGroup); } //tvCommands.ImageList = uiImages; }
private void frmSettings_Load(object sender, EventArgs e) { newAppSettings = new Core.ApplicationSettings(); newAppSettings = newAppSettings.GetOrCreateApplicationSettings(); var serverSettings = newAppSettings.ServerSettings; chkServerEnabled.DataBindings.Add("Checked", serverSettings, "ServerConnectionEnabled", false, DataSourceUpdateMode.OnPropertyChanged); chkAutomaticallyConnect.DataBindings.Add("Checked", serverSettings, "ConnectToServerOnStartup", false, DataSourceUpdateMode.OnPropertyChanged); chkRetryOnDisconnect.DataBindings.Add("Checked", serverSettings, "RetryServerConnectionOnFail", false, DataSourceUpdateMode.OnPropertyChanged); chkBypassValidation.DataBindings.Add("Checked", serverSettings, "BypassCertificateValidation", false, DataSourceUpdateMode.OnPropertyChanged); txtPublicKey.DataBindings.Add("Text", serverSettings, "ServerPublicKey", false, DataSourceUpdateMode.OnPropertyChanged); txtServerURL.DataBindings.Add("Text", serverSettings, "ServerURL", false, DataSourceUpdateMode.OnPropertyChanged); txtHttpsAddress.DataBindings.Add("Text", serverSettings, "HTTPServerURL", false, DataSourceUpdateMode.OnPropertyChanged); txtGUID.DataBindings.Add("Text", serverSettings, "HTTPGuid", false, DataSourceUpdateMode.OnPropertyChanged); var engineSettings = newAppSettings.EngineSettings; chkShowDebug.DataBindings.Add("Checked", engineSettings, "ShowDebugWindow", false, DataSourceUpdateMode.OnPropertyChanged); chkAutoCloseWindow.DataBindings.Add("Checked", engineSettings, "AutoCloseDebugWindow", false, DataSourceUpdateMode.OnPropertyChanged); chkEnableLogging.DataBindings.Add("Checked", engineSettings, "EnableDiagnosticLogging", false, DataSourceUpdateMode.OnPropertyChanged); chkAdvancedDebug.DataBindings.Add("Checked", engineSettings, "ShowAdvancedDebugOutput", false, DataSourceUpdateMode.OnPropertyChanged); chkCreateMissingVariables.DataBindings.Add("Checked", engineSettings, "CreateMissingVariablesDuringExecution", false, DataSourceUpdateMode.OnPropertyChanged); chkTrackMetrics.DataBindings.Add("Checked", engineSettings, "TrackExecutionMetrics", false, DataSourceUpdateMode.OnPropertyChanged); txtVariableStartMarker.DataBindings.Add("Text", engineSettings, "VariableStartMarker", false, DataSourceUpdateMode.OnPropertyChanged); txtVariableEndMarker.DataBindings.Add("Text", engineSettings, "VariableEndMarker", false, DataSourceUpdateMode.OnPropertyChanged); txtCommandDelay.DataBindings.Add("Text", engineSettings, "DelayBetweenCommands", false, DataSourceUpdateMode.OnPropertyChanged); chkOverrideInstances.DataBindings.Add("Checked", engineSettings, "OverrideExistingAppInstances", false, DataSourceUpdateMode.OnPropertyChanged); cboCancellationKey.DataSource = Enum.GetValues(typeof(Keys)); cboCancellationKey.DataBindings.Add("Text", engineSettings, "CancellationKey", false, DataSourceUpdateMode.OnPropertyChanged); // cmbxNewBox.DataSource = Enum.GetValues(typeof(MyEnum)) //.Cast<Enum>() //.Select(value => new //{ // (Attribute.GetCustomAttribute(value.GetType().GetField(value.ToString()), typeof(DescriptionAttribute)) as DescriptionAttribute).Description, // value //}) //.OrderBy(item => item.value) //.ToList(); // cmbxNewBox.DisplayMember = "Description"; // cmbxNewBox.ValueMember = "value"; var clientSettings = newAppSettings.ClientSettings; chkAntiIdle.DataBindings.Add("Checked", clientSettings, "AntiIdleWhileOpen", false, DataSourceUpdateMode.OnPropertyChanged); txtAppFolderPath.DataBindings.Add("Text", clientSettings, "RootFolder", false, DataSourceUpdateMode.OnPropertyChanged); txtAttendedTaskFolder.DataBindings.Add("Text", clientSettings, "AttendedTasksFolder", false, DataSourceUpdateMode.OnPropertyChanged); chkInsertCommandsInline.DataBindings.Add("Checked", clientSettings, "InsertCommandsInline", false, DataSourceUpdateMode.OnPropertyChanged); chkSequenceDragDrop.DataBindings.Add("Checked", clientSettings, "EnableSequenceDragDrop", false, DataSourceUpdateMode.OnPropertyChanged); chkMinimizeToTray.DataBindings.Add("Checked", clientSettings, "MinimizeToTray", false, DataSourceUpdateMode.OnPropertyChanged); cboStartUpMode.DataBindings.Add("Text", clientSettings, "StartupMode", false, DataSourceUpdateMode.OnPropertyChanged); chkPreloadCommands.DataBindings.Add("Checked", clientSettings, "PreloadBuilderCommands", false, DataSourceUpdateMode.OnPropertyChanged); chkSlimActionBar.DataBindings.Add("Checked", clientSettings, "UseSlimActionBar", false, DataSourceUpdateMode.OnPropertyChanged); //get metrics bgwMetrics.RunWorkerAsync(); }