public void RdHfFrAssignedEngine(object sender, RdHfFrAssigned msg)
        {
            string text;

            _Logger.Trace("Procesando {0}: {1}", EventTopicNames.RdHfFrAssignedEngine, msg);

            RdDst    rd = _StateManager.Radio[msg.Id];
            NotifMsg notif;

            switch (msg.HfEstado)
            {
            case 0xFF:
                text = Resources.RdHfFrAssignedEngine;
                break;

            case 0xFD:
                text = string.Format(Resources.RdFrAsignedToOtherConfirmation, rd.Frecuency);
                break;

            case 0xFE:
                text = string.Format(Resources.RdHfResourceError, rd.Frecuency);
                break;

            default:
                text = Resources.RdHfEquipment;
                break;
            }

            //= msg.HfEstado == 0xFF ? Resources.RdHfFrAssignedEngine : Resources.RdHfEquipment;
            notif = new NotifMsg("RdHfFrAssignedEngine", Resources.MessageInfoCaption, text, 0, MessageType.Information, MessageButtons.Ok, msg);

            _StateManager.ShowUIMessage(notif);
        }
示例#2
0
        public void OnShowNotifMsgUI(object sender, NotifMsg e)
        {
            MessageBoxView view = WorkItem.SmartParts.Contains(e.Id) ?
                                  WorkItem.SmartParts.Get <MessageBoxView>(e.Id) :
                                  WorkItem.SmartParts.AddNew <MessageBoxView>(e.Id);

            view.Message = e;

            if (!_StateManager.ScreenSaver.On)
            {
                WindowSmartPartInfo info = new WindowSmartPartInfo();

                info.ControlBox  = false;
                info.MaximizeBox = false;
                info.MinimizeBox = false;
                info.Title       = view.Message.Caption;
                info.Keys[WindowWorkspaceSetting.FormBorderStyle] = FormBorderStyle.Sizable;
                view.Width    = view.Message.Width;
                view.Height   = view.Message.Height;
                info.Location = new Point((Screen.PrimaryScreen.Bounds.Width - view.Width) / 2, (Screen.PrimaryScreen.Bounds.Height - view.Height) / 2);

                WorkItem.Workspaces[WorkspaceNames.ModalWindows].Show(view, info);
            }
            else if (!_Messages.Contains(view))
            {
                _Messages.Add(view);
            }
        }
        public void RdSwitchRtxState(int id)
        {
            _RdButtonClick = true;

            NotifMsg msg = _StateManager.Radio.SwitchTempGroupIfRtxOn(id, _StateManager.Jacks.SomeJack);

            if (msg != null)
            {
                _StateManager.ShowUIMessage(msg);
            }
        }
 public void FunctionReplay(FunctionReplay function, ViaReplay via, string fileName, long fileLength)
 {
     if (function != BusinessEntities.FunctionReplay.Erase)
     {
         _EngineCmdManager.FunctionReplay(function, via, fileName, fileLength);
     }
     else
     {
         NotifMsg msg = new NotifMsg(Resources.DeleteSessionGLP, Resources.MessageInfoCaption, Resources.DeleteSessionGLP, 0, MessageType.Information, MessageButtons.OkCancel);
         _StateManager.ShowUIMessage(msg);
     }
 }
        public void OnRemoveRtxGroup(object sender, EventArgs msg)
        {
            _Logger.Trace("Procesando {0}", EventTopicNames.RemoveRtxGroup);

            //int tempRtxGroup = _StateManager.Radio.Rtx;
            //_StateManager.Radio.SetRtx((tempRtxGroup + 1) % (Settings.Default.MaxRtxGroups + 1));

            Dictionary <int, RtxState> newRtxGroup = _StateManager.Radio.ResetRtx();

            _EngineCmdManager.SetRtxGroup((_StateManager.Radio.Rtx + 1) % (Settings.Default.MaxRtxGroups + 1), newRtxGroup);

            NotifMsg message = new NotifMsg(Resources.RtxOperationRunning, Resources.MessageInfoCaption, Resources.RtxOperationRunning, 10000, MessageType.Processing, MessageButtons.None);

            _StateManager.ShowUIMessage(message);
        }
        public void OnRemoteListenStateEngine(object sender, ListenPickUpMsg msg)
        {
            _Logger.Trace("Procesando {0}: {1}", EventTopicNames.RemoteListenStateEngine, msg);

            if (msg.State == FunctionState.Executing)
            {
                NotifMsg notif = new NotifMsg("ListenBy" + msg.Id, Resources.MessageInfoCaption, Resources.ListenByConfirmation, 29000, MessageType.Warning, MessageButtons.OkCancel, msg);
                _StateManager.ShowUIMessage(notif);
            }
            else
            {
                _StateManager.HideUIMessage("ListenBy" + msg.Id);
                _StateManager.Tlf.ListenBy.Reset(msg);
            }
        }
