Example #1
0
        private void BatchTaskForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }
#if NO
            MainForm.AppInfo.LoadMdiChildFormStates(this,
                                                    "mdi_form_state");
            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);  // 和容器关联
#endif

            this.comboBox_taskName.Text = MainForm.AppInfo.GetString(
                "BatchTaskForm",
                "BatchTaskName",
                "");

            this.webBrowser_info.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_info_DocumentCompleted);


            // 使得菜单显示正确
            this.MessageStyle = this.MessageStyle;

            //
            API.PostMessage(this.Handle, WM_INITIAL, 0, 0);
        }
Example #2
0
        private void UrgentChargingForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }

#if NO
            MainForm.AppInfo.LoadMdiChildFormStates(this,
                                                    "mdi_form_state");
            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);


            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);  // 和容器关联
#endif

            this.MainForm.Urgent = true;

            this.FuncState = this.FuncState;    // 使"操作"按钮文字显示正确
            Global.WriteHtml(this.webBrowser_operationInfo,
                             "<pre>");
            EnableControls(false);

            API.PostMessage(this.Handle, WM_PREPARE, 0, 0);
        }
Example #3
0
        private void ReaderManageForm_Load(object sender, EventArgs e)
        {
            if (Program.MainForm != null)
            {
                MainForm.SetControlFont(this, Program.MainForm.DefaultFont);
            }

#if NO
            MainForm.AppInfo.LoadMdiChildFormStates(this,
                                                    "mdi_form_state");
            this.Channel.Url = Program.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);  // 和容器关联
#endif

            this.GetValueTable += new GetValueTableEventHandler(ReaderManageForm_GetValueTable);

            // webbrowser
            this.m_webExternalHost.Initial(// Program.MainForm,
                this.webBrowser_normalInfo);
            this.webBrowser_normalInfo.ObjectForScripting = this.m_webExternalHost;

            this.commander         = new Commander(this);
            this.commander.IsBusy -= new IsBusyEventHandler(commander_IsBusy);
            this.commander.IsBusy += new IsBusyEventHandler(commander_IsBusy);
        }
Example #4
0
        private void DtlpLogForm_Load(object sender, EventArgs e)
        {
            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);  // 和容器关联


            // 初始化ChannelArray
            channelArray.appInfo         = MainForm.AppInfo;
            channelArray.AskAccountInfo += new AskDtlpAccountInfoEventHandle(channelArray_AskAccountInfo);

            /*
             * channelArray.procAskAccountInfo = new Delegate_AskAccountInfo(
             *  this.AskAccountInfo);
             * */

            // 准备唯一的通道
            if (this.Channel == null)
            {
                this.Channel = channelArray.CreateChannel(0);
            }

            this.textBox_serverAddr.Text = MainForm.AppInfo.GetString(
                "dtlplogform",
                "serveraddr",
                "");

            this.textBox_logFileName.Text = MainForm.AppInfo.GetString(
                "dtlplogform",
                "logfilename",
                "");

            this.marcEditor_record.FieldNameCaptionWidth = 0;
        }
Example #5
0
        private void ReaderManageForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }

#if NO
            MainForm.AppInfo.LoadMdiChildFormStates(this,
    "mdi_form_state");
            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联
#endif

            this.GetValueTable += new GetValueTableEventHandler(ReaderManageForm_GetValueTable);

            // webbrowser
            this.m_webExternalHost.Initial(this.MainForm, this.webBrowser_normalInfo);
            this.webBrowser_normalInfo.ObjectForScripting = this.m_webExternalHost;

            this.commander = new Commander(this);
            this.commander.IsBusy -= new IsBusyEventHandler(commander_IsBusy);
            this.commander.IsBusy += new IsBusyEventHandler(commander_IsBusy);

        }
Example #6
0
        private void ClockForm_Load(object sender, EventArgs e)
        {
            if (Program.MainForm != null)
            {
                MainForm.SetControlFont(this, Program.MainForm.DefaultFont);
            }

            this.dateTimePicker1.Value = DateTime.Now;

#if NO
            this.Channel.Url = Program.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            this.Channel.AfterLogin -= new AfterLoginEventHandle(Channel_AfterLogin);
            this.Channel.AfterLogin += new AfterLoginEventHandle(Channel_AfterLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);  // 和容器关联
#endif

            // API.PostMessage(this.Handle, WM_PREPARE, 0, 0);
            this.BeginInvoke(new Action(Initial));

            this.timer1.Start();
        }
Example #7
0
        private void ClockForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }

            this.dateTimePicker1.Value = DateTime.Now;

#if NO
            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            this.Channel.AfterLogin -= new AfterLoginEventHandle(Channel_AfterLogin);
            this.Channel.AfterLogin += new AfterLoginEventHandle(Channel_AfterLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联
#endif

            // API.PostMessage(this.Handle, WM_PREPARE, 0, 0);
            this.BeginInvoke(new Action(Initial));

            this.timer1.Start();
        }
Example #8
0
        /*
         * public string RefID_2
         * {
         *  get
         *  {
         *      if (String.IsNullOrEmpty(this.m_strRefID_2) == true)
         *          this.m_strRefID_2 = Guid.NewGuid().ToString();
         *
         *      return this.m_strRefID_2;
         *  }
         * }*/

        private void QuickChangeEntityForm_Load(object sender, EventArgs e)
        {
            if (Program.MainForm != null)
            {
                MainForm.SetControlFont(this, Program.MainForm.DefaultFont);
            }
#if NO
            this.Channel.Url = Program.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);  // 和容器关联
#endif

            this.m_webExternalHost_biblio.Initial(// Program.MainForm,
                this.webBrowser_biblio);
            this.webBrowser_biblio.ObjectForScripting = this.m_webExternalHost_biblio;

            this.AcceptButton = this.button_loadBarcode;

            this.entityEditControl1.GetValueTable += new GetValueTableEventHandler(entityEditControl1_GetValueTable);

            BeginSwitchFocus("load_barcode", true);
        }
Example #9
0
        private void EaccForm_Load(object sender, EventArgs e)
        {
            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联


            this.textBox_unihanFilenames.Text = MainForm.AppInfo.GetString(
                "eacc_form",
                "unihan_filename",
                "");
            this.textBox_e2uFilename.Text = MainForm.AppInfo.GetString(
                "eacc_form",
                "e2u_filename",
                "");
            /*
            this.textBox_u2eFilename.Text = MainForm.applicationInfo.GetString(
                "eacc_form",
                "u2e_filename",
                "");
             * */

            Global.FillEncodingList(this.comboBox_codePage,
                false);

        }
Example #10
0
        private void DtlpLogForm_Load(object sender, EventArgs e)
        {
            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联


            // 初始化ChannelArray
            channelArray.appInfo = MainForm.AppInfo;
            channelArray.AskAccountInfo += new AskDtlpAccountInfoEventHandle(channelArray_AskAccountInfo);
            /*
            channelArray.procAskAccountInfo = new Delegate_AskAccountInfo(
                this.AskAccountInfo);
             * */

            // 准备唯一的通道
            if (this.Channel == null)
            {
                this.Channel = channelArray.CreateChannel(0);
            }

            this.textBox_serverAddr.Text = MainForm.AppInfo.GetString(
    "dtlplogform",
    "serveraddr",
    ""); 

            this.textBox_logFileName.Text = MainForm.AppInfo.GetString(
    "dtlplogform",
    "logfilename",
    "");

            this.marcEditor_record.FieldNameCaptionWidth = 0;

        }
Example #11
0
        private void EaccForm_Load(object sender, EventArgs e)
        {
            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);  // 和容器关联


            this.textBox_unihanFilenames.Text = MainForm.AppInfo.GetString(
                "eacc_form",
                "unihan_filename",
                "");
            this.textBox_e2uFilename.Text = MainForm.AppInfo.GetString(
                "eacc_form",
                "e2u_filename",
                "");

            /*
             * this.textBox_u2eFilename.Text = MainForm.applicationInfo.GetString(
             *  "eacc_form",
             *  "u2e_filename",
             *  "");
             * */

            Global.FillEncodingList(this.comboBox_codePage,
                                    false);
        }
Example #12
0
 /// <summary>
 /// 初始化停止管理器
 /// </summary>
 /// <param name="toolbarbuttonstop">工具条上的停止按钮</param>
 /// <param name="statusbar">状态条</param>
 public void InitialStopManager(ToolBarButton toolbarbuttonstop,
                                StatusBar statusbar)
 {
     stopManager.Initial(toolbarbuttonstop,
                         statusbar,
                         null);
     stop = new DigitalPlatform.Stop();
     stop.Register(this.stopManager, true);      // 和容器关联
 }
Example #13
0
File: DupForm.cs Project: zgren/dp2
        private void DupForm_Load(object sender, EventArgs e)
        {
            if (Program.MainForm != null)
            {
                MainForm.SetControlFont(this, Program.MainForm.DefaultFont);
            }

#if NO
            this.Channel.Url = Program.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);  // 和容器关联
#endif

            this.checkBox_includeLowCols.Checked = Program.MainForm.AppInfo.GetBoolean(
                "dup_form",
                "include_low_cols",
                true);
            this.checkBox_returnAllRecords.Checked = Program.MainForm.AppInfo.GetBoolean(
                "dup_form",
                "return_all_records",
                true);
            this.checkBox_returnSearchDetail.Checked = Program.MainForm.AppInfo.GetBoolean(
                "dup_form",
                "return_search_detail",
                false);

            if (String.IsNullOrEmpty(this.comboBox_projectName.Text) == true)
            {
                this.comboBox_projectName.Text = Program.MainForm.AppInfo.GetString(
                    "dup_form",
                    "projectname",
                    "");
            }

            string strWidths = Program.MainForm.AppInfo.GetString(
                "dup_form",
                "browse_list_column_width",
                "");
            if (String.IsNullOrEmpty(strWidths) == false)
            {
                ListViewUtil.SetColumnHeaderWidth(this.listView_browse,
                                                  strWidths,
                                                  true);
            }

            this.Channel = null;

            // 自动启动查重
            if (this.AutoBeginSearch == true)
            {
                API.PostMessage(this.Handle, WM_INITIAL, 0, 0);
            }
        }
