Пример #1
0
        // 导入成员库的全部检索途径(显示时已去重合并)到当前检索途径定义中。
        // 导入当前定义窗时,发现重复的style要警告。对于重复style的<from>允许用户选择保留以前的还是用新的冲入
        private void button_from_import_Click(object sender, EventArgs e)
        {
            string strError = "";
            int    nRet     = 0;

            List <string> dbnames = GetMemberDatabaseNames();

            if (dbnames.Count == 0)
            {
                strError = "尚未定义成员库名,因此无法导入成员库的检索途径定义";
                goto ERROR1;
            }

            ImportFromsDialog dlg = new ImportFromsDialog();

            MainForm.SetControlFont(dlg, this.Font, false);

            this.EnableControls(false);
            nRet = dlg.Initial(this.ManagerForm,
                               dbnames,
                               out strError);
            this.EnableControls(true);
            if (nRet == -1)
            {
                goto ERROR1;
            }
            dlg.StartPosition = FormStartPosition.CenterScreen;
            dlg.ShowDialog(this);

            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }

            if (this.fromEditControl1.Elements.Count == 0)
            {
                this.fromEditControl1.Xml = dlg.SelectedFromsXml;
            }
            else
            {
                // 如果当前已经有内容,提醒合并还是替代
                DialogResult result = MessageBox.Show(this,
                                                      "当前已存在检索途径配置信息。是否将要导入的内容要合并到当前窗口?\r\n\r\n(Yes: 合并; No: 覆盖; Cancel: 放弃)",
                                                      "OpacVirtuslDatabaseDialog",
                                                      MessageBoxButtons.YesNoCancel,
                                                      MessageBoxIcon.Question,
                                                      MessageBoxDefaultButton.Button1);
                if (result == DialogResult.Yes)
                {
                    // 合并要导入的检索途径定义
                    nRet = MergeImportFroms(dlg.SelectedFromsXml,
                                            out strError);
                    if (nRet == -1)
                    {
                        goto ERROR1;
                    }
                }
                if (result == DialogResult.No)
                {
                    // 覆盖
                    this.fromEditControl1.Xml = dlg.SelectedFromsXml;
                }
                if (result == DialogResult.Cancel)
                {
                    return;
                }
            }

            return;

ERROR1:
            MessageBox.Show(this, strError);
        }
Пример #2
0
        // 导入成员库的全部检索途径(显示时已去重合并)到当前检索途径定义中。
        // 导入当前定义窗时,发现重复的style要警告。对于重复style的<from>允许用户选择保留以前的还是用新的冲入
        private void button_from_import_Click(object sender, EventArgs e)
        {
            string strError = "";
            int nRet = 0;

            List<string> dbnames = GetMemberDatabaseNames();
            if (dbnames.Count == 0)
            {
                strError = "尚未定义成员库名,因此无法导入成员库的检索途径定义";
                goto ERROR1;
            }

            ImportFromsDialog dlg = new ImportFromsDialog();
            MainForm.SetControlFont(dlg, this.Font, false);

            this.EnableControls(false);
            nRet = dlg.Initial(this.ManagerForm,
                dbnames,
                out strError);
            this.EnableControls(true);
            if (nRet == -1)
                goto ERROR1;
            dlg.StartPosition = FormStartPosition.CenterScreen;
            dlg.ShowDialog(this);

            if (dlg.DialogResult != DialogResult.OK)
                return;

            if (this.fromEditControl1.Elements.Count == 0)
                this.fromEditControl1.Xml = dlg.SelectedFromsXml;
            else
            {
                // 如果当前已经有内容,提醒合并还是替代
                DialogResult result = MessageBox.Show(this,
"当前已存在检索途径配置信息。是否将要导入的内容要合并到当前窗口?\r\n\r\n(Yes: 合并; No: 覆盖; Cancel: 放弃)",
"OpacVirtuslDatabaseDialog",
MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button1);
                if (result == DialogResult.Yes)
                {
                    // 合并要导入的检索途径定义
                    nRet = MergeImportFroms(dlg.SelectedFromsXml,
                        out strError);
                    if (nRet == -1)
                        goto ERROR1;

                }
                if (result == DialogResult.No)
                {
                    // 覆盖
                    this.fromEditControl1.Xml = dlg.SelectedFromsXml;
                }
                if (result == DialogResult.Cancel)
                {
                    return;
                }
            }

            return;
        ERROR1:
            MessageBox.Show(this, strError);
        }