示例#1
0
        public TCFile(string name, string filePath, string previousFolder, TCType tcType, string iconSource) : this()
        {
            if ((!string.IsNullOrEmpty(name)) && (TcType == TCType.FOLDER) && string.IsNullOrEmpty(Path.GetFileNameWithoutExtension(name)))
            {
                FileNameText = name;
            }
            else
            {
                FileNameText = (name == "...") ? name : (string.IsNullOrEmpty(name)) ? string.Empty : Path.GetFileNameWithoutExtension(name);
            }

            FilePath         = filePath;
            TcType           = tcType;
            IconSourceString = iconSource;

            switch (tcType)
            {
            case TCType.FILE:
                IsFolder = false;
                break;

            case TCType.PREVIOUS:
                IsSystemItem = true;
                IsFolder     = true;
                break;

            case TCType.FOLDER:
                IsFolder = true;
                break;

            case TCType.FAVORITE:
                IsFolder    = false;
                IsFavorited = true;
                break;

            default:
                break;
            }

            if (tcType == TCType.FILE || tcType == TCType.FAVORITE)
            {
                try
                {
                    File = new FileInfo(FilePath);
                }
                catch (Exception)
                {
                }
            }

            fileClickedArg = new FileClickedEventArgs(FilePath, isFolder, file);
        }
示例#2
0
        public static string GetStrByTCType(TCType type)
        {
            string str;

            switch (type)
            {
            case TCType.Trigger:
                str = "触发获取";
                break;

            case TCType.Cycle:
                str = "循环获取";
                break;

            default:
                str = "";
                break;
            }

            return(str);
        }