示例#1
0
 private void Form1_Load(object sender, EventArgs e)
 {
     // Initialize Language with this as the IHost
     ScriptingLanguage.SetHost(this);
     // Create and initialize BasicNoUIObj object
     basicNoUIObj                = new WinWrap.Basic.BasicNoUIObj();
     basicNoUIObj.Begin         += basicNoUIObj_Begin;
     basicNoUIObj.Disconnecting += basicNoUIObj_Disconnecting;
     basicNoUIObj.DoEvents      += basicNoUIObj_DoEvents;
     basicNoUIObj.ErrorAlert    += basicNoUIObj_ErrorAlert;
     basicNoUIObj.Pause_        += basicNoUIObj_Pause_;
     basicNoUIObj.Secret         = new System.Guid("00000000-0000-0000-0000-000000000000");
     basicNoUIObj.Initialize();
     // automatically disconnect BasicNoUIObj when form closes
     basicNoUIObj.AttachToForm(this, WinWrap.Basic.ManageConstants.All);
     // Extend WinWrap Basic scripts with Examples.Extensions assembly
     // Add "Imports Examples.Extensions" to all WinWrap Basic scripts
     // Add "Imports Examples.Extensions.ScriptingLanguage" all WinWrap Basic scripts
     basicNoUIObj.AddScriptableObjectModel(typeof(ScriptingLanguage));
     if (!basicNoUIObj.LoadModule(ScriptPath("Globals.bas")))
     {
         LogError(basicNoUIObj.Error);
         buttonRunScript.Enabled = false;
     }
 }
示例#2
0
        private void buttonRunScript_Click(object sender, EventArgs e)
        {
            TheIncident = new Incident();
            using (var basicNoUIObj = new WinWrap.Basic.BasicNoUIObj())
            {
                basicNoUIObj.Begin += basicNoUIObj_Begin;
                basicNoUIObj.DoEvents += basicNoUIObj_DoEvents;
                basicNoUIObj.ErrorAlert += basicNoUIObj_ErrorAlert;
                basicNoUIObj.Pause_ += basicNoUIObj_Pause_;
                basicNoUIObj.Synchronizing += basicNoUIObj_Synchronizing;
                basicNoUIObj.Secret = new System.Guid("00000000-0000-0000-0000-000000000000");
                basicNoUIObj.Initialize();

                basicNoUIObj.AttachToForm(this, WinWrap.Basic.ManageConstants.All);

                if (conns_.Any)
                {
                    basicNoUIObj.Synchronized = true;
                    basicNoUIObj.Wait(3);
                }

                /// Extend WinWrap Basic scripts with Examples.Extensions assembly
                /// Add "Imports Examples.Extensions" to all WinWrap Basic scripts
                /// Add "Imports Examples.Extensions.ScriptingLanguage" all WinWrap Basic scripts
                basicNoUIObj.AddScriptableObjectModel(typeof(ScriptingLanguage));

                try
                {
                    if (!basicNoUIObj.LoadModule(ScriptPath("Globals.bas")))
                        throw basicNoUIObj.Error.Exception;

                    using (var module = basicNoUIObj.ModuleInstance(ScriptPath(Script), false))
                    {
                        if (module == null)
                            throw basicNoUIObj.Error.Exception;

                        if (basicNoUIObj.Synchronized)
                            module.StepInto = true;

                        // Execute script code via an event
                        ScriptingLanguage.TheIncident.Start(this.Text);
                    }
                }
                catch (Exception ex)
                {
                    if (basicNoUIObj.Synchronized)
                    {
                        basicNoUIObj.ReportError(ex);
                        basicNoUIObj.Wait(3);
                    }

                    basicNoUIObj.ReportError(ex);

                    if (basicNoUIObj.Synchronized)
                        basicNoUIObj.Wait(1);
                }
            }

            TheIncident = null;
        }
