Exemple #1
0
        private RootElement[] getMediaElements(string rootPath, MediaFileType fileType)
        {
            List <RootElement> elements = new List <RootElement>();

            if (Directory.Exists(rootPath))
            {
                foreach (string directory in Directory.GetDirectories(rootPath))
                {
                    string      shortDirName = Path.GetFileName(directory);
                    RootElement element      = new RootElement(shortDirName);
                    string      text         = fileType == MediaFileType.Movie ? "Touch file to play" : "Touch file to view";
                    Section     fileSection  = new Section(text);
                    element.Add(fileSection);
                    foreach (string file in Directory.GetFiles(directory))
                    {
                        FileElement fileElement = new FileElement(Path.GetFileName(file), fileType, handleFileElementTap);
                        fileElement.Path = file;
                        fileSection.Add(fileElement);
                    }
                    elements.Add(element);
                }
            }
            return(elements.ToArray());
        }
		private RootElement[] getMediaElements( string rootPath, MediaFileType fileType )
		{
			List<RootElement> elements = new List<RootElement>();
			if ( Directory.Exists( rootPath ) )
			{
				foreach ( string directory in Directory.GetDirectories( rootPath ) )
				{
					string shortDirName = Path.GetFileName( directory );
					RootElement element = new RootElement( shortDirName );
					string text = fileType == MediaFileType.Movie ? "Touch file to play" : "Touch file to view";
					Section fileSection = new Section( text );
					element.Add( fileSection );
					foreach ( string file in Directory.GetFiles( directory ) )
					{
						FileElement fileElement = new FileElement( Path.GetFileName( file ), fileType, handleFileElementTap );
						fileElement.Path = file;
						fileSection.Add( fileElement );
					}
					elements.Add( element );
				}
			}
			return elements.ToArray();
		}