private void buttonShowConsole_Click(object sender, EventArgs e) { var kntEngine = new KntSEngine(new InOutDeviceForm(), new MyLibrary()); KntScriptConsoleForm f = new KntScriptConsoleForm(kntEngine); f.Show(); }
public KntScriptConsoleForm(KntSEngine engine, string file = null) { InitializeComponent(); PersonalizeTabStop(); _engine = engine; _sourceCodeFile = file; }
public void ShowKntScriptConsole() { var kntEngine = new KntSEngine(new InOutDeviceForm(), new KNoteScriptLibrary(Store)); var kntScriptCom = new KntScriptConsoleComponent(Store); kntScriptCom.KntSEngine = kntEngine; kntScriptCom.Run(); }
public KntScriptConsoleForm(KntScriptConsoleComponent com) // , KntSEngine engine, string file = null { InitializeComponent(); PersonalizeTabStop(); _com = com; _engine = _com.KntSEngine; _sourceCodeFile = _com.CodeFile; }
private void buttonRunSample_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(_selectedFile)) { MessageBox.Show("File no seleted."); return; } var kntScript = new KntSEngine(new InOutDeviceForm(), new KNoteScriptLibrary(_store)); kntScript.RunFile(_pathSampleScripts + _selectedFile); }
private void buttonShowConsole_Click(object sender, EventArgs e) { var kntEngine = new KntSEngine(new InOutDeviceForm(), new KNoteScriptLibrary(_store)); var com = new KntScriptConsoleComponent(_store); com.KntSEngine = kntEngine; com.Run(); //KntScriptConsoleForm f = new KntScriptConsoleForm(com); //f.Show(); }
private void buttonShowSample_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(_selectedFile)) { MessageBox.Show("File no seleted."); return; } var kntEngine = new KntSEngine(new InOutDeviceForm(), new MyLibrary()); KntScriptConsoleForm f = new KntScriptConsoleForm(kntEngine, _pathSampleScripts + _selectedFile); f.Show(); }
private void buttonInteract_Click(object sender, EventArgs e) { // // Demo, inject variables and personalized api library // var kntScript = new KntSEngine(new InOutDeviceForm(), new MyLibrary()); var a = new DocumentDummy(); a.Description = "My object, to inject in script."; // inject variable kntScript.AddVar("_a", a); var code = @"printline ""Demo external variables / MyLibrary injected""; ' This variable (_a) comes from the host application printline _a.Description; printline _a.IdDocument; printline _a.CreationDateTime; printline _a.Folder.Name; _a.DocumentTestMethodA("" param A ""); var b = _a.DocumentTestMethodB("" == param C ==""); printline b; ' Test MyLibrary (injected library) printline """"; printline ""Test MyLibrary""; var colec = ColecDocDemo(); foreach x in colec printline x.Description; end foreach; printline """"; _a.Description = ""KntScript - changed description property !!""; printline _a.Description; printline """"; printline ""<< end >>""; "; kntScript.Run(code); var b = (DocumentDummy)kntScript.GetVar("_a"); // -> a MessageBox.Show(a.Description + " <==> " + b.Description); }
private void buttonRunScript_Click(object sender, EventArgs e) { var kntScript = new KntSEngine(new InOutDeviceForm(), new KNoteScriptLibrary(_store)); kntScript.Run(@" var i = 1; var str = ""Hello world ""; for i = 1 to 10 printline str + i; end for; printline """"; str = ""(type text here ...) ""; readvar {""Example input str var:"": str }; printline str; printline ""<< end >>""; "); }
private void buttonShowSample_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(_selectedFile)) { MessageBox.Show("File no seleted."); return; } var kntEngine = new KntSEngine(new InOutDeviceForm(), new KNoteScriptLibrary(_store)); var com = new KntScriptConsoleComponent(_store); com.KntSEngine = kntEngine; com.CodeFile = Path.Combine(_pathSampleScripts, _selectedFile); com.Run(); //KntScriptConsoleForm f = new KntScriptConsoleForm(com); //f.Show(); }
public void RunScript(string code, bool newThread = true) { if (string.IsNullOrEmpty(code)) { return; } var kntScript = new KntSEngine(new InOutDeviceForm(), new KNoteScriptLibrary(this)); if (newThread) { var t = new Thread(() => kntScript.Run(code)); t.IsBackground = false; t.Start(); } else { kntScript.Run(code); } }
private void buttonRunBackground_Click(object sender, EventArgs e) { var kntScript = new KntSEngine(new InOutDeviceForm(), new KNoteScriptLibrary(_store)); var code = @" var i = 1; var str = ""Hello world ""; for i = 1 to 1000 printline str + i; end for; printline ""<< end >>""; "; // --- Synchronous version // kntScript.Run(code); // --- Asynchronous version var t = new Thread(() => kntScript.Run(code)); t.IsBackground = false; t.Start(); }
private void buttonInteract_Click(object sender, EventArgs e) { // // Demo, inject variables and personalized api library // var kntScript = new KntSEngine(new InOutDeviceForm(), new KNoteScriptLibrary(_store)); var a = new FolderDto(); a.Name = "My folder, to inject in script."; a.Tags = "my tags"; a.CreationDateTime = DateTime.Now; // inject variable kntScript.AddVar("_a", a); var code = @"printline ""Demo external variables / KNoteScriptLibrary injected""; ' This variable (_a) comes from the host application printline _a.Name; printline _a.Tags; printline _a.CreationDateTime; _a.Name = ""KntScript - changed description property !!""; printline _a.Name; printline """"; printline ""<< end >>""; "; kntScript.Run(code); var b = (FolderDto)kntScript.GetVar("_a"); // -> a MessageBox.Show(a.Name + " <==> " + b.Name); }