// 保存饼图数据列表 public async void SaveToFile() { try { await StorageFileHelper.WriteAsync(data, FILE_PIE_NAME); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); } }
// 读取饼图数据列表 public async Task <bool> LoadFromFile() { try { data = await StorageFileHelper.ReadAsync <ObservableCollection <PieChartDataItem> >(FILE_PIE_NAME); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); } return(data != null); }
// 添加一条日常记录 public async void AddNew(Daily item) { await Getdata(); _data.Add(item); if (_data != null) { await StorageFileHelper.WriteAsync(_data, "Daily.dat"); } else { MessageDialog dialog = new MessageDialog("data is null!"); await dialog.ShowAsync(); } }
// 读取日常列表 public async Task <bool> LoadFromFile() { _data = await StorageFileHelper.ReadAsync <List <Daily> >("Daily.dat"); return(_data != null); }
// 读取事项列表 public async Task <bool> LoadFromFile() { _data = await StorageFileHelper.ReadAsync <ObservableCollection <EventListViewItem> >("Event.dat"); return(_data != null); }