Inheritance: System.Windows.Forms.Form
Esempio n. 1
0
        private void OnOpenIndex(object sender, System.EventArgs e)
        {
            OpenIndex openIndexDlg = new OpenIndex(p);

            if (openIndexDlg.ShowDialog(this) == DialogResult.OK)
            {
                LukeInit(openIndexDlg);
            }
        }
Esempio n. 2
0
 private void OnOpenIndex(object sender, System.EventArgs e)
 {
     OpenIndex openIndexDlg = new OpenIndex(p);
     if (openIndexDlg.ShowDialog(this) == DialogResult.OK)
         LukeInit(openIndexDlg);
 }
Esempio n. 3
0
        private void LukeInit(OpenIndex openIndexDlg)
        {
            indexPath = openIndexDlg.Path;
            _readOnly = openIndexDlg.ReadOnlyIndex;
            bool force = openIndexDlg.UnlockIndex;

            FSDirectory newDir = FSDirectory.Open(new DirectoryInfo(indexPath));

            if (indexPath == String.Empty || !IndexReader.IndexExists(newDir))
            {
                ErrorMessage(resources.GetString("InvalidPath"));
                return;
            }

            if (dir != null)
            {
                try
                {
                    if (indexReader != null)
                        indexReader.Close();
                }
                catch (Exception) { };
                try
                {
                    dir.Close();
                }
                catch (Exception) { };
            }

            try
            {
                dir = newDir;
                p.AddToMruList(indexPath);

                if (IndexWriter.IsLocked(dir))
                {
                    if (_readOnly)
                    {
                        ShowStatus(resources.GetString("IndexLockedRo"));
                        dir.Close();
                        return;
                    }
                    if (force)
                    {
                        IndexWriter.Unlock(dir);
                    }
                    else
                    {
                        ShowStatus(resources.GetString("IndexLocked"));
                        dir.Close();
                        return;
                    }
                }

                // files tab
                tabFiles.ShowFiles(dir);

                indexReader = IndexReader.Open(dir, true);

                menuItemCompound.Checked = p.UseCompound;

                // plugins tab
                pluginsTabPage.LoadPlugins();

                // overview tab
                InitOverview();

                searchTabPage.UpdateListSearch(indexFields);

                ShowStatus(resources.GetString("IndexOpened"));
            }
            catch (Exception e)
            {
                ErrorMessage(e.Message);
            }
        }
Esempio n. 4
0
        private void LukeInit(OpenIndex openIndexDlg)
        {
            indexPath = openIndexDlg.Path;
            _readOnly = openIndexDlg.ReadOnlyIndex;
            bool force = openIndexDlg.UnlockIndex;

            FSDirectory newDir = FSDirectory.Open(new DirectoryInfo(indexPath));

            if (indexPath == String.Empty || !IndexReader.IndexExists(newDir))
            {
                ErrorMessage(resources.GetString("InvalidPath"));
                return;
            }

            if (dir != null)
            {
                try
                {
                    if (indexReader != null)
                    {
                        indexReader.Close();
                    }
                }
                catch (Exception) { };
                try
                {
                    dir.Close();
                }
                catch (Exception) { };
            }

            try
            {
                dir = newDir;
                p.AddToMruList(indexPath);

                if (IndexWriter.IsLocked(dir))
                {
                    if (_readOnly)
                    {
                        ShowStatus(resources.GetString("IndexLockedRo"));
                        dir.Close();
                        return;
                    }
                    if (force)
                    {
                        IndexWriter.Unlock(dir);
                    }
                    else
                    {
                        ShowStatus(resources.GetString("IndexLocked"));
                        dir.Close();
                        return;
                    }
                }

                // files tab
                tabFiles.ShowFiles(dir);

                indexReader = IndexReader.Open(dir, true);

                menuItemCompound.Checked = p.UseCompound;

                // plugins tab
                pluginsTabPage.LoadPlugins();

                // overview tab
                InitOverview();

                searchTabPage.UpdateListSearch(indexFields);

                ShowStatus(resources.GetString("IndexOpened"));
            }
            catch (Exception e)
            {
                ErrorMessage(e.Message);
            }
        }