Ejemplo n.º 1
0
        public void OnToastNotificationActivated(ToastActivationType activationType, string args)
        {
            WwwFormUrlDecoder decoder = new WwwFormUrlDecoder(args);
            uint  activeCallID        = 0;
            uint  incomingCallID      = 0;
            Call  activeCall          = null;
            Call  incomingCall        = null;
            Frame frame = null;

            switch (decoder.GetFirstValueByName(NotificationSystem.ACTION))
            {
            case NotificationSystem.END:
                activeCallID = uint.Parse(decoder.GetFirstValueByName(NotificationSystem.ACTIVE_CALL_ID));
                activeCall   = CallSystem.CallManager.CurrentCalls.FirstOrDefault(x => x.ID == activeCallID);
                //if (activeCall?.AvailableActions.EndCallAvailable ?? false)
                //{
                activeCall?.End();
                //}
                //else
                //{
                //    //LOG
                //}
                break;

            case NotificationSystem.REJECT:
                incomingCallID = uint.Parse(decoder.GetFirstValueByName(NotificationSystem.INCOMING_CALL_ID));
                incomingCall   = CallSystem.CallManager.CurrentCalls.FirstOrDefault(x => x.ID == incomingCallID);
                incomingCall?.RejectIncoming();
                break;

            case NotificationSystem.TEXT_REPLY:
                incomingCallID = uint.Parse(decoder.GetFirstValueByName(NotificationSystem.INCOMING_CALL_ID));

                break;

            case NotificationSystem.END_AND_ANSWER:
                activeCallID = uint.Parse(decoder.GetFirstValueByName(NotificationSystem.ACTIVE_CALL_ID));
                activeCall   = CallSystem.CallManager.CurrentCalls.FirstOrDefault(x => x.ID == activeCallID);
                //if (activeCall?.AvailableActions.EndCallAvailable ?? false)
                //{
                activeCall?.End();
                //}
                //else
                //{
                //    //LOG
                //}
                goto case NotificationSystem.ANSWER;

            case NotificationSystem.HOLD_AND_ANSWER:
                activeCallID = uint.Parse(decoder.GetFirstValueByName(NotificationSystem.ACTIVE_CALL_ID));
                activeCall   = CallSystem.CallManager.CurrentCalls.FirstOrDefault(x => x.ID == activeCallID);
                //if (activeCall?.AvailableActions.HoldAvailable ?? false)
                //{
                activeCall?.SetHold(true);
                //}
                //else
                //{
                //    //LOG
                //}
                goto case NotificationSystem.ANSWER;

            case NotificationSystem.ANSWER:
                incomingCallID = uint.Parse(decoder.GetFirstValueByName(NotificationSystem.INCOMING_CALL_ID));
                incomingCall   = CallSystem.CallManager.CurrentCalls.FirstOrDefault(x => x.ID == incomingCallID);
                //if (incomingCall?.AvailableActions.AnswerAvailable ?? false)
                //{
                incomingCall?.AcceptIncomingEx();
                //}
                //else
                //{
                //    //LOG
                //}
                if (activationType == ToastActivationType.Foreground)
                {
                    goto case NotificationSystem.SHOW_CALL_UI;
                }
                else
                {
                    break;
                }

            case NotificationSystem.SHOW_CALL_UI:
                UISystem.ShowCallUIWindow();
                //frame = Window.Current.Content as Frame;
                //frame.Navigate(typeof(InCallUI));
                break;

            case NotificationSystem.SHOW_INCOMING_CALL_UI:
                frame = Window.Current.Content as Frame;
                //frame.Navigate(typeof(IncomingCallUI));
                break;
            }
        }
Ejemplo n.º 2
0
        public async void OnToastNotificationActivated(ToastActivationType activationType, string args)
        {
            QueryString query          = QueryString.Parse(args);
            uint        activeCallID   = 0;
            uint        incomingCallID = 0;
            Call        activeCall     = null;
            Call        incomingCall   = null;
            Frame       frame          = null;

            switch (query[NotificationSystem.ACTION])
            {
            case NotificationSystem.END:
                activeCallID = uint.Parse(query[NotificationSystem.ACTIVE_CALL_ID]);
                activeCall   = CallSystem.CallManager.CurrentCalls.FirstOrDefault(x => x.ID == activeCallID);
                //if (activeCall?.AvailableActions.EndCallAvailable ?? false)
                //{
                activeCall?.End();
                //}
                //else
                //{
                //    //LOG
                //}
                break;

            case NotificationSystem.REJECT:
                incomingCallID = uint.Parse(query[NotificationSystem.INCOMING_CALL_ID]);
                incomingCall   = CallSystem.CallManager.CurrentCalls.FirstOrDefault(x => x.ID == incomingCallID);
                incomingCall?.RejectIncoming();
                break;

            case NotificationSystem.TEXT_REPLY:
                incomingCallID = uint.Parse(query[NotificationSystem.INCOMING_CALL_ID]);

                break;

            case NotificationSystem.END_AND_ANSWER:
                activeCallID = uint.Parse(query[NotificationSystem.ACTIVE_CALL_ID]);
                activeCall   = CallSystem.CallManager.CurrentCalls.FirstOrDefault(x => x.ID == activeCallID);
                //if (activeCall?.AvailableActions.EndCallAvailable ?? false)
                //{
                activeCall?.End();
                //}
                //else
                //{
                //    //LOG
                //}
                goto case NotificationSystem.ANSWER;

            case NotificationSystem.HOLD_AND_ANSWER:
                activeCallID = uint.Parse(query[NotificationSystem.ACTIVE_CALL_ID]);
                activeCall   = CallSystem.CallManager.CurrentCalls.FirstOrDefault(x => x.ID == activeCallID);
                //if (activeCall?.AvailableActions.HoldAvailable ?? false)
                //{
                activeCall?.SetHold(true);
                //}
                //else
                //{
                //    //LOG
                //}
                goto case NotificationSystem.ANSWER;

            case NotificationSystem.ANSWER:
                incomingCallID = uint.Parse(query[NotificationSystem.INCOMING_CALL_ID]);
                incomingCall   = CallSystem.CallManager.CurrentCalls.FirstOrDefault(x => x.ID == incomingCallID);
                //if (incomingCall?.AvailableActions.AnswerAvailable ?? false)
                //{
                incomingCall?.AcceptIncomingEx();
                //}
                //else
                //{
                //    //LOG
                //}
                if (activationType == ToastActivationType.Foreground)
                {
                    goto case NotificationSystem.SHOW_CALL_UI;
                }
                else
                {
                    break;
                }

            case NotificationSystem.SHOW_CALL_UI:
                CompactOverlayId = await CallUIPage.ShowInCallUI();

                //frame = Window.Current.Content as Frame;
                //frame.Navigate(typeof(InCallUI));
                break;

            case NotificationSystem.SHOW_INCOMING_CALL_UI:
                frame = Window.Current.Content as Frame;
                frame.Navigate(typeof(IncomingCallUI));
                break;
            }
        }