locked
control to output to screen the details of a task

    Question

  • Hi,

    I have an app page with multiple tiles on the page which each have detailed tasks.

    I am looking for the best way to keep the user informed as a task is completed.  For example, in 1 of the tasks - it connects to the database and downloads data...so I would like to output to the screen as it connects to the data and then as it downloads data and the how much data it has downloaded etc...

    Is there a particular control perfect for this...or has anyone seen a slick tutorial going through something like this. 

    Thanks for any advise.




    • Edited by Ireland75 Monday, September 29, 2014 3:40 PM
    Monday, September 29, 2014 3:39 PM

Answers

  • Hi Ireland,

    According to your description, I realize you want to know the work process working in the task in store app. We can use Dispatcher.RunAsync method. Code looks like the following.

    private void Button_Click(object sender, RoutedEventArgs e)
    
            {
    
                Task task = new Task(new Action(WorkProcess));
    
                task.Start();
    
            }
    
    
    
            private async void WorkProcess()
    
            {
    
                 await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
    
                    {
    
                        ShowStatus("work start");
    
                    });
    
                 await Task.Delay(2000);
    
    
    
                 await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
    
                 {
    
                     ShowStatus("connect to database start");
    
                 });
    
                 await Task.Delay(2000);
    
    
    
                 await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
    
                 {
    
                     ShowStatus("connect to database end");
    
                 });
    
                 await Task.Delay(2000);
    
    
    
                 await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
    
                 {
    
                     ShowStatus("download start");
    
                 });
    
                 await Task.Delay(5000);
    
    
    
                 await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
    
                 {
    
                     ShowStatus("download end");
    
                 });
    
                 await Task.Delay(2000);
    
    
    
                 await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
    
                    {
    
                        ShowStatus("work end");
    
                    });
    
                 await Task.Delay(2000);
    
            }
    
    
    
            private void ShowStatus(string msg)
    
            {
    
                txtMSG.Text += DateTime.Now.ToString() + "    " + msg + "\r\n";
    
            }

    You can get my test project from my OneDrive. http://1drv.ms/1xvQXt2.

    If I misunderstand you, please feel free to let me know.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, September 30, 2014 5:54 AM
    Moderator

All replies

  • Hi Ireland,

    According to your description, I realize you want to know the work process working in the task in store app. We can use Dispatcher.RunAsync method. Code looks like the following.

    private void Button_Click(object sender, RoutedEventArgs e)
    
            {
    
                Task task = new Task(new Action(WorkProcess));
    
                task.Start();
    
            }
    
    
    
            private async void WorkProcess()
    
            {
    
                 await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
    
                    {
    
                        ShowStatus("work start");
    
                    });
    
                 await Task.Delay(2000);
    
    
    
                 await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
    
                 {
    
                     ShowStatus("connect to database start");
    
                 });
    
                 await Task.Delay(2000);
    
    
    
                 await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
    
                 {
    
                     ShowStatus("connect to database end");
    
                 });
    
                 await Task.Delay(2000);
    
    
    
                 await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
    
                 {
    
                     ShowStatus("download start");
    
                 });
    
                 await Task.Delay(5000);
    
    
    
                 await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
    
                 {
    
                     ShowStatus("download end");
    
                 });
    
                 await Task.Delay(2000);
    
    
    
                 await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
    
                    {
    
                        ShowStatus("work end");
    
                    });
    
                 await Task.Delay(2000);
    
            }
    
    
    
            private void ShowStatus(string msg)
    
            {
    
                txtMSG.Text += DateTime.Now.ToString() + "    " + msg + "\r\n";
    
            }

    You can get my test project from my OneDrive. http://1drv.ms/1xvQXt2.

    If I misunderstand you, please feel free to let me know.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, September 30, 2014 5:54 AM
    Moderator
  • thanks for that...it helps what I am looking for.

    Wednesday, October 01, 2014 4:44 PM