private void VideoDlg_FormClosing(object sender, FormClosingEventArgs e) { if (this.userid > 0 && unsubscribe_cmdid == 0) { if (MessageBox.Show("Do you wish to stop receiving video from this user?", "Close Video", MessageBoxButtons.YesNo) == DialogResult.Yes) { //we wait for the server to repond to us that we'll no //longer receive video from this user. ttclient.OnCmdProcessing += new TeamTalk.CommandProcessing(ttclient_OnCmdProcessing); //figure out how we're subscribing to video Subscription subtype = Subscription.SUBSCRIBE_NONE; User user = new User(); if (ttclient.GetUser(this.userid, ref user)) { if (user.uLocalSubscriptions.HasFlag(Subscription.SUBSCRIBE_VIDEOCAPTURE)) { subtype = Subscription.SUBSCRIBE_VIDEOCAPTURE; } else if (user.uLocalSubscriptions.HasFlag(Subscription.SUBSCRIBE_INTERCEPT_VIDEOCAPTURE)) { subtype = Subscription.SUBSCRIBE_INTERCEPT_VIDEOCAPTURE; } } //store the command ID we get back from the client instance unsubscribe_cmdid = ttclient.DoUnsubscribe(this.userid, subtype); e.Cancel = true; } else { e.Cancel = true; } } else { ttclient.OnUserVideoCapture -= ttclient_OnUserVideoFrame; } }