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


C# Engine.ResumeExecution方法代码示例

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


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

示例1: StartProfiler

        internal void StartProfiler(string device, string logFile, string transport, 
            string exePath, string buildPath, ArrayList referenceList, bool isDevEnvironment, string assemblyName )
        {
            try
            {
                PortDefinition port = Utils.GetPort(device, transport, exePath);

                m_engine = new Engine(port);
                m_session = new ProfilerSession(m_engine);

#if DEBUG
                m_exporter = new Exporter_OffProf(m_session, logFile);
#endif

                lock (m_engine)
                {
                    m_engine.StopDebuggerOnConnect = true;
                    m_engine.Start();

                    bool connected = false;

                    connected = m_engine.TryToConnect(20, 500, true, ConnectionSource.TinyCLR);

                    if (connected)
                    {
                        if (m_engine.Capabilities.Profiling == false)
                        {
                            throw new ApplicationException("This device is not running a version of TinyCLR that supports profiling.");
                        }

                        // Deploy the test files to the device.                    
                        Utils.DeployToDevice(buildPath, referenceList, m_engine, transport, isDevEnvironment, assemblyName);

                        // Move IsDeviceInInitializeState(), IsDeviceInExitedState(), 
                        // GetDeviceState(),EnsureProcessIsInInitializedState() to Debugger.dll?

                        m_engine.RebootDevice(Engine.RebootOption.RebootClrWaitForDebugger);

                        if (!m_engine.TryToConnect(100, 500))
                        {
                            throw new ApplicationException("Connection Failed");
                        }

                        m_engine.ThrowOnCommunicationFailure = true;
                        m_session.EnableProfiling();

                        m_session.SetProfilingOptions(true, false);
                        m_engine.OnCommand += new CommandEventHandler(OnWPCommand);
                        m_engine.ResumeExecution();
                    }
                    else
                    {
                        throw new ApplicationException("Connection failed");
                    }
                }
            }
            catch (Exception ex)
            {
                SoftDisconnectDone(null, null);
                throw ex;
            }            
        }
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:62,代码来源:Profile.cs

示例2: ConnectToDevice

        private void ConnectToDevice(string buildPath, string exePath, ArrayList referenceList)
        {
            TestSystem.IncludesDeviceTest = true;
            PortDefinition port = Utils.GetPort(m_device, m_transport, exePath);

            try
            {
                for (int retry = 0; retry < 3; retry++)
                {
                    m_engine = new Microsoft.SPOT.Debugger.Engine(port);
                    m_engine.StopDebuggerOnConnect = true;
                    m_engine.Start();

                    bool connected = false;

                    connected = m_engine.TryToConnect(200, 500, true, ConnectionSource.TinyCLR);

                    if (connected)
                    {
                        m_engine.PauseExecution();

                        if (!string.Equals(m_transport.ToLower(), "emulator"))
                        {
                            // Deploy the test files to the device.                    
                            Utils.DeployToDevice(buildPath, referenceList, m_engine, m_transport, m_isDevEnvironment, m_assemblyName);

                            // Connect to the device and execute the deployed test.
                            m_engine.RebootDevice(Microsoft.SPOT.Debugger.Engine.RebootOption.RebootClrWaitForDebugger);

                            // give the device some time to restart (especially for tcp/ip)
                            Thread.Sleep(500);

                            if (m_engine.PortDefinition is PortDefinition_Tcp)
                            {
                                Thread.Sleep(1000);
                            }

                            connected = false;

                            connected = m_engine.TryToConnect(200, 500, true, ConnectionSource.TinyCLR);
                        }


                        if (!connected)
                        {
                            DetachFromEngine();
                            throw new ApplicationException("Reboot Failed");
                        }

                        AttachToProcess();

                        m_engine.ThrowOnCommunicationFailure = true;
                        m_engine.OnMessage += new MessageEventHandler(OnMessage);
                        m_engine.OnCommand += new CommandEventHandler(OnCommand);
                        m_engine.OnNoise += new NoiseEventHandler(OnNoise);

                        Console.WriteLine("\tExecuting the device test..");
                        m_initialTime = DateTime.Now;
                        m_engine.ResumeExecution();

                        m_deviceDone.WaitOne();
                        break;
                    }
                    else
                    {
                        DetachFromEngine();
                        //throw new ApplicationException("Connection failed");
                    }
                }
            }
            catch(Exception ex)
            {
                DetachFromEngine();
                throw new ApplicationException("Connection failed: " + ex.ToString());
            }
        }
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:76,代码来源:Harness.cs


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