Exemplo n.º 1
0
        private void Ok()
        {
            string lastList = config.AppSettings.Settings["Url"].Value;

            if (lastList != txtURL.Text)
            {
                config.AppSettings.Settings["Url"].Value = txtURL.Text;
                Channels channels = Channels.Get();
                channels.SetUrl(txtURL.Text);
                channels.SetNeedRefresh(true);
                ConfigurationManager.RefreshSection("appSettings");
            }

            string lastEPG = config.AppSettings.Settings["Epg"].Value;

            if (lastEPG != txtEPG.Text)
            {
                config.AppSettings.Settings["Epg"].Value = txtEPG.Text;
                EPG_DB epgDB = EPG_DB.Get();
                epgDB.Refresh = true;
                ConfigurationManager.RefreshSection("appSettings");
            }
            config.AppSettings.Settings["audio"].Value = Utils.GetAudioConfName(audio.SelectedItem.ToString());
            config.AppSettings.Settings["sub"].Value   = Utils.GetSubConfName(sub.SelectedItem.ToString());
            config.Save(ConfigurationSaveMode.Modified);
            this.Close();
            this.Dispose();
        }
Exemplo n.º 2
0
        private void btnCancel_Click(object sender, EventArgs e)
        {
            Channels channels = Channels.Get();

            channels.SetNeedRefresh(false);
            this.Close();
            this.Dispose();
        }
Exemplo n.º 3
0
        private void Ok()
        {
            AmiConfiguration amiconf = AmiConfiguration.Get();
            var encode = Utils.Base64Encode(txtParentalControl.Text);

            if (amiconf.PARENTAL_PASS != encode && !string.IsNullOrEmpty(txtParentalControl.Text))
            {
                if (!string.IsNullOrEmpty(amiconf.PARENTAL_PASS))
                {
                    using (var askForm = new AskPass())
                    {
                        var result = askForm.ShowDialog();
                        if (result == DialogResult.Cancel)
                        {
                            return;
                        }
                    }
                }
                amiconf.PARENTAL_PASS = encode;
            }
            if (string.IsNullOrEmpty(txtParentalControl.Text) && !string.IsNullOrEmpty(amiconf.PARENTAL_PASS))
            {
                if (!string.IsNullOrEmpty(amiconf.PARENTAL_PASS))
                {
                    using (var askForm = new AskPass())
                    {
                        var result = askForm.ShowDialog();
                        if (result == DialogResult.Cancel)
                        {
                            return;
                        }
                    }
                }

                amiconf.PARENTAL_PASS = "";
            }
            if (amiconf.URL_IPTV != txtURL.Text)
            {
                amiconf.URL_IPTV = txtURL.Text;
                Channels channels = Channels.Get();
                channels.SetUrl(txtURL.Text);
                channels.SetNeedRefresh(true);
            }
            else
            {
                Channels channels = Channels.Get();
                channels.SetNeedRefresh(false);
            }
            if (amiconf.REQ_EMAIL != txtRequestEmail.Text)
            {
                amiconf.REQ_EMAIL = txtRequestEmail.Text;
            }

            if (amiconf.URL_EPG != txtEPG.Text)
            {
                amiconf.URL_EPG = txtEPG.Text;
                EPG_DB epgDB = EPG_DB.Get();
                epgDB.Refresh = true;
            }
            if (!amiconf.ENABLE_LOG && chLog.Checked)
            {
                amiconf.ENABLE_LOG = true;
                PrincipalForm.RepaintLabels();
            }
            if (amiconf.ENABLE_LOG && !chLog.Checked)
            {
                amiconf.ENABLE_LOG = false;
                PrincipalForm.RepaintLabels();
            }
            amiconf.DEF_LANG = Utils.GetAudioConfName(audio.SelectedItem.ToString());
            amiconf.DEF_SUB  = Utils.GetSubConfName(sub.SelectedItem.ToString());

            using (StreamWriter file = File.CreateText(Utils.CONF_PATH + "amiIptvConf.json"))
            {
                JsonSerializer serializer = new JsonSerializer();
                serializer.Serialize(file, amiconf);
            }

            this.Close();
            this.Dispose();
        }