Example #14
0
        private void ChangePasswordForm_Load(object sender, EventArgs e)
        {
            this.Channels              = new LibraryChannelCollection();
            this.Channels.BeforeLogin += new BeforeLoginEventHandle(Channels_BeforeLogin);
            this.Channels.AfterLogin  += new AfterLoginEventHandle(Channels_AfterLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);  // 和容器关联
        }
Example #15
0
 /// <summary>
 /// 初始化停止管理器
 /// </summary>
 /// <param name="buttonStop">停止按钮</param>
 /// <param name="labelMessage">消息标签</param>
 public void InitialStopManager(Button buttonStop,
                                Label labelMessage)
 {
     stopManager.Initial(buttonStop,
                         labelMessage,
                         null);
     stop = new DigitalPlatform.Stop();
     stop.Register(this.stopManager, true);      // 和容器关联
 }
Example #16
0
        private void XmlStatisForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }

#if NO
            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);  // 和容器关联
#endif
            ScriptManager.CfgFilePath = Path.Combine(
                this.MainForm.UserDir,
                "xml_statis_projects.xml");

#if NO
            ScriptManager.applicationInfo = this.MainForm.AppInfo;
            ScriptManager.CfgFilePath     =
                this.MainForm.DataDir + "\\xml_statis_projects.xml";
            ScriptManager.DataDir = this.MainForm.DataDir;

            ScriptManager.CreateDefaultContent -= new CreateDefaultContentEventHandler(scriptManager_CreateDefaultContent);
            ScriptManager.CreateDefaultContent += new CreateDefaultContentEventHandler(scriptManager_CreateDefaultContent);

            try
            {
                ScriptManager.Load();
            }
            catch (FileNotFoundException)
            {
                // 不必报错 2009/2/4
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message);
            }
#endif

            // 输入的条码号文件名
            this.textBox_inputXmlFilename.Text = this.MainForm.AppInfo.GetString(
                "xmlstatisform",
                "input_xml_filename",
                "");


            // 方案名
            this.textBox_projectName.Text = this.MainForm.AppInfo.GetString(
                "xmlstatisform",
                "projectname",
                "");
        }
Example #17
0
        private void ChangePasswordForm_Load(object sender, EventArgs e)
        {
            this.Channels = new LibraryChannelCollection();
            this.Channels.BeforeLogin += new BeforeLoginEventHandle(Channels_BeforeLogin);
            this.Channels.AfterLogin += new AfterLoginEventHandle(Channels_AfterLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联

        }
Example #18
0
        private void XmlDetailForm_Load(object sender, EventArgs e)
        {
            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);  // 和容器关联

            Global.FillEncodingList(this.comboBox_originDataEncoding,
                                    false);

            this.NeedIndentXml = this.MainForm.AppInfo.GetBoolean(
                "xmldetailform",
                "need_indent_xml",
                true);

            API.PostMessage(this.Handle, WM_LOADSIZE, 0, 0);
        }
Example #19
0
        private void XmlDetailForm_Load(object sender, EventArgs e)
        {
            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联

            Global.FillEncodingList(this.comboBox_originDataEncoding,
                false);

            this.NeedIndentXml = this.MainForm.AppInfo.GetBoolean(
                "xmldetailform",
                "need_indent_xml",
                true);

            API.PostMessage(this.Handle, WM_LOADSIZE, 0, 0);
        }
Example #20
0
        private void HtmlPrintForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }
            // 把第一页装入
            this.LoadPageFile();

            this.EnableButtons();

            DisplayPageInfoLine();

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联
        }
Example #21
0
        private void HtmlPrintForm_Load(object sender, EventArgs e)
        {
            if (Program.MainForm != null)
            {
                MainForm.SetControlFont(this, Program.MainForm.DefaultFont);
            }
            // 把第一页装入
            this.LoadPageFile();

            this.EnableButtons();

            DisplayPageInfoLine();

            stop = new DigitalPlatform.Stop();
            stop.Register(Program.MainForm.stopManager, true);  // 和容器关联
        }
Example #22
0
        private void PassGateForm_Load(object sender, EventArgs e)
        {
            if (Program.MainForm != null)
            {
                MainForm.SetControlFont(this, Program.MainForm.DefaultFont);
            }

#if NO
            this.Channel.Url = Program.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);  // 和容器关联
#endif

            // webbrowser
            this.m_webExternalHost.Initial(// Program.MainForm,
                this.webBrowser_readerInfo);
            this.webBrowser_readerInfo.ObjectForScripting = this.m_webExternalHost;

            this.commander         = new Commander(this);
            this.commander.IsBusy -= new IsBusyEventHandler(commander_IsBusy);
            this.commander.IsBusy += new IsBusyEventHandler(commander_IsBusy);

            this.AcceptButton = this.button_passGate;

            this.textBox_gateName.Text = Program.MainForm.AppInfo.GetString(
                "passgate_form",
                "gate_name",
                "");
            this.checkBox_displayReaderDetailInfo.Checked = Program.MainForm.AppInfo.GetBoolean(
                "passgate_form",
                "display_reader_detail_info",
                true);
            this.checkBox_hideBarcode.Checked = Program.MainForm.AppInfo.GetBoolean(
                "passgate_form",
                "hide_barcode",
                false);
            this.checkBox_hideReaderName.Checked = Program.MainForm.AppInfo.GetBoolean(
                "passgate_form",
                "hide_readername",
                false);

            this.StartWorkerThread();
        }
Example #23
0
        private void QuickChangeBiblioForm_Load(object sender, EventArgs e)
        {
            if (Program.MainForm != null)
            {
                MainForm.SetControlFont(this, Program.MainForm.DefaultFont);
            }

#if NO
            this.Channel.Url = Program.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);  // 和容器关联
#endif
        }
Example #24
0
        // return:
        //      0   没有准备成功
        //      1   准备成功
        /// <summary>
        /// 准备进行检索
        /// </summary>
        /// <returns>0: 没有成功; 1: 成功</returns>
        int PrepareSearch()
        {
            if (String.IsNullOrEmpty(this.textBox_server_dp2LibraryServerUrl.Text) == true)
            {
                return(0);
            }

            this.Channel.Url = this.textBox_server_dp2LibraryServerUrl.Text;

            this.Channel.BeforeLogin -= new DigitalPlatform.LibraryClient.BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new DigitalPlatform.LibraryClient.BeforeLoginEventHandle(Channel_BeforeLogin);

            Stop = new DigitalPlatform.Stop();
            Stop.Register(this.MainForm.stopManager, true);     // 和容器关联

            return(1);
        }
Example #25
0
        private void PassGateForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }

#if NO
            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联
#endif

            // webbrowser
            this.m_webExternalHost.Initial(this.MainForm, this.webBrowser_readerInfo);
            this.webBrowser_readerInfo.ObjectForScripting = this.m_webExternalHost;

            this.commander = new Commander(this);
            this.commander.IsBusy -= new IsBusyEventHandler(commander_IsBusy);
            this.commander.IsBusy += new IsBusyEventHandler(commander_IsBusy);

            this.AcceptButton = this.button_passGate;

            this.textBox_gateName.Text = this.MainForm.AppInfo.GetString(
                "passgate_form",
                "gate_name",
                "");
            this.checkBox_displayReaderDetailInfo.Checked = this.MainForm.AppInfo.GetBoolean(
                "passgate_form",
                "display_reader_detail_info",
                true);
            this.checkBox_hideBarcode.Checked = this.MainForm.AppInfo.GetBoolean(
                "passgate_form",
                "hide_barcode",
                false);
            this.checkBox_hideReaderName.Checked = this.MainForm.AppInfo.GetBoolean(
                "passgate_form",
                "hide_readername",
                false);

            this.StartWorkerThread();
        }
Example #26
0
        private void QuickChangeBiblioForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }

#if NO
            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联
#endif
        }
Example #27
0
        private void BookshelfForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }

            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            this.Channel.AfterLogin -= new AfterLoginEventHandle(Channel_AfterLogin);
            this.Channel.AfterLogin += new AfterLoginEventHandle(Channel_AfterLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);  // 和容器关联
        }
Example #28
0
        private void EaccForm_Load(object sender, EventArgs e)
        {
            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager);        // 和容器关联


            this.textBox_unihanFilenames.Text = MainForm.applicationInfo.GetString(
                "eacc_form",
                "unihan_filename",
                "");
            this.textBox_e2uFilename.Text = MainForm.applicationInfo.GetString(
                "eacc_form",
                "e2u_filename",
                "");
            this.textBox_u2eFilename.Text = MainForm.applicationInfo.GetString(
                "eacc_form",
                "u2e_filename",
                "");
        }
Example #29
0
        private void SelectDictionaryItemDialog_Load(object sender, EventArgs e)
        {
#if NO
            // 第一次检索装载
            {
                this.toolStripLabel_currentKey.Text = this.Key;

                string        strError = "";
                List <string> results  = new List <string>();
                int           nRet     = Search(this.DbName,
                                                this.Key,
                                                "exact",
                                                1000,
                                                ref results,
                                                out strError);
                if (nRet == -1)
                {
                    MessageBox.Show(this, strError);
                }

                FillListView(results);
            }
#endif
            _stopManager.Initial(this.toolStripButton_stop,
                                 (object)this.label_message,
                                 (object)null);

            _stop = new DigitalPlatform.Stop();
            _stop.Register(this._stopManager, true);    // 和容器关联


#if NO
            if (string.IsNullOrEmpty(ColumnWidthList) == false)
            {
                ListViewUtil.SetColumnHeaderWidth(this.listView_list,
                                                  ColumnWidthList,
                                                  true);
            }
#endif
            this.SetUiState(this.UiStates);

            this.BeginInvoke(new Delegate_FillLevels(this.FillLevels));
        }
