当前位置: 首页>>代码示例>>C#>>正文


C# Script.runScript方法代码示例

本文整理汇总了C#中System.Script.runScript方法的典型用法代码示例。如果您正苦于以下问题:C# Script.runScript方法的具体用法?C# Script.runScript怎么用?C# Script.runScript使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Script的用法示例。


在下文中一共展示了Script.runScript方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: run_selected_script

 void run_selected_script()
 {
     script = new Script(checkBoxRedirectOutput.Checked);
     script.runScript(selectedscript);
     scriptrunning = false;
 }
开发者ID:Viousa,项目名称:MissionPlanner,代码行数:6,代码来源:FlightData.cs

示例2: ScriptStart

        void ScriptStart()
        {
            string myscript = @"
            # cs.???? = currentstate, any variable on the status tab in the planner can be used.
            # Script = options are
            # Script.Sleep(ms)
            # Script.ChangeParam(name,value)
            # Script.GetParam(name)
            # Script.ChangeMode(mode) - same as displayed in mode setup screen 'AUTO'
            # Script.WaitFor(string,timeout)
            # Script.SendRC(channel,pwm,sendnow)
            #

            print 'Start Script'
            for chan in range(1,9):
            Script.SendRC(chan,1500,False)
            Script.SendRC(3,Script.GetParam('RC3_MIN'),True)

            Script.Sleep(5000)
            while cs.lat == 0:
            print 'Waiting for GPS'
            Script.Sleep(1000)
            print 'Got GPS'
            jo = 10 * 13
            print jo
            Script.SendRC(3,1000,False)
            Script.SendRC(4,2000,True)
            cs.messages.Clear()
            Script.WaitFor('ARMING MOTORS',30000)
            Script.SendRC(4,1500,True)
            print 'Motors Armed!'

            Script.SendRC(3,1700,True)
            while cs.alt < 50:
            Script.Sleep(50)

            Script.SendRC(5,2000,True) # acro

            Script.SendRC(1,2000,False) # roll
            Script.SendRC(3,1370,True) # throttle
            while cs.roll > -45: # top hald 0 - 180
            Script.Sleep(5)
            while cs.roll < -45: # -180 - -45
            Script.Sleep(5)

            Script.SendRC(5,1500,False) # stabalise
            Script.SendRC(1,1500,True) # level roll
            Script.Sleep(2000) # 2 sec to stabalise
            Script.SendRC(3,1300,True) # throttle back to land

            thro = 1350 # will decend

            while cs.alt > 0.1:
            Script.Sleep(300)

            Script.SendRC(3,1000,False)
            Script.SendRC(4,1000,True)
            Script.WaitFor('DISARMING MOTORS',30000)
            Script.SendRC(4,1500,True)

            print 'Roll complete'

            ";

            CustomMessageBox.Show("This is Very ALPHA");

            Form scriptedit = new Form();

            scriptedit.Size = new System.Drawing.Size(500,500);

            TextBox tb = new TextBox();

            tb.Dock = DockStyle.Fill;

            tb.ScrollBars = ScrollBars.Both;
            tb.Multiline = true;

            tb.Location = new Point(0,0);
            tb.Size = new System.Drawing.Size(scriptedit.Size.Width-30,scriptedit.Size.Height-30);

            scriptedit.Controls.Add(tb);

            tb.Text = myscript;

            scriptedit.ShowDialog();

            if (DialogResult.Yes == CustomMessageBox.Show("Run Script", "Run this script?", MessageBoxButtons.YesNo))
            {

                Script scr = new Script();

                scr.runScript(tb.Text);
            }
        }
开发者ID:digitalcraft,项目名称:ardupilot-mega-buzz,代码行数:94,代码来源:FlightData.cs

