public void LeaveRoom() { syncClient.Close(); syncClient.ConnectionChanged -= SyncClient_ConnectionChanged; syncClient.SeekToReceived -= SyncClient_SeekToReceived; syncClient.PauseReceived -= SyncClient_PauseReceived; syncClient.PlayReceived -= SyncClient_PlayReceived; syncClient.ChatReceived -= SyncClient_ChatReceived; syncClient = null; }
// Plain Methods public bool JoinRoom() { if (!string.IsNullOrWhiteSpace(Properties.Settings.Default.ServerAddress) && !string.IsNullOrWhiteSpace(Properties.Settings.Default.RoomName) && !string.IsNullOrWhiteSpace(Properties.Settings.Default.Username) && syncClient == null) { syncClient = new SyncClient(Properties.Settings.Default.ServerAddress, Properties.Settings.Default.RoomName, Properties.Settings.Default.Username); syncClient.ConnectionChanged += SyncClient_ConnectionChanged; syncClient.SeekToReceived += SyncClient_SeekToReceived; syncClient.PauseReceived += SyncClient_PauseReceived; syncClient.PlayReceived += SyncClient_PlayReceived; syncClient.ChatReceived += SyncClient_ChatReceived; if (syncClient.Connect() == true) { return(true); } else { return(false); } } else { return(false); } }