Example #1
0
        private void _updateStack(LoaderStackItem justFinishedItem)
        {
            lock ("loadstatus")
            {
                if (_loaderStack.Contains(justFinishedItem))
                {
                    _loaderStack.Remove(justFinishedItem);
                }

                if (_loaderStack.Count == 0)
                {
                    _dispatch(HideIndicator);

                    return;
                }
                var tItem = _loaderStack.FirstOrDefault(_ => _.Text != null);

                _dispatch(() =>
                {
                    //find the most recent item with text, and show it.

                    ShowIndicator(tItem != null ? tItem.Text : null);
                });
            }
        }
Example #2
0
        public async Task Loader(Task awaiter, string text = null)
        {
            var lsItem = new LoaderStackItem {
                Text = text
            };

            _loaderStack.Insert(0, lsItem);

            _dispatch(() => ShowIndicator(text));

            await awaiter;

            _updateStack(lsItem);
        }
Example #3
0
        public async Task <T> Loader <T>(Task <T> awaiter, string text = null)
        {
            var lsItem = new LoaderStackItem {
                Text = text
            };

            _loaderStack.Insert(0, lsItem);

            _dispatch(() => ShowIndicator(text));

            await awaiter;

            _updateStack(lsItem);

            return(awaiter.Result);
        }