示例3: updateCameraLensIris

        private void updateCameraLensIris()
        {
            //auto close camera lens for Canon S110

            //check to see if 20 meters has been reached
            if (MainV2.comPort.MAV.cs.alt > 20)
            {
                Reached50M = true;
                CameraClosed = false; //assume the camera is open anytime above 50m..
                                      //...fixes the issue of the camera not closing on any flight after the first because the program already thinks it is closed.
            }

            //close camera lens based on parameters
            if (MainV2.comPort.MAV.cs.connected && MainV2.comPort.MAV.cs.alt < 10
                && CameraClosed == false && Reached50M == true
                && playingLog == false)
            {
                CameraClosed = true;
                Script script = new Script();
                script.runScript("ShutCamtrig.py");
                //CustomMessageBox.Show("Camera lens closed because of low altitude!!!");
            }
        }
开发者ID:Event38,项目名称:MissionPlanner,代码行数:23,代码来源:FlightData.cs

示例4: BUT_CloseLens_Click

 private void BUT_CloseLens_Click(object sender, EventArgs e)
 {
     if (!MainV2.comPort.MAV.cs.connected)
     {
         CustomMessageBox.Show("Please connect first");
     }
     else
     {
         if (File.Exists("ShutCamtrig.py"))
         {
             //string closeLens = File.ReadAllText("ShutCamtrig.py");
             Script script = new Script();
             //MessageBox.Show(closeLens); //--test code
             script.runScript("ShutCamtrig.py");
         }
         else
             CustomMessageBox.Show("ERROR in BUT_CloseLens function (ShutCamtrig.py file was not found)");
     }
 }
开发者ID:Event38,项目名称:MissionPlanner,代码行数:19,代码来源:FlightData.cs

示例5: ScriptStart

        void ScriptStart()
        {
            string myscript = @"
            print 'Start Script'
            for chan in range(1,9):
            Script.SendRC(chan,1500,False)
            Script.SendRC(3,Script.GetParam('RC3_MIN'),True)

            Script.Sleep(5000)
            while cs.lat == 0:
            print 'Waiting for GPS'
            Script.Sleep(1000)
            print 'Got GPS'
            jo = 10 * 13
            print jo
            Script.SendRC(3,1000,False)
            Script.SendRC(4,2000,True)
            cs.messages.Clear()
            Script.WaitFor('ARMING MOTORS',30000)
            Script.SendRC(4,1500,True)
            print 'Motors Armed!'

            Script.SendRC(3,1700,True)
            while cs.alt < 50:
            Script.Sleep(50)

            Script.SendRC(5,2000,True) # acro

            Script.SendRC(1,2000,False) # roll
            Script.SendRC(3,1370,True) # throttle
            while cs.roll > -45: # top hald 0 - 180
            Script.Sleep(5)
            while cs.roll < -45: # -180 - -45
            Script.Sleep(5)

            Script.SendRC(5,1500,False) # stabalise
            Script.SendRC(1,1500,True) # level roll
            Script.Sleep(2000) # 2 sec to stabalise
            Script.SendRC(3,1300,True) # throttle back to land

            thro = 1350 # will decend

            while cs.alt > 0.1:
            Script.Sleep(300)

            Script.SendRC(3,1000,False)
            Script.SendRC(4,1000,True)
            Script.WaitFor('DISARMING MOTORS',30000)
            Script.SendRC(4,1500,True)

            print 'Roll complete'

            ";

            MessageBox.Show("This is Very ALPHA");

            Form scriptedit = new Form();

            scriptedit.Size = new System.Drawing.Size(500,500);

            TextBox tb = new TextBox();

            tb.Dock = DockStyle.Fill;

            tb.ScrollBars = ScrollBars.Both;
            tb.Multiline = true;

            tb.Location = new Point(0,0);
            tb.Size = new System.Drawing.Size(scriptedit.Size.Width-30,scriptedit.Size.Height-30);

            scriptedit.Controls.Add(tb);

            tb.Text = myscript;

            scriptedit.ShowDialog();

            if (DialogResult.Yes == MessageBox.Show("Run Script", "Run this script?", MessageBoxButtons.YesNo))
            {

                Script scr = new Script();

                scr.runScript(tb.Text);
            }
        }
开发者ID:415porto,项目名称:ardupilotone,代码行数:84,代码来源:FlightData.cs


注:本文中的System.Script.runScript方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。