Beispiel #1
0
        private void Reset(HMIButton bt, TlfDst dst)
        {
            bt.Id = dst.Id;

            if (_FastBlinkList.Remove(bt) && (_FastBlinkList.Count == 0))
            {
                _FastBlinkTimer.Enabled = false;
                _FastBlinkOn            = true;
            }
            if (_SlowBlinkList.Remove(bt) && (_SlowBlinkList.Count == 0))
            {
                _SlowBlinkTimer.Enabled = false;
                _SlowBlinkOn            = true;
            }

            if (dst.IsConfigurated)
            {
                Color backColor = VisualStyle.ButtonColor;

                if (!dst.Unavailable)
                {
                    backColor = GetStateColor(bt, dst.State);
                }

                bt.Reset(dst.Dst, dst.Unavailable, backColor);
                bt.Enabled = TlfDstEnabled(dst);
            }

            bt.Visible = dst.IsConfigurated;
        }
Beispiel #2
0
        public void OnTransferChanged(object sender, EventArgs e)
        {
            if (_IsCurrentView)
            {
                if (_StateManager.Tlf.Transfer.State == FunctionState.Idle)
                {
                    if ((_StateManager.Tlf[TlfState.Set] + _StateManager.Tlf[TlfState.Conf]) == 1)
                    {
                        int id = _StateManager.Tlf.GetFirstInState(TlfState.Set, TlfState.Conf);

                        _SetCall       = _StateManager.Tlf[id];
                        _Keypad.Dst    = string.IsNullOrEmpty(_SetCall.Number) ? _SetCall.Dst : _SetCall.Number;
                        _Keypad.Digits = _SetCall.Digits;
                    }
                    else
                    {
                        _Keypad.Digits = "";
                        _Keypad.Dst    = "";
                    }
                }
                else if (_StateManager.Tlf.Transfer.State == FunctionState.Ready)
                {
                    _SetCall       = null;
                    _Keypad.Digits = "";
                    _Keypad.Dst    = "";
                }

                OnFacilityChanged(sender, e);
            }
        }
Beispiel #3
0
        public void OnTlfChanged(object sender, RangeMsg e)
        {
            for (int i = e.From, to = e.From + e.Count; i < to; i++)
            {
                TlfDst dst = _StateManager.Tlf[i];

                if (!string.IsNullOrEmpty(dst.PreviusStateDescription))
                {
                    if (_MsgLB.Items.Contains(dst.PreviusStateDescription))
                    {
                        _MsgLB.Items.Remove(dst.PreviusStateDescription);
                        _MsgLB.BackColor = System.Drawing.Color.Gainsboro;
                        _MsgLB.Refresh();
                    }
                    else
                    {
                        _ConfUnused.Remove(dst.PreviusStateDescription);
                    }
                }
                if (!string.IsNullOrEmpty(dst.StateDescription))
                {
                    if (_MsgLB.Items.Contains(dst.StateDescription))
                    {
                        _ConfUnused.Add(dst.StateDescription);
                    }
                    else
                    {
                        _MsgLB.Items.Add(dst.StateDescription);
                        _MsgLB.BackColor = System.Drawing.Color.White;
                        _MsgLB.Refresh();
                    }
                }
            }
        }
Beispiel #4
0
        public void OnTlfChanged(object sender, RangeMsg e)
        {
            for (int i = e.From, to = e.From + e.Count; i < to; i++)
            {
                TlfDst dst = _StateManager.Tlf[i];

                if (!string.IsNullOrEmpty(dst.PreviusStateDescription))
                {
                    if (_MsgLB.Text.Contains(dst.PreviusStateDescription))
                    {
                        _MsgLB.Text = _MsgLB.Text.Replace(dst.PreviusStateDescription, "");
                    }
                    else
                    {
                        _ConfUnused.Remove(dst.PreviusStateDescription);
                    }
                }
                if (!string.IsNullOrEmpty(dst.StateDescription))
                {
                    if (_MsgLB.Text.Contains(dst.StateDescription))
                    {
                        _ConfUnused.Add(dst.StateDescription);
                    }
                    else
                    {
                        _MsgLB.Text += dst.StateDescription;
                    }
                }
            }
        }
