private void ItemDictTypes_SelectionChangedEvent(int oldSelection, int newSelection) { ItemDict.Clear(); ItemDictVM <object> itdvm = new ItemDictVM <object>(ParentVM, ItemDictTypes.SelectedKey); itdvm.PropertyChanged += Itdvm_PropertyChanged; ItemDict.Add(itdvm); }
public static bool SetItemKeys(HttpSessionStateBase Session, List <string> theKeys, string from) { Dictionary <string, string> ItemDict = ReturnItemKeys(Session); if (ItemDict == null) { ItemDict = new Dictionary <string, string>(); } foreach (string key in theKeys) { string ItemKey = Regex.Split(key, ":")[0]; string ItemKeyValue = Regex.Split(key, ":")[1]; if (from == "A") { if (ItemDict.ContainsKey("A:" + ItemKey)) { ItemDict["A:" + ItemKey] = ItemKeyValue; } else { if (ItemDict.ContainsKey("I:" + ItemKey)) { ItemDict.Add("A:" + ItemKey, ItemKeyValue); ItemDict.Remove("I:" + ItemKey); } else { ItemDict.Add("A:" + ItemKey, ItemKeyValue); } } } else { if (ItemDict.ContainsKey("I:" + ItemKey)) { ItemDict["I:" + ItemKey] = ItemKeyValue; } else { if (ItemDict.ContainsKey("A:" + ItemKey)) { } else { ItemDict.Add("I:" + ItemKey, ItemKeyValue); } } } } StoreItemKeys(ItemDict, Session); return(true); }
public static bool SetItemKey(HttpSessionStateBase Session, string ItemKey, string ItemKeyValue, string from) { Dictionary <string, string> ItemDict = ReturnItemKeys(Session); if (ItemDict == null) { ItemDict = new Dictionary <string, string>(); } if (from == "A") { if (ItemDict.ContainsKey("A:" + ItemKey)) { ItemDict["A:" + ItemKey] = ItemKeyValue; } else { if (ItemDict.ContainsKey("I:" + ItemKey)) { ItemDict.Add("A:" + ItemKey, ItemKeyValue); ItemDict.Remove("I:" + ItemKey); } else { ItemDict.Add("A:" + ItemKey, ItemKeyValue); } } } else { if (ItemDict.ContainsKey("I:" + ItemKey)) { ItemDict["I:" + ItemKey] = ItemKeyValue; } else { if (ItemDict.ContainsKey("A:" + ItemKey)) { } else { ItemDict.Add("I:" + ItemKey, ItemKeyValue); } } } StoreItemKeys(ItemDict, Session); return(true); }
private void Itdvm_PropertyChanged(object sender, PropertyChangedEventArgs e) { foreach (var item in ItemDict.ToList()) { if (string.IsNullOrWhiteSpace(item.Formula) && ItemDict.IndexOf(item) < ItemDict.Count - 1) { ItemDict.Remove(item); } } if (!string.IsNullOrWhiteSpace(ItemDict.Last().Formula)) { ItemDictVM <object> itdvm = new ItemDictVM <object>(ParentVM, ItemDictTypes.SelectedKey); itdvm.PropertyChanged += Itdvm_PropertyChanged; ItemDict.Add(itdvm); } }