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(); } }
public InCallForm(Call c, NoneCallback ncb) { this.updateFriendViewOnClosing = ncb; this.call = c; updateGlobalCallVar(); this.callId = new Id(c.callId); InitializeComponent(); this.Text = "(" + Program.username + ") Aktywne połączenie"; StringCallback callback2 = addUser; StringCallback callback3 = removeUser; LoggedInService.AddUserToCall = callback2; LoggedInService.RemoveUserFromCall = callback3; updateUsersInCall(); ByteCallback callback = incomingTraffic; NoneCallback callback4 = closeCall; CallProcessing.ReceiveMsgCallback = callback; CallProcessing.CloseCallCallback = callback4; CallProcessing.Start(); Program.isInCall = true; packetsCounterTimer.Interval = 1000; packetsCounterTimer.Elapsed += packetsCounterTimer_OnTimerElapsed; packetsCounterTimer.AutoReset = true; packetsCounterTimer.Start(); ByteCallback sendCb = sendSound; sp = new SoundProcessing(sendCb); Program.spGlobal = sp; tokenSource = new System.Threading.CancellationTokenSource(); token = tokenSource.Token; Task.Run(() => sp.startUp(this.call.usernames, token), token); }
public void sendSound(byte[] sound) { CallProcessing.SendMessages(sound); }