console-application

How do I enable logging for HttpClient in a .NET Core console app?

人走茶凉 提交于 2021-01-29 03:20:45
问题 .NET Core 2.2 I have a basic CLI created with dotnet new console . It uses HttpClient to make web requests. How can I see trace or logging information about these requests? Data like this: https://www.stevejgordon.co.uk/httpclientfactory-asp-net-core-logging In the .NET Framework, you could turn on System Tracing: https://docs.microsoft.com/en-us/dotnet/framework/network-programming/how-to-configure-network-tracing 回答1: In your appsettings.json file there will be an object which looks similar

Best place to store saved messages

柔情痞子 提交于 2021-01-28 18:55:24
问题 I am currently creating a console applications that only accepts some commands defined by me. The thing is I'm storing a lot of error and notification messages on a static class I created called Messages and then just calling them like Messages.ErrorMessage.... ErrorMessage is just a static string that contains w/e I want printed on the console. What I wanted to ask is if that's a good way of implementing such behavior or should I instead change where I'm keeping all of this Messages? Thanks

Console APP with Timer not running

岁酱吖の 提交于 2021-01-28 11:02:31
问题 I did this first into a WinForm project, now I've changed the application type to "Console application", I've deleted the form1.vb, changed the startup object to this "Module1.vb" but now I can't run the app. well the app runs but the timer tick is doing nothing, the code is exactly the same, I only did one change for the sub main/form1_load name What I'm doing wrong? PS: I've tested if the error was in the conditional of the lock method and all is good there, the problem is with the ticker

Why Does C# Console Application Stop Running When Text is HIghlighted?

 ̄綄美尐妖づ 提交于 2021-01-28 02:41:11
问题 I have a console application which acts as a Synchronous Server Socket to receive data from a Synchronous Client Socket on the same machine. After sending some data a few times from the Client to the Server I realize that if I were to highlight some text in the console, it would stop running code and the Client would not be able to establish a connection. I'd like to know the reason why this happens and if there is a way to make the code still run. 回答1: Essentially, the console is locked, to

Adding MenuItems to Contextmenu for a TrayIcon in a Console app

我的梦境 提交于 2021-01-28 01:11:14
问题 I made a little console app which locks the Mouse to the first screen. Now I want to create a TrayIcon with a ContextMenu to close the application. In debug-mode, I can see that the ContextMenu has two Items, just like it should, but it doesn't display the ContextMenu. An EventHandler shouldn't be needed from what I've read so far. My code: static void GenerateTrayIcon() { ContextMenu trayiconmenu = new ContextMenu(); trayiconmenu.MenuItems.Add(0, new MenuItem("Show", new EventHandler(Show

Pure console Android Application?

拜拜、爱过 提交于 2021-01-27 21:08:02
问题 Is it possible to create a pure console android application that will run in the android emulator? I mean we can run classic desktop Java application that utilize System.out.println for console output, so I don't see why we are not able to do the same for Android via the android.util.Log classes. The advantages of doing it on an emulator will be that gives access to the desired functionality implemented by Android Java classes. Perhaps a dex file without the Application , Activity class and

Draw a circle around cursor (C#)

老子叫甜甜 提交于 2021-01-27 19:20:17
问题 using C#; I'm trying to make an application using a Leap Motion sensor to map finger movements to cursor movement. On the screen, I would like to draw a circle around the cursor. After some searching I found someone trying to do the same thing (Leap Motion excluded) Want a drawn circle to follow my mouse in C#. The code presented there: private void drawCircle(int x, int y) { Pen skyBluePen = new Pen(Brushes.DeepSkyBlue); Graphics graphics = CreateGraphics(); graphics.DrawEllipse( skyBluePen,

How to prevent automatic newlines, when the output is wider than the console?

心不动则不痛 提交于 2021-01-27 13:12:05
问题 I'm implementing the game of life, using console output. So far it's looking good: However, when I make the width of the output larger than the with of the console, this happens: Instead of letting the lines run offscreen, it inserts a newline. Is there a way to turn this off? I'm on a small laptop, so changing the console width doesn't really help. 回答1: I think you have to get and set the maximum length of the screen. So you get the length. If you need more space you can set the windows size

Ctrl-S input event in Windows console with ReadConsoleInputW

北城以北 提交于 2021-01-27 11:44:59
问题 I am using ReadConsoleInputW to read Windows 10 console input. I want to be able to detect when Ctrl + S is pressed. Using the code I have, I can detect Ctrl + Q without issue, but I'm not seeing anything for Ctrl + S . Is Ctrl + S even detectable? The below is the sequence of INPUT_RECORD I read when pressing Ctrl + S a few times, followed by Ctrl + Q . Key { key_down: true, repeat_count: 1, key_code: 17, scan_code: 29, wide_char: 0, control_key_state: 40 } Key { key_down: true, repeat_count

Unicode special character not displaying in label

て烟熏妆下的殇ゞ 提交于 2021-01-27 05:19:11
问题 I would like to print that kind of character, but I dont get it, I thought c# supports unicode. The way I solved it: label3.Text = "\u1F6B5"; This is not the only symbol ,which does not work. Thank you. 回答1: label3.Text = "\u1F6B5"; The \u escape takes only 4 hex digits, you are trying to use 5. So you end up with a string that contains two characters, '\u1F6B' and '5'. Looks like "Ὣ5", not what you want. Using codepoints from the upper bit planes (codes >= 0x10000) require a capital U to get