Nextrek
@ 58
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
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 System.IO; namespace The_Rats_in_the_Walls { public partial class PanoramaPage1 : PhoneApplicationPage { public PanoramaPage1() { InitializeComponent(); } private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e) { List<string> content = ReadCapContents(); panorama.ItemsSource = content; TextPage.Text = "1/" + NumberOfTextPage(); bindList(); } private List<string> ReadCapContents() { int i; int n = NumberOfCapPage(); List<string> testoPagine = new List<string>(); for (i = 1; i <= n; i++) { //this verse is loaded for the first time so fill it from the text file string uri = String.Format("The Rats in the Walls;component/Data/Part1/Nuovo documento di testo ({0}).txt", i); var ResrouceStream = Application.GetResourceStream(new Uri(uri, UriKind.Relative)); if (ResrouceStream != null) { Stream myFileStream = ResrouceStream.Stream; if (myFileStream.CanRead) { StreamReader myStreamReader = new StreamReader(myFileStream); //read the content here string testo = myStreamReader.ReadToEnd(); testoPagine.Add(testo); } } } return testoPagine; } private int NumberOfTextPage() { //this verse is loaded for the first time so fill it from the text file var ResrouceStream = Application.GetResourceStream(new Uri("The Rats in the Walls;component/Data/config.txt", UriKind.Relative)); if (ResrouceStream != null) { Stream myFileStream = ResrouceStream.Stream; if (myFileStream.CanRead) { StreamReader myStreamReader = new StreamReader(myFileStream); //read the content here string numero = myStreamReader.ReadToEnd(); return Int16.Parse(numero); } } return 0; } private int NumberOfCapPage() { //this verse is loaded for the first time so fill it from the text file var ResrouceStream = Application.GetResourceStream(new Uri("The Rats in the Walls;component/Data/Part1/config1.txt", UriKind.Relative)); if (ResrouceStream != null) { Stream myFileStream = ResrouceStream.Stream; if (myFileStream.CanRead) { StreamReader myStreamReader = new StreamReader(myFileStream); //read the content here string numero = myStreamReader.ReadToEnd(); return Int16.Parse(numero); } } return 0; } private void panorama_SelectionChanged(object sender, SelectionChangedEventArgs e) { string numPagina = ((panorama.SelectedIndex) + 1).ToString(); string pagTotali = NumberOfTextPage().ToString(); TextPage.Text = numPagina + "/" + pagTotali; } private void bindList() { List<string> links = new List<string>(); string stringLink = ""; int n = NumberOfCapPage(); for (int i = 1; i <= n; i++) { stringLink = String.Format("PAGE..........{0}", i); links.Add(stringLink); } LinkPageListBox.ItemsSource = links; } private void page_Click(object sender, RoutedEventArgs e) { String pageClicked = (String)((Control)sender).DataContext; string page = pageClicked.Substring(14); Int32 numPage = ((Int32.Parse(page)) - 1); panorama.DefaultItem = panorama.Items[numPage]; pageCanvas.Visibility = System.Windows.Visibility.Collapsed; } private void openPageLinkButton_Click(object sender, RoutedEventArgs e) { pageCanvas.Visibility = System.Windows.Visibility.Visible; } private void nextCap_Click(object sender, RoutedEventArgs e) { NavigationService.Navigate(new Uri("/The Rats in the Walls;component/PanoramaPage2.xaml", UriKind.Relative)); } //private void home_Click(object sender, RoutedEventArgs e) //{ // NavigationService.Navigate(new Uri("/The Thing on the Doorstep;component/MainPage.xaml", UriKind.Relative)); //} } } |
Commits for Nextrek//WindowsPhone/NextrekBook/H. P. Lovecraft/The Rats in the Walls/The Rats in the Walls/MainPage.xaml.cs
Revision | Author | Commited | Message |
---|---|---|---|
5 | MOliva | Fri 19 Apr, 2013 17:26:06 +0000 | primo caricamento libri win phone 7 |