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 8506725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:40:13+00:00 2026-06-11T02:40:13+00:00

I am using the MVC model with WPF, and am having difficulties with the

  • 0

I am using the MVC model with WPF, and am having difficulties with the UI locking up. The application is communicating between two endpoints, and the UI has a TextBox that I write detailed logs of the communication to. The code may either send a single file or multiple files in a burst.

I have a specific logging class that I use to process the logs, since they need to be created, formatted, and written to disk. I pass the TextBox to the Logging class, and then use a Dispatcher to write to it, but when I have several logs writing at the same time, the UI locks up. If I am only writing logs from a single sent file, everything works fine.

I have tried adding a Thread Lock, but this doesn’t seem to fix anything. I’ve even locked the entire writing process (processing the information, writing to disk, and writing to the UI), but continue to get the same locking problems.

The code I use to write to the UI is listed below:

    /// <summary>
    /// Post the message to the UI.
    /// </summary>
    /// <param name="message">Message to post.</param>
    /// <param name="scrollToEnd">Scroll to the end of the Text Box if true</param>
    private void PostMessage(String message, bool scrollToEnd)
    {
        LoggingBox.Dispatcher.BeginInvoke(
            System.Windows.Threading.DispatcherPriority.Normal,
            new Action(delegate()
                {
                    LoggingBox.AppendText(message);
                    if (scrollToEnd)
                        LoggingBox.ScrollToEnd();
                }
            ));
    }

The LogBox is just a TextBox:

    /// <summary>
    /// Location for logs to be displayed.
    /// </summary>
    public TextBox LoggingBox { get; set; }

This is my first time working with WPF,so I am sure there is a simple mistake that I am making. Any insight would be greatly appreciated.

  • 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-11T02:40:15+00:00Added an answer on June 11, 2026 at 2:40 am

    After following through the code, and disabling various parts, I realized that posting to the UI was not what was causing the UI to freeze. One of the objects that did a majority of the work had not been put on a separate thread by the original developer. After creating the thread, the UI stopped freezing.

    Thank you to everyone who gave assistance. The community here is awesome!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using MVC-View Model, EF Model first I am having problems with two
I am setting up an application using the MVC model and I have a
I'm new to using MVC and I'm trying to make a model that uses
I am creating a simple application using the MVC design pattern where my model
I'm using ASP.NET MVC and have a model which has an image (byte array)
using ASP.NET MVC, I have a Model, to which I'm attaching attributes so that
Im using MVC 3, EF Model first for my web application. I have a
I'm using MVC 2 and EF4. I have a view that displays my Application
Im using MVC-Viewmodel, EF Model first on my project. I have a foreach loop
I am using MVC-Viewmodel, EF model first on my project. I have 3 DropDonLista

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.