Пример #1
0
        public bool Execute(ScriptExecutionService service)
        {
            Random r = new Random();

            System.Threading.Thread.Sleep(r.Next(this.m_LowTimeOut, this.m_HighTimeOut + 1));
            return(true);
        }
Пример #2
0
 protected override void OnClick(EventArgs e)
 {
     if (this.Parent is ScriptingMenuItem &&
         ((ScriptingMenuItem)this.Parent).CurrentScript != null)
     {
         service = new ScriptExecutionService(localModel, this.GetMainMenu().GetForm());
         System.Threading.Thread scriptThread = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(service.ExecuteScriptThreadEntry));
         scriptThread.Start(((ScriptingMenuItem)this.Parent).CurrentScript);
     }
 }
Пример #3
0
 public bool Execute(ScriptExecutionService service)
 {
     System.Windows.Forms.Control c = service.GetControl(this.m_Path);
     if (c == null)
     {
         return(false);
     }
     MessageSender.SendClick(c);
     return(true);
 }
Пример #4
0
        public ActionResult Index(string sid, string statement)
        {
            var se = new ScriptExecutionService();
            var result = se.Execute(sid, statement);
            if (string.IsNullOrEmpty(result))
            {
                return Content("Executed...");
            }

            return Content(result);
        }
Пример #5
0
        public ActionResult Index(string sid, string statement)
        {
            var se     = new ScriptExecutionService();
            var result = se.Execute(sid, statement);

            if (string.IsNullOrEmpty(result))
            {
                return(Content("Executed..."));
            }

            return(Content(result));
        }
Пример #6
0
 public bool Execute(ScriptExecutionService service)
 {
     System.Windows.Forms.Menu m = service.GetMenuItem(this.m_Path);
     if (m == null)
     {
         return(false);
     }
     if (m is MenuItem)
     {
         ((MenuItem)m).PerformClick();
     }
     else
     {
         return(false);
     }
     return(true);
 }
Пример #7
0
        /// <summary>
        /// Execute the ink drawing event
        /// </summary>
        /// <param name="service">The service to execute over</param>
        /// <returns>True if successful, false otherwise</returns>
        public bool Execute(ScriptExecutionService service)
        {
            Control c = service.GetControl(this.m_Path);

            if (c == null)
            {
                return(false);
            }
            if (c.InvokeRequired)
            {
                GenericVoidCallback func = new GenericVoidCallback(delegate { c.Focus(); });
                c.Invoke(func);
            }
            else
            {
                c.Focus();
            }

            this.PlaybackRecordedData(c, true, PacketPlaybackRate.Default, service.GetInkTransform());
            return(true);
        }
        public async Task ExecuteWithDictionary()
        {
            Mock <ITaskService> taskservice = new Mock <ITaskService>();

            taskservice.Setup(s => s.CreateTask(WorkableType.Script, 0, 0, "Test", It.IsAny <IDictionary <string, object> >())).Returns(new WorkableTask()
            {
                Token  = new CancellationTokenSource(),
                Log    = new List <string>(),
                Status = TaskStatus.Running
            });

            ScriptExecutionService service = new ScriptExecutionService(new NullLogger <ScriptExecutionService>(), taskservice.Object, new TestCompiler());
            WorkableTask           task    = await service.Execute(new NamedCode {
                Name = "Test",
                Code = "return(param.property)"
            }, new Dictionary <string, object> {
                ["param"] = "{\"property\":3}"
            }, TimeSpan.FromSeconds(10));

            Assert.AreEqual(TaskStatus.Success, task.Status);
            Assert.AreEqual(3, task.Result);
        }
Пример #9
0
 public bool Execute(ScriptExecutionService service)
 {
     System.Threading.Thread.Sleep(this.m_TimeOut);
     return(true);
 }