How to create a navigation menu in dotnet application?

后端 未结 1 1731
北海茫月
北海茫月 2021-01-26 06:00

I have created a console application which have a menu that allow me to navigate between the menu items. I handle the navigation logic in this method:

public vir         


        
相关标签:
1条回答
  • 2021-01-26 06:48

    The short answer to doing what you want to do is that you simply can't.

    Think about it: you are trying to have an interactive program (that users can interact with via the keyboard). But you are also making it a daemon (a deamon runs the background and doesn't interact with users directly). These are two contradictory goals.

    When systemd (or supervisord, or upstart or really any system services program) runs your application as a service, it doesn't give it a way to interact with users, since these applications want to be daemons - which means users can't interact with them.

    So, ask yourself what you want to do: do you want to make an interactive program or not? If you want make an interactive program you can't run it via supervisor. Run it directly, via dotnet /path/to/your.dll.

    Other comments:

    • ReadKey may have issues, but certainly not in the common case that you are drying to do, which seems to be Linux on x86_64.

    • OmniSharp is a plugin for IDEs/text-editors to make development easier. It provides auto completion and real time syntax highlighting. It's not involved when you are running your application.

    0 讨论(0)
提交回复
热议问题