Esempio n. 1
0
        public AutoCacheConditionViewModel(CacheSettings cacheSettings, TagCondition tagCondition)
        {
            TagCondition = tagCondition;

            Label = tagCondition.ToReactivePropertyAsSynchronized(x => x.Label);

            IncludeTags = tagCondition.IncludeTags;
            ExcludeTags = tagCondition.ExcludeTags;

            IncludeTagText = new ReactiveProperty <string>("");
            ExcludeTagText = new ReactiveProperty <string>("");

            AddIncludeTagCommand = IncludeTagText.Select(x => x.Length > 0)
                                   .ToReactiveCommand();
            AddIncludeTagCommand.Subscribe(x =>
            {
                if (AddIncludeTag(IncludeTagText.Value))
                {
                    IncludeTagText.Value = "";
                }
            });

            AddExcludeTagCommand = ExcludeTagText.Select(x => x.Length > 0)
                                   .ToReactiveCommand();
            AddExcludeTagCommand.Subscribe(x =>
            {
                if (AddExcludeTag(ExcludeTagText.Value))
                {
                    ExcludeTagText.Value = "";
                }
            });

            RemoveIncludeTagCommand = new DelegateCommand <string>(x => RemoveIncludeTag(x));
            RemoveExcludeTagCommand = new DelegateCommand <string>(x => RemoveExcludeTag(x));
        }
Esempio n. 2
0
 public ConnectionTag FirstMatch(TagCondition cond)
 {
     foreach (ConnectionTag ct in _connections)
     {
         if (cond(ct))
         {
             return(ct);
         }
     }
     return(null);
 }
Esempio n. 3
0
 public ConnectionTag FirstMatch(TagCondition cond)
 {
     foreach(ConnectionTag ct in _connections) {
         if(cond(ct)) return ct;
     }
     return null;
 }
Esempio n. 4
0
 protected bool Equals(TagCondition other)
 {
     return(string.Equals(Tag, other.Tag));
 }