Beispiel #1
0
        public NavItem(NavigationItemInfo itemInfo, ProcessList procList)
        {
            if (itemInfo == null)
            {
                throw new ArgumentNullException("itemInfo");
            }

            if (procList == null)
            {
                throw new ArgumentNullException("procList");
            }

            Id = itemInfo.Id;
            Name = itemInfo.Name;
            SystemName = itemInfo.SystemName;
            ProcessSystemName = itemInfo.ProcessSystemName;
            Description = itemInfo.Description;
            BackgroundColor = ColorTranslator.ToHtml(Color.FromArgb((int)itemInfo.BackgroundColor));
            IsSystem = itemInfo.IsSystem;
            ProcessId = itemInfo.ProcessId;
            RuntimeId = itemInfo.RuntimeId;
            ProcessViewGuid = itemInfo.ProcessViewGuid;

            var processInfo = procList.FirstOrDefault(x => x.SystemName == this.SystemName);
            if (processInfo != null)
            {
                ProcessDescription = processInfo.ProcessDocumentation;
            }
        }
Beispiel #2
0
        /// <summary>
        /// The initialize.
        /// </summary>
        /// <param name="item">
        /// The item.
        /// </param>
        /// <param name="groupName">
        /// The group name.
        /// </param>
        /// <param name="favoriteList">
        /// The favorite list.
        /// </param>
        public void Initialize(NavigationItemInfo item, string groupName, IFavoriteList<IFavoriteInfo> favoriteList = null)
        {
            Model = item;
            Name = item.Name;
            GroupName = groupName;

            BackgroundColor = ColorUtils.GetGradientBrush(Colors.White.Lerp(item.BackgroundColor.ToColor(), 0.7f), item.BackgroundColor.ToColor());
            BorderBrush = new SolidColorBrush(item.BackgroundColor.ToColor().Lerp(Colors.White, 0.5f));
            if (favoriteList != null)
            {
                foreach (var f in favoriteList.Where(f => f.ProcessSystemName == GetProcessName()))
                {
                    _isFavorite = true;
                    _favoriteId = f.Id;
                    break;
                }
            }

            LoadIcon();
        }