Пример #1
0
 public void OnSelected(object sender, SelectedItemChangedEventArgs e)
 {
     current = e.SelectedItem as EleItem;
     eleList.SelectedItem = current;
     newItemName.Text     = current.Name;
     Library.PlayClick();
 }
 public async Task DeleteTaskAsync(EleItem item)
 {
     try
     {
         await dataTable.DeleteAsync(item);
     }
     catch (Exception e)
     {
         Debug.WriteLine("Delete error: {0}", new[] { e.Message });
     }
 }
Пример #3
0
        public async void OnAdd(object sender, EventArgs e)
        {
            if (newItemName.Text.Trim() == "")
            {
                return;
            }

            if (await DisplayAlert("Add?", "Would you like to Add element {" + newItemName.Text + "}", "Yes", "No"))
            {
                EleItem item = new EleItem();
                item.Name  = newItemName.Text;
                item.CatId = currentCatId;
                item.OS    = Library.GetOS();
                await manager.SaveTaskAsync(item);
                await RefreshItems();
            }
        }
 public async Task SaveTaskAsync(EleItem item)
 {
     try
     {
         if (item.Id == null)
         {
             await dataTable.InsertAsync(item);
         }
         else
         {
             await dataTable.UpdateAsync(item);
         }
     }
     catch (Exception e)
     {
         Debug.WriteLine("Save error: {0}", new[] { e.Message });
     }
 }