示例#3
0
        private void buttonRunScript_Click(object sender, EventArgs e)
        {
            TheIncident = new Incident();
            using (var basicNoUIObj = new WinWrap.Basic.BasicNoUIObj())
            {
                basicNoUIObj.Begin         += basicNoUIObj_Begin;
                basicNoUIObj.DoEvents      += basicNoUIObj_DoEvents;
                basicNoUIObj.ErrorAlert    += basicNoUIObj_ErrorAlert;
                basicNoUIObj.Pause_        += basicNoUIObj_Pause_;
                basicNoUIObj.Synchronizing += basicNoUIObj_Synchronizing;
                basicNoUIObj.Secret         = new System.Guid("00000000-0000-0000-0000-000000000000");
                basicNoUIObj.Initialize();

                basicNoUIObj.AttachToForm(this, WinWrap.Basic.ManageConstants.All);

                if (conns_.Any)
                {
                    basicNoUIObj.Synchronized = true;
                    basicNoUIObj.Wait(3);
                }

                /// Extend WinWrap Basic scripts with Examples.Extensions assembly
                /// Add "Imports Examples.Extensions" to all WinWrap Basic scripts
                /// Add "Imports Examples.Extensions.ScriptingLanguage" all WinWrap Basic scripts
                basicNoUIObj.AddScriptableObjectModel(typeof(ScriptingLanguage));

                try
                {
                    if (!basicNoUIObj.LoadModule(ScriptPath("Globals.bas")))
                    {
                        throw basicNoUIObj.Error.Exception;
                    }

                    using (var module = basicNoUIObj.ModuleInstance(ScriptPath(Script), false))
                    {
                        if (module == null)
                        {
                            throw basicNoUIObj.Error.Exception;
                        }

                        if (basicNoUIObj.Synchronized)
                        {
                            module.StepInto = true;
                        }

                        // Execute script code via an event
                        ScriptingLanguage.TheIncident.Start(this.Text);
                    }
                }
                catch (Exception ex)
                {
                    if (basicNoUIObj.Synchronized)
                    {
                        basicNoUIObj.ReportError(ex);
                        basicNoUIObj.Wait(3);
                    }

                    basicNoUIObj.ReportError(ex);

                    if (basicNoUIObj.Synchronized)
                    {
                        basicNoUIObj.Wait(1);
                    }
                }
            }

            TheIncident = null;
        }
示例#4
0
 private void Form1_Load(object sender, EventArgs e)
 {
     // Initialize Language with this as the IHost
     ScriptingLanguage.SetHost(this);
     // Create and initialize BasicNoUIObj object
     basicNoUIObj = new WinWrap.Basic.BasicNoUIObj();
     basicNoUIObj.Begin += basicNoUIObj_Begin;
     basicNoUIObj.Disconnecting += basicNoUIObj_Disconnecting;
     basicNoUIObj.DoEvents += basicNoUIObj_DoEvents;
     basicNoUIObj.ErrorAlert += basicNoUIObj_ErrorAlert;
     basicNoUIObj.Pause_ += basicNoUIObj_Pause_;
     basicNoUIObj.Secret = new System.Guid("00000000-0000-0000-0000-000000000000");
     basicNoUIObj.Initialize();
     // automatically disconnect BasicNoUIObj when form closes
     basicNoUIObj.AttachToForm(this, WinWrap.Basic.ManageConstants.All);
     // Extend WinWrap Basic scripts with Examples.Extensions assembly
     // Add "Imports Examples.Extensions" to all WinWrap Basic scripts
     // Add "Imports Examples.Extensions.ScriptingLanguage" all WinWrap Basic scripts
     basicNoUIObj.AddScriptableObjectModel(typeof(ScriptingLanguage));
     if (!basicNoUIObj.LoadModule(ScriptPath("Globals.bas")))
     {
         LogError(basicNoUIObj.Error);
         buttonRunScript.Enabled = false;
     }
 }