Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Animation;
- using System.Windows.Shapes;
- using Microsoft.Phone.Controls;
- using Microsoft.Phone.Shell;
- using System.Collections.ObjectModel;
- namespace MentalStack
- {
- public partial class MainPage : PhoneApplicationPage
- {
- private ObservableCollection<Note> thoughts;
- public ObservableCollection<Note> Thoughts{
- get
- {
- if (thoughts == null)
- {
- thoughts = new ObservableCollection<Note>();
- }
- return thoughts;
- }
- }
- // Constructor
- public MainPage()
- {
- InitializeComponent();
- Note item = new Note("hi", "just testing");
- thoughts = new ObservableCollection<Note>();
- thoughts.Add(new Note("aaa", "BBB"));
- }
- protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
- {
- base.OnNavigatedTo(e);
- if (PhoneApplicationService.Current.State.ContainsKey("Thoughts"))
- {
- thoughts = (ObservableCollection<Note>)PhoneApplicationService.Current.State["Thoughts"];
- }
- }
- protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
- {
- PhoneApplicationService.Current.State["Thoughts"] = thoughts;
- base.OnNavigatedFrom(e);
- }
- private void addThought(object sender, EventArgs e)
- {
- NavigationService.Navigate(new Uri("/PageAddThought.xaml", UriKind.Relative));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment