예제 #1
0
 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();
     }
 }
예제 #2
0
        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);
        }
예제 #3
0
 public void sendSound(byte[] sound)
 {
     CallProcessing.SendMessages(sound);
 }