Beispiel #5
0
 private bool TlfDstEnabled(TlfDst dst)
 {
     return(_StateManager.Tft.Enabled && _StateManager.Engine.Operative &&
            !dst.Unavailable &&
            (_StateManager.Tlf.Priority.State != FunctionState.Error) &&
            ((_StateManager.Tlf.Listen.State == FunctionState.Idle) || (_StateManager.Tlf.Listen.State == FunctionState.Ready)) &&
            ((_StateManager.Tlf.Transfer.State == FunctionState.Idle) ||
             ((_StateManager.Tlf.Transfer.State == FunctionState.Ready) &&
              ((dst.State == TlfState.Idle) || (dst.State == TlfState.Hold) || (dst.State == TlfState.NotAllowed) ||
               (dst.State == TlfState.Mem) || (dst.State == TlfState.RemoteMem)))));
 }
Beispiel #6
0
        public void OnActiveViewChanging(object sender, EventArgs <string> e)
        {
            if (e.Data == ViewNames.TlfIa)
            {
                _IsCurrentView = true;

                if ((_StateManager.Tlf.Transfer.State == FunctionState.Idle) &&
                    (_StateManager.Tlf[TlfState.Set] + _StateManager.Tlf[TlfState.Conf] == 1))
                {
                    int id = _StateManager.Tlf.GetFirstInState(TlfState.Set, TlfState.Conf);
                    _SetCall = _StateManager.Tlf[id];

                    _Keypad.Dst    = string.IsNullOrEmpty(_SetCall.Number) ? _SetCall.Dst : _SetCall.Number;
                    _Keypad.Digits = _SetCall.Digits;
                }
                else
                {
                    _SetCall       = null;
                    _Keypad.Digits = "";
                    _Keypad.Dst    = "";
                }

                _Keypad.Enabled = _KeypadEnabled;
                _CallBT.Enabled = _CallEnabled;
                _MemBT.Enabled  = _MemEnabled;

                bool numEnabled = _NumEnabled;
                _Num1BT.Enabled = numEnabled && (_Historic[0] != null);
                _Num2BT.Enabled = numEnabled && (_Historic[1] != null);
                _Num3BT.Enabled = numEnabled && (_Historic[2] != null);
                _Num4BT.Enabled = numEnabled && (_Historic[3] != null);

                ShowAgenda(false);

                _CallBT.ButtonColor = GetStateColor(_CallBT, _StateManager.Tlf.Unhang.State);
            }
            else if (_IsCurrentView)
            {
                _IsCurrentView = false;
                _CallTimestamp = null;

                if (_StateManager.Tlf.Unhang.AssociatePosition != -1)
                {
                    _StateManager.Tlf.Unhang.Reset();

                    if (_SlowBlinkList.Remove(_CallBT) && (_SlowBlinkList.Count == 0))
                    {
                        _SlowBlinkTimer.Enabled = false;
                        _SlowBlinkOn            = true;
                    }
                }
            }
        }
        public void OnTlfChanged(object sender, RangeMsg e)
        {
            if (_ActualTlfView == ViewNames.Depencences)
            {
                for (int i = e.From, to = e.From + e.Count; i < to; i++)
                {
                    TlfDst dst = _StateManager.Tlf[i];

                    if ((dst.State == TlfState.In) || (dst.State == TlfState.InPrio) || (dst.State == TlfState.RemoteIn))
                    {
                        NavigateToPrevius();
                        break;
                    }
                }
            }
        }