Example #30
0
        private void BatchTaskForm_Load(object sender, EventArgs e)
        {
            if (Program.MainForm != null)
            {
                MainForm.SetControlFont(this, Program.MainForm.DefaultFont);
            }
#if NO
            MainForm.AppInfo.LoadMdiChildFormStates(this,
                                                    "mdi_form_state");
            this.Channel.Url = Program.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);  // 和容器关联
#endif

            this.comboBox_taskName.Text = MainForm.AppInfo.GetString(
                "BatchTaskForm",
                "BatchTaskName",
                "");

            this.webBrowser_info.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_info_DocumentCompleted);


            // 使得菜单显示正确
            this.MessageStyle = this.MessageStyle;

            // 删除一些不需要的任务名
            for (int i = 0; i < this.comboBox_taskName.Items.Count; i++)
            {
                string strTaskName = this.comboBox_taskName.Items[i] as string;
                if (strTaskName.StartsWith("~"))
                {
                    this.comboBox_taskName.Items.RemoveAt(i);
                    i--;
                }
            }

            //
            API.PostMessage(this.Handle, WM_INITIAL, 0, 0);
        }
Example #31
0
        private void DupForm_Load(object sender, EventArgs e)
        {
            this.Channels              = new LibraryChannelCollection();
            this.Channels.BeforeLogin += new BeforeLoginEventHandle(Channels_BeforeLogin);
            this.Channels.AfterLogin  += new AfterLoginEventHandle(Channels_AfterLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);  // 和容器关联

            this.checkBox_includeLowCols.Checked = this.MainForm.AppInfo.GetBoolean(
                "dup_form",
                "include_low_cols",
                true);
            this.checkBox_returnAllRecords.Checked = this.MainForm.AppInfo.GetBoolean(
                "dup_form",
                "return_all_records",
                true);
            if (String.IsNullOrEmpty(this.comboBox_projectName.Text) == true)
            {
                this.comboBox_projectName.Text = this.MainForm.AppInfo.GetString(
                    "dup_form",
                    "projectname",
                    "");
            }

            string strWidths = this.MainForm.AppInfo.GetString(
                "dup_form",
                "browse_list_column_width",
                "");

            if (String.IsNullOrEmpty(strWidths) == false)
            {
                ListViewUtil.SetColumnHeaderWidth(this.listView_browse,
                                                  strWidths,
                                                  true);
            }

            // 自动启动查重
            if (this.AutoBeginSearch == true)
            {
                API.PostMessage(this.Handle, WM_INITIAL, 0, 0);
            }
        }
Example #32
0
        private void ActivateForm_Load(object sender, EventArgs e)
        {
            if (Program.MainForm != null)
            {
                MainForm.SetControlFont(this, Program.MainForm.DefaultFont);
            }
#if NO
            MainForm.AppInfo.LoadMdiChildFormStates(this,
                                                    "mdi_form_state");
            this.Channel.Url = Program.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);  // 和容器关联
#endif

            this.readerEditControl_old.SetReadOnly("librarian");
            this.readerEditControl_old.GetValueTable += new GetValueTableEventHandler(readerEditControl1_GetValueTable);
            this.readerEditControl_old.Initializing   = false; // 如果没有此句,一开始在空模板上修改就不会变色

            this.readerEditControl_new.SetReadOnly("librarian");
            this.readerEditControl_new.GetValueTable += new GetValueTableEventHandler(readerEditControl1_GetValueTable);
            this.readerEditControl_new.Initializing   = false; // 如果没有此句,一开始在空模板上修改就不会变色


            // webbrowser
            this.m_webExternalHost_new.Initial(// Program.MainForm,
                this.webBrowser_newReaderInfo);
            this.webBrowser_newReaderInfo.ObjectForScripting = this.m_webExternalHost_new;

            this.m_webExternalHost_old.Initial(// Program.MainForm,
                this.webBrowser_oldReaderInfo);
            this.webBrowser_oldReaderInfo.ObjectForScripting = this.m_webExternalHost_old;

            // commander
            this.commander         = new Commander(this);
            this.commander.IsBusy -= new IsBusyEventHandler(commander_IsBusy);
            this.commander.IsBusy += new IsBusyEventHandler(commander_IsBusy);
        }
Example #33
0
        private void SelectPatronDialog_Load(object sender, EventArgs e)
        {
            _stopManager.Initial(this.toolStripButton_stop,
                                 (object)this.toolStripLabel_message,
                                 (object)null);

            stop = new DigitalPlatform.Stop();
            stop.Register(this._stopManager, true);     // 和容器关联

            FillRecPath();

            EnableControls(false);

            this.m_webExternalHost_patron.Initial(this.MainForm, this.webBrowser_patron);
            this.webBrowser_patron.ObjectForScripting = this.m_webExternalHost_patron;

            MessageVisible = MessageVisible;

            // API.PostMessage(this.Handle, WM_LOAD_ALL_DATA, 0, 0);
            this.BeginInvoke(new Action(Initial));
        }
Example #34
0
        private void SelectPatronDialog_Load(object sender, EventArgs e)
        {
            _stopManager.Initial(this.toolStripButton_stop,
(object)this.toolStripLabel_message,
(object)null);

            stop = new DigitalPlatform.Stop();
            stop.Register(this._stopManager, true);	// 和容器关联

            FillRecPath();

            EnableControls(false);

            this.m_webExternalHost_patron.Initial(this.MainForm, this.webBrowser_patron);
            this.webBrowser_patron.ObjectForScripting = this.m_webExternalHost_patron;

            MessageVisible = MessageVisible;

            // API.PostMessage(this.Handle, WM_LOAD_ALL_DATA, 0, 0);
            this.BeginInvoke(new Action(Initial));
        }
Example #35
0
        private void ActivateForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }
#if NO
            MainForm.AppInfo.LoadMdiChildFormStates(this,
    "mdi_form_state");
            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联
#endif

            this.readerEditControl_old.SetReadOnly("librarian");
            this.readerEditControl_old.GetValueTable += new GetValueTableEventHandler(readerEditControl1_GetValueTable);
            this.readerEditControl_old.Initializing = false;   // 如果没有此句,一开始在空模板上修改就不会变色

            this.readerEditControl_new.SetReadOnly("librarian");
            this.readerEditControl_new.GetValueTable += new GetValueTableEventHandler(readerEditControl1_GetValueTable);
            this.readerEditControl_new.Initializing = false;   // 如果没有此句,一开始在空模板上修改就不会变色


            // webbrowser
            this.m_webExternalHost_new.Initial(this.MainForm, this.webBrowser_newReaderInfo);
            this.webBrowser_newReaderInfo.ObjectForScripting = this.m_webExternalHost_new;

            this.m_webExternalHost_old.Initial(this.MainForm, this.webBrowser_oldReaderInfo);
            this.webBrowser_oldReaderInfo.ObjectForScripting = this.m_webExternalHost_old;

            // commander
            this.commander = new Commander(this);
            this.commander.IsBusy -= new IsBusyEventHandler(commander_IsBusy);
            this.commander.IsBusy += new IsBusyEventHandler(commander_IsBusy);
        }
Example #36
0
        public void Initial(MainForm main_form,
            bool bDoEvents = false)
        {
            this._doEvents = bDoEvents;
            this.MainForm = main_form;

            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            this.Channel.AfterLogin -= new AfterLoginEventHandle(Channel_AfterLogin);
            this.Channel.AfterLogin += new AfterLoginEventHandle(Channel_AfterLogin);

            this.Channel.Idle -= new IdleEventHandler(Channel_Idle);
            this.Channel.Idle += new IdleEventHandler(Channel_Idle);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联

            return;
        }
Example #37
0
        public void Initial(// MainForm main_form,
            bool bDoEvents = false)
        {
            this._doEvents = bDoEvents;
            // this.MainForm = main_form;

            this.Channel.Url = Program.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            this.Channel.AfterLogin -= new AfterLoginEventHandle(Channel_AfterLogin);
            this.Channel.AfterLogin += new AfterLoginEventHandle(Channel_AfterLogin);

            this.Channel.Idle -= new IdleEventHandler(Channel_Idle);
            this.Channel.Idle += new IdleEventHandler(Channel_Idle);

            stop = new DigitalPlatform.Stop();
            stop.Register(Program.MainForm.stopManager, true);  // 和容器关联

            return;
        }
Example #38
0
        private void SelectItemDialog_Load(object sender, EventArgs e)
        {
            Program.MainForm.FillBiblioFromList(this.comboBox_from);

#if NO
            {
                _floatingMessage         = new FloatingMessageForm(this);
                _floatingMessage.Font    = new System.Drawing.Font(this.Font.FontFamily, this.Font.Size * 2, FontStyle.Bold);
                _floatingMessage.Opacity = 0.7;
                _floatingMessage.Show(this);
            }
#endif
            this._floatingMessage.RectColor = Color.Purple;

            stopManager.Initial(this.button_stop,
                                (object)this.toolStripStatusLabel1,
                                (object)this.toolStripProgressBar1);

            if (stop != null)
            {
                stop.Unregister();
            }

            stop = new DigitalPlatform.Stop();
            stop.Register(stopManager, true);   // 和容器关联

            if (this.AutoSearch == true &&
                string.IsNullOrEmpty(this.textBox_queryWord.Text) == false)
            {
                this.BeginInvoke(new Action <object, EventArgs>(button_search_Click), this, new EventArgs());
            }

            if (StringUtil.CompareVersion(Program.MainForm.ServerVersion, "2.33") < 0)
            {
                MessageBox.Show(this, "选择册记录功能要求 dp2Library 版本必须在 2.33 以上。当前 dp2Library 的版本为 " + Program.MainForm.ServerVersion.ToString() + ",请及时升级");
            }
        }
