Exemplo n.º 1
0
        private void sektionen_ListBox_SelectedIndexChanged_1(object sender, EventArgs e)
        {
            Button_UnEnable(true);
            Werte_Textbox.Text = String.Empty;
            int position_ausgewaehlter_Sektion = sektionen_ListBox.SelectedIndex;

            if (!DAtei_schon_geaendert && position_ausgewaehlter_Sektion >= 0)
            {
                Sektion ausgewaehlte_Sektion = neue_Datei.liste_von_Sektionen.ElementAt(position_ausgewaehlter_Sektion);
                attribute_Listbox.Items.Clear();
                foreach (Attribute attr in ausgewaehlte_Sektion.liste_Attribute)
                {
                    attribute_Listbox.Items.Add(attr.name);
                }
            }
            else if (DAtei_schon_geaendert && position_ausgewaehlter_Sektion >= 0)
            {
                Sektion ausgewaehlte_Sektion = neu_geaenderte_Datei.liste_von_Sektionen.ElementAt(position_ausgewaehlter_Sektion);
                attribute_Listbox.Items.Clear();
                foreach (Attribute attr in ausgewaehlte_Sektion.liste_Attribute)
                {
                    attribute_Listbox.Items.Add(attr.name);
                }
            }
        }
Exemplo n.º 2
0
        private void abbrechen_button_Click(object sender, EventArgs e)
        {
            DialogResult warnung = MessageBox.Show("Durch diese Aktion stornieren Sie alle vorherigen vorgenommenen Änderungen !! \n Wollen Sie diese Aktion trotzdem durchführen?", "Abbrechen", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (warnung == DialogResult.Yes)
            {
                zu_bearbeitende_Sektion = null;
                aenderungen_vorhanden   = false;
                this.Close();
            }
        }
Exemplo n.º 3
0
 public Bearbeiten_Sektion(Sektion selektierte_Sektion)
 {
     InitializeComponent();
     this.zu_bearbeitende_Sektion = selektierte_Sektion;
     this.Text = zu_bearbeitende_Sektion.sektion_name;
     for (int i = 0; i < zu_bearbeitende_Sektion.liste_Attribute.Count; i++)
     {
         Attribute_Listbox.Items.Add(zu_bearbeitende_Sektion.liste_Attribute.ElementAt(i).name);
     }
     label5.Visible = false;
 }
Exemplo n.º 4
0
        private void sektionen_ListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            Button_UnEnable(true);
            int     position_ausgewaehlter_Sektion = sektionen_ListBox.SelectedIndex;
            Sektion ausgewaehlte_Sektion           = neue_Datei.liste_von_Sektionen.ElementAt(position_ausgewaehlter_Sektion);

            attribute_Listbox.Items.Clear();
            foreach (Attribute attr in ausgewaehlte_Sektion.liste_Attribute)
            {
                attribute_Listbox.Items.Add(attr.name);
            }
        }
Exemplo n.º 5
0
        private void attribute_Listbox_SelectedIndexChanged(object sender, EventArgs e)
        {
            int position_ausgewaehlter_Sektion = sektionen_ListBox.SelectedIndex;

            int     position_selected_attribute = attribute_Listbox.SelectedIndex;
            Sektion ausgewaehlte_Sektion        = neue_Datei.liste_von_Sektionen.ElementAt(position_ausgewaehlter_Sektion);

            Attribute selected_Attribute = ausgewaehlte_Sektion.liste_Attribute.ElementAt(position_selected_attribute);

            //wert_des_attribute_textbox.Text = selected_Attribute.wert;
            dateipfad_textbox.Text = "";
            dateipfad_textbox.Text = selected_Attribute.wert;
        }
