public static ILVItemViewModel CreateItem( string path , FSItemType type , string displayName) { return(new LVItemViewModel(path, type, displayName)); }
/// <summary> /// class constructor /// </summary> /// <param name="curdir"></param> /// <param name="itemName"></param> /// <param name="itemType"></param> /// <param name="showIcon"></param> public ListItemViewModel(string curdir, FSItemType itemType, string itemName, bool showIcon) : this(curdir, itemType, itemName) { this.ShowIcon = showIcon; }
/// <summary> /// class constructor /// </summary> /// <param name="curdir"></param> /// <param name="itemName"></param> /// <param name="itemType"></param> public ListItemViewModel(string curdir, FSItemType itemType, string itemName) : this() { this._PathObject = PathFactory.Create(curdir, itemType); this.ItemName = itemName; }
/// <summary> /// class constructor /// </summary> /// <param name="curdir"></param> /// <param name="displayName"></param> /// <param name="itemType"></param> /// <param name="showIcon"></param> public LVItemViewModel(string curdir, FSItemType itemType, string displayName, bool showIcon) : this(curdir, itemType, displayName) { this.ShowIcon = showIcon; }
/// <summary> /// Method is executed when a listview item is double clicked. /// </summary> /// <param name="infoType"></param> /// <param name="newPath"></param> FSItemType IBrowseNavigation.BrowseDown(FSItemType infoType, string newPath) { if (infoType == FSItemType.Folder || infoType == FSItemType.LogicalDrive) { SetCurrentFolder(newPath, true); } return(infoType); }
/// <summary> /// class constructor /// </summary> /// <param name="curdir"></param> /// <param name="itemType"></param> /// <param name="itemName"></param> /// <param name="indentation"></param> public LVItemViewModel(string curdir, FSItemType itemType, string itemName, int indentation = 0) : this() { this._PathObject = PathFactory.Create(curdir, itemType); this.ItemName = itemName; }
/// <summary> /// class constructor /// </summary> /// <param name="curdir"></param> /// <param name="displayName"></param> /// <param name="itemType"></param> /// <param name="showIcon"></param> /// <param name="indentation"></param> public FSItemViewModel(string curdir, FSItemType itemType, string displayName, bool showIcon, int indentation = 0) : this(curdir, itemType, displayName, indentation) { this.ShowToolTip = showIcon; }
/// <summary> /// class constructor /// </summary> /// <param name="curdir"></param> /// <param name="displayName"></param> /// <param name="itemType"></param> /// <param name="indentation"></param> public FSItemViewModel(string curdir, FSItemType itemType, string displayName, int indentation = 0) : this() { this.mPathObject = new PathModel(curdir, itemType); this.DisplayName = displayName; this.Indentation = indentation; }
public void Copy(PathModel pathModelCopy) { if (pathModelCopy == null) { return; } mItemType = pathModelCopy.mItemType; mPath = pathModelCopy.mPath; }
/// <summary> /// Copy Constructor /// </summary> /// <param name="pathModelCopy"></param> public PathModel(PathModel pathModelCopy) : this() { if (pathModelCopy == null) { return; } mItemType = pathModelCopy.mItemType; mPath = pathModelCopy.mPath; }
/// <summary> /// Construct dummy folder /// </summary> /// <param name="path"></param> /// <param name="type"></param> protected FolderViewModel(string path, FSItemType type) { // Names of Logical drives cannot be changed with this if (type == FSItemType.LogicalDrive) { this.IsReadOnly = true; } mIsExpanded = mIsSelected = false; mModel = new PathModel(path, type); // Add dummy folder by default to make tree view show expander by default mFolders = new ObservableSortedDictionary <string, IFolderViewModel>(); mVolumeLabel = null; }
/// <summary> /// Class constructor /// </summary> public PathModel(string path, FSItemType itemType) : this() { mItemType = itemType; switch (itemType) { case FSItemType.Folder: case FSItemType.LogicalDrive: mPath = PathModel.NormalizeDirectoryPath(path); break; case FSItemType.File: mPath = PathModel.NormalizePath(path); break; case FSItemType.DummyEntry: break; case FSItemType.Unknown: default: throw new NotImplementedException(string.Format("Enumeration member: '{0}' not supported.", itemType)); } }
public FSItem(string path, FSItemType type) { this.path = path; this.type = type; }
/// <summary> /// Get a DynamicResource from ResourceDictionary or a static ImageSource (as fallback) for expanded folder item. /// </summary> /// <param name="itemType"></param> /// <returns></returns> private object GetExpandedImages(FSItemType itemType) { string uriPath = null; switch (itemType) { case FSItemType.Folder: uriPath = string.Format("FolderItem_Image_{0}", "FolderOpen"); break; case FSItemType.LogicalDrive: uriPath = string.Format("FolderItem_Image_{0}", "HardDisk"); break; default: case FSItemType.File: case FSItemType.Unknown: Logger.Error("Type of item is not supported:" + itemType.ToString()); break; } object item = null; if (uriPath != null) { item = Application.Current.Resources[uriPath]; if (item != null) { return(item); } } string pathValue = null; switch (itemType) { case FSItemType.Folder: pathValue = "pack://application:,,,/FolderBrowser;component/Images/Generic/FolderOpen.png"; break; case FSItemType.LogicalDrive: pathValue = "pack://application:,,,/FolderBrowser;component/Images/Generic/HardDisk.ico"; break; default: case FSItemType.File: case FSItemType.Unknown: Logger.Error("Type of item is not supported:" + itemType.ToString()); break; } if (pathValue != null) { try { Uri imagePath = new Uri(pathValue, UriKind.RelativeOrAbsolute); ImageSource source = new System.Windows.Media.Imaging.BitmapImage(imagePath); return(source); } catch { } } // Attempt to load fallback folder from ResourceDictionary item = Application.Current.Resources[string.Format("FolderItem_Image_{0}", "FolderOpen")]; if (item != null) { return(item); } else { // Attempt to load fallback folder from fixed Uri pathValue = "pack://application:,,,/FolderBrowser;component/Images/Generic/FolderOpen.png"; try { Uri imagePath = new Uri(pathValue, UriKind.RelativeOrAbsolute); ImageSource source = new System.Windows.Media.Imaging.BitmapImage(imagePath); return(source); } catch { } } return(null); }
protected TreeItemViewModel(string dir, FSItemType ItemType, ITreeItemViewModel parent) : this(PathFactory.Create(dir, ItemType), parent) { }
/// <summary> /// Constructs a new <seealso cref="IPathModel"/> object and returns it. /// </summary> public static IPathModel Create(string path, FSItemType itemType) { return(new PathModel(path, itemType)); }
/// <summary> /// Class constructor /// </summary> public PathModel() { mPath = string.Empty; mItemType = FSItemType.Unknown; }
/// <summary> /// Class constructor /// </summary> protected PathModel() { mPath = string.Empty; mItemType = FSItemType.Unknown; }