Beispiel #8
0
        public void OnFacilityChanged(object sender, EventArgs e)
        {
            int absPageBegin = _Page * _NumPositionsByPage;

            for (int i = 0; i < _NumPositionsByPage; i++)
            {
                HMIButton bt  = _TlfButtons[i];
                TlfDst    dst = _StateManager.Tlf[i + absPageBegin];

                Reset(bt, dst);
            }

            HMIButton mapBt  = _TlfButtons[_NumPositionsByPage];
            TlfDst    mapDst = _StateManager.Tlf[Tlf.IaMappedPosition];

            Reset(mapBt, mapDst);
        }
        private void OnHangupCallsTimerElapsed(object sender, ElapsedEventArgs e)
        {
            if (!_StateManager.Jacks.SomeJack && _StateManager.Engine.Connected)
            {
                for (int i = 0; i < Tlf.NumDestinations + Tlf.NumIaDestinations; i++)
                {
                    TlfDst dst = _StateManager.Tlf[i];

                    switch (dst.State)
                    {
                    case TlfState.Hold:
                        _EngineCmdManager.EndTlfCall(i, TlfState.Hold);
                        break;

                    case TlfState.Conf:
                        _EngineCmdManager.EndTlfConfCall(i);
                        break;

                    case TlfState.OutOfService:
                    case TlfState.Congestion:
                    case TlfState.Busy:
                    case TlfState.Out:
                    case TlfState.Set:
                    case TlfState.RemoteHold:
                        _EngineCmdManager.EndTlfCall(i);
                        break;
                    }
                }

                for (int i = 0; i < Radio.NumDestinations; i++)
                {
                    RdDst dst = _StateManager.Radio[i];

                    if (dst.Rx)
                    {
                        _EngineCmdManager.ResetRdPosition(i);
                        //_EngineCmdManager.SetRdRx(i, false);
                    }
                }
            }
        }
Beispiel #10
0
        private void Reset(HMIButton bt, TlfDst dst)
        {
            bt.Id = dst.Id;

            if (_FastBlinkList.Remove(bt) && (_FastBlinkList.Count == 0))
            {
                _FastBlinkTimer.Enabled = false;
                _FastBlinkOn            = true;
            }
            if (_SlowBlinkList.Remove(bt) && (_SlowBlinkList.Count == 0))
            {
                _SlowBlinkTimer.Enabled = false;
                _SlowBlinkOn            = true;
            }

            if (dst.IsConfigurated)
            {
                Color backColor = VisualStyle.ButtonColor;

                if (!dst.Unavailable)
                {
                    backColor = GetStateColor(bt, dst.State);
                }

                if (dst.Type == TlfType.Md)
                {
                    bt.Reset(dst.Dst, dst.Unavailable, backColor, Resources.group);
                }
                else
                {
                    bt.Reset(dst.Dst, dst.Unavailable, backColor);
                }
                bt.Enabled = TlfDstEnabled(dst);
                //Hay destinos que no permiten ser llamados con prioridad (lineas PP)
                //por eso se deshabilita su AD cuando se pulsa la tecla prioridad.
            }

            bt.Visible = dst.IsConfigurated;
        }
Beispiel #11
0
 private bool TlfDstEnabled(TlfDst dst)
 {
     return((_StateManager.Tft.Enabled && _StateManager.Engine.Operative &&
             !dst.Unavailable &&
             (_StateManager.Tlf.Priority.State != FunctionState.Executing) &&
             ((_StateManager.Tlf.Listen.State == FunctionState.Idle) || (_StateManager.Tlf.Listen.State == FunctionState.Ready)) &&
             ((_StateManager.Tlf.Transfer.State == FunctionState.Idle) ||
              ((_StateManager.Tlf.Transfer.State == FunctionState.Ready) &&
               ((dst.State == TlfState.Idle) || (dst.State == TlfState.Hold) || (dst.State == TlfState.NotAllowed) ||
                (dst.State == TlfState.Mem) || (dst.State == TlfState.RemoteMem)))) &&
             (dst.State != TlfState.Inactive)) &&
            //Hay destinos que no permiten ser llamados con prioridad (lineas PP)
            //por eso se deshabilita su AD cuando se pulsa la tecla prioridad.
            ((dst.PriorityAllowed) || (_StateManager.Tlf.Priority.State != FunctionState.Ready)) &&
            //La escucha, y la Captura solo se permiten a Tops (puestos de operador internos)
            //Durante la captura se admiten llamadas entrantes
            ((dst.IsTop ||
              ((_StateManager.Tlf.PickUp.State == FunctionState.Idle) || (dst.State == TlfState.In))) &&
             //El desvío se permiten a tops y a punto a punto
             (dst.ForwardAllowed ||
              ((_StateManager.Tlf.Forward.State != FunctionState.Ready)))));
 }
