Пример #1
0
 private void DefinicoesForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (!saveDefinicoes)
     {
         //Se não tiver carregado no OK, faz reset às definicoes
         Definicoes.Load();
     }
 }
Пример #2
0
        public void gravarDefinicoes(Definicoes def)
        {
            DataSet ds = new DataSet();
            string s="";
            StringCollection sc = new StringCollection();
            sc = def.getExtensoes();
            int i = 0;
            foreach (string x in sc)
            {
                s += x;
                if (i < sc.Count - 1)
                    s += ", ";
                i++;
            }
            FileStream finschema = new FileStream("definicoes.xsd", FileMode.OpenOrCreate, FileAccess.Read, FileShare.Read);
            ds.ReadXmlSchema(finschema);
            finschema.Close();
            FileStream findata = new FileStream("definicoes.xml", FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite);
            ds.ReadXml(findata);
            findata.Close();

            foreach (DataRow dr in ds.Tables["definicoes"].Rows)
            {
                dr["extensoes"] = s;
            }
            FileStream fout = new FileStream("definicoes.xml", FileMode.Truncate,
                   FileAccess.Write, FileShare.ReadWrite);
            ds.WriteXml(fout);
            fout.Close();
        }
Пример #3
0
        public Definicoes getDefinicoes()
        {
            DataSet ds = new DataSet();
            Definicoes def = new Definicoes();

            FileStream finschema = new FileStream("definicoes.xsd", FileMode.OpenOrCreate, FileAccess.Read, FileShare.Read);
            ds.ReadXmlSchema(finschema);
            finschema.Close();
            FileStream findata = new FileStream("definicoes.xml", FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite);
            ds.ReadXml(findata);
            findata.Close();

            foreach (DataRow dr in ds.Tables["definicoes"].Rows)
            {
                def.setExtensoes((string)(dr["extensoes"]));
            }

            return def;
        }
Пример #4
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     saveDefinicoes = true; //Informa que quando o form fechar não é para fazer reset às definicoes
     Definicoes.Save();
     Close();
 }
Пример #5
0
        private void Proproj_Load(object sender, EventArgs e)
        {
            BD bd = new BD();
            def = bd.getDefinicoes();
            StringCollection sc = new StringCollection();
            sc = def.getExtensoes();
            foreach (string s in sc)
            {
                comboBox3.Items.Add(s);
            }
            numericUpDown2.Enabled = false;
            if (i == 1)
            {
                textBox1.Enabled = false;
                textBox1.Text = p.getNome();
                textBox2.Text = p.getUrlInicial();
                textBox3.Text = p.getPasta();
                if (p.getvisualizacaolocal() == 1)
                {
                    radioButton1.Checked = true;
                    radioButton2.Checked = false;
                }
                else
                {
                    radioButton2.Checked = true;
                    radioButton1.Checked = false;
                }

                if (p.getNivel() == -1)
                {
                    radioButton3.Checked = true;
                    radioButton4.Checked = false;
                    radioButton5.Checked = false;
                }

                if (p.getNivel() == 0)
                {
                    radioButton3.Checked = false;
                    radioButton4.Checked = false;
                    radioButton5.Checked = true;
                }

                if (p.getNivel() > 0)
                {
                    radioButton3.Checked = false;
                    radioButton4.Checked = true;
                    radioButton5.Checked = false;
                    numericUpDown2.Enabled = true;
                    numericUpDown2.Value = p.getNivel();
                }

                if (p.getImagensRemotas() == 1)
                    checkBox16.Checked = true;

                if (p.getFiltros() != null)
                    carregar_filtros(p.getFiltros());

                if (p.getAceitarRejeitar() == 1)
                {
                    radioButton7.Checked = false;
                    radioButton8.Checked = true;
                }
                else
                {
                    radioButton7.Checked = true;
                    radioButton8.Checked = false;
                }

            }

               numericUpDown1.Visible=false;
               dateTimePicker1.Visible=false;
               button7.Visible = false;
               label11.Visible = false;
               textBox4.Visible = false;
               comboBox3.Visible = false;
        }