コード例 #1
0
ファイル: Factory.cs プロジェクト: RyanFu/MLib
 public static ILVItemViewModel CreateItem(
     string path
     , FSItemType type
     , string displayName)
 {
     return(new LVItemViewModel(path, type, displayName));
 }
コード例 #2
0
 /// <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;
 }
コード例 #3
0
 /// <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;
 }
コード例 #4
0
ファイル: LVItemViewModel.cs プロジェクト: mcswaip1/fsc
 /// <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;
 }
コード例 #5
0
        /// <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);
        }
コード例 #6
0
ファイル: LVItemViewModel.cs プロジェクト: mcswaip1/fsc
 /// <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;
 }
コード例 #7
0
 /// <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;
 }
コード例 #8
0
 /// <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;
 }
コード例 #9
0
ファイル: PathModel.cs プロジェクト: IlyaFinkelshteyn/MLib
        public void Copy(PathModel pathModelCopy)
        {
            if (pathModelCopy == null)
            {
                return;
            }

            mItemType = pathModelCopy.mItemType;
            mPath     = pathModelCopy.mPath;
        }
コード例 #10
0
        /// <summary>
        /// Copy Constructor
        /// </summary>
        /// <param name="pathModelCopy"></param>
        public PathModel(PathModel pathModelCopy)
            : this()
        {
            if (pathModelCopy == null)
            {
                return;
            }

            mItemType = pathModelCopy.mItemType;
            mPath     = pathModelCopy.mPath;
        }
コード例 #11
0
        /// <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;
        }
コード例 #12
0
        /// <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));
            }
        }
コード例 #13
0
ファイル: FSItem.cs プロジェクト: sys27/SRF
 public FSItem(string path, FSItemType type)
 {
     this.path = path;
     this.type = type;
 }
コード例 #14
0
        /// <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);
        }
コード例 #15
0
 protected TreeItemViewModel(string dir, FSItemType ItemType, ITreeItemViewModel parent)
     : this(PathFactory.Create(dir, ItemType), parent)
 {
 }
コード例 #16
0
ファイル: PathFactory.cs プロジェクト: mcswaip1/fsc
 /// <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));
 }
コード例 #17
0
ファイル: FSItem.cs プロジェクト: sys27/SRF
 public FSItem(string path, FSItemType type)
 {
     this.path = path;
     this.type = type;
 }
コード例 #18
0
 /// <summary>
 /// Class constructor
 /// </summary>
 public PathModel()
 {
     mPath     = string.Empty;
     mItemType = FSItemType.Unknown;
 }
コード例 #19
0
 /// <summary>
 /// Class constructor
 /// </summary>
 protected PathModel()
 {
     mPath     = string.Empty;
     mItemType = FSItemType.Unknown;
 }