private void InCallForm_FormClosing(object sender, FormClosingEventArgs e) { if (closingApp == true) { return; } closingApp = true; Program.actualCall = null; Program.isInCall = false; Program.spGlobal = null; if (this.callId == null) { return; } packetsCounterTimer.Stop(); tokenSource.Cancel(); sp.stop(); CallProcessing.SendMessages(BitConverter.GetBytes(callId.id)); CallProcessing.SendMessages(BitConverter.GetBytes(callId.id)); CallProcessing.SendMessages(BitConverter.GetBytes(callId.id)); CallProcessing.Stop(); LoggedInService.declineCall(this.callId); if (updateFriendViewOnClosing != null) { updateFriendViewOnClosing(); } }
private void declineCall_button_Click(object sender, EventArgs e) { if (this.call == null) { return; } LoggedInService.declineCall(new Id(this.call.callId)); this.call = null; this.Close(); }
private void IncomingCallForm_FormClosing(object sender, FormClosingEventArgs e) { if (this.call == null) { return; } if (!acceptedCall) { LoggedInService.declineCall(new Id(this.call.callId)); } this.call = null; }
public void callUserReplyFromUser(Boolean reply) { if (callingStatusLabel.InvokeRequired) { callingStatusLabel.Invoke(new MethodInvoker(() => { callUserReplyFromUser(reply); })); } else { callingStatusLabel.Visible = true; if (reply == true) { callUser.Enabled = false; callingStatusLabel.Text = ""; callingStatusLabel.ForeColor = Color.Green; if (lastCallId != null && lastCallUsername != null) { Call c = new Call(lastCallId.id, new List <string> { lastCallUsername.username }); NoneCallback ncb = updateFriendViewOnCallClosing; InCallForm icf = new InCallForm(c, ncb); icf.Show(); updateCallStatus(new Friend(lastCallUsername, 1)); } } else { callUser.Enabled = true; callingStatusLabel.Text = "Odrzucono połączenie!"; callingStatusLabel.ForeColor = Color.Red; if (!Program.isInCall) { LoggedInService.declineCall(lastCallId); } } } }