Exemple #1
0
        public LocalShellItem(ShellFolder parent, FileInfo info)
            : base(parent, info) // there is a specific overload for FileInfo
        {
            CanCopy   = true;
            CanDelete = true;
            CanLink   = true;
            CanMove   = true;
            CanPaste  = true;
            CanRename = true;
            Info      = info;

            var ms = new MemoryPropertyStore();

            ms.SetValue(Props.System.PropList.StatusIcons, "prop:" + LocalShellFolder.IconProperty.CanonicalName);
            ms.SetValue(Props.System.PropList.StatusIconsDisplayFlag, (uint)2);

            if (info.Name.Contains("error"))
            {
                ms.SetValue(LocalShellFolder.IconProperty, IconValue.Error);
            }
            else if (info.Name.Contains("warn"))
            {
                ms.SetValue(LocalShellFolder.IconProperty, IconValue.Warning);
            }
            else
            {
                ms.SetValue(LocalShellFolder.IconProperty, IconValue.Ok);
            }

            SetPropertyValue(LocalShellFolder.IconUIProperty, ms);
        }
Exemple #2
0
        private static MemoryPropertyStore GetSyncState(ShellItem item)
        {
            var ms = new MemoryPropertyStore();

            ms.SetValue(Props.System.PropList.StatusIcons, "prop:" + Props.System.StorageProviderState.CanonicalName);
            ms.SetValue(Props.System.PropList.StatusIconsDisplayFlag, (uint)2);

            // read the sync state from the shell
            // it works because we have set ReadPropertiesFromShell = true as a passthrough
            var state = item.GetPropertyValue(Props.System.StorageProviderState, 0);

            ms.SetValue(Props.System.StorageProviderState, state);

            return(ms);
        }