简体   繁体   English

如何在有限状态机实现中与用户通信?

[英]How do I communicate with the user in a finite state machine implementation?

Basically I have a custom implemented finite state machine that mostly listens for hardware switch state changes for initiating transitions, but some things need communication with the user... 基本上我有一个自定义实现的有限状态机,主要监听硬件开关状态变化以启动转换,但有些事情需要与用户通信...

For instance, the user needs to tell it whether to repeat or save and reset. 例如,用户需要告诉它是重复还是保存和重置。

I have a pretty good idea of how to do it... I can raise events when it gets to that point, and then the UI layer will ask the user and then trigger the transition, but is there some better way or some patterns I should be following? 我对如何做到这一点非常了解...我可以在达到这一点时引发事件,然后UI层会询问用户然后触发转换,但是有更好的方法或某些模式我应该遵循?

Just looking for some insight so I don't do this the wrong way. 只是寻找一些见解,所以我不这样做错误的方式。

I'm marking this as community wiki since it's not really a single answer type of question. 我将此标记为社区维基,因为它不是真正的单一答案类型的问题。

I'd guess that a natural way to organize such communication would be to set up a special state (or states) in your machine. 我猜想组织这种通信的一种自然方式是在你的机器中建立一个特殊的状态(或状态)。

Start -> Ask user's name -> Say hello 开始 - >询问用户名 - >打招呼

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何命名和组织有限状态机使用的方法? - How can I name and organize methods used by a finite state machine? 有限状态机问题 - Finite State Machine issue 有限状态机是否应该具有“嵌套”有限状态机? - Should a Finite State Machine have a "nested" Finite State Machine? 创建可扩展的有限状态机 - Creating an extendable finite state machine 如何将 Switch 语句重构为灵活有限 State 机器 - How To Refactor Switch Statement To Flexible Finite State Machine 我应该触发触发器来改变有限状态机中的OnEntry()方法的状态吗? - Should I fire trigger to change state from the OnEntry() method in finite state machine? 使用有限状态机解析 CSV 数据 - Parsing CSV data using a finite state machine C# Unity,用 Animator 编写一个有限状态机,但是当条件停止时我有一个奇怪的循环 - C# Unity, writing a Finite state machine with Animator, but i have a weird loop when the condition stops 在C#中,如何在网络计算机上对用户进行身份验证? - In C#, how do I authenticate a user on a network machine? 如何在不同的Silverlight用户控件和子页面之间进行通信? - How do I communicate between different Silverlight user controls and sub-pages?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM