public static void InitItem(EverythingItem item) { StringBuilder sb = new StringBuilder(500); Everything_GetResultFullPathName(item.Index, sb, (uint)sb.Capacity); string path = sb.ToString(); Everything_GetResultDateModified(item.Index, out var fileTime); item.Directory = Path.GetDirectoryName(path); item.Name = Path.GetFileName(path); if (fileTime != -1) { item.Date = DateTime.FromFileTime(fileTime); } item.WasInitialized = true; }
void ShowMenu(Point screenPos) { if (MainDataGrid.SelectedItem != null) { EverythingItem item = MainDataGrid.SelectedItem as EverythingItem; string file = Path.Combine(item.Directory, item.Name); if (File.Exists(file)) { ShellContextMenu menu = new ShellContextMenu(); FileInfo[] files = { new FileInfo(file) }; IntPtr handle = new WindowInteropHelper(this).Handle; System.Drawing.Point screenPos2 = new System.Drawing.Point((int)screenPos.X, (int)screenPos.Y); menu.ShowContextMenu(handle, files, screenPos2); Task.Run(() => { Thread.Sleep(2000); ViewModel.Update(); }); } } }