Beispiel #1
0
 private void AddListViewItems(string[] sourcefiles)
 {
     for (int i = 0; i < sourcefiles.Length; i++)
     {
         FileConvertItem k = new FileConvertItem {
             Name = Path.GetFileName(sourcefiles[i]), FullPathName = sourcefiles[i], Status = string.Empty
         };
         listViewSourceFiles.Items.Add(new FileConvertListViewItem(k));
     }
 }
        public FileConvertListViewItem(FileConvertItem item)
            : base(item.Name)
        {
            ListViewSubItem lsi;
            ListViewItem    li = this;

            lsi      = li.SubItems.Add(item.Status);//Status
            lsi.Name = "status";
            li.Tag   = item;
        }
Beispiel #3
0
        List <FileConvertItem> GetSourceFileListData()
        {
            List <FileConvertItem> lst = new List <FileConvertItem>(listViewSourceFiles.Items.Count);

            for (int i = 0; i < listViewSourceFiles.Items.Count; i++)
            {
                FileConvertListViewItem li = listViewSourceFiles.Items[i] as FileConvertListViewItem;
                if (li != null)
                {
                    FileConvertItem dataitem = li.Tag as FileConvertItem;
                    if (dataitem != null)
                    {
                        lst.Add(dataitem);
                    }
                }
            }
            return(lst);
        }
 private void StartThread()
 {
     try
     {
         SendStarted();
         int i;
         for (i = 0; i < files.Count && !IsQuit; i++)
         {
             FileConvertItem dataitem = files[i];
             if (dataitem != null)
             {
                 SendListItemUpdate(i, "Converting...");
                 bool ok = false;
                 try
                 {
                     Util.ConvertFile(dataitem.FullPathName, destinationPath, null, null);
                     ok = true;
                 }
                 catch (Exception ex)
                 {
                     SendListItemUpdate(i, ex.Message);
                 }
                 GC.Collect();
                 if (ok)
                 {
                     SendListItemUpdate(i, "Done");
                 }
             }
         }
     }
     catch
     {
     }
     finally
     {
         SendFinished();
     }
 }