本文整理汇总了C#中ShellDll.ShellItem.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# ShellItem.Equals方法的具体用法?C# ShellItem.Equals怎么用?C# ShellItem.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShellDll.ShellItem
的用法示例。
在下文中一共展示了ShellItem.Equals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetRealPath
public static string GetRealPath(ShellItem item)
{
if(item.Equals(item.browser.DesktopItem))
{
return "::{450d8fba-ad25-11d0-98a8-0800361b1103}";
}
else if(item.Type == item.Browser.SystemFolderName)
{
IntPtr strr = Marshal.AllocCoTaskMem(ShellAPI.MAX_PATH * 2 + 4);
Marshal.WriteInt32(strr, 0, 0);
StringBuilder buf = new StringBuilder(ShellAPI.MAX_PATH);
if(item.ParentItem.ShellFolder.GetDisplayNameOf(
item.PIDLRel.Ptr,
ShellAPI.SHGNO.FORPARSING,
strr) == ShellAPI.S_OK)
{
ShellAPI.StrRetToBuf(strr, item.PIDLRel.Ptr, buf, ShellAPI.MAX_PATH);
}
Marshal.FreeCoTaskMem(strr);
return buf.ToString();
}
else
return item.Path;
}
示例2: SetNewPath
/// <summary>
/// When a new directory is selected, this method is called to clear the ListView and fill it with
/// the contents of the new directory
/// </summary>
/// <param name="oldItem">The ShellItem of the previous selected directory</param>
/// <param name="newItem">The ShellItem of the new selected directory</param>
private bool SetNewPath(ShellItem oldItem, ShellItem newItem)
{
Cursor.Current = Cursors.WaitCursor;
if (oldItem != newItem && newItem.Expand(true, false, Handle))
{
ShellBrowser.UpdateCondition.ContinueUpdate = false;
fileView.BeginUpdate();
fileView.Items.Clear();
fileView.ClearSelections();
if (oldItem != null)
{
bool used = false;
foreach (Browser br in ShellBrowser.Browsers)
{
if (!this.Equals(br) && oldItem.Equals(br.SelectedItem))
{
used = true;
break;
}
}
if (!used)
oldItem.Clear(true, false);
}
selectedItem = newItem;
ListViewItem[] newListItemsArray = new ListViewItem[newItem.Count];
string[] subItems = new string[fileView.Columns.Count - 1];
for (int i = 0; i < newListItemsArray.Length; i++)
{
newListItemsArray[i] = GetListViewItem(subItems, newItem[i]);
}
fileView.SetSorting(true);
fileView.Items.AddRange(newListItemsArray);
fileView.SetSorting(false);
fileView.EndUpdate();
Cursor.Current = Cursors.Default;
return true;
}
else
{
Cursor.Current = Cursors.Default;
return (oldItem == newItem);
}
}
示例3: GetListItem
public bool GetListItem(ShellItem shellItem, out ListViewItem listItem)
{
listItem = null;
foreach (ListViewItem item in Items)
{
if (shellItem.Equals(item.Tag))
{
listItem = item;
return true;
}
}
return false;
}