public async Task LoadData() { try { var sw = Stopwatch.StartNew(); var settingsFile = new FileInfo("settings.xml"); if (settingsFile.Exists) { SettingsManager.Load(settingsFile.FullName); } else { SettingsManager.InitalizeNew(); } Settings = SettingsManager.Current; await MusicDataManager.Load(AppDomain.CurrentDomain.BaseDirectory); MusicDataManager.MusicStreamingPluginManager.LoadPlugins("", new IMusicStreamingService[] { new YouTubeService() }); Debug.Print($"Dataloading time: {sw.ElapsedMilliseconds}"); SettingsViewModel = new SettingsViewModel(MusicDataManager, () => RefreshView?.Invoke(this, EventArgs.Empty)); } catch (Exception) { NotificationManager.ShowInformation(Application.Current.Resources["Error"].ToString(), Application.Current.Resources["ErrorWhileLoadingData"].ToString(), MessageNotificationIcon.Error); } ViewManager = new ViewManager(MusicDataManager.Playlists); ViewManager.ViewItems.First(x => x is QueueView) .Load(MusicDataManager, _viewController, NotificationManager).Forget(); //Important because the queue view wants to set an event SelectedViewItem = ViewManager.ViewItems[0]; }
private void OnRefreshView(object sender, EventArgs args) { RefreshView?.Invoke(sender, args); }
protected virtual void OnRefresh(EventArgs e) { RefreshView?.Invoke(this, e); }