private void OnTickerLoading(TickerFileViewModel tickerVM) { LoadingCount++; tickers.Add(tickerVM); tickerVM.ExecuteWhenLoadCompletes(OnLoadingEnd); tickerVM.CloseCommandExecuted += OnCloseCommand; }
private void OnTickerLoaded(TickerFileViewModel tickerVM) { LoadingCount--; LoadedCount++; RecalculateIndicesFrom(tickers.IndexOf(tickerVM)); }
private void OnTickerError(TickerFileViewModel tickerVM) { LoadingCount--; ErrorCount++; }
private void OnLoadingEnd(TickerFileViewModel tickerVM) { if (tickerVM.LoadState == AsyncState.Error) OnTickerError(tickerVM); else OnTickerLoaded(tickerVM); }
private void OnCloseCommand(TickerFileViewModel tickerVM) { ChangeCount(tickerVM.LoadState, false); int index = tickers.IndexOf(tickerVM); tickers.Remove(tickerVM); RecalculateIndicesFrom(index); }
private void OnClearAll() { var tickersCopy = new TickerFileViewModel[tickers.Count]; tickers.CopyTo(tickersCopy, 0); tickers.Clear(); foreach (var t in tickersCopy.Where(x => x.LoadState == AsyncState.Running)) t.RemoveNotification(OnLoadingEnd); LoadingCount = 0; ErrorCount = 0; LoadedCount = 0; }