示例#7
0
        private void _BT_Click(object sender, EventArgs e)
        {
            string text = ((HMIButton)sender).Text;

            Digits = _Digits + text[0];

            General.SafeLaunchEvent(NewKey, this, text[0]);

            if (Display == _Exit)
            {
                Application.Exit();
            }
            else if (Display == _Reset)
            {
                Process.Start("Launcher.exe", "HMI.exe");
            }
            else if (Display == _EngineInfo)
            {
                ToolStripItem item = ParentForm.ContextMenuStrip.Items["EngineInfo"];

                //Assembly.GetExecutingAssembly().GetName().Version.ToString()

                if (item != null)
                {
                    item.PerformClick();
                }
            }
            else if (Display == _StateInfo)
            {
                string str = string.Format("Unavailable = {0}, Idle = {1}, PaPBusy = {2}{3}",
                                           _StateManager.Tlf[TlfState.Unavailable], _StateManager.Tlf[TlfState.Idle], _StateManager.Tlf[TlfState.PaPBusy], Environment.NewLine);
                str += string.Format("RemoteMem = {0}, Mem = {1}, Hold = {2}{3}",
                                     _StateManager.Tlf[TlfState.RemoteMem], _StateManager.Tlf[TlfState.Mem], _StateManager.Tlf[TlfState.Hold], Environment.NewLine);
                str += string.Format("RemoteHold = {0}, Out = {1}, Set = {2}{3}",
                                     _StateManager.Tlf[TlfState.RemoteHold], _StateManager.Tlf[TlfState.Out], _StateManager.Tlf[TlfState.Set], Environment.NewLine);
                str += string.Format("Conf = {0}, Congestion = {1}, Busy = {2}{3}",
                                     _StateManager.Tlf[TlfState.Conf], _StateManager.Tlf[TlfState.Congestion], _StateManager.Tlf[TlfState.Busy], Environment.NewLine);
                str += string.Format("RemoteIn = {0}, In = {1}, InPrio = {2}{3}",
                                     _StateManager.Tlf[TlfState.RemoteIn], _StateManager.Tlf[TlfState.In], _StateManager.Tlf[TlfState.InPrio], Environment.NewLine);
                str += string.Format("NotAllowed = {0}, Inactive = {1}",
                                     _StateManager.Tlf[TlfState.NotAllowed], _StateManager.Tlf[TlfState.Inactive], Environment.NewLine);

                NotifMsg msg = new NotifMsg("StateInfo", "Estado", str, 0, MessageType.Information, MessageButtons.Ok);
                _StateManager.ShowUIMessage(msg);
            }
        }
