123456789101112131415161718192021222324252627282930 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Threading;
- namespace TestViewer
- {
- internal class Loading
- {
- public static event EventHandler<bool> LoadingChanged;
- public static void Run(Action action)
- {
- LoadingChanged?.Invoke(null, true);
- Task.Run(()=>
- {
- try
- {
- action();
- }
- finally
- {
- LoadingChanged?.Invoke(null, false);
- }
- });
- }
- }
- }
|