Beispiel #1
0
 private void ModifyTagExcuted()
 {
     if (selectedTag == null)
     {
         return;
     }
     if (selectedTag.Tag.TagID == null)
     {
         foreach (TagItem tag in tags)
         {
             if (tag.Tag.TagName == tagName.Text)
             {
                 return;
             }
         }
         selectedTag.Tag.TagName = tagName.Text;
         Tag     temp    = new Tag(selectedTag.Tag.TagID, selectedTag.Tag.TagName, selectedTag.Tag.ResourceID);
         TagItem tagItem = TagItem.CreateTagItem(temp);
         tagItem.Tag   = temp;
         tagItem.State = selectedTag.State;
         int index = tags.IndexOf(selectedTag);
         tagList.SelectedItem = null;
         tags[index]          = tagItem;
         return;
     }
     TagModified(selectedTag.Tag, tagName.Text, tagModifiedCallBack);
 }
Beispiel #2
0
        public void UpdateTagsCollection(string tagDisplayName, string tagValue, Dispatcher dispatcher)
        {
            bool tagFound = false;

            dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
            {
                foreach (TagInfo summarySignal in _summaryStatusTags)
                {
                    if (summarySignal.TagName.Equals(tagDisplayName))
                    {
                        int index = _summaryStatusTags.IndexOf(summarySignal);

                        _summaryStatusTags.RemoveAt(index);

                        summarySignal.TagName  = tagDisplayName;
                        summarySignal.TagValue = tagValue;
                        _summaryStatusTags.Insert(index, summarySignal);
                        tagFound = true;
                        break;
                    }
                }

                if (!tagFound)
                {
                    TagInfo summarySignal  = new TagInfo();
                    summarySignal.TagValue = tagValue;
                    summarySignal.TagName  = tagDisplayName;
                    _summaryStatusTags.Add(summarySignal);
                }
            }));
        }
Beispiel #3
0
        public void UpdateTagsCollection(string tagDisplayName, string tagValue, Dispatcher dispatcher)
        {
            bool tagFound = false;

            dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
            {
                foreach (TagInfo estop in _warningTags)
                {
                    if (estop.TagName.Equals(tagDisplayName))
                    {
                        int index = _warningTags.IndexOf(estop);

                        _warningTags.RemoveAt(index);

                        estop.TagName  = tagDisplayName;
                        estop.TagValue = tagValue;
                        _warningTags.Insert(index, estop);
                        tagFound = true;
                        break;
                    }
                }

                if (!tagFound)
                {
                    TagInfo estop  = new TagInfo();
                    estop.TagValue = tagValue;
                    estop.TagName  = tagDisplayName;
                    _warningTags.Add(estop);
                }
            }));
        }
Beispiel #4
0
        private static bool TryGetValueInternal(TagCollection tags, string key, out string value)
        {
            value = null;
            if (tags == null)
            {
                return(false);
            }

            var index = tags.IndexOf(key);

            if (index < 0)
            {
                return(false);
            }

            value = tags.ValueAt(index);
            return(true);
        }
Beispiel #5
0
        public void CanAddAndCheckContainsTags()
        {
            // ARRANGE
            var tags = new TagCollection(3);

            // ACT
            tags.Add("key1", "value1");
            tags.Add("key2", "value2");
            tags.Add("key0", "value0");

            tags = tags.AsReadOnly();

            // ASSERT
            Assert.IsTrue(tags.IndexOf("key0") >= 0);
            Assert.AreEqual("value0", tags[tags.IndexOf("key0")].Value);
            Assert.IsTrue(tags.IndexOf("key1") >= 0);
            Assert.AreEqual("value1", tags[tags.IndexOf("key1")].Value);
            Assert.IsTrue(tags.IndexOf("key2") >= 0);
            Assert.AreEqual("value2", tags[tags.IndexOf("key2")].Value);
            Assert.IsFalse(tags.IndexOf("key3") >= 0);
        }
Beispiel #6
0
 public static bool ContainsKey(this TagCollection tags, string key)
 {
     return(tags.IndexOf(key) >= 0);
 }