• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ShellObject类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ShellObject的典型用法代码示例。如果您正苦于以下问题:C# ShellObject类的具体用法?C# ShellObject怎么用?C# ShellObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ShellObject类属于命名空间,在下文中一共展示了ShellObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
        }
开发者ID:Corillian,项目名称:Windows-API-Code-Pack-1.1,代码行数:12,代码来源:MainWindow.xaml.cs


示例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);
        }
开发者ID:rad1oactive,项目名称:BetterExplorer,代码行数:26,代码来源:ArchiveViewWindow.xaml.cs


示例3: Load

 public void Load(ShellObject shellObject)
 {
     using (var stream = new FileStream(shellObject.ParsingName, FileMode.Open, FileAccess.Read))
     {
         Populate(stream);
     }
 }
开发者ID:QuocHuy7a10,项目名称:Arianrhod,代码行数:7,代码来源:WPFPreviewHandlerDemo.cs


示例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;
        }
开发者ID:pmorton,项目名称:Log2Console,代码行数:11,代码来源:ShellThumbnail.cs


示例5: DriveItem

 public DriveItem(DriveInfo info)
 {
     Name = GetDriveInfoString(info);
     RootDirectory = info.RootDirectory.FullName;
     ShellObject = ShellObject.FromParsingName(RootDirectory);
     IsReady = info.IsReady;
 }
开发者ID:glupschta,项目名称:Kex,代码行数:7,代码来源:DrivesPopup.cs


示例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;
        }
开发者ID:dbremner,项目名称:Windows-API-Code-Pack-1.1,代码行数:13,代码来源:ShellThumbnail.cs


示例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;
 }
开发者ID:glupschta,项目名称:Kex,代码行数:14,代码来源:PathResolver.cs


示例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);
                    }
                    
                }
            }));

        }
开发者ID:rad1oactive,项目名称:BetterExplorer,代码行数:49,代码来源:BreadcrumbBarItem.xaml.cs


示例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;
 }
开发者ID:soukoku,项目名称:MExplorer,代码行数:16,代码来源:Util.cs


示例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;
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:22,代码来源:ShellObjectWatcher.cs


示例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;
        }
开发者ID:rad1oactive,项目名称:BetterExplorer,代码行数:18,代码来源:ResizeImage.xaml.cs


示例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.");
 }
开发者ID:SteveHarveyUK,项目名称:PhotoSync,代码行数:19,代码来源:Photo.cs


示例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);
 }
开发者ID:jiliyutou,项目名称:Kinect.Joy,代码行数:20,代码来源:WinShellWraper.cs


示例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);
     }
 }
开发者ID:jiliyutou,项目名称:Kinect.Joy,代码行数:22,代码来源:WinShellWraper.cs


示例15: PropertySystemDevices

 internal PropertySystemDevices(ShellObject parent)
 {
     shellObjectParent = parent;
 }
开发者ID:overeemm,项目名称:JoomlaPodcaster,代码行数:4,代码来源:StronglyTypedProperties.cs


