Console and GUI app in same EXE #1946
Unanswered
TonyValenti
asked this question in
Q&A
Replies: 2 comments
-
Termina.gui has nothing built in that will help.
However, it is possible to do, at least on Windows. Last time I did it, I had two .exe files. Foo.exe and FooGui.exe.
`foo —gui` would launch FooGui.exe
IIRC it’s more tricky to make it be in a single .exe.
…-cek
Sent via mobile. Expect brevity, typos, and dangerous driving.
________________________________
From: Tony Valenti ***@***.***>
Sent: Saturday, August 6, 2022 1:52:46 PM
To: gui-cs/Terminal.Gui ***@***.***>
Cc: Subscribed ***@***.***>
Subject: [gui-cs/Terminal.Gui] Console and GUI app in same EXE (Discussion #1946)
I just found this library and have some questions.
I have seen some MS utilities that are desktop applications but they have a console mode if you run them from the command line or with command line arguments.
I would like to do something similar in my app. Does this library have some way to determine if it was invoked as a console app? Or does it have some way to either create a console for a desktop app (or hide the console from a console app that wants to launch a WPF gui?
—
Reply to this email directly, view it on GitHub<#1946>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAEO6CQKJUCDD3PY5GT7YP3VX27A5ANCNFSM55ZHVFMQ>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
-
In this example im using public static async Task Main(string[] args)
{
var rootCommand = new RootCommand();
var guiOption = new Option<bool>("gui", "Starts the server with a GUI.");
rootCommand.AddOption(guiOption);
rootCommand.SetHandler(
async (gui) =>
{
var runnable = gui ? StartGuiAsync() : StartServerAsync();
await runnable;
},
guiOption
);
await rootCommand.InvokeAsync(args);
}
private static Task StartGuiAsync()
{
Application.Init();
Application.Run(new MainView());
Application.Shutdown();
return Task.CompletedTask;
}
public static async Task StartServerAsync()
{
//Run without GUI.
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I just found this library and have some questions.
I have seen some MS utilities that are desktop applications but they have a console mode if you run them from the command line or with command line arguments.
I would like to do something similar in my app. Does this library have some way to determine if it was invoked as a console app? Or does it have some way to either create a console for a desktop app (or hide the console from a console app that wants to launch a WPF gui?
Beta Was this translation helpful? Give feedback.
All reactions