Example #39
0
File: MyForm.cs Project: gvhung/dp2
        /// <summary>
        /// 窗口 Load 时被触发
        /// </summary>
        public virtual void OnMyFormLoad()
        {
            if (this.MainForm == null)
            {
                return;
            }

            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            this.Channel.AfterLogin -= new AfterLoginEventHandle(Channel_AfterLogin);
            this.Channel.AfterLogin += new AfterLoginEventHandle(Channel_AfterLogin);

            this.Channel.Idle -= Channel_Idle;
            this.Channel.Idle += Channel_Idle;

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);  // 和容器关联

            {
                _floatingMessage = new FloatingMessageForm(this, true);
                // _floatingMessage.AutoHide = false;
                _floatingMessage.Font      = new System.Drawing.Font(this.Font.FontFamily, this.Font.Size * 2, FontStyle.Bold);
                _floatingMessage.Opacity   = 0.7;
                _floatingMessage.RectColor = Color.Green;
                _floatingMessage.Show(this);

                // _floatingMessage.Text = "test";
                //_floatingMessage.Clicked += _floatingMessage_Clicked;
                if (this.MainForm != null)
                {
                    this.MainForm.Move += new EventHandler(MainForm_Move);
                }
            }
        }
Example #40
0
        /// <summary>
        /// 窗口 Load 时被触发
        /// </summary>
        public virtual void OnMyFormLoad()
        {
            if (this.MainForm == null)
            {
                return;
            }

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);  // 和容器关联

            {
                _floatingMessage = new FloatingMessageForm(this, true);
                // _floatingMessage.AutoHide = false;
                _floatingMessage.Font      = new System.Drawing.Font(this.Font.FontFamily, this.Font.Size * 2, FontStyle.Bold);
                _floatingMessage.Opacity   = 0.7;
                _floatingMessage.RectColor = Color.Green;
                _floatingMessage.Show(this);

                if (this.MainForm != null)
                {
                    this.MainForm.Move += new EventHandler(MainForm_Move);
                }
            }
        }
Example #41
0
        private void ChangePasswordForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }
#if NO
            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);


            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联
#endif

            bool bReader = this.MainForm.AppInfo.GetBoolean(
                "default_account",
                "isreader",
                false);
            if (bReader == false)
            {
                this.textBox_reader_oldPassword.Enabled = false;
            }
            else
            {
                this.textBox_reader_comment.Text = "这是读者为自己修改密码。";
                this.tabControl_main.Controls.Remove(this.tabPage_worker);
                this.AddFreeControl(this.tabPage_worker);   // 2015/11/7
            }

            checkBox_worker_force_CheckedChanged(this, null);

            API.PostMessage(this.Handle, WM_FIRST_SETFOCUS, 0, 0);
        }
Example #42
0
        private void CalendarForm_Load(object sender, EventArgs e)
        {
            if (Program.MainForm != null)
            {
                MainForm.SetControlFont(this, Program.MainForm.DefaultFont);
            }

#if NO
            MainForm.AppInfo.LoadMdiChildFormStates(this,
                                                    "mdi_form_state");
            this.Channel.Url = Program.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);  // 和容器关联
#endif

            this.comboBox_calendarName.Text = MainForm.AppInfo.GetString(
                "CalendarForm",
                "CalendarName",
                "");
        }
Example #43
0
        private void ChangePasswordForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }
#if NO
            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);


            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);  // 和容器关联
#endif

            bool bReader = this.MainForm.AppInfo.GetBoolean(
                "default_account",
                "isreader",
                false);
            if (bReader == false)
            {
                this.textBox_reader_oldPassword.Enabled = false;
            }
            else
            {
                this.textBox_reader_comment.Text = "这是读者为自己修改密码。";
                this.tabControl_main.Controls.Remove(this.tabPage_worker);
                this.AddFreeControl(this.tabPage_worker);   // 2015/11/7
            }

            checkBox_worker_force_CheckedChanged(this, null);

            API.PostMessage(this.Handle, WM_FIRST_SETFOCUS, 0, 0);
        }
Example #44
0
        private void CheckBorrowInfoForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }
#if NO
            MainForm.AppInfo.LoadMdiChildFormStates(this,
    "mdi_form_state");
            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联
#endif

            Global.ClearForPureTextOutputing(this.webBrowser_resultInfo);

            this.checkBox_displayPriceString.Checked = this.MainForm.AppInfo.GetBoolean(
                "check_borrowinfo_form",
                "display_price_string",
                true);

            this.checkBox_forceCNY.Checked = this.MainForm.AppInfo.GetBoolean(
                "check_borrowinfo_form",
                "force_cny",
                false);

            this.checkBox_overwriteExistPrice.Checked = this.MainForm.AppInfo.GetBoolean(
                "check_borrowinfo_form",
                "overwrite_exist_price",
                false);

        }
Example #45
0
        // 汉字字符串转换为拼音
        // 如果函数中已经MessageBox报错,则strError第一字符会为空格
        // return:
        //      -1  出错
        //      0   用户希望中断
        //      1   正常
        public int SmartHanziTextToPinyin(
            string strText,
            PinyinStyle style,
            out string strPinyin,
            out string strError)
        {
            strPinyin = "";
            strError = "";

            Stop new_stop = new DigitalPlatform.Stop();
            new_stop.Register(MainForm.stopManager, true);	// 和容器关联
            new_stop.OnStop += new StopEventHandler(new_stop_OnStop);
            new_stop.Initial("正在获得 '" + strText + "' 的拼音信息 (从服务器 " + this.MainForm.PinyinServerUrl + ")...");
            new_stop.BeginLoop();

            m_gcatClient = null;
            try
            {

                m_gcatClient = GcatNew.CreateChannel(this.MainForm.PinyinServerUrl);

            REDO_GETPINYIN:
                int nStatus = -1;	// 前面一个字符的类型 -1:前面没有字符 0:普通英文字母 1:空格 2:汉字
                string strPinyinXml = "";
                // return:
                //      -2  strID验证失败
                //      -1  出错
                //      0   成功
                int nRet = GcatNew.GetPinyin(
                    new_stop,
                    m_gcatClient,
                    m_strPinyinGcatID,
                    strText,
                    out strPinyinXml,
                    out strError);
                if (nRet == -1)
                {
                    DialogResult result = MessageBox.Show(this,
    "从服务器 '" + this.MainForm.PinyinServerUrl + "' 获取拼音的过程出错:\r\n" + strError + "\r\n\r\n是否要临时改为使用本机加拼音功能? \r\n\r\n(注:临时改用本机拼音的状态在程序退出时不会保留。如果要永久改用本机拼音方式,请使用主菜单的“参数配置”命令,将“服务器”属性页的“拼音服务器URL”内容清空)",
    "EntityForm",
    MessageBoxButtons.YesNo,
    MessageBoxIcon.Question,
    MessageBoxDefaultButton.Button2);
                    if (result == System.Windows.Forms.DialogResult.Yes)
                    {
                        this.MainForm.ForceUseLocalPinyinFunc = true;
                        strError = "将改用本机拼音,请重新操作一次。(本次操作出错: " + strError + ")";
                        return -1;
                    }
                    strError = " " + strError;
                    return -1;
                }

                if (nRet == -2)
                {
                    IdLoginDialog login_dlg = new IdLoginDialog();
                    login_dlg.Text = "获得拼音 -- "
                        + ((string.IsNullOrEmpty(this.m_strPinyinGcatID) == true) ? "请输入ID" : strError);
                    login_dlg.ID = this.m_strPinyinGcatID;
                    login_dlg.SaveID = this.m_bSavePinyinGcatID;
                    login_dlg.StartPosition = FormStartPosition.CenterScreen;
                    if (login_dlg.ShowDialog(this) == DialogResult.Cancel)
                    {
                        return 0;
                    }

                    this.m_strPinyinGcatID = login_dlg.ID;
                    this.m_bSavePinyinGcatID = login_dlg.SaveID;
                    goto REDO_GETPINYIN;
                }

                XmlDocument dom = new XmlDocument();
                try
                {
                    dom.LoadXml(strPinyinXml);
                }
                catch (Exception ex)
                {
                    strError = "strPinyinXml装载到XMLDOM时出错: " + ex.Message;
                    return -1;
                }

                foreach (XmlNode nodeWord in dom.DocumentElement.ChildNodes)
                {
                    if (nodeWord.NodeType == XmlNodeType.Text)
                    {
                        SelPinyinDlg.AppendText(ref strPinyin, nodeWord.InnerText);
                        nStatus = 0;
                        continue;
                    }

                    if (nodeWord.NodeType != XmlNodeType.Element)
                        continue;

                    string strWordPinyin = DomUtil.GetAttr(nodeWord, "p");
                    if (string.IsNullOrEmpty(strWordPinyin) == false)
                        strWordPinyin = strWordPinyin.Trim();

                    // 目前只取多套读音的第一套
                    nRet = strWordPinyin.IndexOf(";");
                    if (nRet != -1)
                        strWordPinyin = strWordPinyin.Substring(0, nRet).Trim();

                    string[] pinyin_parts = strWordPinyin.Split(new char[] { ' ' });
                    int index = 0;
                    // 让选择多音字
                    foreach (XmlNode nodeChar in nodeWord.ChildNodes)
                    {
                        if (nodeChar.NodeType == XmlNodeType.Text)
                        {
                            SelPinyinDlg.AppendText(ref strPinyin, nodeChar.InnerText);
                            nStatus = 0;
                            continue;
                        }

                        string strHanzi = nodeChar.InnerText;
                        string strCharPinyins = DomUtil.GetAttr(nodeChar, "p");

                        if (String.IsNullOrEmpty(strCharPinyins) == true)
                        {
                            strPinyin += strHanzi;
                            nStatus = 0;
                            index++;
                            continue;
                        }

                        if (strCharPinyins.IndexOf(";") == -1)
                        {
                            DomUtil.SetAttr(nodeChar, "sel", strCharPinyins);
                            SelPinyinDlg.AppendPinyin(ref strPinyin,
                                SelPinyinDlg.ConvertSinglePinyinByStyle(
                                    strCharPinyins,
                                    style)
                                    );
                            nStatus = 2;
                            index++;
                            continue;
                        }

#if _TEST_PINYIN
                        // 调试!
                        string[] parts = strCharPinyins.Split(new char[] {';'});
                        {
                            DomUtil.SetAttr(nodeChar, "sel", parts[0]);
                            AppendPinyin(ref strPinyin, parts[0]);
                            nStatus = 2;
                            index++;
                            continue;
                        }
#endif


                        string strSampleText = "";
                        int nOffs = -1;
                        SelPinyinDlg.GetOffs(dom.DocumentElement,
                            nodeChar,
                out strSampleText,
                out nOffs);

                        {	// 如果是多个拼音
                            SelPinyinDlg dlg = new SelPinyinDlg();
                            float ratio_single = dlg.listBox_multiPinyin.Font.SizeInPoints / dlg.Font.SizeInPoints;
                            float ratio_sample = dlg.textBox_sampleText.Font.SizeInPoints / dlg.Font.SizeInPoints;
                            GuiUtil.SetControlFont(dlg, this.Font, false);
                            // 维持字体的原有大小比例关系
                            dlg.listBox_multiPinyin.Font = new Font(dlg.Font.FontFamily, ratio_single * dlg.Font.SizeInPoints, GraphicsUnit.Point);
                            dlg.textBox_sampleText.Font = new Font(dlg.Font.FontFamily, ratio_sample * dlg.Font.SizeInPoints, GraphicsUnit.Point);
                            // 这个对话框比较特殊 GuiUtil.SetControlFont(dlg, this.Font, false);

                            dlg.Text = "请选择汉字 '" + strHanzi + "' 的拼音 (来自服务器 " + this.MainForm.PinyinServerUrl + ")";
                            dlg.SampleText = strSampleText;
                            dlg.Offset = nOffs;
                            dlg.Pinyins = strCharPinyins;
                            if (index < pinyin_parts.Length)
                                dlg.ActivePinyin = pinyin_parts[index];
                            dlg.Hanzi = strHanzi;

                            MainForm.AppInfo.LinkFormState(dlg, "SelPinyinDlg_state");

                            dlg.ShowDialog(this);

                            MainForm.AppInfo.UnlinkFormState(dlg);

                            Debug.Assert(DialogResult.Cancel != DialogResult.Abort, "推断");

                            if (dlg.DialogResult == DialogResult.Abort)
                            {
                                return 0;   // 用户希望整个中断
                            }

                            DomUtil.SetAttr(nodeChar, "sel", dlg.ResultPinyin);

                            if (dlg.DialogResult == DialogResult.Cancel)
                            {
                                SelPinyinDlg.AppendText(ref strPinyin, strHanzi);
                                nStatus = 2;
                            }
                            else if (dlg.DialogResult == DialogResult.OK)
                            {
                                SelPinyinDlg.AppendPinyin(ref strPinyin,
                                    SelPinyinDlg.ConvertSinglePinyinByStyle(
                                    dlg.ResultPinyin,
                                    style)
                                    );
                                nStatus = 2;
                            }
                            else
                            {
                                Debug.Assert(false, "SelPinyinDlg返回时出现意外的DialogResult值");
                            }

                            index++;
                        }

                    }
                }

#if _TEST_PINYIN
#else
                // return:
                //      -2  strID验证失败
                //      -1  出错
                //      0   成功
                nRet = GcatNew.SetPinyin(
                    new_stop,
                    m_gcatClient,
                    "",
                    dom.DocumentElement.OuterXml,
                    out strError);
                if (nRet == -1)
                    return -1;
#endif

                return 1;
            }
            finally
            {
                new_stop.EndLoop();
                new_stop.OnStop -= new StopEventHandler(new_stop_OnStop);
                new_stop.Initial("");
                new_stop.Unregister();
                if (m_gcatClient != null)
                {
                    m_gcatClient.Close();
                    m_gcatClient = null;
                }
            }
        }
