/// <summary> /// Delete a watch item and send it to the Pebble (if connected) /// </summary> /// <param name="_deleteItem"></param> /// <returns></returns> public async Task <bool> DeleteWatchItemAsync(WatchItem _deleteItem) { try { //Remove from app await WatchItems.DeleteWatchItem(_deleteItem); //Remove from storage await LocalStorage.Delete(_deleteItem.File); await LocalStorage.Delete(_deleteItem.File.Replace(".zip", ".gif")); //Remove from watch if (IsConnected) { await Pebble.DeleteWatchItemAsync(_deleteItem); } return(true); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("DeleteWatchItemAsync exception: " + e.Message); } return(false); }
/// <summary> /// Creates and adds a new watch item using the specified name and type. /// </summary> /// <param name="name">The watch item name.</param> /// <param name="type">The type name.</param> public void AddNewWatch(string name, string type) { var li = new ListViewItem(name); li.SubItems.Add("?"); li.SubItems.Add(type); var watchItem = new WatchItem(li); WatchItems.Add(watchItem); listView.Items.Add(li); OnWatchAdded(watchItem); }
/// <summary> /// Deletes selected watch items. /// </summary> protected void DeleteSelected() { if (listView.SelectedItems.Count > 0) { var toDel = new List <WatchItem>(); // Find all WatchItems to delete foreach (ListViewItem item in listView.SelectedItems) { var w = item.Tag as WatchItem; if (w != null) { toDel.Add(w); } } // Delete found items. foreach (var item in toDel) { WatchItems.Remove(item); listView.Items.Remove(item.Item); } } }