private void stopLoadFile(string path, bool close)
 {
     lock (los)
     {
         if (path.Contains(selectedPath))
         {
             FilelistBox.Invoke(new Action(() => FilelistBox.SelectedIndex = selectItemInFileListBoxByPath(selectedPath)));
         }
         countLoad--;
         this.toolStripStatusLoadLabel.Text = "Load File-" + countLoad;
     }
 }
 private int selectItemInFileListBoxByPath(string path)
 {
     ListBox.ObjectCollection coll = null;
     FilelistBox.Invoke(new Action(() => coll = FilelistBox.Items));
     for (int i = 0; i < coll.Count; i++)
     {
         if (coll[i].ToString() == path)
         {
             return(i);
         }
     }
     return(0);
 }
        private void loadForm()
        {
            DirectoryInfo   inf   = new DirectoryInfo(workDirrectory);
            List <FileInfo> files = inf.GetFiles().ToList();

            for (int i = 0; i < files.Count(); i++)
            {
                if (files[i].Name.Contains("Words"))
                {
                    FilelistBox.Invoke(new Action(() => FilelistBox.Items.Add(files[i].Name)));
                    Files.Add(files[i].FullName);
                }
                else if (files[i].Name.Contains("IrregularVerbs"))
                {
                    FilelistBox.Invoke(new Action(() => FilelistBox.Items.Add(files[i].Name)));
                    irFiles.Add(files[i].FullName);
                }
            }
            translators = new WorkTransetor(Files.ToArray(), irFiles.ToArray(), new StartLoad(startLoadFile), new StopLoad(stopLoadFile), new TrainingWords.ChangeWord(ChangedWord));
        }