Beispiel #1
0
        private void frmProcessingStatus_LoadAsync(object sender, EventArgs e)
        {
            if (_isParentScheduledTask)
            {
                List <string> assemblyList = NugetPackageManager.LoadPackageAssemblies(_configPath, true);
                Dictionary <string, List <Type> > groupedTypes = new Dictionary <string, List <Type> >();
                var builder = AppDomainSetupManager.LoadBuilder(assemblyList, groupedTypes);
                ScriptEngineContext.Container = builder.Build();
            }

            //move engine form to bottom right and bring to front
            if (_engineSettings.ShowDebugWindow)
            {
                BringToFront();
                MoveFormToBottomRight(this);
            }

            CommandControls = new CommandControls();

            //start running
            EngineInstance = new AutomationEngineInstance(ScriptEngineContext);

            if (IsNewTaskSteppedInto)
            {
                EngineInstance.PauseScript();
                uiBtnPause.Image       = Resources.engine_resume;
                uiBtnPause.DisplayText = "Resume";
                uiBtnStepOver.Visible  = true;
                uiBtnStepInto.Visible  = true;

                ScriptEngineContext.ScriptBuilder.CurrentEngine = this;

                //toggle running flag to allow for tab selection
                ScriptEngineContext.ScriptBuilder.IsScriptRunning = false;
                ((frmScriptBuilder)ScriptEngineContext.ScriptBuilder).OpenOpenBotsFile(ScriptEngineContext.FilePath, true);
                ScriptEngineContext.ScriptBuilder.IsScriptRunning = true;
            }

            EngineInstance.ReportProgressEvent    += Engine_ReportProgress;
            EngineInstance.ScriptFinishedEvent    += Engine_ScriptFinishedEvent;
            EngineInstance.LineNumberChangedEvent += EngineInstance_LineNumberChangedEvent;
            EngineInstance.AutomationEngineContext.ScriptEngine = this;
            EngineInstance.IsServerExecution = ServerExecution;

            if (JsonData == null)
            {
                EngineInstance.ExecuteScriptAsync();
            }
            else
            {
                EngineInstance.ExecuteScriptJson();
            }
        }
Beispiel #2
0
        private void frmProcessingStatus_Load(object sender, EventArgs e)
        {
            //move engine form to bottom right and bring to front
            if (_engineSettings.ShowDebugWindow)
            {
                BringToFront();
                MoveFormToBottomRight(this);
            }

            //start running
            EngineInstance = new AutomationEngineInstance(ScriptEngineLogger);

            if (IsNewTaskSteppedInto)
            {
                EngineInstance.PauseScript();
                uiBtnPause.Image       = Properties.Resources.command_resume;
                uiBtnPause.DisplayText = "Resume";
                uiBtnStepOver.Visible  = true;
                uiBtnStepInto.Visible  = true;

                CallBackForm.CurrentEngine = this;

                //toggle running flag to allow for tab selection
                CallBackForm.IsScriptRunning = false;
                ((frmScriptBuilder)CallBackForm).OpenFile(FilePath);
                CallBackForm.IsScriptRunning = true;
            }

            EngineInstance.ReportProgressEvent    += Engine_ReportProgress;
            EngineInstance.ScriptFinishedEvent    += Engine_ScriptFinishedEvent;
            EngineInstance.LineNumberChangedEvent += EngineInstance_LineNumberChangedEvent;
            EngineInstance.TaskModel       = RemoteTask;
            EngineInstance.TasktEngineUI   = this;
            EngineInstance.ServerExecution = ServerExecution;

            LocalTCPClient.AutomationInstance = EngineInstance;

            if (JsonData == null)
            {
                EngineInstance.ExecuteScriptAsync(this, FilePath, _scriptVariableList, _scriptElementList);
            }
            else
            {
                EngineInstance.ExecuteScriptJson(JsonData);
            }
        }
        private void frmProcessingStatus_Load(object sender, EventArgs e)
        {
            //get engine settings
            EngineContext.EngineSettings = new ApplicationSettings().GetOrCreateApplicationSettings().EngineSettings;

            //add hooks for hot key cancellation
            GlobalHook.HookStopped += new EventHandler(OnHookStopped);
            GlobalHook.StartEngineCancellationHook(EngineContext.EngineSettings.CancellationKey);
            GlobalHook.KeyDownEvent += GlobalHook_KeyDownEvent;

            if (_isParentScheduledTask)
            {
                List <string> assemblyList = NugetPackageManager.LoadPackageAssemblies(_configPath, true);
                Dictionary <string, List <Type> > groupedTypes = new Dictionary <string, List <Type> >();
                Dictionary <string, List <AssemblyReference> > allNamespaces = new Dictionary <string, List <AssemblyReference> >();
                var builder = AppDomainSetupManager.LoadBuilder(assemblyList, groupedTypes, allNamespaces, ScriptDefaultNamespaces.DefaultNamespaces);// EngineContext.ImportedNamespaces);
                EngineContext.Container = builder.Build();
            }

            //move engine form to bottom right and bring to front
            if (EngineContext.EngineSettings.ShowDebugWindow || EngineContext.IsDebugMode)
            {
                BringToFront();
                MoveFormToBottomRight(this);
            }
            else
            {
                MoveFormToBottomRight(this);
            }

            if (!EngineContext.IsDebugMode && !EngineContext.EngineSettings.ShowDebugWindow)
            {
                FormsHelper.HideForm(this);
            }

            //if listbox should be shown
            if (EngineContext.EngineSettings.ShowAdvancedDebugOutput || EngineContext.IsDebugMode)
            {
                lstSteppingCommands.Show();
                lblMainLogo.Show();
                pbBotIcon.Hide();
                lblAction.Hide();
            }
            else
            {
                lstSteppingCommands.Hide();
                lblMainLogo.Hide();
                pbBotIcon.Show();
                lblAction.Show();
            }

            //start running
            EngineInstance = new AutomationEngineInstance(EngineContext);

            if (IsNewTaskSteppedInto)
            {
                EngineInstance.PauseScript();
                uiBtnPause.Image       = Resources.engine_resume;
                uiBtnPause.DisplayText = "Resume";
                uiBtnStepOver.Visible  = true;
                uiBtnStepInto.Visible  = true;

                EngineContext.ScriptBuilder.CurrentEngine = this;

                //toggle running flag to allow for tab selection
                EngineContext.ScriptBuilder.IsScriptRunning = false;
                ((frmScriptBuilder)EngineContext.ScriptBuilder).OpenOpenBotsFile(EngineContext.FilePath, true);
                EngineContext.ScriptBuilder.IsScriptRunning = true;
            }

            EngineInstance.ReportProgressEvent       += Engine_ReportProgress;
            EngineInstance.ScriptFinishedEvent       += Engine_ScriptFinishedEvent;
            EngineInstance.LineNumberChangedEvent    += EngineInstance_LineNumberChangedEvent;
            EngineInstance.EngineContext.ScriptEngine = this;

            EngineInstance.ExecuteScriptAsync();
        }