Beispiel #12
0
        public void OnTlfChanged(object sender, RangeMsg e)
        {
            Debug.Assert(e.Count > 0);

            if ((e.From + e.Count) > Tlf.IaMappedPosition)
            {
                HMIButton bt  = _TlfButtons[_NumPositionsByPage];
                TlfDst    dst = _StateManager.Tlf[Tlf.IaMappedPosition];

                Reset(bt, dst);
            }

            if (e.From < Tlf.NumDestinations)
            {
                int absPageBegin         = _Page * _NumPositionsByPage;
                int absFirstBtPageBegin  = (int.Parse(_TlfPageFirstBT.Text) - 1) * _NumPositionsByPage;
                int absSecondBtPageBegin = (int.Parse(_TlfPageSecondBT.Text) - 1) * _NumPositionsByPage;

                for (int i = Math.Max(e.From, absPageBegin), to = Math.Min(e.From + e.Count, absPageBegin + _NumPositionsByPage); i < to; i++)
                {
                    HMIButton bt  = _TlfButtons[i - absPageBegin];
                    TlfDst    dst = _StateManager.Tlf[i];

                    Reset(bt, dst);
                }

                if ((e.From < absFirstBtPageBegin + _NumPositionsByPage) && (e.From + e.Count > absFirstBtPageBegin))
                {
                    ResetBtPage(_TlfPageFirstBT);
                }

                if ((e.From < absSecondBtPageBegin + _NumPositionsByPage) && (e.From + e.Count > absSecondBtPageBegin))
                {
                    ResetBtPage(_TlfPageSecondBT);
                }
            }
        }
Beispiel #13
0
        public void OnLoadTlfDaPage(object sender, PageMsg e)
        {
            if (_Page != e.Page)
            {
                Debug.Assert(e.Page < 3);

                _Page = e.Page;
                int absPageBegin = _Page * _NumPositionsByPage;

                if (_Page == 0)
                {
                    _TlfPageFirstBT.Text  = "2";
                    _TlfPageSecondBT.Text = "3";
                }
                else if (_Page == 1)
                {
                    _TlfPageFirstBT.Text  = "1";
                    _TlfPageSecondBT.Text = "3";
                }
                else if (_Page == 2)
                {
                    _TlfPageFirstBT.Text  = "1";
                    _TlfPageSecondBT.Text = "2";
                }

                for (int i = 0; i < _NumPositionsByPage; i++)
                {
                    HMIButton bt  = _TlfButtons[i];
                    TlfDst    dst = _StateManager.Tlf[i + absPageBegin];

                    Reset(bt, dst);
                }

                ResetBtPage(_TlfPageFirstBT);
                ResetBtPage(_TlfPageSecondBT);
            }
        }
Beispiel #14
0
        public void OnLoadTlfDaPage(object sender, PageMsg e)
        {
            if (_Page != e.Page)
            {
                Debug.Assert(e.Page < Settings.Default.NumTelPages);

                _Page = e.Page;
                int absPageBegin = _Page * _NumPositionsByPage;

                foreach (HMIButton page in _TlfPageButtons)
                {
                    page.Enabled = true;
                }

                for (int i = 0; i < _NumPositionsByPage; i++)
                {
                    // La página 9 sólo tiene 18 posiciones de AD
                    if (_Page == 8 && i == 18)
                    {
                        continue;
                    }

                    HMIButton bt  = _TlfButtons[i];
                    TlfDst    dst = _StateManager.Tlf[i + absPageBegin];

                    Reset(bt, dst);
                }

                switch (_Page)
                {
                case 0:
                    _TlfPage1BT.Enabled = false;
                    ResetBtPage(_TlfPage1BT);
                    break;

                case 1:
                    _TlfPage2BT.Enabled = false;
                    ResetBtPage(_TlfPage2BT);
                    break;

                case 2:
                    _TlfPage3BT.Enabled = false;
                    ResetBtPage(_TlfPage3BT);
                    break;

                case 3:
                    _TlfPage4BT.Enabled = false;
                    ResetBtPage(_TlfPage4BT);
                    break;

                case 4:
                    _TlfPage5BT.Enabled = false;
                    ResetBtPage(_TlfPage5BT);
                    break;

                case 5:
                    _TlfPage6BT.Enabled = false;
                    ResetBtPage(_TlfPage6BT);
                    break;

                case 6:
                    _TlfPage7BT.Enabled = false;
                    ResetBtPage(_TlfPage7BT);
                    break;

                case 7:
                    _TlfPage8BT.Enabled = false;
                    ResetBtPage(_TlfPage8BT);
                    break;

                case 8:
                    _TlfPage9BT.Enabled = false;
                    ResetBtPage(_TlfPage9BT);
                    break;
                }
            }
        }
