public override bool Equals(object obj) { if (obj == null) { return(false); } ToolUpdateInfo other = obj as ToolUpdateInfo; if (other == null) { return(false); } return(Equals(_packageIdentifer, other._packageIdentifer) && Equals(_packageName, other._packageName)); }
public ToolUpdatesDlg(SkylineWindow parent, IEnumerable <ToolDescription> tools, IToolUpdateHelper updateHelper) { InitializeComponent(); checkedListBoxTools.Height += labelOperation.Bottom - checkedListBoxTools.Bottom; Icon = Resources.Skyline; _parent = parent; _tools = new Dictionary <ToolUpdateInfo, ICollection <ToolDescription> >(); _updateHelper = updateHelper; // group tools with multiple components together by their package identifier foreach (var tool in tools) { var info = new ToolUpdateInfo(tool.PackageIdentifier, tool.PackageName); ICollection <ToolDescription> toolComponents; if (_tools.TryGetValue(info, out toolComponents)) { toolComponents.Add(tool); } else { _tools.Add(info, new List <ToolDescription> { tool }); } } // populate the checklistbox with the tools package names checkedListBoxTools.Items.AddRange(_tools.Select(pair => pair.Key._packageName).Cast <Object>().ToArray()); // set all tools to checked for (int i = 0; i < checkedListBoxTools.Items.Count; i++) { checkedListBoxTools.SetItemCheckState(i, CheckState.Checked); } }
public ToolUpdatesDlg(SkylineWindow parent, IEnumerable<ToolDescription> tools, IToolUpdateHelper updateHelper) { InitializeComponent(); checkedListBoxTools.Height += labelOperation.Bottom - checkedListBoxTools.Bottom; Icon = Resources.Skyline; _parent = parent; _tools = new Dictionary<ToolUpdateInfo, ICollection<ToolDescription>>(); _updateHelper = updateHelper; // group tools with multiple components together by their package identifier foreach (var tool in tools) { var info = new ToolUpdateInfo(tool.PackageIdentifier, tool.PackageName); ICollection<ToolDescription> toolComponents; if (_tools.TryGetValue(info, out toolComponents)) { toolComponents.Add(tool); } else { _tools.Add(info, new List<ToolDescription> {tool}); } } // populate the checklistbox with the tools package names checkedListBoxTools.Items.AddRange(_tools.Select(pair => pair.Key._packageName).Cast<Object>().ToArray()); // set all tools to checked for (int i = 0; i < checkedListBoxTools.Items.Count; i++) { checkedListBoxTools.SetItemCheckState(i, CheckState.Checked); } }