示例#8
0
        public NotifMsg SwitchTempGroupIfRtxOn(int id, bool someJack)
        {
            RdDst dst = _Dst[id];

            if ((_Rtx > 0) && dst.Tx && !dst.Unavailable && ((dst.RtxGroup == 0) || (dst.RtxGroup == _Rtx)))
            {
                Debug.Assert((dst.TempRtxGroup == 0) || (dst.TempRtxGroup == _Rtx));

                if (dst.TempRtxGroup == 0)
                {
                    if (!someJack)
                    {
                        NotifMsg msg = new NotifMsg(Resources.NoJacksError, Resources.BadOperation, Resources.NoJacksError, 0, MessageType.Error, MessageButtons.Ok);
                        return(msg);
                    }

                    if (_NumRtx == 10)
                    {
                        NotifMsg msg = new NotifMsg(Resources.RtxMaxFrError, Resources.MessageErrorCaption, Resources.RtxMaxFrError, 0, MessageType.Error, MessageButtons.Ok);
                        return(msg);
                    }

                    dst.TempRtxGroup = _Rtx;
                    _NumRtx++;
                }
                else
                {
                    // No está permitido sacar un elemento del grupo de RTX si hay una retransmisión en curso
                    //Ver Incidencia #2852
                    if ((dst.Ptt == PttState.ExternPtt) ||
                        (dst.Squelch == SquelchState.SquelchOnlyPort) || (dst.Squelch == SquelchState.SquelchPortAndMod))
                    {
                        NotifMsg msg = new NotifMsg(Resources.RtxActiveNoRemove, Resources.MessageErrorCaption, Resources.RtxActiveNoRemove, 0, MessageType.Error, MessageButtons.Ok);
                        return(msg);
                    }
                    dst.TempRtxGroup = 0;
                    _NumRtx--;
                }

                General.SafeLaunchEvent(RadioChanged, this, new RangeMsg(id, 1));
            }

            return(null);
        }
 public void BriefingFunction()
 {
     if (_StateManager.Tft.Briefing)
     {
         _EngineCmdManager.BriefingFunction();   // Parar Briefing
     }
     else
     {                                           // Solicitar confirmación para iniciar Briefing
         if (!_StateManager.Tft.Playing)
         {
             // Solicitar confirmación para iniciar Briefing
             NotifMsg msg = new NotifMsg(Resources.BriefingFunction, Resources.MessageInfoCaption, Resources.BriefingFunction, 0, MessageType.Information, MessageButtons.OkCancel);
             _StateManager.ShowUIMessage(msg);
         }
         else
         {
             General.SafeLaunchEvent(BriefingSessionUI, this);
         }
     }
 }
        public void RdFrAsignedToOtherEngine(object sender, RdFrAsignedToOtherMsg msg)
        {
            _Logger.Trace("Procesando {0}: {1}", EventTopicNames.RdFrAsignedToOtherEngine, msg);

            RdDst    rd = _StateManager.Radio[msg.RdId];
            NotifMsg notif;

            if (!rd.Tx)
            {
                string text = string.Format(Resources.RdFrAsignedToOtherConfirmation, rd.Frecuency);
                notif = new NotifMsg("RdFrAsignedToOtherConfirmation", Resources.MessageInfoCaption, text, 0, MessageType.Warning, MessageButtons.OkCancel, msg);
            }
            else
            {
                string text = string.Format(Resources.RdFrAsignedToOtherNotification, msg.Owner, rd.Frecuency);
                notif = new NotifMsg("RdFrAsignedToOther", Resources.MessageInfoCaption, text, Settings.Default.MessageToutSg * 1000, MessageType.Information, MessageButtons.Ok, null);
            }

            _StateManager.ShowUIMessage(notif);
        }
        public void MessageResponse(NotifMsg msg, NotifMsgResponse response)
        {
            _StateManager.HideUIMessage(msg.Id);

            if (msg.Id.StartsWith("ListenBy"))
            {
                ListenPickUpMsg info = (ListenPickUpMsg)msg.Info;

                _EngineCmdManager.SetRemoteListen(response == NotifMsgResponse.Ok || response == NotifMsgResponse.Timeout, info.Id);
                if (response == NotifMsgResponse.Ok || response == NotifMsgResponse.Timeout)
                {
                    _StateManager.Tlf.ListenBy.Reset(info);
                }
            }
            else if (msg.Id == "RdFrAsignedToOtherConfirmation")
            {
                if (response == NotifMsgResponse.Ok)
                {
                    RdFrAsignedToOtherMsg info = (RdFrAsignedToOtherMsg)msg.Info;
                    _EngineCmdManager.ConfirmRdTx(info.RdId);
                }
            }
            else if (msg.Id == Resources.BriefingFunction)
            {
                if (response == NotifMsgResponse.Ok)
                {
                    _EngineCmdManager.BriefingFunction();
                }
            }
            else if (msg.Id == Resources.DeleteSessionGLP)
            {
                if (response == NotifMsgResponse.Ok)
                {
                    General.SafeLaunchEvent(DeleteSessionGlp, this);
                }
            }
        }
示例#12
0
        public void OnTxInProgressError(object sender, TxInProgressErrorCode e)
        {
            var InGroupButtons = new Dictionary <UrrRdButton, RdDst>(_PttPushedList);

            switch (e.IdEvent)
            {
            case 0:                 // PTT OFF
                /* VMG 04/09/2018 */
                // Con esto hacemos que una vez que se ha dado el error de transmision,
                // al dejar de recibir PTT o dejar de pulsar el boton, se genera un estado NoPtt
                // que hace que el boton vuelva al estado normal seleccionado (color verde presumiblemente)
                //foreach (KeyValuePair<UrrRdButton, RdDst> p in InGroupButtons)
                //{
                //    if (p.Value.Ptt != PttState.PttOnlyPort && p.Value.Ptt != PttState.PttPortAndMod
                //        && p.Value.Ptt != PttState.ExternPtt && p.Value.Ptt != PttState.Blocked)
                //    {
                //        try
                //        {
                //            General.SafeLaunchEvent(RdPosPttStateEngine, this, new RangeMsg<PttState>(p.Key.Id, PttState.NoPtt));
                //        }
                //        catch (Exception ex)
                //        {
                //            _Logger.Error("ERROR generando evento PTT.NoPtt. " + ex);
                //        }
                //    }
                //}
                InGroupButtons.Where(p => p.Value.Ptt != PttState.PttOnlyPort && p.Value.Ptt != PttState.PttPortAndMod &&
                                     p.Value.Ptt != PttState.ExternPtt && p.Value.Ptt != PttState.Blocked).ToList().ForEach(p1 =>
                {
                    General.SafeLaunchEvent(RdPosPttStateEngine, this, new RangeMsg <PttState>(p1.Key.Id, PttState.NoPtt));
                });
                break;

            case 1:                 // Error en Confirmacion TX.
            {
                //foreach (KeyValuePair<UrrRdButton, RdDst> p in InGroupButtons)
                //{
                //    if (p.Value.Ptt != PttState.PttOnlyPort &&
                //        p.Value.Ptt != PttState.PttPortAndMod &&
                //        p.Value.Ptt != PttState.ExternPtt &&
                //        /** 20190205. Cuando esta en BLOQUEO no hay que testear el fallo de confirmacion de TX */
                //        p.Value.Ptt != PttState.Blocked)
                //    {
                //        General.SafeLaunchEvent(RdPosPttStateEngine, this, new RangeMsg<PttState>(p.Key.Id, PttState.TxError));//VMG Invented por ahora
                //    }
                //}
                InGroupButtons.Where(p => p.Value.Ptt != PttState.PttOnlyPort && p.Value.Ptt != PttState.PttPortAndMod &&
                                     p.Value.Ptt != PttState.ExternPtt && p.Value.Ptt != PttState.Blocked).ToList().ForEach(p1 =>
                    {
                        General.SafeLaunchEvent(RdPosPttStateEngine, this, new RangeMsg <PttState>(p1.Key.Id, PttState.TxError));           //VMG Invented por ahora
                    });
                NotifMsg msg = new NotifMsg("Bad Operation", Resources.BadOperation, Resources.TxConfirmationDetectionError, 3000, MessageType.Error, MessageButtons.Ok);
                General.SafeLaunchEvent(ShowNotifMsgEngine, this, msg);
            }
            break;

            case 2:                 // Error en Confirmacion Portadora.
            {
                //foreach (KeyValuePair<UrrRdButton, RdDst> p in InGroupButtons)
                //{
                //    if (p.Value.Ptt == PttState.PttOnlyPort && p.Value.Squelch == SquelchState.NoSquelch)
                //    {
                //        General.SafeLaunchEvent(RdPosPttStateEngine, this, new RangeMsg<PttState>(p.Key.Id, PttState.CarrierError));
                //    }
                //}
                InGroupButtons.Where(p => p.Value.Ptt == PttState.PttOnlyPort && p.Value.Squelch == SquelchState.NoSquelch).
                ToList().ForEach(p1 =>
                    {
                        General.SafeLaunchEvent(RdPosPttStateEngine, this, new RangeMsg <PttState>(p1.Key.Id, PttState.CarrierError));
                    });
                NotifMsg msg = new NotifMsg("Bad Operation", Resources.BadOperation, Resources.CarrierDetectionError, 3000, MessageType.Error, MessageButtons.Ok);
                General.SafeLaunchEvent(ShowNotifMsgEngine, this, msg);
            }
            break;

            case 3:                 // Error en Grupo RTX
                //foreach (KeyValuePair<UrrRdButton, RdDst> p in InGroupButtons)
                //{
                //    if (p.Value.RtxGroup>0 && p.Value.Squelch == SquelchState.NoSquelch)
                //    {
                //        p.Key.setRtxErrorColor(true);
                //    }
                //}
                InGroupButtons.Where(p => p.Value.RtxGroup > 0 && p.Value.Squelch == SquelchState.NoSquelch).
                ToList().ForEach(p1 =>
                {
                    p1.Key.setRtxErrorColor(true);
                });
                break;

            case 4:                 // RTX OFF
                //foreach (KeyValuePair<UrrRdButton, RdDst> p in InGroupButtons)
                //{
                //    if (p.Value.RtxGroup > 0 && p.Value.Squelch == SquelchState.NoSquelch)
                //    {
                //        p.Key.setRtxErrorColor(false);
                //    }
                //}
                InGroupButtons.Where(p => p.Value.RtxGroup > 0 && p.Value.Squelch == SquelchState.NoSquelch).
                ToList().ForEach(p1 =>
                {
                    p1.Key.setRtxErrorColor(false);
                });
                break;
            }
        }
 public void ShowUIMessage(NotifMsg msg)
 {
     General.SafeLaunchEvent(ShowNotifMsgUI, this, msg);
 }
        public void OnShowNotifMsgEngine(object sender, NotifMsg msg)
        {
            _Logger.Trace("Procesando {0}: {1}", EventTopicNames.ShowNotifMsgEngine, msg);

            _StateManager.ShowUIMessage(msg);
        }
示例#15
0
        private void Reset(UrrRdButton bt, RdDst dst)
        {
            bt.Id = dst.Id;

            if (_PttBlinkList.Remove(bt) && (_PttBlinkList.Count == 0))
            {
                _PttBlinkTimer.Enabled = false;
                _PttBlinkOn            = true;
            }
            if (_SquelchBlinkList.Remove(bt) && (_SquelchBlinkList.Count == 0))
            {
                _SquelchBlinkTimer.Enabled = false;
                _SquelchBlinkOn            = true;
            }
            _RtxBlinkList.Remove(bt);
            _PttPushedList.Remove(bt);

            if (dst.IsConfigurated)
            {
                Color title          = HMI.Presentation.AUrr.UI.VisualStyle.ButtonColor;
                Color tx             = HMI.Presentation.AUrr.UI.VisualStyle.ButtonColor;
                Color rx             = HMI.Presentation.AUrr.UI.VisualStyle.ButtonColor;
                Color txForeColor    = HMI.Presentation.AUrr.UI.VisualStyle.Colors.Black;
                Color rxForeColor    = HMI.Presentation.AUrr.UI.VisualStyle.Colors.Black;
                Color titleForeColor = HMI.Presentation.AUrr.UI.VisualStyle.Colors.Black;
                Image ptt            = null;
                Image squelch        = null;
                Image audio          = null;
                int   rtxGroup       = 0;
                bool  allAsOneBt     = false;
                /** 20190121. AGL. ALIAS a mostrar en la tecla... */
                // string alias = dst.Alias;
                string alias        = dst.KeyAlias;
                bool   isGreenIcons = false;

                if (!dst.Unavailable)
                {
                    rtxGroup = dst.RtxGroup;
                    alias    = (dst.TempAlias != string.Empty && dst.TempAlias != dst.Alias) ? dst.TempAlias : alias;

                    if (_StateManager.ManagingSite)
                    {
                        allAsOneBt        = true;
                        title             = _RtxBlinkOn ? HMI.Presentation.AUrr.UI.VisualStyle.Colors.Yellow : HMI.Presentation.AUrr.UI.VisualStyle.ButtonColor;
                        _RtxBlinkList[bt] = HMI.Presentation.AUrr.UI.VisualStyle.Colors.Yellow;
                    }
                    else if (dst.Rx)
                    {
                        rx = HMI.Presentation.AUrr.UI.VisualStyle.Colors.White;

                        rxForeColor = HMI.Presentation.AUrr.UI.VisualStyle.Colors.Green;

                        if (dst.Tx)
                        {
                            tx = HMI.Presentation.AUrr.UI.VisualStyle.Colors.HeaderBlueA1;
                            bt.changeTxText("Tx");
                            txForeColor        = HMI.Presentation.AUrr.UI.VisualStyle.Colors.Black;//Seleccionado en reposo
                            _PttPushedList[bt] = dst;

                            if (_StateManager.Radio.Rtx > 0)
                            {
                                rtxGroup = dst.RtxGroup < 0 ? dst.RtxGroup : dst.TempRtxGroup;

                                if (rtxGroup == 0)
                                {
                                    allAsOneBt        = true;
                                    title             = _RtxBlinkOn ? HMI.Presentation.AUrr.UI.VisualStyle.Colors.Yellow : bt.CurrentBackColor;
                                    _RtxBlinkList[bt] = HMI.Presentation.AUrr.UI.VisualStyle.Colors.Yellow;
                                }
                                else if (rtxGroup == _StateManager.Radio.Rtx)
                                {
                                    allAsOneBt = true;
                                    title      = HMI.Presentation.AUrr.UI.VisualStyle.Colors.Yellow;
                                }
                            }
                        }
                        else
                        {
                            bt.changeTxText("");
                        }
                    }

                    NotifMsg msg = null;
                    switch (dst.Ptt)
                    {
                    case PttState.NoPtt:
                        if (dst.Tx)
                        {
                            tx = HMI.Presentation.AUrr.UI.VisualStyle.Colors.HeaderBlueA1;
                        }
                        else
                        {
                            tx = HMI.Presentation.AUrr.UI.VisualStyle.ButtonColor;
                        }
                        break;

                    case PttState.ExternPtt:
                        titleForeColor = HMI.Presentation.AUrr.UI.VisualStyle.Colors.Red;
                        break;

                    case PttState.PttOnlyPort:
                        title = HMI.Presentation.AUrr.UI.VisualStyle.Colors.DarkGreen;
                        break;

                    case PttState.PttPortAndMod:
                        title                  = HMI.Presentation.AUrr.UI.VisualStyle.Colors.DarkGreen;
                        _PttBlinkList[bt]      = Resources.Ptt;
                        _PttBlinkTimer.Enabled = true;
                        break;

                    case PttState.Blocked:
                        title          = HMI.Presentation.AUrr.UI.VisualStyle.Colors.Red;
                        titleForeColor = HMI.Presentation.AUrr.UI.VisualStyle.Colors.DarkRed;
                        break;

                    /** halfduplex */
                    case PttState.CarrierError:    //Error en portadora
                        title = HMI.Presentation.AUrr.UI.VisualStyle.Colors.Red;
                        break;

                    case PttState.TxError:    //Error en la confirmacion de la Tx
                        title = HMI.Presentation.AUrr.UI.VisualStyle.Colors.Red;
                        break;
                        //Sin default
                    }

                    switch (dst.Squelch)
                    {
                    case SquelchState.SquelchOnlyPort:
                        /** 20190205 */
                        if (dst.PttSrcId.StartsWith("Rtx_") && dst.Ptt == PttState.ExternPtt)
                        {
                            txForeColor = HMI.Presentation.AUrr.UI.VisualStyle.Colors.Red;
                        }
                        switch (dst.AudioVia)
                        {
                        case RdRxAudioVia.Speaker:
                            rx           = HMI.Presentation.AUrr.UI.VisualStyle.Colors.DarkGreen;
                            audio        = Resources.RxSpeakerBlack; //Iconos negros
                            isGreenIcons = true;
                            break;

                        case RdRxAudioVia.HeadPhones:
                            rx           = HMI.Presentation.AUrr.UI.VisualStyle.Colors.DarkGreen;
                            audio        = Resources.RxHeadPhonesBlack;
                            isGreenIcons = true;
                            break;

                        case RdRxAudioVia.NoAudio:
                            rxForeColor = HMI.Presentation.AUrr.UI.VisualStyle.Colors.StrongGreen;
                            rx          = HMI.Presentation.AUrr.UI.VisualStyle.Colors.DarkGreen;
                            break;
                        }


                        break;

                    case SquelchState.SquelchPortAndMod:
                        switch (dst.AudioVia)
                        {
                        case RdRxAudioVia.Speaker:
                            audio        = Resources.RxSpeaker; //Iconos verdes
                            isGreenIcons = true;
                            break;

                        case RdRxAudioVia.HeadPhones:
                            audio        = Resources.RxHeadPhones;
                            isGreenIcons = true;
                            break;

                        case RdRxAudioVia.NoAudio:
                            rxForeColor = HMI.Presentation.AUrr.UI.VisualStyle.Colors.StrongGreen;
                            break;
                        }
                        _SquelchBlinkList[bt]      = Resources.Squelch;
                        _SquelchBlinkTimer.Enabled = true;
                        break;

                    case SquelchState.NoSquelch:
                        break;
                    }

                    if (!isGreenIcons)
                    {
                        switch (dst.AudioVia)
                        {
                        case RdRxAudioVia.Speaker:
                            audio = Resources.RxSpeakerBlack;    //Iconos negros
                            break;

                        case RdRxAudioVia.HeadPhones:
                            audio = Resources.RxHeadPhonesBlack;
                            break;
                        }
                    }
                }
                else
                {
                    bt.changeTxText("");
                    title = HMI.Presentation.AUrr.UI.VisualStyle.Colors.HeaderBlueA1;
                    tx    = HMI.Presentation.AUrr.UI.VisualStyle.ButtonColor;
                    rx    = HMI.Presentation.AUrr.UI.VisualStyle.ButtonColor;
                }
                // Mostrar información Qidx sólo si en HMI.exe.config está habilitado
                if (Settings.Default.ShowBssProperties)
                {
                    bt.Reset(dst.Frecuency, dst.TipoFrecuencia == TipoFrecuencia_t.FD ? dst.QidxResource : alias, dst.Unavailable, allAsOneBt, rtxGroup, ptt, squelch, audio, title, tx, rx, txForeColor, rxForeColor, titleForeColor,
                             dst.QidxResource, dst.QidxValue, dst.State == FrequencyState.Degraded);
                }
                else
                {
                    /** 20190121. AGL. ALIAS a mostrar en la tecla... */
                    // bt.Reset(dst.Frecuency, dst.TipoFrecuencia == TipoFrecuencia_t.FD ? string.Empty : alias, dst.Unavailable, allAsOneBt, rtxGroup, ptt, squelch, audio, title, tx, rx, txForeColor, rxForeColor, titleForeColor,
                    bt.Reset(dst.Frecuency, alias, dst.Unavailable, allAsOneBt, rtxGroup, ptt, squelch, audio, title, tx, rx, txForeColor, rxForeColor, titleForeColor,

                             dst.State == FrequencyState.Degraded);
                }
                bt.Enabled = _StateManager.Tft.Enabled && _StateManager.Engine.Operative && !dst.Unavailable;
            }

            bt.Visible = dst.IsConfigurated;
        }
        public void RdRtxClick(int numPositionsByPage)
        {
            if (!_StateManager.Radio.PttOn)
            {
                int tempRtxGroup = _StateManager.Radio.Rtx;

                if (tempRtxGroup == 0)
                {
                    _RdButtonClick = false;
                }

                if (!_RdButtonClick)
                {
                    _StateManager.Radio.SetRtx((tempRtxGroup + 1) % (Settings.Default.MaxRtxGroups + 1), numPositionsByPage);
                }
                else
                {
                    Dictionary <int, RtxState> newRtxGroup = _StateManager.Radio.SetRtx(0, numPositionsByPage);

                    if (newRtxGroup.Count > 0)
                    {
                        int numElementsInRxtGroup = 0;
                        int numElementsToAdd      = 0;
                        int notChangedPos         = 0;

                        foreach (KeyValuePair <int, RtxState> p in newRtxGroup)
                        {
                            switch (p.Value)
                            {
                            case RtxState.Add:
                                numElementsInRxtGroup++;
                                numElementsToAdd++;
                                break;

                            case RtxState.NoChanged:
                                numElementsInRxtGroup++;
                                notChangedPos = p.Key;
                                break;
                            }
                        }

                        if (numElementsInRxtGroup == 1)
                        {
                            if (numElementsToAdd > 0)
                            {
                                NotifMsg msg = new NotifMsg(Resources.RtxNeedMoreFrecuenties, Resources.MessageErrorCaption, Resources.RtxNeedMoreFrecuenties, Settings.Default.MessageToutSg * 1000, MessageType.Error, MessageButtons.Ok);
                                _StateManager.ShowUIMessage(msg);
                            }
                            else
                            {
                                newRtxGroup[notChangedPos] = RtxState.Delete;
                                _EngineCmdManager.SetRtxGroup(tempRtxGroup, newRtxGroup);

                                //No es necesaria esta ventana de notificación porque el procesamiento es muy rápido y no se llega a leer.
                                //NotifMsg msg = new NotifMsg(Resources.RtxOperationRunning, Resources.MessageInfoCaption, Resources.RtxOperationRunning, 10000, MessageType.Processing, MessageButtons.None);
                                //_StateManager.ShowUIMessage(msg);
                            }
                        }
                        else
                        {
                            _EngineCmdManager.SetRtxGroup(tempRtxGroup, newRtxGroup);

                            //No es necesaria esta ventana de notificación porque el procesamiento es muy rápido y no se llega a leer.
                            //NotifMsg msg = new NotifMsg(Resources.RtxOperationRunning, Resources.MessageInfoCaption, Resources.RtxOperationRunning, 10000, MessageType.Processing, MessageButtons.None);
                            //_StateManager.ShowUIMessage(msg);
                        }
                    }
                }
            }
        }
示例#17
0
        private void Reset(RdButton bt, RdDst dst)
        {
            bt.Id = dst.Id;

            if (_PttBlinkList.Remove(bt) && (_PttBlinkList.Count == 0))
            {
                _PttBlinkTimer.Enabled = false;
                _PttBlinkOn            = true;
            }
            if (_SquelchBlinkList.Remove(bt) && (_SquelchBlinkList.Count == 0))
            {
                _SquelchBlinkTimer.Enabled = false;
                _SquelchBlinkOn            = true;
            }
            _RtxBlinkList.Remove(bt);
            _PttPushedList.Remove(bt);

            if (dst.IsConfigurated)
            {
                Color title       = VisualStyle.ButtonColor;
                Color tx          = VisualStyle.ButtonColor;
                Color rx          = VisualStyle.ButtonColor;
                Color txForeColor = VisualStyle.Colors.White;
                Color rxForeColor = VisualStyle.Colors.White;
                Image ptt         = null;
                Image squelch     = null;
                Image audio       = null;
                int   rtxGroup    = 0;
                bool  allAsOneBt  = false;

                if (!dst.Unavailable)
                {
                    rtxGroup = dst.RtxGroup;

                    if (dst.Rx)
                    {
                        title       = rx = VisualStyle.Colors.White;
                        rxForeColor = VisualStyle.Colors.Green;

                        if (dst.Tx)
                        {
                            tx                 = VisualStyle.Colors.White;
                            txForeColor        = VisualStyle.Colors.Green;
                            _PttPushedList[bt] = dst;//VMG lista con los botones seleccionados en la UI

                            if (_StateManager.Radio.Rtx > 0)
                            {
                                rtxGroup = dst.RtxGroup < 0 ? dst.RtxGroup : dst.TempRtxGroup;

                                if (rtxGroup == 0)
                                {
                                    allAsOneBt        = true;
                                    title             = _RtxBlinkOn ? VisualStyle.Colors.Yellow : VisualStyle.ButtonColor;
                                    _RtxBlinkList[bt] = VisualStyle.Colors.Yellow;
                                }
                                else if (rtxGroup == _StateManager.Radio.Rtx)
                                {
                                    allAsOneBt = true;
                                    title      = VisualStyle.Colors.Yellow;
                                }
                            }
                        }
                    }

                    NotifMsg msg = null;
                    switch (dst.Ptt)
                    {
                    case PttState.NoPtt:
                        break;

                    case PttState.ExternPtt:
                    case PttState.PttOnlyPort:
                        ptt = Resources.Ptt;
                        break;

                    case PttState.PttPortAndMod:
                        ptt = _PttBlinkOn ? Resources.Ptt : null;
                        _PttBlinkList[bt]      = Resources.Ptt;
                        _PttBlinkTimer.Enabled = true;
                        break;

                    case PttState.Blocked:
                        ptt = Resources.PttBlocked;
                        break;

                    //VMG 04/09/2018 Cambios en los estados
                    case PttState.Error:    //Error en portadora
                        title       = VisualStyle.Colors.Red;
                        txForeColor = VisualStyle.Colors.Red;
                        msg         = new NotifMsg("Bad Operation", Resources.BadOperation, Resources.CarrierDetectionError, 3000, MessageType.Error, MessageButtons.Ok);
                        General.SafeLaunchEvent(ShowNotifMsgEngine, this, msg);
                        break;

                    //VMG 05/09/2018 Cambios en los estados
                    case PttState.CarrierError:    //Error en portadora
                        title       = VisualStyle.Colors.Red;
                        txForeColor = VisualStyle.Colors.Red;
                        if (!_CarrierDetectionEventFired && !_TxErrorEventFired)
                        {    //Lanzamos el mensaje solo una vez
                            msg = new NotifMsg("Bad Operation", Resources.BadOperation, Resources.CarrierDetectionError, 3000, MessageType.Error, MessageButtons.Ok);
                            General.SafeLaunchEvent(ShowNotifMsgEngine, this, msg);
                        }
                        break;

                    case PttState.TxError:    //Error en la confirmacion de la Tx
                        // PttState.PttNotConfirmed
                        title       = VisualStyle.Colors.Red;
                        txForeColor = VisualStyle.Colors.Red;
                        if (!_TxErrorEventFired && !_CarrierDetectionEventFired)
                        {    //Lanzamos el mensaje solo una vez
                            msg = new NotifMsg("Bad Operation", Resources.BadOperation, Resources.TxConfirmationDetectionError, 3000, MessageType.Error, MessageButtons.Ok);
                            General.SafeLaunchEvent(ShowNotifMsgEngine, this, msg);
                        }
                        break;

                        /*default://Error en la confirmacion de la Tx lo capturamos como PttState.NoPtt
                         *  // PttState.PttNotConfirmed
                         *  title = VisualStyle.Colors.Red;
                         *  txForeColor = VisualStyle.Colors.Red;
                         *  NotifMsg msg2 = new NotifMsg("Bad Operation", Resources.BadOperation, Resources.TxConfirmationDetectionError, 3000, MessageType.Error, MessageButtons.Ok);
                         *  General.SafeLaunchEvent(ShowNotifMsgEngine, this, msg2);
                         *  break;*/
                    }

                    switch (dst.Squelch)
                    {
                    case SquelchState.SquelchOnlyPort:
                        squelch = Resources.Squelch;
                        break;

                    case SquelchState.SquelchPortAndMod:
                        squelch = _SquelchBlinkOn ? Resources.Squelch : null;
                        _SquelchBlinkList[bt]      = Resources.Squelch;
                        _SquelchBlinkTimer.Enabled = true;
                        break;
                    }

                    switch (dst.AudioVia)
                    {
                    case RdRxAudioVia.Speaker:
                        if (_StateManager.Radio.DoubleRadioSpeaker)
                        {
                            audio = Resources.SpeakerUp;
                        }
                        else
                        {
                            audio = Resources.RxSpeaker;
                        }
                        break;

                    case RdRxAudioVia.HeadPhones:
                        audio = Resources.RxHeadPhones;
                        break;

                    case RdRxAudioVia.HfSpeaker:
                        if (_StateManager.Radio.DoubleRadioSpeaker)
                        {
                            audio = Resources.HFSpeakerUp;
                        }
                        else
                        {
                            audio = Resources.HfSpeaker;
                        }
                        break;
                    }
                }

                bt.Reset(dst.Frecuency, dst.Alias, dst.Unavailable, allAsOneBt, rtxGroup, ptt, squelch, audio, title, tx, rx, txForeColor, rxForeColor, dst.TipoFrecuencia == TipoFrecuencia_t.HF ? VisualStyle.Colors.HfColor : VisualStyle.Colors.Black);
                bt.Enabled = _StateManager.Tft.Enabled && _StateManager.Engine.Operative && !dst.Unavailable;
                UpdateTx(bt, dst);
            }

            bt.Visible = dst.IsConfigurated;
        }