Ejemplo n.º 1
0
        private void menuItem9_Click(object sender, System.EventArgs e)
        {
            if (lastOpenedFile == "")
            {
                menuItem4_Click(sender, e);
            }
            else
            {
                ODFTextArea name = textDocument.FindControlById("name") as ODFTextArea;
                if (name != null)
                {
                    name.CurrentValue = eName.Text;
                }

                ODFTextArea surname = textDocument.FindControlById("surname") as ODFTextArea;
                if (surname != null)
                {
                    surname.CurrentValue = eSurname.Text;
                }

                ODFListBox gender = textDocument.FindControlById("gender") as ODFListBox;
                if (gender != null)
                {
                    ODFOption m = gender.GetOptionByLabel("Male");
                    ODFOption f = gender.GetOptionByLabel("Female");
                    if (eGender.SelectedIndex == 0)
                    {
                        if (m != null && f != null)
                        {
                            m.CurrentSelected = XmlBoolean.True;
                            f.CurrentSelected = XmlBoolean.False;
                        }
                    }
                    else if (eGender.SelectedIndex == 1)
                    {
                        if (f != null && m != null)
                        {
                            f.CurrentSelected = XmlBoolean.True;
                            m.CurrentSelected = XmlBoolean.False;
                        }
                    }
                }

                ODFFormattedText age = textDocument.FindControlById("age") as ODFFormattedText;
                if (age != null)
                {
                    age.CurrentValue = eAge.Value.ToString();
                }

                ODFTextArea addinfo = textDocument.FindControlById("addinfo") as ODFTextArea;
                if (addinfo != null)
                {
                    addinfo.CurrentValue = eAdditional.Text;
                }

                ODFCheckBox usesaodl = textDocument.FindControlById("usesaodl") as ODFCheckBox;
                if (usesaodl != null)
                {
                    if (eUsesAODL.Checked)
                    {
                        usesaodl.CurrentState = State.Checked;
                    }
                    else
                    {
                        usesaodl.CurrentState = State.Unchecked;
                    }
                }
                textDocument.SaveTo(lastOpenedFile);
            }
        }
Ejemplo n.º 2
0
        private void menuItem3_Click(object sender, System.EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                textDocument.Load(openFileDialog1.FileName);

                ODFTextArea name = textDocument.FindControlById("name") as ODFTextArea;
                if (name != null)
                {
                    eName.Text = name.CurrentValue;
                }
                else
                {
                    MessageBox.Show("");
                }
                ODFTextArea surname = textDocument.FindControlById("surname") as ODFTextArea;
                if (surname != null)
                {
                    eSurname.Text = surname.CurrentValue;
                }

                ODFListBox gender = textDocument.FindControlById("gender") as ODFListBox;
                if (gender != null)
                {
                    ODFOption opt = gender.GetOptionByLabel("Male");
                    if (opt != null)
                    {
                        if (opt.CurrentSelected == XmlBoolean.True)
                        {
                            eGender.SelectedIndex = 0;
                        }
                    }

                    opt = gender.GetOptionByLabel("Female");
                    if (opt != null)
                    {
                        if (opt.CurrentSelected == XmlBoolean.True)
                        {
                            eGender.SelectedIndex = 1;
                        }
                    }
                }

                ODFFormattedText age = textDocument.FindControlById("age") as ODFFormattedText;
                if (age != null)
                {
                    eAge.Value = int.Parse(age.CurrentValue);
                }

                ODFTextArea addinfo = textDocument.FindControlById("addinfo") as ODFTextArea;
                if (addinfo != null)
                {
                    eAdditional.Text = addinfo.CurrentValue;
                }

                ODFCheckBox usesaodl = textDocument.FindControlById("usesaodl") as ODFCheckBox;
                if (usesaodl != null)
                {
                    eUsesAODL.Checked = (usesaodl.CurrentState == State.Checked);
                }

                lastOpenedFile = openFileDialog1.FileName;
            }
        }