开发者

displaying friendly messages to users

开发者 https://www.devze.com 2023-03-04 15:54 出处:网络
i have a TCP client-server application written in C#. My application starts many TCP Client connections and transfer data from remote servers at the same time. Because it starts doing the operation at

i have a TCP client-server application written in C#. My application starts many TCP Client connections and transfer data from remote servers at the same time. Because it starts doing the operation at the same time, there become many user friendly messages to show. Currently 开发者_JAVA技巧i show these messages on my application within a richtextbox. But this slows down the performans. I am looking for a better way to displaying these messages so that my application can work better. Can you share any ideas? Thanks.


A good approach is to use a logging library like log4net for your entire app.

This allows you to configure multiple log appenders, which can be used to filter desired levels of log messages from some or all loggers into different targets (console, log file, a text box, or any other control). If you feel that a level of logging is too detailed for a certain purpose, you can easily disable it by modifying the app configuration file.

You will need to create a custom appender if you don't want to use preconfigured ones, but there are examples on how to do it:

  • Log4net Scrolling text box
  • Using a delegate and Custom Appender with log4net to display live log text
  • Rich Text Box appender


Servers should be Windows Services, not winform applications.

Write to a log file using an existing framework like nlog.


If there are that many messages, are you sure you really want to show them all? Why bother the user with 100s of messages? Wouldn't you rather write them to a log file?


You can try to display this information in "Console" with Console.Write(info);

0

精彩评论

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