private async Task RefreshSelectedDemos() { IsBusy = true; HasNotification = true; NotificationMessage = "Analyzing..."; List <Demo> demosFailed = new List <Demo>(); List <Demo> demosNotFound = new List <Demo>(); foreach (Demo demo in SelectedDemos) { if (!File.Exists(demo.Path)) { demosNotFound.Add(demo); continue; } try { NotificationMessage = "Analyzing " + demo.Name + "..."; await _demosService.AnalyzeDemo(demo); if (AppSettings.IsInternetConnectionAvailable()) { await _demosService.AnalyzeBannedPlayersAsync(demo); } await _cacheService.WriteDemoDataCache(demo); } catch (Exception e) { Logger.Instance.Log(e); demo.Status = "old"; demosFailed.Add(demo); await _cacheService.WriteDemoDataCache(demo); } } IsBusy = false; HasNotification = false; CommandManager.InvalidateRequerySuggested(); if (demosNotFound.Any()) { await _dialogService.ShowDemosNotFoundAsync(demosNotFound); } if (demosFailed.Any()) { await _dialogService.ShowDemosFailedAsync(demosFailed); } }
public DetailsViewModel(IDemosService demosService, DialogService dialogService, ISteamService steamService, ICacheService cacheService, ExcelService excelService) { _demosService = demosService; _dialogService = dialogService; _steamService = steamService; _cacheService = cacheService; _excelService = excelService; if (IsInDesignModeStatic) { Application.Current.Dispatcher.Invoke(async() => { CurrentDemo = await _demosService.AnalyzeDemo(new Demo(), CancellationToken.None); }); } Messenger.Default.Register <SelectedPlayerChangedMessage>(this, HandleSelectedPlayerChangedMessage); }
public DetailsViewModel(IDemosService demosService, DialogService dialogService, ISteamService steamService, ICacheService cacheService, ExcelService excelService) { _demosService = demosService; _dialogService = dialogService; _steamService = steamService; _cacheService = cacheService; _excelService = excelService; if (IsInDesignModeStatic) { var demo = _demosService.AnalyzeDemo(new Demo()); CurrentDemo = demo.Result; IsAnalyzing = true; HasNotification = true; NotificationMessage = "Loading..."; } Messenger.Default.Register <SelectedPlayerChangedMessage>(this, HandleSelectedPlayerChangedMessage); }
public DetailsViewModel(IDemosService demosService, DialogService dialogService, ISteamService steamService, ICacheService cacheService, ExcelService excelService) { _demosService = demosService; _dialogService = dialogService; _steamService = steamService; _cacheService = cacheService; _excelService = excelService; if (IsInDesignModeStatic) { Application.Current.Dispatcher.Invoke(async () => { CurrentDemo = await _demosService.AnalyzeDemo(new Demo(), CancellationToken.None); }); } Messenger.Default.Register<SelectedPlayerChangedMessage>(this, HandleSelectedPlayerChangedMessage); }
public DetailsViewModel(IDemosService demosService, DialogService dialogService, ISteamService steamService, ICacheService cacheService, ExcelService excelService) { _demosService = demosService; _dialogService = dialogService; _steamService = steamService; _cacheService = cacheService; _excelService = excelService; if (IsInDesignModeStatic) { var demo = _demosService.AnalyzeDemo(new Demo()); CurrentDemo = demo.Result; } }
public DetailsViewModel(IDemosService demosService, DialogService dialogService, ISteamService steamService, ICacheService cacheService, ExcelService excelService) { _demosService = demosService; _dialogService = dialogService; _steamService = steamService; _cacheService = cacheService; _excelService = excelService; if (IsInDesignModeStatic) { var demo = _demosService.AnalyzeDemo(new Demo()); CurrentDemo = demo.Result; IsAnalyzing = true; HasNotification = true; NotificationMessage = "Loading..."; } Messenger.Default.Register<SelectedPlayerChangedMessage>(this, HandleSelectedPlayerChangedMessage); }