Skip to content

Instantly share code, notes, and snippets.

@Chubek
Created June 30, 2016 09:42
Show Gist options
  • Save Chubek/0ca7a1d4b11e207bb2ee566f1cf6630f to your computer and use it in GitHub Desktop.
Save Chubek/0ca7a1d4b11e207bb2ee566f1cf6630f to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Xml;
using System.Xml.Serialization;
using System.IO;
namespace MyPostIt
{
/// <summary>
/// Interaction logic for AddWindow.xaml
/// </summary>
public partial class AddWindow : Window
{
List<string> Notes = new List<string>();
public AddWindow()
{
InitializeComponent();
}
private void addButton_Click(object sender, RoutedEventArgs e)
{
string stringToAdd = textBox.Text;
Notes.Add(stringToAdd);
using (StreamWriter myStreamWriter = new StreamWriter("Notes.xml"))
{
XmlSerializer myXML = new XmlSerializer(typeof(Note));
Note myNote = new Note();
myNote.Notes = stringToAdd;
myXML.Serialize(myStreamWriter, myNote);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment