开发者

Trigger a function call in a console application from a shell command

开发者 https://www.devze.com 2023-04-01 16:56 出处:网络
How would I go ab开发者_JAVA百科out modifying my c# console application to retrieve values or have methods or events triggered by a shell command.

How would I go ab开发者_JAVA百科out modifying my c# console application to retrieve values or have methods or events triggered by a shell command.

Basically after the applications loads I want the ability to be able to execute functions in the application as well as pass data to those functions.

Any Direction?


.NET 3.5 Adds Named Pipes Support, I think it can be a solution.


EDIT: better link.

You may use SingleInstance pattern - C# : how to - single instance application that accepts new parameters? .


you should accept input from the console using something like:

Console.ReadLine();

it would work, then the user types a command and clicks enter and you parse the command and execute the actions you need to execute.

it's a bit old fashion like DOS programs, and keep in mind that depending on your design the Console application you are writing would hang until the user enters value and presses ENTER key, means cannot execute anything else because the thread which callls Console.ReadLine waits that command to come from the user.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号