Click here to Skip to main content
15,887,585 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I need to update UI via new thread during another background thread is running.

i.e

I need to update image of current button before it reaches to next page on button click.

thanks
Sunny

What I have tried:

public void GoNext()
        {

            
           
            if (touchDevice != null)
                CaptureTouch(touchDevice);
                    

            //Create instance of current window data context
            var vm = DataContext as DeviceInfoViewModel;
            //if not null proceed
            if (vm != null)
            {
                // Gets the selected network adapter
                vm.AdapterDesc = Adapters.SelectedItem.ToString();

                //check if "None" is selected or not from the dropdown. 
                //If not proceed with IP configuration
                if (!vm.AdapterDesc.Trim().ToLower().Equals(Settings.Default.NONE.ToLower()))
                {
                    //sets IP config to selected adapter.
                    vm.SetIpCommand.Execute(null);
                }
                //navigate to next window on successfull completion
                Navigate();
            }
            
                      
        }
Posted
Updated 29-Mar-17 21:35pm

1 solution

I can found the sol.

await Task.Run(() =>
            {
                int progress = 0;
                for (int i = 1; i < 5; i++)
                {
                    System.Threading.Thread.Sleep(1);
                    progress++;

                }
            });


Just put above code between the code where we want to do preform another task.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900