public static void Delete(Child item) { var settings = IsolatedStorageSettings.ApplicationSettings; if (settings.Contains(item.Guid)) { settings.Remove(item.Guid); } settings.Save(); }
public static void Save(Child item) { var settings = IsolatedStorageSettings.ApplicationSettings; if (settings.Contains(item.Guid)) { settings[item.Guid] = item; } else { settings.Add(item.Guid, item.GetCopy()); } settings.Save(); }
protected override void OnNavigatedTo(NavigationEventArgs e) { var guid = GetQuerystring(); if (!String.IsNullOrWhiteSpace(guid)) { CurrentItem = ViewModel.Children.FirstOrDefault(x => x.Guid == guid); LayoutRoot.DataContext = CurrentItem; PageTitle.Text = "redigera"; if (CurrentItem != null && CurrentItem.SavedImage != null) { ItemImage.Source = CurrentItem.SavedImage; _imageFile = CurrentItem.ImagePath; } } }
private void OnAppBarSaveIconClick(object sender, EventArgs e) { if (!String.IsNullOrWhiteSpace(ChildIdNumber.Text) && !String.IsNullOrWhiteSpace(ChildName.Text) && !String.IsNullOrWhiteSpace(ParentIdNumber.Text)) { if (CurrentItem != null) { CurrentItem.ChildIdNumber = ChildIdNumber.Text; CurrentItem.Name = ChildName.Text; CurrentItem.ParentIdNumber = ParentIdNumber.Text; CurrentItem.ImagePath = _imageFile; IsolatedStorageHelper.Save(CurrentItem); } else { var newChild = new Child { Guid = Convert.ToString(Guid.NewGuid()), ChildIdNumber = ChildIdNumber.Text, Name = ChildName.Text, ParentIdNumber = ParentIdNumber.Text, ImagePath = _imageFile }; IsolatedStorageHelper.Save(newChild); } Helper.NavigateToUrl(Globals.MainUri); } else { MessageBox.Show(Globals.ErrorMessageAdd, Globals.ErrorMessageCaptionAdd, MessageBoxButton.OK); } }