Exemple #1
0
 private void OpenMenuItem_Click(object sender, RoutedEventArgs e)
 {
     if (openFileDialog.ShowDialog() == true)
     {
         var serializer = new XmlSerializer(typeof(StringDataSource));
         using (XmlReader fs = XmlReader.Create(openFileDialog.FileName))
         {
             dataSource = serializer.Deserialize(fs) as StringDataSource;
         }
     }
 }
Exemple #2
0
        public DataEditor()
        {
            InitializeComponent();

            saveFileDialog.DefaultExt = ".xml";
            openFileDialog.DefaultExt = ".xml";
            saveFileDialog.Filter     = "XML Files|*.xml|All Files|*.*";
            openFileDialog.Filter     = "XML Files|*.xml|All Files|*.*";

            dataSource = new StringDataSource();
            dataSource.data.Add(new Student("Anna"));
            dataSource.data.Add(new Student("Boris"));
        }