Beispiel #15
0
        public void OnActiveViewChanging(object sender, EventArgs <string> e)
        {
            if (e.Data == ViewNames.TlfIa)
            {
                _IsCurrentView = true;

                if ((_StateManager.Tlf.Transfer.State == FunctionState.Idle) &&
                    (_StateManager.Tlf[TlfState.Set] + _StateManager.Tlf[TlfState.Conf] == 1))
                {
                    int id = _StateManager.Tlf.GetFirstInState(TlfState.Set, TlfState.Conf);
                    if (Tlf.IaMappedPosition == id)
                    {
                        _SetCall = _StateManager.Tlf[id];

                        // JCAM: 03/01/2017
                        // #2431
                        _Keypad.Dst    = ""; // !string.IsNullOrEmpty(_SetCall.Dst) ? _SetCall.Dst : _SetCall.Number;
                        _Keypad.Digits = ""; // _SetCall.Digits;
                    }
                    else
                    {
                        _Keypad.Digits = "";
                        _Keypad.Dst    = "";
                    }
                }
                else
                {
                    _SetCall       = null;
                    _Keypad.Digits = "";
                    _Keypad.Dst    = "";
                }


                if (_SetCall != null && _SetCall.State == TlfState.Set && !string.IsNullOrEmpty(_Keypad.Dst)) //FGB
                {                                                                                             // al volver de AD a AI _StateManager.Tlf.Unhang.State vale Idle en vez de Set
                    // cuando se ha hecho una llamada por AI
                    _Keypad.Enabled         = false;
                    _CallBT.Enabled         = true;
                    _SlowBlinkTimer.Enabled = true;
                    _SlowBlinkOn            = true;
                    _CallTimestamp          = Environment.TickCount;

                    _CallBT.ButtonColor = GetStateColor(_CallBT, UnhangState.Set);
                }
                else
                {
                    _Keypad.Enabled     = _KeypadEnabled;
                    _CallBT.Enabled     = _CallEnabled;
                    _CallBT.ButtonColor = GetStateColor(_CallBT, _StateManager.Tlf.Unhang.State);
                }

                _MemBT.Enabled = _MemEnabled;

                bool numEnabled = _NumEnabled;
                _Num1BT.Enabled = numEnabled && (_Historic[0] != null);
                _Num2BT.Enabled = numEnabled && (_Historic[1] != null);
                _Num3BT.Enabled = numEnabled && (_Historic[2] != null);
                _Num4BT.Enabled = numEnabled && (_Historic[3] != null);

                ShowAgenda(false);
            }
            else if (_IsCurrentView)
            {
                _IsCurrentView = false;
                _CallTimestamp = null;

                if (_StateManager.Tlf.Unhang.AssociatePosition != -1)
                {
                    _StateManager.Tlf.Unhang.Reset();

                    if (_SlowBlinkList.Remove(_CallBT) && (_SlowBlinkList.Count == 0))
                    {
                        _SlowBlinkTimer.Enabled = false;
                        _SlowBlinkOn            = true;
                    }
                }
            }
        }
        private void TlfClick(string number, bool ia, string givenLiteral = null, int id = Int32.MaxValue)
        {
            string literal = null;

            if (number.Length > 0)
            {
                number = Tlf.NumberToEngine(number);

                if (_StateManager.Tlf.Listen.State == FunctionState.Ready)
                {
                    _EngineCmdManager.ListenTo(number);
                }
                else if (_StateManager.Tlf.Transfer.State == FunctionState.Ready)
                {
                    _EngineCmdManager.TransferTo(number);
                }
                else if (_StateManager.Tlf.PickUp.State == FunctionState.Ready)
                {
                    _EngineCmdManager.PreparePickUp(number);
                }
                else if (_StateManager.Tlf.PickUp.State == FunctionState.Executing)
                {
                    _EngineCmdManager.CancelPickUp();
                    _EngineCmdManager.PreparePickUp(number);
                }
                else if (_StateManager.Tlf.Forward.State == FunctionState.Ready)
                {
                    _EngineCmdManager.PrepareForward(number);
                }
                else
                {
                    bool wait = false;

                    for (int i = 0; i < Tlf.NumDestinations + Tlf.NumIaDestinations; i++)
                    {
                        TlfDst dst = _StateManager.Tlf[i];
                        literal = dst.Dst;

                        switch (dst.State)
                        {
                        case TlfState.Hold:
                            //if (i == Tlf.IaMappedPosition)
                            //{
                            //    _EngineCmdManager.EndTlfCall(i, TlfState.Hold);
                            //    wait = true;
                            //}
                            break;

                        case TlfState.Conf:
                            _EngineCmdManager.EndTlfConfCall(i);
                            wait = true;
                            break;

                        case TlfState.Out:
                        case TlfState.Set:
                        case TlfState.RemoteHold:
                        case TlfState.Congestion:
                        case TlfState.OutOfService:
                        case TlfState.Busy:
                            _EngineCmdManager.EndTlfCall(i);
                            wait = true;
                            break;

                        case TlfState.InProcess:
                            //Do nothing
                            break;
                        }
                    }

                    if (wait && (_EngineCmdManager.Name == "Ope"))
                    {
                        _EngineCmdManager.Wait(500);
                    }
                    if (_StateManager.Tlf.PickUp.State == FunctionState.Error)
                    {
                        _EngineCmdManager.CancelPickUp();
                    }
                    if (id != Int32.MaxValue)
                    {
                        _EngineCmdManager.BeginTlfCall(number, _StateManager.Tlf.Priority.NewCall(Tlf.IaMappedPosition), id, literal);
                    }
                    else
                    {
                        _EngineCmdManager.BeginTlfCall(number, _StateManager.Tlf.Priority.NewCall(Tlf.IaMappedPosition), givenLiteral);
                    }
                    _StateManager.Tlf.Unhang.NewCall(ia);
                }
            }
        }
