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


C# States.ToString方法代码示例

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


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

示例1: GetNextState

 //public static States GetPreviousState(States currentState)
 //{
 //    switch (currentState)
 //    {
 //        case States.Eating:
 //            return States.Ordering;
 //        case States.Checkout:
 //            return States.Eating;
 //        case States.Paying:
 //            return States.Checkout;
 //        default:
 //            throw new NotSupportedException("currentState not supported: " + currentState.ToString());
 //    }
 //}
 public static States GetNextState(States currentState)
 {
     switch (currentState)
     {
         case States.Ordering:
             return States.Eating;
         case States.Eating:
             return States.Checkout;
         case States.Checkout:
             return States.Finished;
         default:
             throw new NotSupportedException("currentState not supported: " + currentState.ToString());
     }
 }
开发者ID:CodeByBerglund,项目名称:nai-framework,代码行数:28,代码来源:StateMachineHelper.cs

示例2: TestAndUpdateStateAsync

        private async Task TestAndUpdateStateAsync()
        {
            switch (currentState)
            {
                case States.Init:
                    currentState = States.Ready;
                    VisualStateManager.GoToState(this, currentState.ToString(), true);
                    break;
                case States.Ready:
                    if(currentReading > 0)
                    {
                        currentReading = 0;
                        maxReading = 0;
                        currentcaptureSecond = captureSeconds;
                        currentState = States.Capturing;
                        VisualStateManager.GoToState(this, currentState.ToString(), true);
                        countdownTimer.Start();
                    }
                    break;
                case States.Capturing:
                    if (currentcaptureSecond <= 0)
                    {
                        currentState = States.Sending;
                        VisualStateManager.GoToState(this, currentState.ToString(), true);
                        await SendReadingAsync();
                        currentState = States.Cooldown;
                        VisualStateManager.GoToState(this, currentState.ToString(), true);
                    }
                    break;
                case States.Cooldown:
                    if (currentReading < 1)
                    {
                        currentState = States.Ready;
                        VisualStateManager.GoToState(this, currentState.ToString(), true);
                        //AliasBlock.Text = string.Empty;
                    }

                    break;
            }
        }
开发者ID:toolboc,项目名称:iot-devices,代码行数:40,代码来源:MainPage.xaml.cs

示例3: SetState

 public void SetState(States newState)
 {
     curState = newState;
     Debug.Log(gameObject.name + " is " + curState.ToString());
 }
开发者ID:AlexanderMekumyanov,项目名称:SerKnight,代码行数:5,代码来源:Actor.cs

示例4: TakeMeasurements

        //=================================================================================================//
        private bool TakeMeasurements(States callerState, ref Measurement measurement)
        {
            const string STRLOG_MethodName = "TakeMeasurements";

            string logMessage = STRLOG_CallerState + callerState.ToString();

            Logfile.WriteCalled(this.logLevel, STRLOG_ClassName, STRLOG_MethodName, logMessage);

            bool success = false;

            //
            // Create the data structure for storing the measurements
            //
            measurement = new Measurement();

            //
            // Initialise state machine
            //
            this.lastError = null;
            States state = States.MeasureFieldCurrent;

            //
            // State machine loop
            //
            while (state != States.Done)
            {
                double value = 0;
                string units = String.Empty;

                //Trace.WriteLine("state: " + state.ToString());

                switch (state)
                {
                    case States.MeasureFieldCurrent:
                        //
                        // Measure the field current
                        //
                        if ((success = this.plc.GetSyncFieldCurrent(ref value, ref units)) == true)
                        {
                            //
                            // Save the field current measurement
                            //
                            measurement.fieldCurrent = value;
                            if (this.measurements.units.fieldCurrent == null)
                            {
                                this.measurements.units.fieldCurrent = units;
                            }

                            state = States.MeasureSyncVoltage;
                        }
                        else
                        {
                            this.lastError = this.plc.LastError;
                        }
                        break;

                    case States.MeasureSyncVoltage:
                        //
                        // Measure the sync voltage
                        //
                        if ((success = this.plc.SyncMonitor.GetSyncVoltage(ref value, ref units)) == true)
                        {
                            //
                            // Save the sync voltage measurement
                            //
                            measurement.syncVoltage = value;
                            if (this.measurements.units.syncVoltage == null)
                            {
                                this.measurements.units.syncVoltage = units;
                            }

                            //
                            // Determine next state
                            //
                            if (callerState == States.TakeMeasurementsForVoltages)
                            {
                                state = States.MeasureMainsVoltage;
                            }
                            else if (callerState == States.TakeMeasurementsForSynchronism)
                            {
                                state = States.MeasureSyncToMainsPhase;
                            }
                            else
                            {
                                state = States.MeasureSyncFrequency;
                            }
                        }
                        else
                        {
                            this.lastError = this.plc.SyncMonitor.LastError;
                        }
                        break;

                    case States.MeasureMainsVoltage:
                        //
                        // Measure the mains voltage
                        //
                        if ((success = this.plc.SyncMonitor.GetMainsVoltage(ref value, ref units)) == true)
                        {
//.........这里部分代码省略.........
开发者ID:votrongdao,项目名称:UQ-iLab-BatchLabServer,代码行数:101,代码来源:DriverMachine_Sync.cs

示例5: Idle

 public States Idle(States state)
 {
     foreach (string direction in DIRECTIONS)
     {
         if (state.ToString().Contains(direction))
         {
             return (States) Enum.Parse(typeof(States), direction + "_IDLE");
         }
     }
     Debug.Log("You must've fallen somehow.");
     return state;
 }
开发者ID:yjao,项目名称:CapstoneProject,代码行数:12,代码来源:CharacterAnimations.cs


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