Пример #1
0
 public int[] GetTopicIds()
 {
     if (SelectedTopics?.Any() ?? false)
     {
         return(SelectedTopics);
     }
     return(SelectedTopicIds?.Split(',')?.Select(x => int.TryParse(x, out var val) ? val : 0)?.Where(x => x != 0)?.ToArray() ?? Array.Empty <int>());
 }
Пример #2
0
 public void ToggleSelectedTopic(string topic)
 {
     if (SelectedTopics.Contains(topic))
     {
         SelectedTopics.Remove(topic);
     }
     else
     {
         SelectedTopics.Add(topic);
     }
 }
Пример #3
0
 public override void Copy()
 {
     if (SelectedTopics != null && SelectedTopics.Length > 0)
     {
         var topics = SelectedTopics.OrderBy(t => t.Level).ToArray();
         Copy(topics, true);
     }
     else if (SelectedObject is Widget)// && ((Widget)SelectedObject).CanCopy)
     {
         var widgets = SelectedObjects.Where(o => o is Widget).ToArray();
         Copy(widgets, false);
     }
 }
Пример #4
0
 public override void Cut()
 {
     if (SelectedTopics != null && SelectedTopics.Length > 0)
     {
         var topics  = SelectedTopics.OrderBy(t => t.Level).ToArray();
         var command = new CutCommand(topics);
         ExecuteCommand(command);
     }
     else if (SelectedObject is Widget)
     {
         var widgets = SelectedObjects.Where(o => o is Widget).ToArray();
         var command = new CutCommand(widgets);
         ExecuteCommand(command);
     }
 }
Пример #5
0
        private void SearchAction(object o)
        {
            RulesList.Clear();
            tempList       = new ObservableCollection <string>();
            SelectedTopics = AddTreeItemsToList(TopicsList);

            tempList        = new ObservableCollection <string>();
            SelectedIssuers = AddTreeItemsToList(IssuersList);

            //foreach (string topic in SelectedTopics)
            //{
            //    foreach (Rule rule in db.Rules.Where(r => r.Topic.Equals(topic)).ToList())
            //        RulesList.Add(rule);
            //}

            foreach (Rule rule in db.Rules.Where(r => SelectedTopics.Contains(r.Topic.TopicName) && SelectedIssuers.Contains(r.Issuer.IssuerName)))
            {
                RulesList.Add(rule);
            }
        }