got rid of all the async stuff. it was crashing the FB components

This commit is contained in:
Don Archer 2016-08-06 08:19:39 -07:00
parent 06b03558e6
commit bd549b584c
2 changed files with 11 additions and 7 deletions

View File

@ -49,9 +49,9 @@ namespace KaraokePlayer.Classes
SetupListener(); SetupListener();
} }
private async void SetupListener() private void SetupListener()
{ {
await _client.OnAsync(CurrentSongPath, _client.OnAsync(CurrentSongPath,
added: (s, args, obj) => added: (s, args, obj) =>
{ {
Console.WriteLine("added " + args.Path + " " + args.Data); Console.WriteLine("added " + args.Path + " " + args.Data);
@ -63,7 +63,7 @@ namespace KaraokePlayer.Classes
} }
); );
await _client.OnAsync(StatePath, _client.OnAsync(StatePath,
added: (s, args, obj) => added: (s, args, obj) =>
{ {
// do we need this? don't think so // do we need this? don't think so
@ -80,7 +80,8 @@ namespace KaraokePlayer.Classes
private void CurrentSongDidChange() private void CurrentSongDidChange()
{ {
var item = _client.Get(CurrentSongPath).ResultAs<QueueItem>(); var response = _client.Get(CurrentSongPath);
var item = response.ResultAs<QueueItem>();
if (item == null) return; if (item == null) return;
if (CurrentSong == null || CurrentSong.Path != item.Song.Path) if (CurrentSong == null || CurrentSong.Path != item.Song.Path)
{ {

View File

@ -38,13 +38,16 @@ namespace KaraokePlayer
switch (args.State) switch (args.State)
{ {
case PlayerState.playing: case PlayerState.playing:
this.Invoke(new Action(() => { player.play(); })); //this.Invoke(new Action(() => { player.play(); }));
player.play();
break; break;
case PlayerState.paused: case PlayerState.paused:
this.Invoke(new Action(() => { player.pause(); })); //this.Invoke(new Action(() => { player.pause(); }));
player.pause();
break; break;
case PlayerState.stopped: case PlayerState.stopped:
this.Invoke(new Action(() => { player.stop(); })); //this.Invoke(new Action(() => { player.stop(); }));
player.stop();
break; break;
} }
}, },