Jypeli  5
The simple game programming library
FilePage.xaml.cs
Siirry tämän tiedoston dokumentaatioon.
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Net;
5 using System.Windows;
6 using System.Windows.Controls;
7 using System.Windows.Documents;
8 using System.Windows.Input;
9 using System.Windows.Media;
10 using System.Windows.Media.Animation;
11 using System.Windows.Shapes;
12 using Microsoft.Phone.Controls;
13 using Jypeli;
14 
15 namespace SilverStorageTest
16 {
17  public partial class FilePage : PhoneApplicationPage
18  {
19  public static Uri URI = new Uri( "/FilePage.xaml", UriKind.Relative );
20 
21  public FilePage()
22  {
23  InitializeComponent();
24  }
25 
26  private void PhoneApplicationPage_GotFocus( object sender, RoutedEventArgs e )
27  {
28  }
29 
30  private void PhoneApplicationPage_Loaded( object sender, RoutedEventArgs e )
31  {
32  UpdateFileList();
33  }
34 
35  private void buttonView_Click( object sender, RoutedEventArgs e )
36  {
37  try
38  {
39  FileContentPage.FileName = GetSelectedFileName();
40  NavigationService.Navigate( FileContentPage.URI );
41  }
42  catch ( IndexOutOfRangeException )
43  {
44  }
45  }
46 
47  private void buttonDelete_Click( object sender, RoutedEventArgs e )
48  {
49  try
50  {
51  DataStorage.Instance.Delete( GetSelectedFileName() );
52  UpdateFileList();
53  }
54  catch ( IndexOutOfRangeException )
55  {
56  }
57  }
58 
59  string GetSelectedFileName()
60  {
61  if ( fileList.SelectedIndex < 0 ) throw new IndexOutOfRangeException();
62  return fileList.SelectedItem as string;
63  }
64 
65  void UpdateFileList()
66  {
67  fileList.Items.Clear();
68  foreach ( string file in DataStorage.Instance.GetFileList() )
69  fileList.Items.Add( file );
70  }
71  }
72 }
static IsolatedStorageManager Instance
Definition: DataStorage.cs:5
override void Delete(string fileName)
Poistaa tiedoston.
override IList< string > GetFileList()