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


C# Engine.SetExecutionMode方法代码示例

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


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

示例1: bwConnecter_DoWork

        private void bwConnecter_DoWork(System.Object sender, DoWorkEventArgs e)
        {
            BackgroundConnectorArguments bca = (BackgroundConnectorArguments)e.Argument;
            _DBG.PortDefinition port = bca.connectPort;

            Debug.Assert(m_engine == null);

            e.Result = false;

#if USE_CONNECTION_MANAGER
            m_engine = m_port.DebugPortSupplier.Manager.Connect(port);
#else
            m_engine = new _DBG.Engine(port);
#endif

            m_killEmulator = false;

            lock (m_engine)
            {
                m_engine.StopDebuggerOnConnect = true;
                m_engine.OnCommand += new _DBG.CommandEventHandler(OnWPCommand);
                m_engine.OnMessage += new _DBG.MessageEventHandler(OnWPMessage);
                m_engine.Start();

                const int retries = 50;
                bool connected = false;
                for (int i = 0; connected == false && i < retries; i++)
                {
                    if (bwConnecter.CancellationPending)
                    {
                        e.Cancel = true;
                        return;
                    }
                    connected = m_engine.TryToConnect(1, 100, false, _DBG.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.");
                    }

                    //Move IsDeviceInInitializeState(), IsDeviceInExitedState(), GetDeviceState(),EnsureProcessIsInInitializedState() to Debugger.dll?
                    uint executionMode = 0;
                    m_engine.SetExecutionMode(0, 0, out executionMode);
                    if (bca.reboot || (executionMode & _WP.Commands.Debugging_Execution_ChangeConditions.c_State_Mask) != _WP.Commands.Debugging_Execution_ChangeConditions.c_State_Initialize)
                    {
                        m_engine.RebootDevice(_DBG.Engine.RebootOption.RebootClrWaitForDebugger);
                        m_engine.TryToConnect(10, 1000);
                        m_engine.SetExecutionMode(0, 0, out executionMode);
                        Debug.Assert((executionMode & _WP.Commands.Debugging_Execution_ChangeConditions.c_State_Mask) == _WP.Commands.Debugging_Execution_ChangeConditions.c_State_Initialize);
                    }

                    m_engine.ThrowOnCommunicationFailure = true;
                    m_session = new _PRF.ProfilerSession(m_engine);
                    if (m_exporter != null)
                    {
                        m_exporter.Close();
                    }

                    switch (bca.exporter)
                    {
                        case BackgroundConnectorArguments.ExporterType.CLRProfiler:
                            m_exporter = new _PRF.Exporter_CLRProfiler(m_session, bca.outputFileName);
                            break;
#if DEBUG
                        case BackgroundConnectorArguments.ExporterType.OffProf:
                            m_exporter = new _PRF.Exporter_OffProf(m_session, bca.outputFileName);
                            break;
#endif
                        default:
                            throw new ArgumentException("Unsupported export format");
                    }
                    m_session.EnableProfiling();
                    e.Result = true;
                }
            }
            return;
        }
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:80,代码来源:ProfilerLauncherForm.cs


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