Example #46
0
        // 打印解释内容
        void menu_printHtml_Click(object sender, EventArgs e)
        {
            string strError = "";

            if (this.listView_records.SelectedItems.Count == 0)
            {
                strError = "尚未选定要打印的行";
                goto ERROR1;
            }

            List<string> filenames = new List<string>();
            string strFileNamePrefix = this.MainForm.DataDir + "\\~operlog_print_";
            string strFilename = strFileNamePrefix + (1).ToString() + ".html";
            filenames.Add(strFilename);

            File.Delete(strFilename);

            StreamUtil.WriteText(strFilename,
    "<html>" +
    GetHeadString(false) +
    "<body>");

            Stop stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联

            stop.OnStop += new StopEventHandler(this.DoStopPrint);
            stop.Initial("正在创建打印页面 ...");
            stop.BeginLoop();

            m_webExternalHost = new WebExternalHost();
            m_webExternalHost.Initial(this.MainForm, null);
            m_webExternalHost.IsInLoop = true;

            this.GetSummary += new GetSummaryEventHandler(OperLogForm_GetSummary);
            try
            {
                stop.SetProgressRange(0, this.listView_records.SelectedItems.Count);
                int i = 0;
                foreach (ListViewItem item in this.listView_records.SelectedItems)
                {
                    Application.DoEvents();

                    if (stop != null && stop.State != 0)
                    {
                        strError = "用户中断";
                        goto ERROR1;
                    }

                    OperLogItemInfo info = (OperLogItemInfo)item.Tag;

                    string strLogFileName = ListViewUtil.GetItemText(item, COLUMN_FILENAME);
                    string strIndex = ListViewUtil.GetItemText(item, COLUMN_INDEX);

                    string strXml = "";
                    // 从服务器获得
                    // return:
                    //      -1  出错
                    //      0   正常
                    //      1   用户中断
                    int nRet = GetXml(item,
            out strXml,
            out strError);
                    if (nRet == 1)
                        return;
                    if (nRet == -1)

                        goto ERROR1;

                    Global.SetXmlString(this.webBrowser_xml,
    strXml,
    this.MainForm.DataDir,
    "operlogexml");

                    string strHtml = "";
                    // 创建解释日志记录内容的 HTML 字符串
                    // return:
                    //      -1  出错
                    //      0   成功
                    //      1   未知的操作类型
                    nRet = GetHtmlString(strXml,
                        false,
                        out strHtml,
                        out strError);
                    if (nRet == -1)
                        goto ERROR1;
                    if (nRet == 1)
                        strHtml = strError;

                    StreamUtil.WriteText(strFilename,
        "<p class='record_title'>" + strLogFileName + " : " + strIndex + "</p>" + strHtml);

                    stop.SetProgressValue(i + 1);
                    i++;
                }
            }
            finally
            {
                this.GetSummary -= new GetSummaryEventHandler(OperLogForm_GetSummary);
                if (m_webExternalHost != null)
                {
                    m_webExternalHost.IsInLoop = false;
                    m_webExternalHost.Destroy();
                    m_webExternalHost = null;
                }

                stop.EndLoop();
                stop.OnStop -= new StopEventHandler(this.DoStopPrint);
                stop.Initial("打印页面创建完成");
                stop.HideProgress();

                if (stop != null) // 脱离关联
                {
                    stop.Unregister();	// 和容器关联
                    stop = null;
                }
            }

            StreamUtil.WriteText(strFilename,
"</body></html>");

            // TODO: 浏览器控件连接javascript host
            HtmlPrintForm printform = new HtmlPrintForm();

            printform.Text = "打印解释内容";
            printform.MainForm = this.MainForm;
            printform.Filenames = filenames;

            this.MainForm.AppInfo.LinkFormState(printform, "operlogform_printform_state");
            printform.ShowDialog(this);
            this.MainForm.AppInfo.UnlinkFormState(printform);

            return;
        ERROR1:
            MessageBox.Show(this, strError);
        }
Example #47
0
        int ProcessSelectedRecords(Delegate_processLog func,
            out string strError)
        {
            strError = "";

            if (this.listView_records.SelectedItems.Count == 0)
            {
                strError = "尚未选定要处理的行";
                return -1;
            }

            Stop stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联

            stop.OnStop += new StopEventHandler(this.DoStopPrint);
            stop.Initial("正在处理日志记录 ...");
            stop.BeginLoop();

            try
            {
                stop.SetProgressRange(0, this.listView_records.SelectedItems.Count);
                int i = 0;
                foreach (ListViewItem item in this.listView_records.SelectedItems)
                {
                    Application.DoEvents();

                    if (stop != null && stop.State != 0)
                    {
                        strError = "用户中断";
                        return -1;
                    }

                    OperLogItemInfo info = (OperLogItemInfo)item.Tag;

                    string strLogFileName = ListViewUtil.GetItemText(item, COLUMN_FILENAME);
                    string strIndex = ListViewUtil.GetItemText(item, COLUMN_INDEX);

                    string strXml = "";
                    // 从服务器获得
                    // return:
                    //      -1  出错
                    //      0   正常
                    //      1   用户中断
                    int nRet = GetXml(item,
            out strXml,
            out strError);
                    if (nRet == 1)
                        return -1;
                    if (nRet == -1)
                        return -1;

                    XmlDocument dom = new XmlDocument();
                    try
                    {
                        dom.LoadXml(strXml);
                    }
                    catch (Exception ex)
                    {
                        strError = "装载日志记录 '" + strLogFileName + ":" + strIndex + "' XML 到 DOM 时发生错误: " + ex.Message;
                        return -1;
                    }

                    if (func != null)
                    {
                        if (func(strLogFileName,
                            Convert.ToInt32(strIndex),
                dom,
                null) == false)
                            break;
                    }

                    stop.SetProgressValue(i + 1);
                    i++;
                }

                return 0;
            }
            finally
            {
                stop.EndLoop();
                stop.OnStop -= new StopEventHandler(this.DoStopPrint);
                stop.Initial("处理完成");
                stop.HideProgress();

                if (stop != null) // 脱离关联
                {
                    stop.Unregister();	// 和容器关联
                    stop = null;
                }
            }
        }
