public Icon GetIcon([NotNull] string mimeType, [CanBeNull] string command = null) { #region Sanity checks if (string.IsNullOrEmpty(mimeType)) { throw new ArgumentNullException("mimeType"); } #endregion if (command == null) { command = Command.NameRun; } var entryPoint = GetEntryPoint(command); if (entryPoint != null) { var commandIcon = entryPoint.Icons.FirstOrDefault(icon => StringUtils.EqualsIgnoreCase(icon.MimeType, mimeType) && icon.Href != null); if (commandIcon != null) { return(commandIcon); } } return(Icons.FirstOrDefault(icon => StringUtils.EqualsIgnoreCase(icon.MimeType, mimeType) && icon.Href != null)); }
public void PointsChanged(MasteryIcon src, int amount) { if (Points > Ranks) { Icons.FirstOrDefault(item => item != src && item.Points >= Points - Ranks.Value).Points -= Points - Ranks.Value; } Tree.PointsChanged(src, Points); }
private void UpdateSelected() { if (Icons.Contains(Selected)) { return; } var brandLower = Car.Brand?.ToLower(CultureInfo.CurrentUICulture); Selected = Icons.FirstOrDefault(x => x.Name.ToLower() == brandLower) ?? (Icons.Count > 0 ? Icons[0] : null); }
public Icon GetIconByName(string dbid, string name) { if (Icons == null || string.IsNullOrWhiteSpace(dbid) || string.IsNullOrWhiteSpace(name)) { return(null); } return(Icons.FirstOrDefault(ic => name.Equals(ic.Name, StringComparison.OrdinalIgnoreCase) && dbid.Equals(ic.DBID))); }