示例#1
0
        private void ToxAv_OnCallRequestReceived(object sender, ToxAvEventArgs.CallRequestEventArgs e)
        {
            if (_callInfo != null)
            {
                //TODO: notify the user there's yet another call incoming
                _toxAv.SendControl(e.FriendNumber, ToxAvCallControl.Cancel);
                return;
            }

            MainWindow.Instance.UInvoke(() =>
            {
                var friend = MainWindow.Instance.ViewModel.CurrentFriendListView.FindFriend(e.FriendNumber);
                if (friend == null)
                {
                    Debugging.Write("Received a call request from a friend we don't know about!");
                    return;
                }

                friend.CallState = CallState.Calling;

                if (e.VideoEnabled)
                {
                    friend.CallState |= CallState.SendingVideo;
                }
            });
        }
示例#2
0
        private void CallRequestReceivedHandler(object sender, ToxAvEventArgs.CallRequestEventArgs e)
        {
            // Automatically decline call request if we have an ongoing call.
            // TODO: Instead of this, tell the user about the situation and let him/her decide if he/she want to hang up the current call and answer the new one!
            if (_friendInCall != -1)
            {
                _toxAv.SendControl(e.FriendNumber, ToxAvCallControl.Cancel);
                return;
            }

            _friendInCall = e.FriendNumber;

            CallRequestReceived?.Invoke(this, e);
        }
示例#3
0
        private void OnToxAvCallRequestReceived(object sender, ToxAvEventArgs.CallRequestEventArgs e)
        {
            Logger.Log(LogLevel.Verbose, "state: " + e.State);

            if (this.callInfo != null)
            {
                // TODO: notify the user there's yet another call incoming
                this.toxAv.SendControl(e.FriendNumber, ToxAvCallControl.Cancel);
                return;
            }

            try
            {
                MainForm.Instance.NotifyToxAvCallRequestReceived(e);
            }
            catch (Exception ex)
            {
                Logger.Log(LogLevel.Error, ex.Message);
            }
        }
示例#4
0
 private void CallRequestReceivedHandler(object sender, ToxAvEventArgs.CallRequestEventArgs e)
 {
     DispatcherHelper.CheckBeginInvokeOnUI(() => { State = CallState.IncomingCall; });
 }