Skip to content

Instantly share code, notes, and snippets.

@Chubek
Created June 30, 2016 16:51
Show Gist options
  • Save Chubek/6a9e44b12a6041052fce14027410c91d to your computer and use it in GitHub Desktop.
Save Chubek/6a9e44b12a6041052fce14027410c91d 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.Navigation;
using System.Windows.Shapes;
using System.Collections;
using System.Collections.ObjectModel;
namespace MyPostIt
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public ObservableCollection<string> Notes = new ObservableCollection<string>();
public void UpdateList()
{
using (System.IO.StreamReader myStreamReader = new System.IO.StreamReader("Notes.xml"))
{
System.Xml.Serialization.XmlSerializer myXML = new System.Xml.Serialization.XmlSerializer(typeof(ObservableCollection<String>));
Notes = (ObservableCollection<String>)myXML.Deserialize(myStreamReader);
}
Notes.Reverse();
listBox.ItemsSource = Notes;
}
public MainWindow()
{
InitializeComponent();
UpdateList();
}
private void newButton_Click(object sender, RoutedEventArgs e)
{
AddWindow myAddWindow = new AddWindow();
myAddWindow.Show();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment