protected override void OnStart() { if (_Script == null) { ScriptHelper helper = ScriptHelper.CreateFromString(Code, Options); if (helper != null) { _Script = helper.CreateNewInstance <IScriptProcess>(); _Script.Source = this; } } }
void toolStripButton2_Click(object sender, EventArgs e) { tError.Tag = null; tError.Text = ""; try { ScriptHelper helper = ScriptHelper.CreateFromString(tEdit.Text, _Options); if (helper != null) { string n = DefinedClasses; foreach (Type t in helper.Assembly.GetExportedTypes()) { if (n != "") { n += " "; } n += t.Name; } tEdit.SetKeywords(3, n); tEdit.Invalidate(); IScriptProcess sc = helper.CreateNewInstance <IScriptProcess>(); if (sc == null) { throw (new Exception("Error")); } } else { throw (new Exception("Error")); } tError.ForeColor = Color.Green; tError.Text = "OK"; if (sender != null) { tError.Visible = true; } } catch (Exception ex) { tError.Visible = true; tError.Tag = true; tError.ForeColor = Color.Red; tError.Text = ex.Message; } }
protected override void OnStop() { _Script = null; }