示例#1
0
        /// <summary>
        ///   Gets the WMI query string based on the current drive types.
        /// </summary>
        /// <returns></returns>
        protected virtual string GetWmiQueryStatement(TreeviewViewModel treeView)
        {
            if ((treeView.DriveTypes & Enums.DriveTypes.All) == Enums.DriveTypes.All)
            {
                return(string.Empty);
            }

            var where = string.Empty;
            var array = Enum.GetValues(typeof(Enums.DriveTypes));

            foreach (Enums.DriveTypes type in array)
            {
                if ((treeView.DriveTypes & type) == type)
                {
                    if (where == string.Empty)
                    {
                        where += "drivetype = " +
                                 Enum.Format(typeof(Enums.Win32_LogicalDiskDriveTypes),
                                             Enum.Parse(typeof(Enums.Win32_LogicalDiskDriveTypes), type.ToString(), true), "d");
                    }
                    else
                    {
                        where += " OR drivetype = " +
                                 Enum.Format(typeof(Enums.Win32_LogicalDiskDriveTypes),
                                             Enum.Parse(typeof(Enums.Win32_LogicalDiskDriveTypes), type.ToString(), true), "d");
                    }
                }
            }

            return(where);
        }
示例#2
0
 /// <summary>
 ///   Initialize a new instance of TreeViewHelper for the specified TreeViewFolderBrowser instance.
 /// </summary>
 /// <param name = "treeView"></param>
 internal TreeViewHelper(TreeviewViewModel treeView)
 {
     _treeView = treeView;
 }