Exemplo n.º 1
0
        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            if (NavigationContext.QueryString["id"] != null)
            {
                int.TryParse(NavigationContext.QueryString["id"].ToString(), out id);
                db = new StoryContext("isostore:/Story.sdf");

                _story = (from item in db.diary where item.idStory == id select item).FirstOrDefault();
                 //MessageBox.Show(id.ToString());

                txtReadStory.Text = _story.TextStory;
                txtReadCreated.Text = _story.Created;
                titlePage.Text = _story.Title;
            }
        }
Exemplo n.º 2
0
        private void btnReadDelete_Click(object sender, EventArgs e)
        {
            if (NavigationContext.QueryString["id"] != null)
            {
                int.TryParse(NavigationContext.QueryString["id"].ToString(), out id);
                db = new StoryContext("isostore:/Story.sdf");

                _story = (from item in db.diary where item.idStory == id select item).FirstOrDefault();

                db.diary.DeleteOnSubmit(_story);
                db.SubmitChanges();

                NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
            }
        }
Exemplo n.º 3
0
        private void menuDelete_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result = MessageBox.Show("Would you like to delete this story?", "Delete Story", MessageBoxButton.OKCancel);

            if (result == MessageBoxResult.OK)
            {
                // delete data
                int id = ((sender as MenuItem).DataContext as Story).idStory;
                db = new StoryContext("isostore:/Story.sdf");
                Story _story = (from item in db.diary where item.idStory == id select item).FirstOrDefault();
                db.diary.DeleteOnSubmit(_story);
                db.SubmitChanges();
                MainListBox.ItemsSource = db.diary;
            }
        }
Exemplo n.º 4
0
        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            db = new StoryContext("isostore:/Story.sdf");
            if (!db.DatabaseExists())
            {
                db.CreateDatabase();
            }

            MainListBox.ItemsSource = db.diary.OrderBy(item => item.idStory);
            MainListBox.SelectedItem = null;

            while (this.NavigationService.BackStack.Any())
            {
                this.NavigationService.RemoveBackEntry();
            }
        }