private void OKButton_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     if (this.StoryListBox.SelectedItem != null || this.StoryListBox.SelectedItem is string)
     {
         string storyName = (string)this.StoryListBox.SelectedItem;
         try
         {
             // 清除内存数据.
             foreach (var photo in App.MediaCollection)
             {
                 photo.ThumbnailStream.Close();
             }
             App.MediaCollection.Clear();
             App.CurrentStoryName = storyName;
             PersistenceHelper.ReadStoryFile(storyName);
             this.NavigationService.Navigate(new Uri("/ComposePage.xaml", UriKind.Relative));
         }
         catch
         {
             MessageBox.Show("无法载入短影. 文件似乎已经损坏.");
         }
     }
 }
Exemple #2
0
 // Code to execute when the application is closing (eg, user hit Back)
 // This code will not execute when the application is deactivated
 private void Application_Closing(object sender, ClosingEventArgs e)
 {
     PersistenceHelper.StoreData();
 }
Exemple #3
0
 // Code to execute when the application is deactivated (sent to background)
 // This code will not execute when the application is closing
 private void Application_Deactivated(object sender, DeactivatedEventArgs e)
 {
     PersistenceHelper.StoreData();
 }
Exemple #4
0
 // Code to execute when the application is activated (brought to foreground)
 // This code will not execute when the application is first launched
 private void Application_Activated(object sender, ActivatedEventArgs e)
 {
     PersistenceHelper.RestoreData();
 }
Exemple #5
0
 // Code to execute when the application is launching (eg, from Start)
 // This code will not execute when the application is reactivated
 private void Application_Launching(object sender, LaunchingEventArgs e)
 {
     PersistenceHelper.RestoreData();
 }
 protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
 {
     this.StoryListBox.ItemsSource = PersistenceHelper.EnumerateStories();
     base.OnNavigatedTo(e);
 }