|
@@ -103,45 +103,7 @@ |
103 |
103 |
|
|
104 |
104 |
|
|
105 |
105 |
|
|
106 |
|
- |
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e) |
107 |
|
- |
{ |
108 |
|
- |
//object myValue; |
109 |
|
- |
//if (phoneAppService.State.ContainsKey("MyValue")) |
110 |
|
- |
//{ |
111 |
|
- |
// if (phoneAppService.State.TryGetValue("MyValue", out myValue)) |
112 |
|
- |
// { |
113 |
|
- |
// feedListPreferiti.ItemsSource = (List<ArticoloPreferito>)myValue; |
114 |
|
- |
// } |
115 |
|
- |
//} |
116 |
|
- |
|
117 |
|
- |
//if (PageOrientation.Landscape == oLand) |
118 |
|
- |
// grigliaTesto.Height = 370.00; |
119 |
|
- |
|
120 |
|
- |
checkConnection(); |
121 |
|
- |
SystemTray.IsVisible = false; |
122 |
|
- |
feedListPreferiti.ItemsSource = listArticoliP; |
123 |
|
- |
|
124 |
|
- |
|
125 |
|
- |
|
126 |
|
- |
// WebClient is used instead of HttpWebRequest in this code sample because |
127 |
|
- |
// the implementation is simpler and easier to use, and we do not need to use |
128 |
|
- |
// advanced functionality that HttpWebRequest provides, such as the ability to send headers. |
129 |
|
- |
WebClient webClient1 = new WebClient(); |
130 |
|
- |
WebClient webClient3 = new WebClient(); |
131 |
|
- |
|
132 |
|
- |
// Subscribe to the DownloadStringCompleted event prior to downloading the RSS feed. |
133 |
|
- |
webClient1.DownloadStringCompleted += new DownloadStringCompletedEventHandler(webClient1_DownloadStringCompleted); |
134 |
|
- |
webClient3.DownloadStringCompleted += new DownloadStringCompletedEventHandler(webClient3_DownloadStringCompleted); |
135 |
|
- |
|
136 |
|
- |
// Download the RSS feed. DownloadStringAsync was used instead of OpenStreamAsync because we do not need |
137 |
|
- |
// to leave a stream open, and we will not need to worry about closing the channel. |
138 |
|
- |
webClient1.DownloadStringAsync(new System.Uri("http://tuttolavoro.indicitalia.it/RSS/app.xml")); |
139 |
|
- |
webClient3.DownloadStringAsync(new System.Uri("http://www.wki.it/marketing/app/tuttolavoroApp_Rel_news.xml")); |
140 |
|
- |
|
141 |
|
- |
|
142 |
|
- |
//if (listArticoliP.Count == 0) |
143 |
|
- |
// feedListPreferiti.Visibility = System.Windows.Visibility.Collapsed; |
144 |
|
- |
} |
|
106 |
+ |
|
145 |
107 |
|
|
146 |
108 |
|
|
147 |
109 |
|
// Click handler that runs when the 'Load Feed' or 'Refresh Feed' button is clicked. |
|
@@ -623,50 +585,6 @@ |
623 |
585 |
|
return text; |
624 |
586 |
|
} |
625 |
587 |
|
|
626 |
|
- |
private void CheckBox_Checked(object sender, RoutedEventArgs e) |
627 |
|
- |
{ |
628 |
|
- |
|
629 |
|
- |
|
630 |
|
- |
ListBoxItem checedItem = this.feedListPreferiti.ItemContainerGenerator.ContainerFromItem((sender as CheckBox).DataContext) as ListBoxItem; |
631 |
|
- |
if (checedItem != null) |
632 |
|
- |
{ |
633 |
|
- |
checedItem.IsSelected = true; |
634 |
|
- |
} |
635 |
|
- |
} |
636 |
|
- |
|
637 |
|
- |
private void CheckBox_Unchecked(object sender, RoutedEventArgs e) |
638 |
|
- |
{ |
639 |
|
- |
ListBoxItem checedItem = this.feedListPreferiti.ItemContainerGenerator.ContainerFromItem((sender as CheckBox).DataContext) as ListBoxItem; |
640 |
|
- |
if (checedItem != null) |
641 |
|
- |
{ |
642 |
|
- |
checedItem.IsSelected = false; |
643 |
|
- |
} |
644 |
|
- |
} |
645 |
|
- |
|
646 |
|
- |
|
647 |
|
- |
private void appBarDelete_Click(object sender, EventArgs e) |
648 |
|
- |
{ |
649 |
|
- |
|
650 |
|
- |
if (listArticoliP.Count > 0) |
651 |
|
- |
{ |
652 |
|
- |
foreach (ArticoloPreferito a in listArticoliP) |
653 |
|
- |
{ |
654 |
|
- |
if (a.IsChecked == true) |
655 |
|
- |
{ |
656 |
|
- |
listArticoliP.Remove(a); |
657 |
|
- |
feedListPreferiti.ItemsSource = listArticoliP; |
658 |
|
- |
} |
659 |
|
- |
} |
660 |
|
- |
} |
661 |
|
- |
|
662 |
|
- |
if (listArticoliP.Count == 0) |
663 |
|
- |
{ |
664 |
|
- |
ApplicationBarIconButton b = (ApplicationBarIconButton)ApplicationBar.Buttons[1]; |
665 |
|
- |
b.IsEnabled = false; |
666 |
|
- |
} |
667 |
|
- |
|
668 |
|
- |
//phoneAppService.State["MyValue"] = feedListPreferiti; |
669 |
|
- |
} |
670 |
588 |
|
|
671 |
589 |
|
|
672 |
590 |
|
private void MenuItem_Click(object sender, RoutedEventArgs e) |
|
@@ -1147,6 +1065,91 @@ |
1147 |
1065 |
|
} |
1148 |
1066 |
|
} |
1149 |
1067 |
|
|
|
1068 |
+ |
private void CheckBox_Checked(object sender, RoutedEventArgs e) |
|
1069 |
+ |
{ |
|
1070 |
+ |
ListBoxItem checkedItem = this.feedListPreferiti.ItemContainerGenerator.ContainerFromItem((sender as CheckBox).DataContext) as ListBoxItem; |
|
1071 |
+ |
if (checkedItem != null) |
|
1072 |
+ |
{ |
|
1073 |
+ |
checkedItem.IsSelected = true; |
|
1074 |
+ |
((ArticoloPreferito)checkedItem.DataContext).IsChecked = true; |
|
1075 |
+ |
} |
|
1076 |
+ |
|
|
1077 |
+ |
ApplicationBarIconButton b = (ApplicationBarIconButton)ApplicationBar.Buttons[1]; |
|
1078 |
+ |
b.IsEnabled = true; |
|
1079 |
+ |
|
|
1080 |
+ |
} |
|
1081 |
+ |
|
|
1082 |
+ |
private void CheckBox_Unchecked(object sender, RoutedEventArgs e) |
|
1083 |
+ |
{ |
|
1084 |
+ |
ListBoxItem checkedItem = this.feedListPreferiti.ItemContainerGenerator.ContainerFromItem((sender as CheckBox).DataContext) as ListBoxItem; |
|
1085 |
+ |
if (checkedItem != null) |
|
1086 |
+ |
{ |
|
1087 |
+ |
checkedItem.IsSelected = false; |
|
1088 |
+ |
((ArticoloPreferito)checkedItem.DataContext).IsChecked = false; |
|
1089 |
+ |
} |
|
1090 |
+ |
|
|
1091 |
+ |
int i = 0; |
|
1092 |
+ |
foreach (ArticoloPreferito ap in listArticoliP) //controlla se la lista dei preferiti è rimasta vuota |
|
1093 |
+ |
{ |
|
1094 |
+ |
if (ap.IsChecked == true) |
|
1095 |
+ |
{ |
|
1096 |
+ |
i++; |
|
1097 |
+ |
} |
|
1098 |
+ |
} |
|
1099 |
+ |
|
|
1100 |
+ |
if (i == 0) |
|
1101 |
+ |
{ |
|
1102 |
+ |
//feedListPreferiti.Visibility = System.Windows.Visibility.Collapsed; |
|
1103 |
+ |
//noFavoritesText.Visibility = System.Windows.Visibility.Visible; |
|
1104 |
+ |
ApplicationBarIconButton b = (ApplicationBarIconButton)ApplicationBar.Buttons[1]; |
|
1105 |
+ |
b.IsEnabled = false; |
|
1106 |
+ |
} |
|
1107 |
+ |
|
|
1108 |
+ |
|
|
1109 |
+ |
|
|
1110 |
+ |
} |
|
1111 |
+ |
|
|
1112 |
+ |
private void appBarDelete_Click(object sender, EventArgs e) |
|
1113 |
+ |
{ |
|
1114 |
+ |
List<ArticoloPreferito> listArticoliP2 = new List<ArticoloPreferito>(); |
|
1115 |
+ |
|
|
1116 |
+ |
if (listArticoliP.Count > 0) |
|
1117 |
+ |
{ |
|
1118 |
+ |
|
|
1119 |
+ |
|
|
1120 |
+ |
for (int i = 0; i < listArticoliP.Count; i++) |
|
1121 |
+ |
{ |
|
1122 |
+ |
ArticoloPreferito ap = listArticoliP[i]; |
|
1123 |
+ |
if (ap.IsChecked == false) |
|
1124 |
+ |
{ |
|
1125 |
+ |
//listArticoliP.Remove(ap); |
|
1126 |
+ |
listArticoliP2.Add(ap); |
|
1127 |
+ |
} |
|
1128 |
+ |
} |
|
1129 |
+ |
} |
|
1130 |
+ |
listArticoliP = listArticoliP2; |
|
1131 |
+ |
feedListPreferiti.ItemsSource = listArticoliP; |
|
1132 |
+ |
|
|
1133 |
+ |
|
|
1134 |
+ |
if (listArticoliP.Count == 0) |
|
1135 |
+ |
{ |
|
1136 |
+ |
noFavoritesText.Visibility = System.Windows.Visibility.Visible; |
|
1137 |
+ |
ApplicationBarIconButton b = (ApplicationBarIconButton)ApplicationBar.Buttons[1]; |
|
1138 |
+ |
b.IsEnabled = false; |
|
1139 |
+ |
} |
|
1140 |
+ |
|
|
1141 |
+ |
ApplicationBarIconButton b1 = (ApplicationBarIconButton)ApplicationBar.Buttons[1]; |
|
1142 |
+ |
b1.IsEnabled = false; |
|
1143 |
+ |
artDelFavCanvas.Visibility = System.Windows.Visibility.Visible; |
|
1144 |
+ |
artDelFavCanvas.Opacity = 1.0; |
|
1145 |
+ |
canvasOn.Interval = new TimeSpan(0, 0, 1); // 1seconds |
|
1146 |
+ |
canvasOn.Tick += new EventHandler(canvasOn_Tick); |
|
1147 |
+ |
canvasOn.Start(); |
|
1148 |
+ |
|
|
1149 |
+ |
phoneAppService.State["MyValue"] = feedListPreferiti; |
|
1150 |
+ |
Boolean d = true; |
|
1151 |
+ |
} |
|
1152 |
+ |
|
1150 |
1153 |
|
private void appBarAddFavorites_Click(object sender, EventArgs e) |
1151 |
1154 |
|
{ |
1152 |
1155 |
|
String titolo = titleCanvas.Text; |
|
@@ -1202,13 +1205,57 @@ |
1202 |
1205 |
|
|
1203 |
1206 |
|
//var y = feedListPreferiti.ItemsSource; |
1204 |
1207 |
|
|
1205 |
|
- |
//phoneAppService.State["MyValue"] = feedListPreferiti.ItemsSource; |
|
1208 |
+ |
phoneAppService.State["MyValue"] = feedListPreferiti.ItemsSource; |
1206 |
1209 |
|
|
1207 |
|
- |
//bool b = true; |
|
1210 |
+ |
//bool c = true; |
1208 |
1211 |
|
|
1209 |
1212 |
|
|
1210 |
1213 |
|
} |
1211 |
1214 |
|
|
|
1215 |
+ |
|
|
1216 |
+ |
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e) |
|
1217 |
+ |
{ |
|
1218 |
+ |
//object myValue; |
|
1219 |
+ |
//if (phoneAppService.State.ContainsKey("MyValue")) |
|
1220 |
+ |
//{ |
|
1221 |
+ |
// if (phoneAppService.State.TryGetValue("MyValue", out myValue)) |
|
1222 |
+ |
// { |
|
1223 |
+ |
// feedListPreferiti.ItemsSource = listArticoliP; |
|
1224 |
+ |
// feedListPreferiti.ItemsSource = (List<ArticoloPreferito>)myValue; |
|
1225 |
+ |
|
|
1226 |
+ |
// } |
|
1227 |
+ |
//} |
|
1228 |
+ |
|
|
1229 |
+ |
//if (PageOrientation.Landscape == oLand) |
|
1230 |
+ |
// grigliaTesto.Height = 370.00; |
|
1231 |
+ |
|
|
1232 |
+ |
checkConnection(); |
|
1233 |
+ |
SystemTray.IsVisible = false; |
|
1234 |
+ |
feedListPreferiti.ItemsSource = listArticoliP; |
|
1235 |
+ |
|
|
1236 |
+ |
|
|
1237 |
+ |
|
|
1238 |
+ |
// WebClient is used instead of HttpWebRequest in this code sample because |
|
1239 |
+ |
// the implementation is simpler and easier to use, and we do not need to use |
|
1240 |
+ |
// advanced functionality that HttpWebRequest provides, such as the ability to send headers. |
|
1241 |
+ |
WebClient webClient1 = new WebClient(); |
|
1242 |
+ |
WebClient webClient3 = new WebClient(); |
|
1243 |
+ |
|
|
1244 |
+ |
// Subscribe to the DownloadStringCompleted event prior to downloading the RSS feed. |
|
1245 |
+ |
webClient1.DownloadStringCompleted += new DownloadStringCompletedEventHandler(webClient1_DownloadStringCompleted); |
|
1246 |
+ |
webClient3.DownloadStringCompleted += new DownloadStringCompletedEventHandler(webClient3_DownloadStringCompleted); |
|
1247 |
+ |
|
|
1248 |
+ |
// Download the RSS feed. DownloadStringAsync was used instead of OpenStreamAsync because we do not need |
|
1249 |
+ |
// to leave a stream open, and we will not need to worry about closing the channel. |
|
1250 |
+ |
webClient1.DownloadStringAsync(new System.Uri("http://tuttolavoro.indicitalia.it/RSS/app.xml")); |
|
1251 |
+ |
webClient3.DownloadStringAsync(new System.Uri("http://www.wki.it/marketing/app/tuttolavoroApp_Rel_news.xml")); |
|
1252 |
+ |
|
|
1253 |
+ |
|
|
1254 |
+ |
//if (listArticoliP.Count == 0) |
|
1255 |
+ |
// feedListPreferiti.Visibility = System.Windows.Visibility.Collapsed; |
|
1256 |
+ |
} |
|
1257 |
+ |
|
|
1258 |
+ |
|
1212 |
1259 |
|
private void boxArticoloPreferito_Loaded(object sender, RoutedEventArgs e) |
1213 |
1260 |
|
{ |
1214 |
1261 |
|
SolidColorBrush evenBackground = new SolidColorBrush(Color.FromArgb(0xff, 0xff, 0xff, 0xff)); |
|
@@ -1313,6 +1360,18 @@ |
1313 |
1360 |
|
} |
1314 |
1361 |
|
} |
1315 |
1362 |
|
|
|
1363 |
+ |
foreach (ArticoloPreferito ap in listArticoliP) |
|
1364 |
+ |
{ |
|
1365 |
+ |
if (ap.Titolo == titleCanvas.Text) |
|
1366 |
+ |
{ |
|
1367 |
+ |
grigliaTesto.Height = 580.00; |
|
1368 |
+ |
boxNote.Visibility = System.Windows.Visibility.Collapsed; |
|
1369 |
+ |
boxNote.Text = ""; |
|
1370 |
+ |
ap.Nota = ""; |
|
1371 |
+ |
break; |
|
1372 |
+ |
} |
|
1373 |
+ |
} |
|
1374 |
+ |
|
1316 |
1375 |
|
editNotePanel.Visibility = System.Windows.Visibility.Collapsed; |
1317 |
1376 |
|
|
1318 |
1377 |
|
deletedNoteCanvas.Visibility = System.Windows.Visibility.Visible; |
|
@@ -1333,6 +1392,15 @@ |
1333 |
1392 |
|
} |
1334 |
1393 |
|
} |
1335 |
1394 |
|
|
|
1395 |
+ |
foreach (Articolo ap in listArticoliP) |
|
1396 |
+ |
{ |
|
1397 |
+ |
if (ap.Titolo == titleCanvas.Text) |
|
1398 |
+ |
{ |
|
1399 |
+ |
ap.Nota = boxNote.Text; |
|
1400 |
+ |
break; |
|
1401 |
+ |
} |
|
1402 |
+ |
} |
|
1403 |
+ |
|
1336 |
1404 |
|
editNotePanel.Visibility = System.Windows.Visibility.Collapsed; |
1337 |
1405 |
|
|
1338 |
1406 |
|
savedNoteCanvas.Visibility = System.Windows.Visibility.Visible; |
|
@@ -1502,7 +1570,7 @@ |
1502 |
1570 |
|
grigliaTesto.Width = 830.00; |
1503 |
1571 |
|
grigliaTesto.Height = 360.00; |
1504 |
1572 |
|
grigliaTesto.Margin = new Thickness(-15, 0, 0, 0); |
1505 |
|
- |
webBrowser1.Margin = new Thickness(0, -25, 0, 0); |
|
1573 |
+ |
webBrowser1.Margin = new Thickness(0, -30, 0, 0); |
1506 |
1574 |
|
if (boxNote.Visibility == System.Windows.Visibility.Visible) |
1507 |
1575 |
|
{ |
1508 |
1576 |
|
grigliaTesto.Height = 220.00; |