Beispiel #17
0
        public void OnTlfChanged(object sender, RangeMsg e)
        {
            if (_IsCurrentView)
            {
                if ((e.Count == 1) && (e.From < Tlf.NumDestinations) && !General.TimeElapsed(_CallTimestamp, 1000))
                {
                    bool   changeView = false;
                    TlfDst dst        = _StateManager.Tlf[e.From];

                    switch (dst.PrevState)
                    {
                    case TlfState.Unavailable:
                    case TlfState.Idle:
                    case TlfState.PaPBusy:
                    case TlfState.RemoteMem:
                    case TlfState.Mem:
                    case TlfState.NotAllowed:
                        changeView = (dst.State == TlfState.NotAllowed) || (dst.State == TlfState.Out) || (dst.State == TlfState.Congestion);
                        break;

                    case TlfState.Hold:
                    case TlfState.RemoteIn:
                    case TlfState.In:
                    case TlfState.InPrio:
                        changeView = (dst.State == TlfState.Set) || (dst.State == TlfState.Conf);
                        break;
                    }

                    if (changeView)
                    {
                        _CmdManager.SwitchTlfView(ViewNames.TlfDa);
                        _CmdManager.TlfLoadDaPage(e.From / ((Settings.Default.TlfRows * Settings.Default.TlfColumns) - 1));

                        return;
                    }
                }

                if ((_StateManager.Tlf.Listen.State == FunctionState.Idle) &&
                    (_StateManager.Tlf.Transfer.State == FunctionState.Idle))
                {
                    int numSet = _StateManager.Tlf[TlfState.Set] + _StateManager.Tlf[TlfState.Conf];

                    if (numSet == 1)
                    {
                        if ((_SetCall == null) || ((_SetCall.State != TlfState.Set) && (_SetCall.State != TlfState.Conf)))
                        {
                            int id = _StateManager.Tlf.GetFirstInState(TlfState.Set, TlfState.Conf);
                            _SetCall = _StateManager.Tlf[id];

                            _Keypad.Dst    = string.IsNullOrEmpty(_SetCall.Number) ? _SetCall.Dst : _SetCall.Number;
                            _Keypad.Digits = _SetCall.Digits;
                        }
                    }
                    else if ((numSet == 0) && (_SetCall != null))
                    {
                        _SetCall = null;

                        if (_StateManager.Tlf.Unhang.State == UnhangState.Idle)
                        {
                            _Keypad.Digits = "";
                            _Keypad.Dst    = "";
                        }
                    }

                    _Keypad.Enabled = _KeypadEnabled;
                    _CallBT.Enabled = _CallEnabled;
                }
            }

            if ((e.From + e.Count) > Tlf.IaMappedPosition)
            {
                TlfDst dst = _StateManager.Tlf[Tlf.IaMappedPosition];

                switch (dst.State)
                {
                case TlfState.In:
                case TlfState.InPrio:
                case TlfState.RemoteIn:
                case TlfState.Congestion:
                case TlfState.Set:
                case TlfState.Conf:
                case TlfState.Out:
                case TlfState.Busy:
                    if (!string.IsNullOrEmpty(dst.Number))
                    {
                        AddToHistoric(new Number(dst.Number, dst.Dst));
                    }
                    break;
                }

                if (_IsCurrentView)
                {
                    bool numEnabled = _NumEnabled;
                    _Num1BT.Enabled = numEnabled && (_Historic[0] != null);
                    _Num2BT.Enabled = numEnabled && (_Historic[1] != null);
                    _Num3BT.Enabled = numEnabled && (_Historic[2] != null);
                    _Num4BT.Enabled = numEnabled && (_Historic[3] != null);
                }
            }
        }
