protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); MusicPlayer player = new(); await PlayPause.InitializeAsync(this, player); await VolumeUp.InitializeAsync(this, player); await VolumeDown.InitializeAsync(this, player); await PickFolder.InitializeAsync(this, player); }
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e) { MusicPlayer player = _player; if (!player.IsPlaying) { Command.Checked = false; player.Play(); return; } General options = await General.GetLiveInstanceAsync(); if (string.IsNullOrEmpty(options.MusicFolder) && !await PickFolder.TryPickFolderAsync()) { return; } Command.Checked = true; player.NextTrack(); }