Beispiel #1
0
        /// <summary>
        /// Creates a new link item for a local path
        /// </summary>
        /// <param name="localLinkPath">The local link path</param>
        /// <param name="displayText">The text to display for the link</param>
        /// <param name="minUserLevel">The minimum required user level for this link item</param>
        public LinkItemViewModel(FileSystemPath localLinkPath, string displayText, UserLevel minUserLevel = UserLevel.Normal)
        {
            MinUserLevel  = minUserLevel;
            LocalLinkPath = localLinkPath.Exists ? localLinkPath.CorrectPathCasing() : localLinkPath;
            IsLocal       = true;
            DisplayText   = displayText;
            IconKind      = localLinkPath.FileExists ? PackIconMaterialKind.FileOutline : PackIconMaterialKind.FolderOutline;

            if (!IsValid)
            {
                return;
            }

            try
            {
                IconSource = GetImageSource(LocalLinkPath);
            }
            catch (Exception ex)
            {
                ex.HandleUnexpected("Getting link item thumbnail");
            }

            OpenLinkCommand = new AsyncRelayCommand(OpenLinkAsync);
        }