void _chat_PrivateChannelRequestEvent(Vha.Net.Chat chat, PrivateChannelRequestEventArgs e) { // Check for ignores if (this.Ignores.Contains(e.Character)) { return; } // Some sensible checks PrivateChannel channel = e.GetPrivateChannel(); bool error = false; lock (this._privateChannels) { error = this._privateChannels.ContainsKey(e.CharacterID); } if (error) { this.Write(MessageClass.Error, "Unexpected invite to private channel from: " + e.Character); return; } // Dispatch invite event PrivateChannelInviteEventArgs args = new PrivateChannelInviteEventArgs(e, channel); if (this.PrivateChannelInviteEvent != null) { this.PrivateChannelInviteEvent(this, args); } }
void _context_PrivateChannelInviteEvent(Context context, PrivateChannelInviteEventArgs args) { if (this.InvokeRequired) { this.BeginInvoke( new Handler <PrivateChannelInviteEventArgs>(_context_PrivateChannelInviteEvent), new object[] { context, args }); return; } // Show dialog DialogResult result = MessageBox.Show( "You have been invited to " + args.Channel.Name + "'s private channel. Do you wish to join?", "Private Channel Invite", MessageBoxButtons.YesNo); // Join channel if accepted if (result == DialogResult.Yes) { args.Accept(); } else { args.Decline(); } }