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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:21:44+00:00 2026-06-14T05:21:44+00:00

I am trying to use a textbox to show Tasks completing. Basically like how

  • 0

I am trying to use a textbox to show Tasks completing. Basically like how console application would show what is happening.

However the text in the textbox is only updating after Window_Loaded_1 has completed, then all the text gets displayed instead of in realtime.

xaml code:

<Window x:Class="timelineTesting.Windows.CreateNewProject"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="CreateNewProject" Height="300" Width="579" Loaded="Window_Loaded_1">
<Grid>
    <Grid.RowDefinitions>
        <RowDefinition/>
    </Grid.RowDefinitions>
    <TextBox Text="{Binding Path=LogData, UpdateSourceTrigger=PropertyChanged}" />
</Grid>

C# code:

public partial class CreateNewProject : Window, INotifyPropertyChanged
{
    private string _data;
    public String LogData
    {
        get
        {
            return _data;
        } 
        set
        {
            _data = value;
            OnPropertyChanged("LogData");
        }
    }

    public CreateNewProject()
    {
        InitializeComponent();
        this.DataContext = this;   
    }

    private void Window_Loaded_1(object sender, RoutedEventArgs e)
    {
        Task t = new Task(() => Directory.CreateDirectory(this.ProjectName));

        LogData+="Starting new project creation...." + Environment.NewLine;
        LogData += "Creating project directory '" + ProjectName + "'....";
        try
        {
            t.Start();
            t.Wait();
        }
        catch (Exception ex)
        {
            LogData += "Error:" + Environment.NewLine;
            LogData += ex.InnerException.ToString();
        }

        LogData+= "Done!" + Environment.NewLine;

        t = new Task(() => File.Copy(this.VideoFilePath, newVideoPath));
        LogData+= "Copying video file to project directory....";
        try
        {
            t.Start();
            t.Wait();
        }
        catch (Exception ex)
        {
            LogData+= "Error:" + Environment.NewLine;
            LogData+= ex.InnerException.ToString();
        }

        LogData+= "Done!" + Environment.NewLine;
        // many more tasks
    }

    public event PropertyChangedEventHandler PropertyChanged;

    protected virtual void OnPropertyChanged(string propertyName)
    {
        PropertyChangedEventHandler handler = this.PropertyChanged;
        if (handler != null)
        {
            handler(this, new PropertyChangedEventArgs(propertyName));
        }
    }
  • 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-14T05:21:46+00:00Added an answer on June 14, 2026 at 5:21 am

    Use await:

    private async void Window_Loaded_1(object sender, RoutedEventArgs e)
    {
      Task t = Task.Run(() => Directory.CreateDirectory(this.ProjectName));
      LogData += "Starting new project creation...." + Environment.NewLine;
      LogData += "Creating project directory '" + ProjectName + "'....";
      try
      {
        await t;
      }
      catch (Exception ex)
      {
        LogData += "Error:" + Environment.NewLine;
        LogData += ex.ToString();
      }
    
      LogData += "Done!" + Environment.NewLine;
    
      t = Task.Run(() => File.Copy(this.VideoFilePath, newVideoPath));
      LogData += "Copying video file to project directory....";
      try
      {
        await t;
      }
      catch (Exception ex)
      {
        LogData += "Error:" + Environment.NewLine;
        LogData += ex.ToString();
      }
    
      LogData += "Done!" + Environment.NewLine;
    
      // many more tasks
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple textbox, and I would like to show an image if
I'm trying to use a textbox or textarea to show a preview of some
I'm trying to use the SelectionStart and SelectionLength properties for a textbox. It is
I'm trying to use a RegularExpressionValidator to validate a TextBox input length. I have
I'm trying to use asp: <asp:TextBox ID=txtInput runat=server TextMode=MultiLine></asp:TextBox> I want a way to
I'm trying to use Rails validations for a form text box to see if
I am trying use gem tire to search in my application. I have tables
I'm trying to save the contents of a textbox to a text file using
I am currently trying to validate a textbox, so only letters (a-Z) can be
I am trying to use ASP.NET Server Controls (ASP.TextBox etc) with MVC (to take

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.