private void OkClick(object sender, RoutedEventArgs e) { // Удаляем удалённые тэги for (var i = _original.Count - 1; i >= 0; i--) { var origTag = _original[i]; if (_localCopy.All(t => t.Id != origTag.Id)) { _original.Remove(origTag); } } // Заменяем или добавляем новые тэги foreach (var tag in _localCopy) { var found = _original.FirstOrDefault(t => t.Id == tag.Id); if (found == null) { found = new ProjectCollectionTag {Id = tag.Id}; _original.Add(found); } found.Name = tag.Name; found.Color = tag.Color; } DialogResult = true; }
/// <summary> /// Deserializes xml markup from file into an ProjectCollectionTag object /// </summary> /// <param name="fileName">string xml file to load and deserialize</param> /// <param name="obj">Output ProjectCollectionTag object</param> /// <param name="exception">output Exception value if deserialize failed</param> /// <returns>true if this Serializer can deserialize the object; otherwise, false</returns> public static bool LoadFromFile(string fileName, out ProjectCollectionTag obj, out System.Exception exception) { exception = null; obj = default(ProjectCollectionTag); try { obj = LoadFromFile(fileName); return(true); } catch (System.Exception ex) { exception = ex; return(false); } }
/// <summary> /// Deserializes workflow markup into an ProjectCollectionTag object /// </summary> /// <param name="input">string workflow markup to deserialize</param> /// <param name="obj">Output ProjectCollectionTag object</param> /// <param name="exception">output Exception value if deserialize failed</param> /// <returns>true if this Serializer can deserialize the object; otherwise, false</returns> public static bool Deserialize(string input, out ProjectCollectionTag obj, out System.Exception exception) { exception = null; obj = default(ProjectCollectionTag); try { obj = Deserialize(input); return(true); } catch (System.Exception ex) { exception = ex; return(false); } }
public static bool LoadFromFile(string fileName, out ProjectCollectionTag obj) { System.Exception exception = null; return LoadFromFile(fileName, out obj, out exception); }
/// <summary> /// Deserializes xml markup from file into an ProjectCollectionTag object /// </summary> /// <param name="fileName">string xml file to load and deserialize</param> /// <param name="obj">Output ProjectCollectionTag object</param> /// <param name="exception">output Exception value if deserialize failed</param> /// <returns>true if this Serializer can deserialize the object; otherwise, false</returns> public static bool LoadFromFile(string fileName, out ProjectCollectionTag obj, out System.Exception exception) { exception = null; obj = default(ProjectCollectionTag); try { obj = LoadFromFile(fileName); return true; } catch (System.Exception ex) { exception = ex; return false; } }
public static bool Deserialize(string input, out ProjectCollectionTag obj) { System.Exception exception = null; return Deserialize(input, out obj, out exception); }
/// <summary> /// Deserializes workflow markup into an ProjectCollectionTag object /// </summary> /// <param name="input">string workflow markup to deserialize</param> /// <param name="obj">Output ProjectCollectionTag object</param> /// <param name="exception">output Exception value if deserialize failed</param> /// <returns>true if this Serializer can deserialize the object; otherwise, false</returns> public static bool Deserialize(string input, out ProjectCollectionTag obj, out System.Exception exception) { exception = null; obj = default(ProjectCollectionTag); try { obj = Deserialize(input); return true; } catch (System.Exception ex) { exception = ex; return false; } }
public bool IsTagSet(ProjectCollectionTag tag) { return _tagIds?.ContainsKey(tag.Id) ?? false; }
public void SetTag(ProjectCollectionTag tag, bool isChecked) { if (isChecked) { if (_tagIds == null) _tagIds = new Dictionary<int, ProjectCollectionTag>(); _tagIds.Add(tag.Id, tag); } else { var curTag = _tagIds.FirstOrDefault(t => t.Value == tag); _tagIds.Remove(curTag.Key); } if (_tagIds != null) { var tagStrs = (from t in _tagIds select t.Key.ToString()).ToArray(); var tagStr = string.Join(";", tagStrs); if (Project != null) Project.Tags = tagStr; ShowTags(); } }
public static bool LoadFromFile(string fileName, out ProjectCollectionTag obj) { System.Exception exception = null; return(LoadFromFile(fileName, out obj, out exception)); }
public static bool Deserialize(string input, out ProjectCollectionTag obj) { System.Exception exception = null; return(Deserialize(input, out obj, out exception)); }