public DeleteCommand(RuntimeStorageBrowser window, GridItem item,IRuntimeStorage intent) { _item = item; _window = window; _intent = intent; }
public void RemoveItem(GridItem item) { _allItems.Remove(item); if (StoredItems.Contains(item)) StoredItems.Remove(item); }
/// <summary> /// This method is a mess. It's just adding runtime intent data to a list. Needs to be rewritten. /// I'm writing this because I'm embarrassed at the awfulness of this method. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RuntimeStorageBrowser_Click(object sender, RoutedEventArgs e) { _runtimeStorageWindow.ClearItems(); List<Tuple<IRuntimeStorage, string, JToken>> runtimeData = new List<Tuple<IRuntimeStorage, string, JToken>>(); IEnumerable<IRuntimeStorage> intents = _prefabInterpretationLogic.GetRuntimeStorages(); intents = intents.Skip(1); //current hack to skip prototype library foreach (var intent in intents) foreach (var data in intent.ReadAllData()) runtimeData.Add(new Tuple<IRuntimeStorage, string, JToken>(intent, data.Key, data.Value)); foreach (var toAdd in runtimeData) { if (!toAdd.Item2.Equals("config")) { GridItem item = new GridItem(); item.DocumentName = toAdd.Item2; item.Data = toAdd.Item3.ToString().Replace("{", "").Replace("}", "").Trim(); item.DeleteCommand = new DeleteCommand(_runtimeStorageWindow, item, toAdd.Item1); if (_runtimeStorageWindow.AllowEdit) item.Visibility = System.Windows.Visibility.Visible; else item.Visibility = System.Windows.Visibility.Collapsed; _runtimeStorageWindow.AddItem(item); } } _runtimeStorageWindow.Show(); }
public void AddItem(GridItem item) { _allItems.Add(item); if (!_isSearching) StoredItems.Add(item); }