LISTBOX数据为什么不更新
下载http://192.168.0.1/a.txt,写入本地储存a.txt.
然后,更新http://192.168.0.1/a.txt的内容,再次下载写入本地存储a.txt
listbox显示还是前一次a.txt内容(有6个TXT文件)
程序有删除和下载功能,可实时删除本地文件,LISTBOX这里为空,但点下载后,内容还是旧数据
怀疑是不是WINDOWS PHONE有系统缓存有问题?
本程序只有从手机卸载后,重新布署,才更新LISTBOX的数据。不知是什么问题,请大师们指教
程序片断如下:
private void readerPivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
Pivot ItemsSelsectGet = sender as Pivot;
List<RssVar> tempList = new List<RssVar>();
if (ItemsSelsectGet != null)
{
if (ItemsSelsectGet.SelectedIndex == 0) titleList0.ItemsSource = null;
if (ItemsSelsectGet.SelectedIndex == 1) titleList1.ItemsSource = null;
if (ItemsSelsectGet.SelectedIndex == 2) titleList2.ItemsSource = null;
if (ItemsSelsectGet.SelectedIndex == 3) titleList3.ItemsSource = null;
if (ItemsSelsectGet.SelectedIndex == 4) titleList4.ItemsSource = null;
if (ItemsSelsectGet.SelectedIndex == 5) titleList5.ItemsSource = null;
if (ItemsSelsectGet.SelectedIndex != 6)
{
// Get the local folder.
//显示加载进度条
TxtMessageTip.Text = "正在加载";
TxtMessageTip.Visibility = Visibility.Visible;
Pbr.Visibility = Visibility.Visible;
Pbr.IsIndeterminate = true;
// Get the DataFolder folder.
IsolatedStorageFile userStore = IsolatedStorageFile.GetUserStoreForApplication();
if (!userStore.DirectoryExists("DataFolder"))
{
userStore.CreateDirectory("DataFolder");
}
string filePath = Path.Combine("DataFolder", rssFileNameArr[ItemsSelsectGet.SelectedIndex]);
if (userStore.FileExists(filePath))
{
StreamReader reader = new StreamReader(userStore.OpenFile(filePath,
FileMode.Open, FileAccess.Read));
string contents = reader.ReadToEnd();
reader.Close();
try
{
tempList = JSONConvert.FromJson<List<RssVar>>(contents);
}
catch
{
TxtMessageTip.Text = "Json格式错误!";
}
}
//LISTBOX显示
if (ItemsSelsectGet.SelectedIndex == 0) titleList0.ItemsSource = tempList;
if (ItemsSelsectGet.SelectedIndex == 1) titleList1.ItemsSource = tempList;
if (ItemsSelsectGet.SelectedIndex == 2) titleList2.ItemsSource = tempList;
if (ItemsSelsectGet.SelectedIndex == 3) titleList3.ItemsSource = tempList;
if (ItemsSelsectGet.SelectedIndex == 4) titleList4.ItemsSource = tempList;
if (ItemsSelsectGet.SelectedIndex == 5) titleList5.ItemsSource = tempList;
//隐藏提示
TxtMessageTip.Visibility = Visibility.Collapsed;
Pbr.Visibility = Visibility.Collapsed;
Pbr.IsIndeterminate = false;
}
}
}