public List <CEpubFicFile> LoadEpubsFromFolder(string vsFilepath)
        {
            try
            {
                var dirs = Directory.EnumerateFiles(vsFilepath, "*.epub", SearchOption.AllDirectories);

                foreach (string currentFile in dirs)
                {
                    CEpubFicFile oEpub = new CEpubFicFile(currentFile);
                    EpubList.Add(oEpub);
                    //string fileName = currentFile.Substring(sourceDirectory.Length + 1);
                    //  Directory.Move(currentFile, Path.Combine(archiveDirectory, fileName));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            return(EpubList);

            /*
             *          var dirs = Directory.GetFiles(vsFilepath, "*.epub", SearchOption.AllDirectories);
             *          //this.oEpubFileList.SetObjects(dirs);
             *          foreach (var sfile in dirs)
             *          {
             *                  cEpubFile oEpub = new cEpubFile(sfile);
             *
             *                  _epubList.Add(oEpub);
             *                  //    count ++;
             *          }
             *          return null;
             * */
        }
        private async Task DoWork(CEpubFicFile epubFile)
        {
            Func <string> function = new Func <string>(() => MakeWork(epubFile));
            TaskFactory   oFactory = new TaskFactory();
            string        res      = await oFactory.StartNew <string>(function);

            Task task = Task.Factory.StartNew(DoWork(epubFile.LoadFileAsync()));
            //  task.
        }
        private async Task <int> HandleFileAsync(string vDir)
        {
            //Console.WriteLine("HandleFile enter");
            int count = 0;
            var dirs  = Directory.GetFiles(vDir, "*.epub", SearchOption.AllDirectories);

            //this.oEpubFileList.SetObjects(dirs);
            foreach (var sfile in dirs)
            {
                CEpubFicFile oEpub = new CEpubFicFile(sfile);
                //	lblStatus.Text = sfile;
                EpubList.Add(oEpub);
                count++;
            }
            //		oEpubFileList.SetObjects(_epubList);
            return(count);
        }
        private async void ProcessDataAsync(string vDir)
        {
            // Start the HandleFile method.
            //   Task<int> task = HandleFileAsync(sFileName);
            var dirs = Directory.GetFiles(vDir, "*.epub", SearchOption.AllDirectories);

            //this.oEpubFileList.SetObjects(dirs);
            foreach (var sfile in dirs)
            {
                CEpubFicFile oEpub = new CEpubFicFile(sfile);
                //	lblStatus.Text = sfile;
                EpubList.Add(oEpub);
                // count ++;
            }
            //		oEpubFileList.SetObjects(_epubList);
            //int x = await task;
            //lblProcessed.Text = x.ToString();
        }
 private string MakeWork(CEpubFicFile epubFile)
 {
     epubFile.LoadFile();
     return(epubFile.FileName);
 }
 private Task CreateReadTask(CEpubFicFile epub)
 {
     return(null);
 }