MahApps / MahApps.Metro

A framework that allows developers to cobble together a better UI for their own WPF applications with minimal effort.
https://mahapps.com
MIT License
9.32k stars 2.45k forks source link

Question: How to do something during ShowProgressAsync show #3495

Closed Torchok19081986 closed 5 years ago

Torchok19081986 commented 5 years ago

Hallo , i work currently on some project and have some difficulty to start task during messagebox / progress MessageBox in wpf c#. i want to search for some itemsi in newtork and function is already here, but cant execute it. my code looks like this: .... <-- here is button / event from wpf window var controller = await this.ShowProgressAsync(this, "Header", "Message") as ProgressDialogController. controller.SetIndeterminate(); //Expectaion here to start new Task, but doesnt work here await controller.CloseAsync(); Can someone help me with ? I use Visual Studio 2019, Net Framework 4.7, MahApps.Metro in 1.6.5.

seba30 commented 5 years ago

I've already used the ProgressDialogController successfully:

_progressDialogController = await _dialogCoordinator.ShowProgressAsync(this, "Please wait", null, true);

_progressDialogController.SetIndeterminate();

_progressDialogController.Canceled += ProgressDialogControllerCanceled;

await GetResultListTask();

await _progressDialogController.CloseAsync();
_progressDialogController.Canceled -= ProgressDialogControllerCanceled;
_progressDialogController = null;
Torchok19081986 commented 5 years ago

Thanks for quick answer, @seba30. Just testet it. Works great. That mean in can execute it always during progress show, if i have to something data investigate ?

seba30 commented 5 years ago

@Torchok19081986 You're welcome. I don't understand your last question.

Torchok19081986 commented 5 years ago

ok, i try to write in another way. Is call progressdialogcontroller method are always the same ? I have to search in my project in network for specific value. Can i do ALWAYS like this or is there some limitations ?