Exemple #1
0
 public virtual void OnConnect(object obj, ConnectionEventArgs args)
 {
     if (Connect != null)
     {
         Connect(obj, args);
     }
 }
Exemple #2
0
 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
 }
Exemple #3
0
        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
        }
Exemple #4
0
 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
 }
Exemple #5
0
 private void OnDisconnect(object sender, ConnectionEventArgs e)
 {
     Thread.Sleep(10000);
     Connect();
 }