Пример #1
0
 public void openInCallWindow(Call c)
 {
     if (callingStatusLabel.InvokeRequired)
     {
         callingStatusLabel.Invoke(new MethodInvoker(() => { openInCallWindow(c); }));
     }
     else
     {
         NoneCallback ncb = updateFriendViewOnCallClosing;
         InCallForm   icf = new InCallForm(c, ncb);
         icf.Show();
     }
 }
Пример #2
0
 private void UpdateList()
 {
     if (this.InvokeRequired)
     {
         NoneCallback updateListCallback = new NoneCallback(UpdateList);
         this.Invoke(updateListCallback);
     }
     else
     {
         online_LB.Items.Clear();
         for (int i = 0; i < users.Count; i++)
         {
             online_LB.Items.Add(users[i]);
         }
     }
 }
Пример #3
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);
        }
Пример #4
0
 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);
             }
         }
     }
 }