示例16: SetSaveAsItem

		/// <summary>
		/// Sets an item to appear as the initial entry in a <b>Save As</b> dialog.
		/// </summary>
		/// <param name="item">The initial entry to be set in the dialog.</param>
		/// <remarks>The name of the item is displayed in the file name edit box, 
		/// and the containing folder is opened in the view. This would generally be 
		/// used when the application is saving an item that already exists.</remarks>
		public void SetSaveAsItem(ShellObject item) {
			if (item == null) {
				throw new ArgumentNullException("item");
			}

			InitializeNativeFileDialog();
			IFileSaveDialog nativeDialog = GetNativeFileDialog() as IFileSaveDialog;

			// Get the native IShellItem from ShellObject
			if (nativeDialog != null) {
				nativeDialog.SetSaveAsItem(item.NativeShellItem);
			}
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:20,代码来源:CommonSaveFileDialog.cs


示例17: Navigate

		/// <summary>
		/// Clears the Explorer Browser of existing content, fills it with
		/// content from the specified container, and adds a new point to the Travel Log.
		/// </summary>
		/// <param name="shellObject">The shell container to navigate to.</param>
		/// <exception cref="System.Runtime.InteropServices.COMException">Will throw if navigation fails for any other reason.</exception>
		public void Navigate(ShellObject shellObject) {
			if (shellObject == null) {
				throw new ArgumentNullException("shellObject");
			}

			if (explorerBrowserControl == null) {
				antecreationNavigationTarget = shellObject;
			} else {
				HResult hr = explorerBrowserControl.BrowseToObject(shellObject.NativeShellItem, 0);
				if (hr != HResult.Ok) {
					if ((hr == HResult.ResourceInUse || hr == HResult.Canceled) && NavigationFailed != null) {
						NavigationFailedEventArgs args = new NavigationFailedEventArgs();
						args.FailedLocation = shellObject;
						NavigationFailed(this, args);
					} else {
						throw new CommonControlException(LocalizedMessages.ExplorerBrowserBrowseToObjectFailed, hr);
					}
				}
			}
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:26,代码来源:ExplorerBrowser.cs


示例18: Navigate

 /// <summary>
 /// Clears the Explorer Browser of existing content, fills it with
 /// content from the specified container, and adds a new point to the Travel Log.
 /// </summary>
 /// <param name="shellObject">The shell container to navigate to.</param>
 /// <exception cref="System.Runtime.InteropServices.COMException">Will throw if navigation fails for any other reason.</exception>
 public void Navigate(ShellObject shellObject)
 {
     if (explorerBrowserControl == null)
     {
         antecreationNavigationTarget = shellObject;
     }
     else
     {
         HRESULT hr = explorerBrowserControl.BrowseToObject(shellObject.NativeShellItem, 0);
         if (hr != HRESULT.S_OK)
         {
             if (hr == HRESULT.RESOURCE_IN_USE)
             {
                 if (NavigationFailed != null)
                 {
                     NavigationFailedEventArgs args = new NavigationFailedEventArgs();
                     args.FailedLocation = shellObject;
                     NavigationFailed(this, args);
                 }
             }
             else
                 throw new COMException("BrowseToObject failed", (int)hr);
         }
     }
 }
开发者ID:TanyaTPG,项目名称:Log2Console,代码行数:31,代码来源:ExplorerBrowser.cs


示例19: NewTab

        //New tab from ShellObject
        private void NewTab(ShellObject navTarget)
        {
            //Add a delay for creating new tabs
            System.Timers.Timer aTimer = new System.Timers.Timer();
            aTimer.Interval = 500;
            aTimer.Elapsed += new ElapsedEventHandler(delegate(object source, ElapsedEventArgs e) {
                tabCreateEnabled = true;
            });
            aTimer.Enabled = true;

            if (!tabCreateEnabled)
            {
                tabControl.SelectedIndex = tabControl.Items.Count - 1;
            }
            else {
                tabCreateEnabled = false;

                ExplorerBrowser expBrowser = new ExplorerBrowser();
                expBrowser.HorizontalAlignment = HorizontalAlignment.Left;
                expBrowser.VerticalAlignment = VerticalAlignment.Top;
                expBrowser.Height = (this.Height - 57) > 0 ? (this.Height - 57) : this.Height;
                expBrowser.Width = this.Width;
                expBrowser.NavigationTarget = navTarget;
                expBrowser.AllowDrop = true;
                expBrowser.ViewMode = ExplorerBrowserViewMode.Icon;

                StackPanel expPanel = new StackPanel();
                expPanel.HorizontalAlignment = HorizontalAlignment.Stretch;
                expPanel.VerticalAlignment = VerticalAlignment.Stretch;
                expPanel.Margin = new Thickness(-5, 0, 0, 0);
                expPanel.Background = new SolidColorBrush(Color.FromRgb(245, 246, 247));

                WrapPanel expControls = new WrapPanel();
                expControls.Height = 34;
                expControls.Width = this.Width;

                Button backButton = new Button()
                {
                    Width = 29,
                    Height = 29,
                    Margin = new Thickness(32, 0, 12, 0),
                    VerticalAlignment = VerticalAlignment.Center,
                    Template = (ControlTemplate)FindResource("GlassButton"),
                    Content = new Image()
                    {
                        Width = 29, //back: 20
                        Height = 29, //back: 20
                        VerticalAlignment = VerticalAlignment.Center,
                        HorizontalAlignment = HorizontalAlignment.Center,
                        Source = new BitmapImage(new Uri("pack://application:,,,/images/back2.ico"))
                    }
                };

                Button forwardButton = new Button()
                {
                    Width = 29,
                    Height = 29,
                    Margin = new Thickness(12, 0, 12, 0),
                    VerticalAlignment = VerticalAlignment.Center,
                    Template = (ControlTemplate)FindResource("GlassButton"),
                    Content = new Image()
                    {
                        Width = 29, //forward: 20
                        Height = 29, //forward: 20
                        VerticalAlignment = VerticalAlignment.Center,
                        HorizontalAlignment = HorizontalAlignment.Center,
                        Source = new BitmapImage(new Uri("pack://application:,,,/images/forward2.ico"))
                    }
                };

                TextBox addressBar = new TextBox() {
                    VerticalAlignment = VerticalAlignment.Center,
                    Width = this.Width - 250,
                    Margin = new Thickness(29, 3, 0, 0),
                    AcceptsReturn = false
                };

                forwardButton.PreviewMouseLeftButtonDown += delegate(object sender, MouseButtonEventArgs e)
                {
                    expBrowser.NavigationLogIndex += 1;
                };

                backButton.PreviewMouseLeftButtonDown += delegate(object sender, MouseButtonEventArgs e)
                {
                    expBrowser.NavigationLogIndex -= 1;
                };

                addressBar.KeyDown += delegate(object sender, KeyEventArgs e)
                {
                    if (e.Key == Key.Enter || e.Key == Key.Return)
                    {
                        tryNavigate(expBrowser, addressBar);
                    }
                };

                addressBar.LostKeyboardFocus += delegate(object sender, KeyboardFocusChangedEventArgs e) {
                    try
                    {
                        expBrowser.NavigationTarget = ShellObject.FromParsingName(addressBar.Text);
//.........这里部分代码省略.........
开发者ID:butnet,项目名称:FancyExplorer,代码行数:101,代码来源:MainWindow.xaml.cs


示例20: PropertySystemComputer

 internal PropertySystemComputer(ShellObject parent)
 {
     shellObjectParent = parent;
 }
开发者ID:overeemm,项目名称:JoomlaPodcaster,代码行数:4,代码来源:StronglyTypedProperties.cs



注:本文中的ShellObject类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Ship类代码示例发布时间:2022-05-24
下一篇:
C# Shell类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap