Exemple #1
0
        protected override void inicializarComponente()
        {
            base.inicializarComponente();

            foreach (var item in _SomAlarme)
            {
                var alarmeSwitch = new AlarmeSwitch {
                    Style     = EstiloUtils.Popup.CheckBox,
                    SomAlarme = item.Key
                };
                alarmeSwitch.Toggled += (sender, e) =>
                {
                    var alSwitch = (AlarmeSwitch)sender;
                    if (alSwitch.IsToggled)
                    {
                        foreach (var s in _Controls)
                        {
                            if (alSwitch.SomAlarme != s.Key)
                            {
                                s.Value.IsToggled = false;
                            }
                        }
                        PreferenciaUtils.SomAlarme = alSwitch.SomAlarme;
                        new AvisoSonoroBLL().play(alSwitch.SomAlarme);
                    }
                };
                _Controls.Add(item.Key, alarmeSwitch);
            }
        }
        protected override void inicializarComponente()
        {
            base.inicializarComponente();

            foreach (var item in _SomAlarme)
            {
                var alarmeSwitch = new AlarmeSwitch {
                    Style     = EstiloUtils.Popup.CheckBox,
                    SomAlarme = item.Key
                };
                alarmeSwitch.Toggled += (sender, e) =>
                {
                    var alSwitch = (AlarmeSwitch)sender;
                    if (alSwitch.IsToggled)
                    {
                        foreach (var s in _Controls)
                        {
                            if (alSwitch.SomAlarme != s.Key)
                            {
                                s.Value.IsToggled = false;
                            }
                        }
                        PreferenciaUtils.SomAlarme = alSwitch.SomAlarme;
                        var regraAviso = new AvisoSonoroBLL();
                        if (PreferenciaUtils.CanalAudio == AudioCanalEnum.Notificacao)
                        {
                            string arquivoSom = regraAviso.pegarArquivo(alSwitch.SomAlarme);
                            MensagemUtils.notificar(104, "Radar+", "Reproduzindo som de alarme para escolha!", audio: arquivoSom);
                        }
                        else
                        {
                            regraAviso.play(alSwitch.SomAlarme);
                        }
                    }
                    else
                    {
                        bool marcado = false;
                        foreach (var s in _Controls)
                        {
                            if (s.Value.IsToggled)
                            {
                                marcado = true;
                                break;
                            }
                        }
                        if (!marcado)
                        {
                            alSwitch.IsToggled = true;
                        }
                    }
                };
                _Controls.Add(item.Key, alarmeSwitch);
            }
        }