So i have a process that runs for a bit with larger files and looking to add a "Please Wait.... Processing... popup so that know its working on their tasks.
I followed this video example on youtube C# Wait Form Tutuorial
Implemented just like the example, but but method that actually does the work never runs
This is my processing form logic, which does display when i run the whole application
public partial class Processing : Form
{
public Action Worker { get; set; }
public Processing(Action worker)
{
InitializeComponent();
if(worker==null)
throw new ArgumentNullException();
Worker = worker;
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
Task.Factory.StartNew(Worker).ContinueWith(t => { this.Close(); }, TaskScheduler.FromCurrentSynchronizationContext());
}
}
Then this is how i call it from my button click
private void btnFilters_Click(object sender, EventArgs e)
{
using (Processing pc = new Processing(ParseFilteredData))
{
pc.ShowDialog(this);
}
//ParseFilteredData();
}
Why is my ParseFilteredData executing but not updating my main form? I stepped thru the code and it executes the method, but my UI doesnt reflect the data.
Please keep in mind that my ParseFilteredData works, if you comment out the using statement and just run the method on button click, after a few minutes, all my listboxes are populated.