public virtual void OnConnect(object obj, ConnectionEventArgs args) { if (Connect != null) { Connect(obj, args); } }
private void OnWatchDisconnect(object sender, ConnectionEventArgs e) { #region Notify the watcher that their connection to the host was lost VideoForm.Invoke((MethodInvoker)delegate { VideoForm.ChatService.PrintLocalMessage("Connection to host lost.", Color.SlateGray); }); #endregion }
private void OnHostConnect(object sender, ConnectionEventArgs e) { #region Send the Client our current PlayState switch ((int)Player.playState) { case 1: e.Client.sendObject(Debug.IsValidURL(Player.URL) ? new JoinPacket(PlayState.STOP, Player.URL) : new JoinPacket(PlayState.STOP, null)); break; case 2: e.Client.sendObject(Debug.IsValidURL(Player.URL) ? new JoinPacket(PlayState.PAUSE, Player.URL) : new JoinPacket(PlayState.PAUSE, null)); break; case 3: e.Client.sendObject(Debug.IsValidURL(Player.URL) ? new JoinPacket(PlayState.PLAY, Player.URL) : new JoinPacket(PlayState.PLAY, null)); break; } #endregion #region Notify the Host of the connection (via MessageBox) VideoForm.Invoke(new MethodInvoker(delegate { MessageBox.Show(VideoForm, "Connection received from " + e.Client.IPAddress + ".", "Connection Received", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); })); #endregion }
private void OnHostDisconnect(object sender, ConnectionEventArgs e) { #region Print a global message of the disconnected client VideoForm.Invoke(new MethodInvoker(delegate { VideoForm.ChatService.PrintGlobalMessage(e.Client.IPAddress + " has disconnected.", Color.SlateGray); })); #endregion }
private void OnDisconnect(object sender, ConnectionEventArgs e) { Thread.Sleep(10000); Connect(); }