本文整理汇总了C#中ShellObject类的典型用法代码示例。如果您正苦于以下问题:C# ShellObject类的具体用法?C# ShellObject怎么用?C# ShellObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ShellObject类属于命名空间,在下文中一共展示了ShellObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartWatcher
private void StartWatcher(ShellObject shellObject)
{
if (_watcher != null) { _watcher.Dispose(); }
eventStack.Children.Clear();
txtPath.Text = shellObject.ParsingName;
_watcher = new ShellObjectWatcher(shellObject, chkRecursive.IsChecked ?? true);
_watcher.AllEvents += AllEventsHandler;
_watcher.Start();
}
示例2: ArchiveViewWindow
public ArchiveViewWindow(ShellObject loc, bool IsPreviewPaneEnabled, bool IsInfoPaneEnabled)
{
InitializeComponent();
archive = loc;
this.Title = "View Archive - " + archive.GetDisplayName(DisplayNameType.Default);
ShellVView.Child = Explorer;
Explorer.NavigationOptions.PaneVisibility.Commands = PaneVisibilityState.Hide;
Explorer.NavigationOptions.PaneVisibility.CommandsOrganize = PaneVisibilityState.Hide;
Explorer.NavigationOptions.PaneVisibility.CommandsView = PaneVisibilityState.Hide;
Explorer.NavigationOptions.PaneVisibility.Preview =
IsPreviewPaneEnabled ? PaneVisibilityState.Show : PaneVisibilityState.Hide;
Explorer.NavigationOptions.PaneVisibility.Details =
IsInfoPaneEnabled ? PaneVisibilityState.Show : PaneVisibilityState.Hide;
Explorer.NavigationOptions.PaneVisibility.Navigation = PaneVisibilityState.Hide;
Explorer.ContentOptions.FullRowSelect = true;
Explorer.ContentOptions.CheckSelect = false;
Explorer.ContentOptions.ViewMode = ExplorerBrowserViewMode.Tile;
Explorer.NavigationComplete += new EventHandler<NavigationCompleteEventArgs>(Explorer_NavigationComplete);
Explorer.Navigate(loc);
}
示例3: Load
public void Load(ShellObject shellObject)
{
using (var stream = new FileStream(shellObject.ParsingName, FileMode.Open, FileAccess.Read))
{
Populate(stream);
}
}
示例4: ShellThumbnail
/// <summary>
/// Internal constructor that takes in a parent ShellObject.
/// </summary>
/// <param name="shellObject"></param>
internal ShellThumbnail(ShellObject shellObject)
{
if (shellObject == null || shellObject.NativeShellItem == null)
throw new ArgumentNullException("shellObject");
shellItemNative = shellObject.NativeShellItem;
}
示例5: DriveItem
public DriveItem(DriveInfo info)
{
Name = GetDriveInfoString(info);
RootDirectory = info.RootDirectory.FullName;
ShellObject = ShellObject.FromParsingName(RootDirectory);
IsReady = info.IsReady;
}
示例6: ShellThumbnail
/// <summary>
/// Internal constructor that takes in a parent ShellObject.
/// </summary>
/// <param name="shellObject"></param>
internal ShellThumbnail(ShellObject shellObject)
{
if (shellObject == null || shellObject.NativeShellItem == null)
{
throw new ArgumentNullException(nameof(shellObject));
}
shellItemNative = shellObject.NativeShellItem;
}
示例7: Resolve
public static string Resolve(ShellObject shellObject, string fullPath)
{
if (shellObject == null)
return fullPath;
if (shellObject.IsLink)
{
var link = ShellLink.FromParsingName(fullPath);
var shellPath = ((string)shellObject.Properties.GetProperty("System.ParsingPath").ValueAsObject);
// var shellPath = ((string)shellObject.Properties.GetProperty("System.Link.TargetParsingPath").ValueAsObject);
//Für .lnk Systemsteuerung/Verwaltung
return shellPath == shellObject.Name ? fullPath : shellPath;
}
return fullPath;
}
示例8: LoadDirectory
public void LoadDirectory(ShellObject obj)
{
obj.Thumbnail.FormatOption = ShellThumbnailFormatOption.IconOnly;
obj.Thumbnail.CurrentSize = new Size(16, 16);
this.PathImage.Source = obj.Thumbnail.BitmapSource;
this.pathName.Text = obj.GetDisplayName(DisplayNameType.Default);
this.so = obj;
path = obj.ParsingName;
Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart)(() =>
{
if (obj.ParsingName == KnownFolders.Network.ParsingName || obj.ParsingName.StartsWith(@"\\"))
{
SetChildren(true);
grid1.Visibility = System.Windows.Visibility.Visible;
MenuBorder.Visibility = System.Windows.Visibility.Visible;
}
else
{
try
{
ShellContainer con = (ShellContainer)obj;
List<ShellObject> joe = new List<ShellObject>();
foreach (ShellObject item in con)
{
if (item.IsFolder == true)
{
if (item.ParsingName.ToLower().EndsWith(".zip") == false && item.ParsingName.ToLower().EndsWith(".cab") == false)
{
joe.Add(item);
}
}
}
SetChildren(joe.Count > 0);
}
catch
{
SetChildren(false);
}
}
}));
}
示例9: GetIcon
internal static ImageSource GetIcon(ShellObject shell, IconSize size)
{
shell.Thumbnail.CurrentSize = new System.Windows.Size(16, 16);
switch (size)
{
case IconSize.ExtraLarge:
return shell.Thumbnail.LargeBitmapSource;
case IconSize.Large:
return shell.Thumbnail.MediumBitmapSource;
case IconSize.Medium:
return shell.Thumbnail.SmallBitmapSource;
case IconSize.Small:
return shell.Thumbnail.BitmapSource;
}
return null;
}
示例10: ShellObjectWatcher
/// <summary>
/// Creates the ShellObjectWatcher for the given ShellObject
/// </summary>
/// <param name="shellObject">The ShellObject to monitor</param>
/// <param name="recursive">Whether to listen for changes recursively (for when monitoring a container)</param>
public ShellObjectWatcher(ShellObject shellObject, bool recursive) {
if (shellObject == null) {
throw new ArgumentNullException("shellObject");
}
if (_context == null) {
_context = new SynchronizationContext();
SynchronizationContext.SetSynchronizationContext(_context);
}
_shellObject = shellObject;
this._recursive = recursive;
var result = MessageListenerFilter.Register(OnWindowMessageReceived);
_listenerHandle = result.WindowHandle;
_message = result.Message;
}
示例11: ResizeImage
public ResizeImage(ShellObject file, string height, string width, string imagename)
{
InitializeComponent();
textBlock1.Text = imagename + ": " + file.GetDisplayName(DisplayNameType.Default);
cvt = new Bitmap(file.ParsingName);
textBlock2.Text = height + ": " + cvt.Height.ToString();
textBlock3.Text = width + ": " + cvt.Width.ToString();
spinner1.Value = 100;
percsetting = true;
textBox1.Text = cvt.Width.ToString();
textBox2.Text = cvt.Height.ToString();
percsetting = false;
}
示例12: Photo
public Photo(string path)
{
// Debug.WriteLine("Photo[" + Thread.CurrentThread.ManagedThreadId + "](" + path + ") started...");
FullPath = path;
#if STORE_SHELLOBJECT
_threadId = Thread.CurrentThread.ManagedThreadId;
_shellObject = ShellObject.FromParsingName(path);
var x = DateTaken;
var xx = Camera;
#else
// var shellObject = ShellObject.FromParsingName(path);
using (var shellObject = ShellObject.FromParsingName(path))
{
DateTaken = shellObject.Properties.GetProperty<DateTime?>(SystemProperties.System.Photo.DateTaken).Value;
Camera = new Camera(shellObject);
}
#endif
// Debug.WriteLine("Photo[" + Thread.CurrentThread.ManagedThreadId + "](" + path + ") complete.");
}
示例13: GetExifRotationInfo
public int GetExifRotationInfo(string path)
{
if (!_shellsupport) return 1;
_shellitem = ShellObject.FromParsingName(path);
object res = 1;
foreach (var item in _shellitem.Properties.DefaultPropertyCollection)
{
if (item.CanonicalName == "System.Photo.Orientation")
{
res = item.ValueAsObject;
break;
}
}
_shellitem.Dispose();
_shellitem = null;
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
return Convert.ToInt32(res);
}
示例14: GetThumbnail
public BitmapSource GetThumbnail(string path)
{
try
{
if (_shellsupport)
{
_shellitem = ShellObject.FromParsingName(path);
BitmapSource ret = _shellitem.Thumbnail.LargeBitmapSource;
_shellitem.Dispose();
_shellitem = null;
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
return ret;
}
else return FailSafeThumbnail(path);
}
catch (Exception)
{
return FailSafeThumbnail(path);
}
}
示例15: PropertySystemDevices
internal PropertySystemDevices(ShellObject parent)
{
shellObjectParent = parent;
}