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>()); }
public void ToggleSelectedTopic(string topic) { if (SelectedTopics.Contains(topic)) { SelectedTopics.Remove(topic); } else { SelectedTopics.Add(topic); } }
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); } }
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); } }
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); } }