Пример #1
0
        private void UpdateCallState(CALL_STATE new_state, Call new_active_call)
        {
            bool actually_make_active  = active_call != new_active_call;
            bool actually_update_state = state != new_state;
            bool set_call_ended        = new_state != CALL_STATE.Answered && new_state != CALL_STATE.Ringing && new_state != CALL_STATE.Hold && new_state != CALL_STATE.Hold_Ringing && call_ended == false;
            ActiveCallChangedArgs args = null;

            if (actually_update_state)
            {
                _state = new_state;
            }
            if (actually_make_active)
            {
                args = new ActiveCallChangedArgs {
                    new_active_call = new_active_call, old_active_call = active_call
                };
                active_call = new_active_call;
            }
            if (set_call_ended)
            {
                call_ended = true;
                _end_time  = DateTime.Now;
            }

            if (args != null)
            {
                ActiveCallChanged(null, args);
            }

            if (actually_update_state)
            {
                RaisePropertyChanged("state");
            }
            if (set_call_ended)
            {
                RaisePropertyChanged("call_ended");
                RaisePropertyChanged("end_time");
            }
        }
Пример #2
0
        private void UpdateCallState(CALL_STATE new_state, Call new_active_call)
        {
            bool actually_make_active = active_call != new_active_call;
            bool actually_update_state = state != new_state;
            bool set_call_ended = new_state != CALL_STATE.Answered && new_state != CALL_STATE.Ringing && new_state != CALL_STATE.Hold && new_state != CALL_STATE.Hold_Ringing && call_ended == false;
            ActiveCallChangedArgs args = null;

            if (actually_update_state)
                _state = new_state;
            if (actually_make_active) {
                args = new ActiveCallChangedArgs { new_active_call = new_active_call, old_active_call = active_call };
                active_call = new_active_call;
            }
            if (set_call_ended) {
                call_ended = true;
                _end_time = DateTime.Now;
            }

            if (args != null)
                ActiveCallChanged(null, args);

            if (actually_update_state)
                RaisePropertyChanged("state");
            if (set_call_ended) {
                RaisePropertyChanged("call_ended");
                RaisePropertyChanged("end_time");
            }
        }