Paint.HomeScreen.InvokeCommandAndShowBusyIndicator C# (CSharp) Method

InvokeCommandAndShowBusyIndicator() private method

private InvokeCommandAndShowBusyIndicator ( Action command ) : void
command Action
return void
        private void InvokeCommandAndShowBusyIndicator(Action command)
        {
            this.activityIndicatorView.StartAnimating();

            BackgroundWorker backgroundWorker = new BackgroundWorker();
            backgroundWorker.DoWork += (s2, e2) =>
            {
                this.InvokeOnMainThread(() =>
                {
                    command();
                });
            };

            backgroundWorker.RunWorkerAsync();

            backgroundWorker.RunWorkerCompleted += (s3, e3) =>
            {
                this.activityIndicatorView.StopAnimating();
            };
        }