Example #48
0
        private void ItemInfoForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }
#if NO
            MainForm.AppInfo.LoadMdiChildFormStates(this,
    "mdi_form_state");
            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联
#endif
            {
                //
                this.binaryResControl1.ContentChanged -= new ContentChangedEventHandler(binaryResControl1_ContentChanged);
                this.binaryResControl1.ContentChanged += new ContentChangedEventHandler(binaryResControl1_ContentChanged);

                this.binaryResControl1.GetChannel -= binaryResControl1_GetChannel;
                this.binaryResControl1.GetChannel += binaryResControl1_GetChannel;

                this.binaryResControl1.ReturnChannel -= binaryResControl1_ReturnChannel;
                this.binaryResControl1.ReturnChannel += binaryResControl1_ReturnChannel;

                this.binaryResControl1.Stop = this.stop;
            }

            // webbrowser
            this.m_webExternalHost_item.Initial(this.MainForm, this.webBrowser_itemHTML);
            this.webBrowser_itemHTML.ObjectForScripting = this.m_webExternalHost_item;

            this.m_chargingInterface.Initial(this.MainForm, this.webBrowser_borrowHistory);
            this.m_chargingInterface.CallFunc += m_chargingInterface_CallFunc;
            this.webBrowser_borrowHistory.ObjectForScripting = this.m_chargingInterface;

            this.m_webExternalHost_biblio.Initial(this.MainForm, this.webBrowser_biblio);
            this.webBrowser_biblio.ObjectForScripting = this.m_webExternalHost_biblio;

            this.commander = new Commander(this);
            this.commander.IsBusy -= new IsBusyEventHandler(commander_IsBusy);
            this.commander.IsBusy += new IsBusyEventHandler(commander_IsBusy);

            this.Text = this.DbTypeCaption;

            ClearBorrowHistoryPage();
        }
Example #49
0
		private void DetailForm_Load(object sender, System.EventArgs e)
		{
            this.MainForm.AppInfo.LoadMdiSize += new EventHandler(AppInfo_LoadMdiSize);
            this.MainForm.AppInfo.SaveMdiSize += new EventHandler(AppInfo_SaveMdiSize);

			// 设置窗口尺寸状态
			if (MainForm.AppInfo != null) 
			{
				MainForm.AppInfo.LoadMdiChildFormStates(this,
                    "mdi_form_state");

                // 恢复tab状态
                this.tabControl_record.SelectedIndex = MainForm.AppInfo.GetInt(
                    "detailform",
                    "tab_state",
                    0);

                // this.MarcEditor.Font = new Font("Fixedsys", 12);
                LoadFontToMarcEditor();
			}

			stop = new DigitalPlatform.Stop();

            stop.Register(MainForm.stopManager, true);	// 和容器关联

            this.Channels.AskAccountInfo += new AskAccountInfoEventHandle(MainForm.Servers.OnAskAccountInfo);
            /*
			this.Channels.procAskAccountInfo = 
				new Delegate_AskAccountInfo(MainForm.Servers.AskAccountInfo);
             */

		
			XmlEditor.Xml = "<root/>";	// ?????

            this.XmlEditor.GenerateData +=new GenerateDataEventHandler(XmlEditor_GenerateData);

			this.Changed = false;

			this.listView_resFiles.procDownloadFiles = new Delegate_DownloadFiles(this.DownloadFiles);
			this.listView_resFiles.procDownloadOneMetaData = new Delegate_DownloadOneMetaData(this.DownloadOneFileMetaData);

			this.listView_resFiles.editor = this.XmlEditor;

			// 最好当确知库有marcdef配置文件时,才打开时钟.
			if (timer_crossRefresh.Enabled == false)
				timer_crossRefresh.Enabled = true;

            this.MarcEditor.GenerateData += new GenerateDataEventHandler(MarcEditor_GenerateData);
            this.MarcEditor.ParseMacro += new ParseMacroEventHandler(MarcEditor_ParseMacro);

            this.m_macroutil.ParseOneMacro += new ParseOneMacroEventHandler(m_macroutil_ParseOneMacro);
		}
Example #50
0
        private void ZhongcihaoForm_Load(object sender, EventArgs e)
        {
            LoadSize();

            this.Channels = new LibraryChannelCollection();
            this.Channels.BeforeLogin += new BeforeLoginEventHandle(Channels_BeforeLogin);

#if NO
            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联
#endif

            // 服务器名
            if (string.IsNullOrEmpty(this.textBox_serverName.Text) == true)
            {
                this.textBox_serverName.Text = this.MainForm.AppInfo.GetString(
    "zhongcihao_form",
    "servername",
    "");
            }

            // 类号
            if (String.IsNullOrEmpty(this.textBox_classNumber.Text) == true)
            {
                this.textBox_classNumber.Text = this.MainForm.AppInfo.GetString(
                    "zhongcihao_form",
                    "classnumber",
                    "");
            }

            // 线索书目库名
            if (String.IsNullOrEmpty(this.comboBox_biblioDbName.Text) == true)
            {
                this.comboBox_biblioDbName.Text = this.MainForm.AppInfo.GetString(
                    "zhongcihao_form",
                    "biblio_dbname",
                    "");
            }

            // 是否要返回浏览列
            this.checkBox_returnBrowseCols.Checked = this.MainForm.AppInfo.GetBoolean(
                    "zhongcihao_form",
                    "return_browse_cols",
                    true);

            string strWidths = this.MainForm.AppInfo.GetString(
"zhongcihao_form",
"record_list_column_width",
"");
            if (String.IsNullOrEmpty(strWidths) == false)
            {
                ListViewUtil.SetColumnHeaderWidth(this.listView_number,
                    strWidths,
                    true);
            }

            if (this.AutoBeginSearch == true)
            {
                API.PostMessage(this.Handle, WM_INITIAL, 0, 0);
            }
        }
Example #51
0
		private void Form1_Load(object sender, System.EventArgs e)
		{
            if (ApplicationDeployment.IsNetworkDeployed == true)
            {
                // MessageBox.Show(this, "network");
                DataDir = Application.LocalUserAppDataPath;
            }
            else
            {
                // MessageBox.Show(this, "no network");
                DataDir = Environment.CurrentDirectory;
            }

			// 从文件中装载创建一个ServerCollection对象
			// parameters:
			//		bIgnorFileNotFound	是否不抛出FileNotFoundException异常。
			//							如果==true,函数直接返回一个新的空ServerCollection对象
			// Exception:
			//			FileNotFoundException	文件没找到
			//			SerializationException	版本迁移时容易出现

			try 
			{
                Servers = ServerCollection.Load(this.DataDir
					+ "\\manager_servers.bin",
					true);
				Servers.ownerForm = this;
			}
			catch (SerializationException ex)
			{
				MessageBox.Show(this, ex.Message);
				Servers = new ServerCollection();
				// 设置文件名,以便本次运行结束时覆盖旧文件
                Servers.FileName = this.DataDir
					+ "\\manager_servers.bin";

			}

            this.Servers.ServerChanged += new ServerChangedEventHandle(Servers_ServerChanged);

			// 从文件中装载创建一个LinkInfoCollection对象
			// parameters:
			//		bIgnorFileNotFound	是否不抛出FileNotFoundException异常。
			//							如果==true,函数直接返回一个新的空ServerCollection对象
			// Exception:
			//			FileNotFoundException	文件没找到
			//			SerializationException	版本迁移时容易出现
			try 
			{
                LinkInfos = LinkInfoCollection.Load(this.DataDir
					+ "\\manager_linkinfos.bin",
					true);
			}
			catch (SerializationException ex)
			{
				MessageBox.Show(this, ex.Message);
				LinkInfos = new LinkInfoCollection();
				// 设置文件名,以便本次运行结束时覆盖旧文件
                LinkInfos.FileName = this.DataDir
					+ "\\manager_linkinfos.bin";

			}




			// 设置窗口尺寸状态
			if (AppInfo != null) 
			{
                SetFirstDefaultFont();

                MainForm.SetControlFont(this, this.DefaultFont);

				AppInfo.LoadFormStates(this,
					"mainformstate");
			}

			stopManager.Initial(toolBarButton_stop,
                this.toolStripStatusLabel_main,
                this.toolStripProgressBar_main);
			stop = new DigitalPlatform.Stop();
			stop.Register(this.stopManager, true);	// 和容器关联

            /*
			this.Channels.procAskAccountInfo = 
				new Delegate_AskAccountInfo(this.Servers.AskAccountInfo);
             */
            this.Channels.AskAccountInfo += new AskAccountInfoEventHandle(this.Servers.OnAskAccountInfo);



			// 简单检索界面准备工作
			treeView_res.AppInfo = this.AppInfo;	// 便于treeview中popup菜单修改配置文件时保存dialog尺寸位置

			treeView_res.stopManager = this.stopManager;

			treeView_res.Servers = this.Servers;	// 引用

			treeView_res.Channels = this.Channels;	// 引用
		
			treeView_res.Fill(null);

			//
			LinkInfos.Channels = this.Channels;

			int nRet = 0;
			string strError = "";
			nRet = this.LinkInfos.Link(out strError);
			if (nRet == -1)
				MessageBox.Show(this, strError);
		
		}
