Ejemplo n.º 1
0
        public void CancelTlfClick()
        {
            if (_StateManager.Tlf.Priority.State == FunctionState.Error)
            {
                _StateManager.Tlf.Priority.Reset();
            }
            else if (_StateManager.Tlf.Listen.State == FunctionState.Error)
            {
                _EngineCmdManager.RecognizeListenState();
            }
            else if (_StateManager.Tlf.Transfer.State == FunctionState.Error)
            {
                _EngineCmdManager.RecognizeTransferState();
            }
            else if (_StateManager.Tlf.Priority.State == FunctionState.Ready)
            {
                _StateManager.Tlf.Priority.Reset();
            }
            else if (_StateManager.Tlf.Listen.State == FunctionState.Ready)
            {
                _StateManager.Tlf.Listen.State = FunctionState.Idle;
            }
            else if (_StateManager.Tlf.Transfer.State == FunctionState.Ready)
            {
                _StateManager.Tlf.Transfer.State = FunctionState.Idle;
            }
            else if (_StateManager.Tlf.Transfer.State == FunctionState.Executing)
            {
                _EngineCmdManager.CancelTransfer();
            }
            else if ((_StateManager.Tlf[TlfState.RemoteIn] > 0) && Settings.Default.SupportInTlfCancel)
            {
                int id = _StateManager.Tlf.GetFirstInState(TlfState.RemoteIn);

                _EngineCmdManager.EndTlfCall(id);
                if (_StateManager.Tlf.Priority.AssociatePosition == id)
                {
                    _StateManager.Tlf.Priority.Reset();
                }
            }
            else if ((_StateManager.Tlf[TlfState.In] > 0) && Settings.Default.SupportInTlfCancel)
            {
                int id = _StateManager.Tlf.GetFirstInState(TlfState.In);

                _EngineCmdManager.EndTlfCall(id);
                if (_StateManager.Tlf.Priority.AssociatePosition == id)
                {
                    _StateManager.Tlf.Priority.Reset();
                }
            }
            else if ((_StateManager.Tlf[TlfState.InPrio] > 0) && Settings.Default.SupportInTlfCancel)
            {
                int id = _StateManager.Tlf.GetFirstInState(TlfState.InPrio);

                _EngineCmdManager.EndTlfCall(id);
                if (_StateManager.Tlf.Priority.AssociatePosition == id)
                {
                    _StateManager.Tlf.Priority.Reset();
                }
            }
            else if (_StateManager.Tlf[TlfState.Conf] > 0)
            {
                _EngineCmdManager.EndTlfAll();
            }
            else if (_StateManager.Tlf[TlfState.Out] + _StateManager.Tlf[TlfState.NotAllowed] > 0)
            {
                int id = _StateManager.Tlf.GetFirstInState(TlfState.Out, TlfState.NotAllowed);

                _EngineCmdManager.EndTlfCall(id);
                if (_StateManager.Tlf.Priority.AssociatePosition == id)
                {
                    _StateManager.Tlf.Priority.Reset();
                }
            }
            else if (_StateManager.Tlf[TlfState.Set] + _StateManager.Tlf[TlfState.RemoteHold] +
                     _StateManager.Tlf[TlfState.Busy] + _StateManager.Tlf[TlfState.Congestion] + _StateManager.Tlf[TlfState.OutOfService] > 0)
            {
                int id = _StateManager.Tlf.GetFirstInState(TlfState.Set, TlfState.RemoteHold, TlfState.Busy, TlfState.Congestion, TlfState.OutOfService);
                _EngineCmdManager.EndTlfCall(id);
            }
            else if (_StateManager.Tlf[TlfState.Mem] + _StateManager.Tlf[TlfState.RemoteMem] > 0)
            {
                int id = _StateManager.Tlf.GetFirstInState(TlfState.Mem, TlfState.RemoteMem, TlfState.NotAllowed);
                //if (id == Tlf.IaMappedPosition)
                _StateManager.Tlf.ResetMem(id);
                //else
                //	_StateManager.Tlf.Reset(new RangeMsg<TlfState>(id, TlfState.Idle));
            }
            else if (_StateManager.Tlf.HangTone.On)
            {
                _EngineCmdManager.SetHangToneOff();
            }
            else if (_StateManager.Tlf[TlfState.Hold] > 0)
            {
                // No hacemos nada
            }
            else
            {
                _EngineCmdManager.Cancel();
            }
        }