Exemplo n.º 1
0
 public static void Delete(Child item)
 {
     var settings = IsolatedStorageSettings.ApplicationSettings;
     if (settings.Contains(item.Guid))
     {
         settings.Remove(item.Guid);
     }
     settings.Save();
 }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
0
        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;
                }
            }
        }
Exemplo n.º 4
0
 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);
     }
 }