private void LoadActions(IEnumerable <Entity> actions) { try { LstAll.BeginUpdate(); LstSpecified.BeginUpdate(); Enable(false); LstAll.Items.Clear(); LstSpecified.Items.Clear(); var localActions = actions.Select(e => e.ToEntity <Workflow>()).ToList(); // Keep from multiple Enumerations localActions.AddRange(WorkflowlessActions); LstSpecified.Items.AddRange(localActions.Where(IsSpecified).Select(e => new ListViewItem(e.Name ?? "N/A") { SubItems = { GetKey(e) } }).ToArray()); LstAll.Items.AddRange(localActions.Where(e => !IsSpecified(e)).Select(e => new ListViewItem(e.Name ?? "N/A") { SubItems = { GetKey(e) } }).ToArray()); } finally { LstAll.EndUpdate(); LstSpecified.EndUpdate(); Enable(true); } }
private void LoadEntities(IEnumerable <EntityMetadata> entities) { try { LstAll.BeginUpdate(); LstSpecified.BeginUpdate(); Enable(false); LstAll.Items.Clear(); LstSpecified.Items.Clear(); var localEntites = entities.ToList(); // Keep from mulitiple Enumerations var specified = new HashSet <string>(SpecifiedEntities.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries)); LstSpecified.Items.AddRange(localEntites.Where(e => specified.Contains(e.LogicalName)).ToObjectCollectionArray()); LstAll.Items.AddRange(localEntites.Where(e => !specified.Contains(e.LogicalName)).ToObjectCollectionArray()); } finally { LstAll.EndUpdate(); LstSpecified.EndUpdate(); Enable(true); } }
private void LoadActions(IEnumerable <Entity> actions) { try { LstAll.BeginUpdate(); LstSpecified.BeginUpdate(); Enable(false); LstAll.Items.Clear(); LstSpecified.Items.Clear(); var localActions = actions.Select(e => e.ToEntity <Workflow>()).OrderBy(a => a.Name + a.Id).ToList(); // Keep from multiple Enumerations var specified = new HashSet <string>(SpecifiedActions.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries)); LstSpecified.Items.AddRange(GetObjectCollection(localActions.Where((a, i) => specified.Contains(a.UniqueName)))); LstAll.Items.AddRange(GetObjectCollection(localActions.Where((a, i) => !specified.Contains(a.UniqueName)))); } finally { LstAll.EndUpdate(); LstSpecified.EndUpdate(); Enable(true); } }