/// <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); } }
/// <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); } }
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(); }
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 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 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!"); } }
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(); }