Exemplo n.º 1
0
        public MainWindowVM()
        {
            model = new SomethingModel();

            Run = new DelegateCommand(async() =>
            {
                IsBusy = true;

                Data0.Clear();
                var j0 = model.RunSin((d) =>
                {
                    Data0.AddRange(d);
                    RaisePropertyChanged(nameof(Data0));
                });
                Data1.Clear();
                var j1 = model.RunCos((d) =>
                {
                    Data1.AddRange(d);
                    RaisePropertyChanged(nameof(Data1));
                });
                Data2.Clear();
                var j2 = model.RunRect((d) =>
                {
                    Data2.AddRange(d);
                    RaisePropertyChanged(nameof(Data2));
                });
                Data3.Clear();
                var j3 = model.RunSinc((d) =>
                {
                    Data3.AddRange(d);
                    RaisePropertyChanged(nameof(Data3));
                });
                await Task.WhenAll(j0, j1, j2, j3);

                IsBusy = false;
            });

            Stop = new DelegateCommand(async() =>
            {
                await model.Cancel();
            });
        }