Example #1
0
        private void сохранитьToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            var sfd = new SaveFileDialog()
            {
                Filter = "Тату|*.spaceship"
            };

            if (sfd.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            var tatooSalon = new TatooSalon()
            {
                VisitorName = textBox8.Text,
                Age         = textBox7.Text,
                CommetsPage = listBox1.Items.OfType <Comments>().ToList(),
                Journal     = listBox2.Items.OfType <Registration>().ToList(),
            };

            var stream = new MemoryStream();

            pictureBox2.Image.Save(stream, ImageFormat.Jpeg);
            tatooSalon.Photo = stream.ToArray();

            var xs   = new XmlSerializer(typeof(TatooSalon));
            var file = File.Create(sfd.FileName);

            xs.Serialize(file, tatooSalon);
            file.Close();
        }
Example #2
0
        private void сохранитьToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            var sfd = new SaveFileDialog()
            {
                Filter = "Тату|*.tatoo"
            };

            if (sfd.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            var tatooSalon = new TatooSalon()
            {
                //CommetsPage = listBox1.Items.OfType<Comments>().ToList(),
                Journal = listBox2.Items.OfType <Registration>().ToList(),
            };

            var xs   = new XmlSerializer(typeof(TatooSalon));
            var file = File.Create(sfd.FileName);

            xs.Serialize(file, tatooSalon);
            file.Close();
        }