Example #52
0
        private void DupForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }

#if NO
            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联
#endif

            this.checkBox_includeLowCols.Checked = this.MainForm.AppInfo.GetBoolean(
                "dup_form",
                "include_low_cols",
                true);
            this.checkBox_returnAllRecords.Checked = this.MainForm.AppInfo.GetBoolean(
    "dup_form",
    "return_all_records",
    true);

            if (String.IsNullOrEmpty(this.comboBox_projectName.Text) == true)
            {
                this.comboBox_projectName.Text = this.MainForm.AppInfo.GetString(
                        "dup_form",
                        "projectname",
                        "");
            }

            string strWidths = this.MainForm.AppInfo.GetString(
    "dup_form",
    "browse_list_column_width",
    "");
            if (String.IsNullOrEmpty(strWidths) == false)
            {
                ListViewUtil.SetColumnHeaderWidth(this.listView_browse,
                    strWidths,
                    true);
            }

            // 自动启动查重
            if (this.AutoBeginSearch == true)
            {
                API.PostMessage(this.Handle, WM_INITIAL, 0, 0);
            }
        }
Example #53
0
        private void MarcDetailForm_Load(object sender, EventArgs e)
        {
            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联

            Global.FillEncodingList(this.comboBox_originDataEncoding,
                true);
            /*
            // 补充MARC8
            this.comboBox_originDataEncoding.Items.Add("MARC-8");
             * */

            this.MarcEditor.AppInfo = this.MainForm.AppInfo;
            LoadFontToMarcEditor();

            this.m_macroutil.ParseOneMacro -= new ParseOneMacroEventHandler(m_macroutil_ParseOneMacro);
            this.m_macroutil.ParseOneMacro += new ParseOneMacroEventHandler(m_macroutil_ParseOneMacro);

            API.PostMessage(this.Handle, WM_LOADSIZE, 0, 0);

            string strSelectedTemplates = this.MainForm.AppInfo.GetString(
    "marcdetailform",
    "selected_templates",
    "");
            if (String.IsNullOrEmpty(strSelectedTemplates) == false)
            {
                selected_templates.Build(strSelectedTemplates);
            }

#if NO
            this.m_strPinyinGcatID = this.MainForm.AppInfo.GetString("entity_form", "gcat_pinyin_api_id", "");
            this.m_bSavePinyinGcatID = this.MainForm.AppInfo.GetBoolean("entity_form", "gcat_pinyin_api_saveid", false);
#endif
        }
Example #54
0
        // 追加保存到数据库
        void menu_saveToDatabase_Click(object sender, EventArgs e)
        {
            string strError = "";
            int nRet = 0;

            if (this.listView_browse.SelectedIndices.Count == 0)
            {
                strError = "尚未选定要保存记录的浏览行";
                goto ERROR1;
            }

            string strLastSavePath = m_mainForm.LastSavePath;
            if (String.IsNullOrEmpty(strLastSavePath) == false)
            {
                string strOutputPath = "";
                nRet = MarcDetailForm.ChangePathToAppendStyle(strLastSavePath,
                    out strOutputPath,
                    out strError);
                if (nRet == -1)
                {
                    m_mainForm.LastSavePath = ""; // 避免下次继续出错
                    goto ERROR1;
                }
                strLastSavePath = strOutputPath;
            }


            SaveRecordDlg dlg = new SaveRecordDlg();
            GuiUtil.SetControlFont(dlg, this.Font);

            dlg.SaveToDbMode = true;    // 不允许在textbox中修改路径

            dlg.MainForm = this.m_mainForm;
            dlg.GetDtlpSearchParam += new GetDtlpSearchParamEventHandle(dlg_GetDtlpSearchParam);
            dlg.GetDp2SearchParam += new GetDp2SearchParamEventHandle(dlg_GetDp2SearchParam);
            {
                dlg.RecPath = strLastSavePath;
                dlg.Text = "请选择目标数据库";
            }
            // dlg.StartPosition = FormStartPosition.CenterScreen;
            this.MainForm.AppInfo.LinkFormState(dlg, "SaveRecordDlg_state");
            dlg.UiState = this.MainForm.AppInfo.GetString("AmazonSearchForm", "SaveRecordDlg_uiState", "");
            dlg.ShowDialog(this);
            this.MainForm.AppInfo.SetString("AmazonSearchForm", "SaveRecordDlg_uiState", dlg.UiState);

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

            m_mainForm.LastSavePath = dlg.RecPath;

            string strProtocol = "";
            string strPath = "";
            nRet = Global.ParsePath(dlg.RecPath,
                out strProtocol,
                out strPath,
                out strError);
            if (nRet == -1)
                goto ERROR1;

            bool bForceFull = false;

            if (HasSelectionContainBriefRecords() == true)
            {
                DialogResult result = MessageBox.Show(this,
"即将保存的记录中有Brief(简要)格式的记录,是否在保存前重新获取为Full(完整)格式的记录?\r\n\r\n(Yes: 是,要完整格式的记录; No: 否,依然保存简明格式的记录; Cancel: 取消,放弃整个保存操作",
"AmazonSearchForm",
MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button1);
                if (result == System.Windows.Forms.DialogResult.Cancel)
                    return;
                if (result == System.Windows.Forms.DialogResult.Yes)
                    bForceFull = true;
            }

            // 首先获得详细记录
            if (bForceFull == true)
            {
                ReloadFullElementSet();
                bool bError = WaitSearchFinish();
            }

            // TODO: 禁止问号以外的其它ID
            DigitalPlatform.Stop stop = null;
            stop = new DigitalPlatform.Stop();
            stop.Register(m_mainForm.stopManager, true);	// 和容器关联

            stop.BeginLoop();

            this.EnableControls(false);
            try
            {

                // dtlp协议的记录保存
                if (strProtocol.ToLower() == "dtlp")
                {
                    DtlpSearchForm dtlp_searchform = this.GetDtlpSearchForm();

                    if (dtlp_searchform == null)
                    {
                        strError = "没有连接的或者打开的DTLP检索窗,无法保存记录";
                        goto ERROR1;
                    }

                    for (int i = 0; i < this.listView_browse.SelectedIndices.Count; i++)
                    {
                        Application.DoEvents();	// 出让界面控制权

                        if (stop != null)
                        {
                            if (stop.State != 0)
                            {
                                strError = "用户中断";
                                goto ERROR1;
                            }
                        }

                        int index = this.listView_browse.SelectedIndices[i];

                        byte[] baTimestamp = null;
                        string strSavePath = "";
                        string strOutStyle = "";
                        LoginInfo logininfo = null;
                        long lVersion = 0;
                        string strXmlFragment = "";
                        DigitalPlatform.Z3950.Record record = null;
                        Encoding currentEncoding = null;
                        string strMARC = "";

                        nRet = this.GetOneRecord(
                            "marc",
                            index,  // 即将废止
                            "index:" + index.ToString(),
                            bForceFull == true ? "force_full" : "", // false,
                            out strSavePath,
                            out strMARC,
                            out strXmlFragment,
                            out strOutStyle,
                            out baTimestamp,
                            out lVersion,
                            out record,
                            out currentEncoding,
                            out logininfo,
                            out strError);
                        if (nRet == -1)
                            goto ERROR1;

                        string strMarcSyntax = "";
                        if (record.m_strSyntaxOID == "1.2.840.10003.5.1")
                            strMarcSyntax = "unimarc";
                        if (record.m_strSyntaxOID == "1.2.840.10003.5.10")
                            strMarcSyntax = "usmarc";

                        // TODO: 有些格式不适合保存到目标数据库

                        byte[] baOutputTimestamp = null;
                        string strOutputPath = "";
                        nRet = dtlp_searchform.SaveMarcRecord(
                            strPath,
                            strMARC,
                            baTimestamp,
                            out strOutputPath,
                            out baOutputTimestamp,
                            out strError);
                        if (nRet == -1)
                            goto ERROR1;
                    }

                    MessageBox.Show(this, "保存成功");
                    return;
                }
                else if (strProtocol.ToLower() == "dp2library")
                {
                    dp2SearchForm dp2_searchform = this.GetDp2SearchForm();

                    if (dp2_searchform == null)
                    {
                        strError = "没有连接的或者打开的dp2检索窗,无法保存记录";
                        goto ERROR1;
                    }

                    string strDp2ServerName = "";
                    string strPurePath = "";
                    // 解析记录路径。
                    // 记录路径为如下形态 "中文图书/1 @服务器"
                    dp2SearchForm.ParseRecPath(strPath,
                        out strDp2ServerName,
                        out strPurePath);

                    string strTargetMarcSyntax = "";

                    try
                    {
                        NormalDbProperty prop = dp2_searchform.GetDbProperty(strDp2ServerName,
             dp2SearchForm.GetDbName(strPurePath));
                        strTargetMarcSyntax = prop.Syntax;
                        if (string.IsNullOrEmpty(strTargetMarcSyntax) == true)
                            strTargetMarcSyntax = "unimarc";
                    }
                    catch (Exception ex)
                    {
                        strError = "在获得目标库特性时出错: " + ex.Message;
                        goto ERROR1;
                    }

                    bool bSkip = false;
                    int nSavedCount = 0;

                    for (int i = 0; i < this.listView_browse.SelectedIndices.Count; i++)
                    {
                        Application.DoEvents();	// 出让界面控制权

                        if (stop != null)
                        {
                            if (stop.State != 0)
                            {
                                strError = "用户中断";
                                goto ERROR1;
                            }
                        }

                        int index = this.listView_browse.SelectedIndices[i];

                        byte[] baTimestamp = null;
                        string strSavePath = "";
                        string strOutStyle = "";
                        LoginInfo logininfo = null;
                        long lVersion = 0;
                        string strXmlFragment = "";
                        DigitalPlatform.Z3950.Record record = null;
                        Encoding currentEncoding = null;
                        string strMARC = "";

                        nRet = this.GetOneRecord(
                            "marc",
                            index,  // 即将废止
                            "index:" + index.ToString(),
                            bForceFull == true ? "force_full" : "", // false,
                            out strSavePath,
                            out strMARC,
                            out strXmlFragment,
                            out strOutStyle,
                            out baTimestamp,
                            out lVersion,
                            out record,
                            out currentEncoding,
                            out logininfo,
                            out strError);
                        if (nRet == -1)
                            goto ERROR1;


                        string strMarcSyntax = "";
                        if (record.m_strSyntaxOID == "1.2.840.10003.5.1")
                            strMarcSyntax = "unimarc";
                        if (record.m_strSyntaxOID == "1.2.840.10003.5.10")
                            strMarcSyntax = "usmarc";

                        // 有些格式不适合保存到目标数据库
                        if (strTargetMarcSyntax != strMarcSyntax)
                        {
                            if (bSkip == true)
                                continue;
                            strError = "记录 " + (index + 1).ToString() + " 的格式类型为 '" + strMarcSyntax + "',和目标库的格式类型 '" + strTargetMarcSyntax + "' 不符合,因此无法保存到目标库";
                            DialogResult result = MessageBox.Show(this,
        strError + "\r\n\r\n要跳过这些记录而继续保存后面的记录么?\r\n\r\n(Yes: 跳过格式不吻合的记录,继续保存后面的; No: 放弃整个保存操作)",
        "AmazonSearchForm",
        MessageBoxButtons.YesNo,
        MessageBoxIcon.Question,
        MessageBoxDefaultButton.Button1);
                            if (result == System.Windows.Forms.DialogResult.No)
                                goto ERROR1;
                            bSkip = true;
                            continue;
                        }

                        string strProtocolPath = this.CurrentProtocol + ":"
    + this.CurrentResultsetPath
    + "/" + (index + 1).ToString();

                        string strOutputPath = "";
                        byte[] baOutputTimestamp = null;
                        string strComment = "copy from " + strProtocolPath; // strSavePath;
                        // return:
                        //      -2  timestamp mismatch
                        //      -1  error
                        //      0   succeed
                        nRet = dp2_searchform.SaveMarcRecord(
                            false,
                            strPath,
                            strMARC,
                            strMarcSyntax,
                            baTimestamp,
                            strXmlFragment,
                            strComment,
                            out strOutputPath,
                            out baOutputTimestamp,
                            out strError);
                        if (nRet == -1)
                            goto ERROR1;
                        nSavedCount++;

                    }
                    MessageBox.Show(this, "共保存记录 " + nSavedCount.ToString() + " 条");
                    return;
                }
                else if (strProtocol.ToLower() == "z3950")
                {
                    strError = "目前暂不支持Z39.50协议的保存操作";
                    goto ERROR1;
                }
                else
                {
                    strError = "无法识别的协议名 '" + strProtocol + "'";
                    goto ERROR1;
                }
            }
            finally
            {
                stop.EndLoop();

                stop.Unregister();	// 和容器关联
                stop = null;

                this.EnableControls(true);
            }

            // return 0;
        ERROR1:
            MessageBox.Show(this, strError);
        }