Exemplo n.º 6
0
 private void weitere_Attribute_Button_Click(object sender, EventArgs e)
 {
     if (sektion_label.Visible && Sektion_Textbox.Visible)
     {
         Sektion neue_erzeugte_Sektion = new Sektion(Sektion_Textbox.Text);
         Liste_der_hinzugefuegten_Sektionen.Add(neue_erzeugte_Sektion);
         sektion_label.Visible     = false;
         Sektion_Textbox.Visible   = false;
         attribut_label.Visible    = true;
         Attribut_TextBox.Visible  = true;
         wert_label.Visible        = true;
         wert_Textbox.Visible      = true;
         zurueck_button.Visible    = true;
         abbrechen_Button.Location = this.position_abbrechen_Button;
     }
     else
     {
         Attribute neues_Attribut = new Attribute(Attribut_TextBox.Text, wert_Textbox.Text);
         Liste_der_hinzugefuegten_Sektionen.ElementAt(Liste_der_hinzugefuegten_Sektionen.Count - 1).liste_Attribute.Add(neues_Attribut);
         Attribut_TextBox.Text = String.Empty;
         wert_Textbox.Text     = String.Empty;
     }
 }
Exemplo n.º 7
0
        private void attribute_Listbox_SelectedIndexChanged(object sender, EventArgs e)
        {
            int position_ausgewaehlter_Sektion = sektionen_ListBox.SelectedIndex;

            int position_selected_attribute = attribute_Listbox.SelectedIndex;

            if (!DAtei_schon_geaendert)
            {
                Sektion ausgewaehlte_Sektion = neue_Datei.liste_von_Sektionen.ElementAt(position_ausgewaehlter_Sektion);

                Attribute selected_Attribute = ausgewaehlte_Sektion.liste_Attribute.ElementAt(position_selected_attribute);
                //wert_des_attribute_textbox.Text = selected_Attribute.wert;
                Werte_Textbox.Text = selected_Attribute.wert;
            }
            else
            {
                Sektion ausgewaehlte_Sektion = neu_geaenderte_Datei.liste_von_Sektionen.ElementAt(position_ausgewaehlter_Sektion);

                Attribute selected_Attribute = ausgewaehlte_Sektion.liste_Attribute.ElementAt(position_selected_attribute);
                //wert_des_attribute_textbox.Text = selected_Attribute.wert;
                Werte_Textbox.Text = selected_Attribute.wert;
            }
        }
Exemplo n.º 8
0
        public void Sektion_Holen()
        {
            Sektion neueSektion;

            for (int j = 0; j < inhalt_der_Datei.Length; j++)
            {
                if (inhalt_der_Datei[j] == String.Empty)
                {
                    continue;
                }
                string line = inhalt_der_Datei[j].Trim();

                //Section??
                if (line[0] == '[')
                {
                    if (line[line.Length - 1] == ']')
                    {
                        string sektion_Name = line.Substring(1, line.Length - 2);
                        neueSektion = new Sektion(sektion_Name, j);
                        liste_von_Sektionen.Add(neueSektion);
                    }
                    else if (line[line.Length - 1] != ']')
                    {
                        throw new FileLoadException("Ini-Datei-Fehler : " + line);
                    }
                }

                else //
                {
                    if (j - 1 >= 0 && liste_von_Sektionen.Count >= 1)
                    {
                        if (line[0] != ';')
                        {
                            string nameAttribut, wertAttribut;
                            nameAttribut = "";
                            wertAttribut = "";
                            int i = 0;
                            while (i < line.Length - 1 && line[i] != '=')
                            {
                                nameAttribut += line[i];
                                i++;
                            }
                            wertAttribut = line.Substring(i + 1, line.Length - nameAttribut.Length - 1);

                            Attribute neuAttribut = new Attribute(nameAttribut, wertAttribut);
                            liste_von_Sektionen[liste_von_Sektionen.Count - 1].liste_Attribute.Add(neuAttribut);
                        }
                        else
                        {
                            if (liste_von_Sektionen[liste_von_Sektionen.Count - 1].liste_Attribute.Count != 0)
                            {
                                liste_von_Sektionen[liste_von_Sektionen.Count - 1].liste_Attribute[liste_von_Sektionen[liste_von_Sektionen.Count - 1].liste_Attribute.Count - 1].liste_von_kommentaren.Add(line.Substring(1, line.Length - 1));
                            }
                            else
                            {
                                liste_von_Sektionen[liste_von_Sektionen.Count - 1].liste_von_Kommentaren.Add(line.Substring(1, line.Length - 1));
                            }
                        }
                    }



                    //Kommentar

                    // Attribut - zu welcher Sektion gehört es? neueSektion
                }
            }
        }