示例#1
0
        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));
        }
示例#2
0
 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);
        }
示例#4
0
        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)));
        }