Пример #1
0
        private void callHandler_OnMyPhoneStatusChanged(object sender, MyPhonePlugins.MyPhoneStatus status)
        {
            if (status == MyPhonePlugins.MyPhoneStatus.LoggedIn)
            {
                this.extensionInfo = sender as MyPhonePlugins.IExtensionInfo;
            }

            LogHelper.Log(Environment.SpecialFolder.ApplicationData, "CallTriggerCmd.log",
                          String.Format("MyPhoneStatusChanged - Status='{0}' - Extension='{1}'", status, extensionInfo == null ? String.Empty : extensionInfo.Number));
            Callback(channel => channel.MyPhoneStatusChanged());
        }
Пример #2
0
        private void callHandler_OnMyPhoneStatusChanged(object sender, MyPhonePlugins.MyPhoneStatus status)
        {
            if (status == MyPhonePlugins.MyPhoneStatus.LoggedIn)
            {
                this.extensionInfo = sender as MyPhonePlugins.IExtensionInfo;
            }

            var onMyPhoneStatusChanged = new OnMyPhoneStatusChanged();

            try
            {
                var _sender = sender as MyPhonePlugins.IMyPhoneCallHandler;

                fillCallHandler_1(_sender, onMyPhoneStatusChanged.CallHandler);

                onMyPhoneStatusChanged.Status = status.ToString();

                foreach (var call in _sender.ActiveCalls)
                {
                    var newCall = new CallStatus();
                    fillCallStatus(call, newCall);
                    onMyPhoneStatusChanged.CallHandler.ActiveCalls.Add(newCall);
                }

                foreach (var profile in _sender.Profiles)
                {
                    var newProfile = new UserProfileStatus();
                    fillProfiles(profile, newProfile);
                    onMyPhoneStatusChanged.CallHandler.Profiles.Add(newProfile);
                }
            }
            catch
            {
                onMyPhoneStatusChanged = null;
            }

            LogHelper.Log(Environment.SpecialFolder.ApplicationData, "CallTriggerCmd.log",
                          String.Format("MyPhoneStatusChanged - Status='{0}' - Extension='{1}'", status, extensionInfo == null ? String.Empty : extensionInfo.Number));
            Callback(channel => channel.MyPhoneStatusChanged(onMyPhoneStatusChanged));
        }