示例#1
0
        private void lua_button_Click(object sender, EventArgs e)
        {
            if (threadLuaRunner == null || (threadLuaRunner.IsAlive == false))
            {
                if (false == HelperApi.ConsoleShow.consoleState)
                {
                    HelperApi.ConsoleShow pConsoleShow = new HelperApi.ConsoleShow();
                    pConsoleShow.CsAllocConsole();
                }
                else
                {
                    System.Console.WriteLine("Lua Running!");
                }



                OpenFileDialog ofd = new OpenFileDialog();
                ofd.Multiselect = false;
                ofd.Filter      = "LuaScript|*.lua";
                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    threadLuaRunner = new Thread(new ParameterizedThreadStart(RunLua));

                    threadLuaRunner.IsBackground = true;
                    threadLuaRunner.Start(ofd.FileName);
                    this.lua_button.Text = "停止脚本";
                }
            }
            else
            {
                threadLuaRunner.Abort();
                this.lua_button.Text = "Run Lua";
            }
        }
示例#2
0
        private void 灯端电压ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (threadLuaRunner == null || (threadLuaRunner.IsAlive == false))
            {
                string fileName = Environment.CurrentDirectory;
                fileName = fileName + "\\脚本\\交流信号机电压.lua";
                if (System.IO.File.Exists(fileName) == false)
                {
                    MessageBox.Show("\"交流信号机电压.lua\"脚本不存在!");
                    return;
                }


                if (false == HelperApi.ConsoleShow.consoleState)
                {
                    HelperApi.ConsoleShow pConsoleShow = new HelperApi.ConsoleShow();
                    pConsoleShow.CsAllocConsole();
                }
                else
                {
                    System.Console.WriteLine("Lua Running!");
                }
                //MessageBox.Show(fileName);
                threadLuaRunner = new Thread(new ParameterizedThreadStart(RunLua));

                threadLuaRunner.IsBackground = true;
                threadLuaRunner.Start(fileName);
            }
            else
            {
                DialogResult dr = MessageBox.Show("当前脚本正在运行,是否中止?", "消息内容", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button2);
                if (dr == DialogResult.Yes)
                {
                    threadLuaRunner.Abort();
                }
            }
        }
示例#3
0
        //550-850HzU
        private void 调制交流UToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (threadLuaRunner == null || (threadLuaRunner.IsAlive == false))
            {
                string fileName = Environment.CurrentDirectory;
                fileName = fileName + "\\脚本\\550-850调制交流电压.lua";
                if (System.IO.File.Exists(fileName) == false)
                {
                    MessageBox.Show("\"550-850调制交流电压.lua\"脚本不存在!");
                    return;
                }

                if (false == HelperApi.ConsoleShow.consoleState)
                {
                    HelperApi.ConsoleShow pConsoleShow = new HelperApi.ConsoleShow();
                    pConsoleShow.CsAllocConsole();
                }
                else
                {
                    System.Console.WriteLine("Lua Running!");
                }
                //MessageBox.Show(fileName);
                threadLuaRunner = new Thread(new ParameterizedThreadStart(RunLua));

                threadLuaRunner.IsBackground = true;
                threadLuaRunner.Start(fileName);

            }
            else
            {
                DialogResult dr = MessageBox.Show("当前脚本正在运行,是否中止?", "消息内容", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button2);
                if (dr == DialogResult.Yes)
                {
                    threadLuaRunner.Abort();
                }

            }
        }
示例#4
0
        private void lua_button_Click(object sender, EventArgs e)
        {
            if (threadLuaRunner == null || (threadLuaRunner.IsAlive == false))
            {

                if (false == HelperApi.ConsoleShow.consoleState)
                {
                    HelperApi.ConsoleShow pConsoleShow = new HelperApi.ConsoleShow();
                    pConsoleShow.CsAllocConsole();
                }
                else
                {
                    System.Console.WriteLine("Lua Running!");
                }

                OpenFileDialog ofd = new OpenFileDialog();
                ofd.Multiselect = false;
                ofd.Filter = "LuaScript|*.lua";
                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    threadLuaRunner = new Thread(new ParameterizedThreadStart(RunLua));

                    threadLuaRunner.IsBackground = true;
                    threadLuaRunner.Start(ofd.FileName);
                    this.lua_button.Text = "停止脚本";

                }

            }
            else
            {
                threadLuaRunner.Abort();
                this.lua_button.Text = "Run Lua";

            }
        }