private void LinkLabelGroup_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { IEnumerable <Group> groups = SelectedMachines .Select(machine => ConnectionStore.Connections.Values .First(connection => ProcessManager.DataObjects.Comparers.Comparer <Machine> .IDObjectsEqual(connection.Machine, machine)) .Configuration) .SelectMany(configuration => configuration.Groups) .Distinct(new GroupEqualityComparer()); Picker.ShowMenu(linkLabelGroup, groups, ContextMenu_SelectGroup_GroupClicked); }
private void UpdateSelectedMachines() { SelectedMachines = SelectedMachines? .Select(selectedMachine => ConnectionStore.Connections.Values .Where(connection => connection.Configuration != null) .Select(connection => connection.Machine) .FirstOrDefault(machine => Comparer.MachinesEqual(machine, selectedMachine))) .Where(machine => machine != null) .Distinct(new MachineEqualityComparer()) .ToList(); UpdateLinkLabelMachines(); }
private void LinkLabelApplications_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { IEnumerable <Tuple <Application, bool> > applications = SelectedMachines .Select(machine => ConnectionStore.Connections.Values .First(connection => ProcessManager.DataObjects.Comparers.Comparer <Machine> .IDObjectsEqual(connection.Machine, machine)) .Configuration) .SelectMany(configuration => configuration .Applications .Where(application => configuration .Groups .Where(group => Comparer.GroupsEqual(group, SelectedGroup)) .SelectMany(group => group.Applications) .Any(applicationID => ProcessManager.DataObjects.Comparers.Comparer <Application> .IDObjectsEqual(application, applicationID)))) .Distinct(new ApplicationEqualityComparer()) .Select(application => new Tuple <Application, bool>(application, SelectedApplications != null && SelectedApplications.Any(x => Comparer.ApplicationsEqual(application, x)))); Picker.ShowMultiSelectMenu(linkLabelApplications, applications, ContextMenu_SelectApplications_MenuClosed); }
private void UpdateSelectedApplications() { if (SelectedApplications != null) { SelectedApplications = SelectedMachines == null ? null : SelectedApplications .Select(selectedApplication => SelectedMachines .Select(machine => ConnectionStore.Connections.Values .First(connection => ProcessManager.DataObjects.Comparers.Comparer <Machine> .IDObjectsEqual(connection.Machine, machine)) .Configuration) .SelectMany(configuration => configuration .Applications .Where(application => configuration .Groups .Where(group => Comparer.GroupsEqual(group, SelectedGroup)) .SelectMany(group => group.Applications) .Any(appID => ProcessManager.DataObjects.Comparers.Comparer <Application> .IDObjectsEqual(application, appID)))) .FirstOrDefault(application => Comparer.ApplicationsEqual(application, selectedApplication))) .Where(application => application != null) .Distinct(new ApplicationEqualityComparer()) .ToList(); } UpdateLinkLabelApplications(); }