示例#1
0
        /// <summary>
        /// Parse the given lists of files and create a wordset from them.
        /// </summary>
        /// <param name="paths"></param>
        /// <remarks>This is marked internal so that unit tests can call it</remarks>
        internal void CreateWordsetFromFiles(string[] paths)
        {
            CheckDisposed();

            using (ProgressDialogWorkingOn dlg = new ProgressDialogWorkingOn())
            {
                m_cache.DomainDataByFlid.BeginUndoTask("Import Word Set", "Import Word Set");
                string sWordSetName = GetWordSetName(paths);
                var    wordSet      = m_cache.ServiceLocator.GetInstance <IWfiWordSetFactory>().Create();
                m_cache.LangProject.MorphologicalDataOA.TestSetsOC.Add(wordSet);
                wordSet.Name.SetAnalysisDefaultWritingSystem(sWordSetName);
                wordSet.Description.SetAnalysisDefaultWritingSystem(GetWordSetDescription(paths));
                dlg.Owner   = FindForm();
                dlg.Icon    = dlg.Owner.Icon;
                dlg.Minimum = 0;
                dlg.Maximum = paths.Length;
                dlg.Text    = String.Format(ParserUIStrings.ksLoadingFilesForWordSetX, sWordSetName);
                dlg.Show();
                dlg.BringToFront();
                WordImporter importer = new WordImporter(m_cache);
                foreach (string path in paths)
                {
                    UpdateProgress(path, dlg);
                    importer.PopulateWordset(path, wordSet);
                }
                m_cache.DomainDataByFlid.EndUndoTask();
                dlg.Close();
            }
        }
示例#2
0
        /// <summary>
        /// Parse the given lists of files and create a wordset from them.
        /// </summary>
        /// <param name="paths"></param>
        /// <remarks>This is marked internal so that unit tests can call it</remarks>
        internal void CreateWordsetFromFiles(string[] paths)
        {
            CheckDisposed();

            using (ProgressDialogWorkingOn dlg = new ProgressDialogWorkingOn())
            {
                string      sWordSetName = GetWordSetName(paths);
                IWfiWordSet wordSet      = WfiWordSet.Create(m_cache, sWordSetName, GetWordSetDescription(paths));
                dlg.Owner   = FindForm();
                dlg.Icon    = dlg.Owner.Icon;
                dlg.Minimum = 0;
                dlg.Maximum = paths.Length;
                dlg.Text    = String.Format(ParserUIStrings.ksLoadingFilesForWordSetX, sWordSetName);
                dlg.Show();
                dlg.BringToFront();
                using (WordImporter importer = new WordImporter(m_cache))
                {
                    foreach (string path in paths)
                    {
                        UpdateProgress(path, dlg);
                        importer.PopulateWordset(path, wordSet);
                    }
                }
                dlg.Close();
            }
        }