Пример #1
0
 private void Export_Click(object sender, EventArgs e)
 {
     try
     {
         SaveFileDialog saveFileDialog = new SaveFileDialog();
         saveFileDialog.Title  = "Export movie album";
         saveFileDialog.Filter = "Files Xml (*.xml)|*.xml|All files (*.*)" +
                                 "|*.*";
         if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             MovieXmlSerialized.Serialize(data, saveFileDialog.FileName);
         }
     }
     catch (Exception x)
     {
         MessageBox.Show("Error : " + x.Message);
     }
 }
Пример #2
0
        //Import MovieForm
        private void movieToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                OpenFileDialog openFileDialog = new OpenFileDialog();
                openFileDialog.Title  = "Import movie";
                openFileDialog.Filter = "Files format Xml (*.xml)|*.xml" +
                                        "|All files (*.*)|*.*";
                openFileDialog.Multiselect = false;

                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    Movie     data      = MovieXmlSerialized.Deserialize(openFileDialog.FileName);
                    MovieForm movieForm = new MovieForm(data);
                    movieForm.MdiParent = this;
                    movieForm.Show();
                }
            }
            catch (Exception x)
            {
                MessageBox.Show("Error : " + x.Message);
            }
        }