Beispiel #18
0
        public void OnTlfChanged(object sender, RangeMsg e)
        {
            Debug.Assert(e.Count > 0);

            if ((e.From + e.Count) > Tlf.IaMappedPosition)
            {
                HMIButton bt  = _TlfButtons[_NumPositionsByPage];
                TlfDst    dst = _StateManager.Tlf[Tlf.IaMappedPosition];

                Reset(bt, dst);
            }

            if (e.From < Tlf.NumDestinations)
            {
                int absPageBegin         = _Page * _NumPositionsByPage;
                int absFirstBtPageBegin  = (int.Parse(_TlfPage2BT.Text) - 1) * _NumPositionsByPage;
                int absSecondBtPageBegin = (int.Parse(_TlfPage3BT.Text) - 1) * _NumPositionsByPage;

                for (int i = Math.Max(e.From, absPageBegin), to = Math.Min(e.From + e.Count, absPageBegin + _NumPositionsByPage); i < to; i++)
                {
                    HMIButton bt  = _TlfButtons[i - absPageBegin];
                    TlfDst    dst = _StateManager.Tlf[i];

                    Reset(bt, dst);
                }

                int pageButtonToReset = (int)(e.From / _NumPositionsByPage);
                switch (pageButtonToReset)
                {
                case 0:
                    ResetBtPage(_TlfPage1BT);
                    break;

                case 1:
                    ResetBtPage(_TlfPage2BT);
                    break;

                case 2:
                    ResetBtPage(_TlfPage3BT);
                    break;

                case 3:
                    ResetBtPage(_TlfPage4BT);
                    break;

                case 4:
                    ResetBtPage(_TlfPage5BT);
                    break;

                case 5:
                    ResetBtPage(_TlfPage6BT);
                    break;

                case 6:
                    ResetBtPage(_TlfPage7BT);
                    break;

                case 7:
                    ResetBtPage(_TlfPage8BT);
                    break;

                case 8:
                    ResetBtPage(_TlfPage9BT);
                    break;
                }
            }
        }