Example #55
0
        private void AmazonSearchForm_Load(object sender, EventArgs e)
        {
            this.MainForm.AppInfo.LoadMdiSize += new EventHandler(AppInfo_LoadMdiSize);
            this.MainForm.AppInfo.SaveMdiSize += new EventHandler(AppInfo_SaveMdiSize);

            LoadSize();

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联


            string strWidths = this.MainForm.AppInfo.GetString(
"amazonsearchform",
"record_list_column_width",
"");
            if (String.IsNullOrEmpty(strWidths) == false)
            {
                ListViewUtil.SetColumnHeaderWidth(this.listView_browse,
                    strWidths,
                    true);
            }
#if NO
            string strCfgFileName = Path.Combine( this.MainForm.DataDir, "amazon_searchcontrol.xml");
            string strError = "";
            int nRet = this.amazonQueryControl1.Initial(strCfgFileName, out strError);
            if (nRet == -1)
                MessageBox.Show(this, strError);
#endif

            this.amazonSimpleQueryControl_simple.Initial();
            this.amazonSimpleQueryControl_simple.SetContentString(
                this.MainForm.AppInfo.GetString("amazonsearchform",
                "simple_query_content", 
                "")
                );

            this.amazonSimpleQueryControl_multiLine.Initial();
            this.amazonSimpleQueryControl_multiLine.SetContentString(
    this.MainForm.AppInfo.GetString("amazonsearchform",
    "multiline_query_content",
    "")
    );
            // 让按钮文字显示出来
            this.RefreshUI();
        }
Example #56
0
        private void UrgentChargingForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }

#if NO
            MainForm.AppInfo.LoadMdiChildFormStates(this,
    "mdi_form_state");
            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);


            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联
#endif

            this.MainForm.Urgent = true;

            this.FuncState = this.FuncState;    // 使"操作"按钮文字显示正确
            Global.WriteHtml(this.webBrowser_operationInfo,
                "<pre>");
            EnableControls(false);

            API.PostMessage(this.Handle, WM_PREPARE, 0, 0);

        }
Example #57
0
        /// <summary>
        /// 准备进行检索
        /// </summary>
        /// <returns>0: 没有成功; 1: 成功</returns>
        public int PrepareSearch()
        {
            if (String.IsNullOrEmpty(this.LibraryServerUrlList) == true)
                return 0;

            if (this.Channel == null)
                this.Channel = new LibraryChannel();

            this.Channel.Url = GetFirstUrl(this.LibraryServerUrlList);

            this.Channel.BeforeLogin -= new DigitalPlatform.LibraryClient.BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new DigitalPlatform.LibraryClient.BeforeLoginEventHandle(Channel_BeforeLogin);

            Stop = new DigitalPlatform.Stop();
            Stop.Register(stopManager, true);	// 和容器关联

            return 1;
        }
Example #58
0
        private void CallNumberForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }

#if NO
            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联
#endif

            this.GetValueTable -= new GetValueTableEventHandler(CallNumberForm_GetValueTable);
            this.GetValueTable += new GetValueTableEventHandler(CallNumberForm_GetValueTable);


            // 类号
            if (String.IsNullOrEmpty(this.textBox_classNumber.Text) == true)
            {
                this.textBox_classNumber.Text = this.MainForm.AppInfo.GetString(
                    "callnumberform",
                    "classnumber",
                    "");
            }

            // 线索馆藏地点
            if (m_bLocationSetted == false)
            {
                this.comboBox_location.Text = this.MainForm.AppInfo.GetString(
                    "callnumberform",
                    "location",
                    "");
                m_bLocationSetted = true;
            }

            // 是否要返回浏览列
            this.checkBox_returnBrowseCols.Checked = this.MainForm.AppInfo.GetBoolean(
                    "callnumberform",
                    "return_browse_cols",
                    true);

            string strWidths = this.MainForm.AppInfo.GetString(
    "callnumberform",
    "record_list_column_width",
    "");
            if (String.IsNullOrEmpty(strWidths) == false)
            {
                ListViewUtil.SetColumnHeaderWidth(this.listView_number,
                    strWidths,
                    true);
            }

            /*
            if (this.cfg_dom == null)
            {
                string strError = "";
                // 初始化索取号配置信息
                int nRet = InitialCallNumberCfgInfo(out strError);
                if (nRet == -1)
                    MessageBox.Show(this, strError);
            }*/

            if (this.AutoBeginSearch == true)
            {
                API.PostMessage(this.Handle, WM_INITIAL, 0, 0);
            }
        }
Example #59
0
        /*
        public string RefID_2
        {
            get
            {
                if (String.IsNullOrEmpty(this.m_strRefID_2) == true)
                    this.m_strRefID_2 = Guid.NewGuid().ToString();

                return this.m_strRefID_2;
            }
        }*/

        private void QuickChangeEntityForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }
#if NO
            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联
#endif

            this.m_webExternalHost_biblio.Initial(this.MainForm, this.webBrowser_biblio);
            this.webBrowser_biblio.ObjectForScripting = this.m_webExternalHost_biblio;

            this.AcceptButton = this.button_loadBarcode;

            this.entityEditControl1.GetValueTable += new GetValueTableEventHandler(entityEditControl1_GetValueTable);
        }
Example #60
0
        private void OperLogForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }

#if NO
            MainForm.AppInfo.LoadMdiChildFormStates(this,
    "mdi_form_state");


            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联
#endif

            this.AcceptButton = this.button_loadFromSingleFile;

#if NO
            this.textBox_logFileName.Text = MainForm.AppInfo.GetString(
                "operlogform",
                "logfilename",
                "");

            this.textBox_repair_sourceFilename.Text = MainForm.AppInfo.GetString(
                "operlogform",
                "repair_source_filename",
                "");
            this.textBox_repair_targetFilename.Text = MainForm.AppInfo.GetString(
                "operlogform",
                "repair_target_filename",
                "");
            this.textBox_repair_verifyFolderName.Text = MainForm.AppInfo.GetString(
                "operlogform",
                "repair_verify_foldername",
                "");
#endif

            this.Channels = new LibraryChannelCollection();
            this.Channels.BeforeLogin -= new BeforeLoginEventHandle(Channels_BeforeLogin);
            this.Channels.BeforeLogin += new BeforeLoginEventHandle(Channels_BeforeLogin);

            /*
            if (this.MainForm.CanDisplayItemProperty() == true)
                DownPannelVisible = false;
             * */
            DownPannelVisible = false;  // 必须隐藏。因为放开后有 javascript 没有连接 host 等问题

            this.UiState = this.MainForm.AppInfo.GetString(
"operlog_form",
"ui_state",
"");
        }