Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8824139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:31:58+00:00 2026-06-14T06:31:58+00:00

I have an application which monitors some devices. I can send a string to

  • 0

I have an application which monitors some devices. I can send a string to the device, and receive text back from the device.

What I need is to make a log file (just .txt) which logs all data sent / received by the device. This should be displayed live in a the application.

Currently what I do is write the logs to a rich textbox and from there to a file. But I want to split the backend code (interfacing with the device and creating the log file) from the gui. This to make the communication interface with the device more portable.

As I am thinking through this process I face one issue: How to update the logs live in my application? I can think of this option: Make a timer and make the gui update on a time interval. but this does not feels terrible. It would be nice to have a buffer in between, and update the gui if the buffer has changed.

Any tips on how to do this correctly?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T06:32:00+00:00Added an answer on June 14, 2026 at 6:32 am

    Maybe you could make your log content IObservable and make your UI subscribe to its changes?

    Another option would be to implement INotifyPropertyChanged and and use a PropertyChangedEventHandler to be notified of changes.

    Here’s a code snippet showing you how to do it with the NotifyPropertyChanged:

    using System.ComponentModel;
    public class YourClass : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(String info)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }
    
        protected void AddLogLine(String log)
        {
            // do your process
            NotifyPropertyChanged("Log");
        }
    }
    

    To register to the changes you simply do something like (in your UI constructor):

    YourClassInstance.PropertyChanged += new PropertyChangedEventHandler(MyFunctionToHandleLogChanges);
    

    Note: make sure you properly remove and add again the handler if you change YourClassInstance

    And then to update your UI, in your UI class again:

    void MyFunctionToHandleLogChanges(object sender, PropertyChangedEventArgs e)
    {
        if (e.PropertyName == "Log")
        {
            // Update UI
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application which uses the microsoft kinect device. The thing is that
I have a Windows Service application which is performing some calls to SQL Server.
I have a dashboard web application. It contains some controls on it which are
I have a Rails 3 application of which some controllers are normal rails controllers
I have application which runs in background. I have some problem - my application
I have made a class which a form can inherit from and it handles
I have an ASP.Net MVC 3 web application in which an administrator can assign
I have a Python application in which I would like to monitor the number
I have to write a SNMP module which monitor a certain server application that
I want to make an application in C or C++ which have to monitor

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.