Exemple #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();
            }
        }
Exemple #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();
            }
        }
Exemple #3
0
        private ProgressDialogWorkingOn InitProgressDialog()
        {
            ProgressDialogWorkingOn dlg = new ProgressDialogWorkingOn();

            dlg.Owner   = this.FindForm();
            dlg.Icon    = dlg.Owner.Icon;
            dlg.Minimum = 0;
            dlg.Maximum = m_cPrompts + m_cTransforms;
            dlg.Text    = m_sProgressDialogTitle;
            dlg.Show();
            return(dlg);
        }
        private ProgressDialogWorkingOn InitProgressDialog()
        {
            Form owner = FindForm();
            Icon icon  = null;

            if (owner != null)
            {
                icon = owner.Icon;
            }
            var dlg = new ProgressDialogWorkingOn
            {
                Owner   = owner,
                Icon    = icon,
                Minimum = 0,
                Maximum = m_cPrompts + m_cTransforms,
                Text    = m_sProgressDialogTitle
            };

            dlg.Show();
            return(dlg);
        }