/// <summary> /// プロパティの初期設定を行います。 /// </summary> private void Initialize() { // SearchCondition初期化 SearchFolderItemFactory.SetCondition(this.SearchCondition.SearchConditionNative); // SearchScopePaths初期化 var shellItems = new List <IShellItem>(this.SearchScopePaths.Length); var shellItemGuid = new Guid(ShellIID.IShellItem); foreach (var path in this.SearchScopePaths) { IShellItem scopeShellItem; var hr = ShellNativeMethods.SHCreateItemFromParsingName(path, IntPtr.Zero, ref shellItemGuid, out scopeShellItem); if (HRESULT.Succeeded(hr)) { shellItems.Add(scopeShellItem); } } var scopeShellItemArray = new ShellItemArray(shellItems.ToArray()); var result = SearchFolderItemFactory.SetScope(scopeShellItemArray); if (HRESULT.Failed(result)) { throw ShellException.FromHRESULT(result); } }
public void SetStacks(params ShellPropertyKey[] propertyKeys) { if (propertyKeys != null && propertyKeys.Length > 0) { var keys = propertyKeys.Select(x => x.PropertyKeyNative).ToArray(); SearchFolderItemFactory.SetStacks((uint)propertyKeys.Length, keys); } }
public void SetFolderLogicalViewMode(FolderLogicalViewMode mode) { var hr = SearchFolderItemFactory.SetFolderLogicalViewMode((FOLDERLOGICALVIEWMODE)mode); if (HRESULT.Failed(hr)) { throw ShellException.FromHRESULT(hr); } }
public void SetIconSize(int value) { var hr = SearchFolderItemFactory.SetIconSize(value); if (HRESULT.Failed(hr)) { throw ShellException.FromHRESULT(hr); } }
public void SetFolderTypeId(Guid value) { Contract.Requires <ArgumentNullException>(value != null); var hr = SearchFolderItemFactory.SetFolderTypeID(value); if (HRESULT.Failed(hr)) { throw ShellException.FromHRESULT(hr); } }
public void SetDisplayName(string displayName) { Contract.Requires <ArgumentException>(!String.IsNullOrEmpty(displayName)); var hr = SearchFolderItemFactory.SetDisplayName(displayName); if (HRESULT.Failed(hr)) { throw ShellException.FromHRESULT(hr); } }
public void SetGroupColumn(ShellPropertyKey propertyKey) { Contract.Requires <ArgumentNullException>(propertyKey != null); var key = propertyKey.PropertyKeyNative; var hr = SearchFolderItemFactory.SetGroupColumn(ref key); if (HRESULT.Failed(hr)) { throw ShellException.FromHRESULT(hr); } }
public void SortColumns(SortColumn[] columns) { Contract.Requires <ArgumentNullException>(columns != null); var values = columns.Select(x => new SORTCOLUMN(x.PropertyKey.PropertyKeyNative, (SORTDIRECTION)x.Direction)).ToArray(); var hr = SearchFolderItemFactory.SetSortColumns((uint)values.Length, values); if (HRESULT.Failed(hr)) { throw new ShellException(ErrorMessages.ShellSearchFolderUnableToSetSortColumns, Marshal.GetExceptionForHR(hr)); } }
public void SetVisibleColumns(ShellPropertyKey[] propertyKeys) { Contract.Requires <ArgumentNullException>(propertyKeys != null); var values = propertyKeys.Select(x => x.PropertyKeyNative).ToArray(); var hr = SearchFolderItemFactory.SetVisibleColumns((uint)values.Length, values); if (HRESULT.Failed(hr)) { throw new ShellException(ErrorMessages.ShellSearchFolderUnableToSetVisibleColumns, Marshal.GetExceptionForHR(hr)); } }
private static ShellItem CreateShellItemInfo() { Contract.Ensures(Contract.Result <ShellItem>() != null); var guid = new Guid(ShellIID.IShellItem); IShellItem shellItem; var hr = SearchFolderItemFactory.GetShellItem(ref guid, out shellItem); if (HRESULT.Failed(hr)) { throw ShellException.FromHRESULT(hr); } return(new ShellItem((IShellItem2)shellItem)); }