Exemplo n.º 1
0
        // AppDomain m_scriptDomain = null;

        private void EntityForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }

            // 2015/5/27
            this._genData = new GenerateData(this, null);
            this._genData.SynchronizeMarcEvent += _genData_SynchronizeMarcEvent;

            // m_scriptDomain = AppDomain.CreateDomain("script");

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

            // this.m_webExternalHost_comment.Initial(this.MainForm);

            this.MainForm.AppInfo.LoadMdiSize += new EventHandler(AppInfo_LoadMdiSize);
            this.MainForm.AppInfo.SaveMdiSize += new EventHandler(AppInfo_SaveMdiSize);

            // LoadLayout0();
            if (this.AcceptMode == false)
            {
#if NO
                // 设置窗口尺寸状态
                MainForm.AppInfo.LoadMdiChildFormStates(this,
                    "mdi_form_state");
#endif
            }
            else
            {
                Form form = this;
                FormWindowState savestate = form.WindowState;
                bool bStateChanged = false;
                if (form.WindowState != FormWindowState.Normal)
                {
                    form.WindowState = FormWindowState.Normal;
                    bStateChanged = true;
                }

                AppInfo_LoadMdiSize(this, null);

                if (bStateChanged == true)
                    form.WindowState = savestate;
            }

            if (this.AcceptMode == true)
            {
#if ACCEPT_MODE
                if (this.WindowState == FormWindowState.Maximized)
                {
                    this.WindowState = FormWindowState.Normal;
                }
#endif
            }


            // 如果为禁止编目功能
            if (this.Cataloging == false)
            {
                this.tabControl_biblioInfo.TabPages.Remove(this.tabPage_marc);
                this.AddFreeControl(this.tabPage_marc); // 2015/11/7
                this.toolStrip_marcEditor.Enabled = false;

                // 对象管理功能也被禁止
                this.tabControl_itemAndIssue.TabPages.Remove(this.tabPage_object);
                this.AddFreeControl(this.tabPage_object);   // 2015/11/7
                this.binaryResControl1.Enabled = false;
            }


            this.MainForm.FillBiblioFromList(this.comboBox_from);

            // 恢复上次退出时保留的检索途径
            string strFrom = this.MainForm.AppInfo.GetString(
            "entityform",
            "search_from",
            "");
            if (String.IsNullOrEmpty(strFrom) == false)
                this.comboBox_from.Text = strFrom;

            this.checkedComboBox_biblioDbNames.Text = this.MainForm.AppInfo.GetString(
                "entityform",
                "search_dbnames",
                "<全部>");

            this.comboBox_matchStyle.Text = this.MainForm.AppInfo.GetString(
                "entityform",
                "search_matchstyle",
                "前方一致");


            /*
            // 2008/6/25 
            this.checkBox_autoDetectQueryBarcode.Checked = this.MainForm.AppInfo.GetBoolean(
                "entityform",
                "auto_detect_query_barcode",
                true);
             * */

            this.checkBox_autoSavePrev.Checked = this.MainForm.AppInfo.GetBoolean(
                "entityform",
                "auto_save_prev",
                true);

            this.BiblioChanged = false;

            // 保存当前活动的属性页名字,因为后面可能要清除有关page
            this.m_strUsedActiveItemPage = GetActiveItemPageName();

            // 初始化册控件
            this.entityControl1.GetMacroValue -= new GetMacroValueHandler(issueControl1_GetMacroValue);
            this.entityControl1.GetMacroValue += new GetMacroValueHandler(issueControl1_GetMacroValue);

            this.entityControl1.ContentChanged -= new ContentChangedEventHandler(issueControl1_ContentChanged);
            this.entityControl1.ContentChanged += new ContentChangedEventHandler(issueControl1_ContentChanged);

            this.entityControl1.GetParameterValue -= new GetParameterValueHandler(entityControl1_GetParameterValue);
            this.entityControl1.GetParameterValue += new GetParameterValueHandler(entityControl1_GetParameterValue);

            this.entityControl1.VerifyBarcode -= new VerifyBarcodeHandler(entityControl1_VerifyBarcode);
            this.entityControl1.VerifyBarcode += new VerifyBarcodeHandler(entityControl1_VerifyBarcode);

            this.entityControl1.EnableControlsEvent -= new EnableControlsHandler(entityControl1_EnableControls);
            this.entityControl1.EnableControlsEvent += new EnableControlsHandler(entityControl1_EnableControls);

            this.entityControl1.LoadRecord -= new LoadRecordHandler(entityControl1_LoadRecord111);
            this.entityControl1.LoadRecord += new LoadRecordHandler(entityControl1_LoadRecord111);

            // 2009/2/24 
            this.entityControl1.GenerateData -= new GenerateDataEventHandler(entityControl1_GenerateData);
            this.entityControl1.GenerateData += new GenerateDataEventHandler(entityControl1_GenerateData);

            /*
            // 2009/2/24 
            this.entityControl1.GenerateAccessNo -= new GenerateDataEventHandler(entityControl1_GenerateAccessNo);
            this.entityControl1.GenerateAccessNo += new GenerateDataEventHandler(entityControl1_GenerateAccessNo); 
             * */

            this.entityControl1.ShowMessage -= entityControl1_ShowMessage;
            this.entityControl1.ShowMessage += entityControl1_ShowMessage;

            ////this.entityControl1.Channel = this.Channel;
            this.entityControl1.Stop = this.Progress;
            this.entityControl1.MainForm = this.MainForm;

            this.EnableItemsPage(false);


            // 初始化期控件

            // 2008/12/27 
            this.issueControl1.GenerateEntity -= new GenerateEntityEventHandler(issueControl1_GenerateEntity);
            this.issueControl1.GenerateEntity += new GenerateEntityEventHandler(issueControl1_GenerateEntity);

            // 2008/12/24 
            this.issueControl1.GetOrderInfo -= new GetOrderInfoEventHandler(issueControl1_GetOrderInfo);
            this.issueControl1.GetOrderInfo += new GetOrderInfoEventHandler(issueControl1_GetOrderInfo);

            this.issueControl1.GetItemInfo -= new GetItemInfoEventHandler(issueControl1_GetItemInfo);
            this.issueControl1.GetItemInfo += new GetItemInfoEventHandler(issueControl1_GetItemInfo);

            this.issueControl1.GetMacroValue -= new GetMacroValueHandler(issueControl1_GetMacroValue);
            this.issueControl1.GetMacroValue += new GetMacroValueHandler(issueControl1_GetMacroValue);

            this.issueControl1.ContentChanged -= new ContentChangedEventHandler(issueControl1_ContentChanged);
            this.issueControl1.ContentChanged += new ContentChangedEventHandler(issueControl1_ContentChanged);

            this.issueControl1.EnableControlsEvent -= new EnableControlsHandler(entityControl1_EnableControls);
            this.issueControl1.EnableControlsEvent += new EnableControlsHandler(entityControl1_EnableControls);

            this.issueControl1.ChangeItem -= new ChangeItemEventHandler(issueControl1_ChangeItem);
            this.issueControl1.ChangeItem += new ChangeItemEventHandler(issueControl1_ChangeItem);

            // 2010/4/27
            this.issueControl1.LoadRecord -= new LoadRecordHandler(entityControl1_LoadRecord111);
            this.issueControl1.LoadRecord += new LoadRecordHandler(entityControl1_LoadRecord111);

            // 2012/9/22
            this.issueControl1.GenerateData -= new GenerateDataEventHandler(entityControl1_GenerateData);
            this.issueControl1.GenerateData += new GenerateDataEventHandler(entityControl1_GenerateData);

            this.issueControl1.GetBiblio -= issueControl1_GetBiblio;
            this.issueControl1.GetBiblio += issueControl1_GetBiblio;

            ////this.issueControl1.Channel = this.Channel;
            this.issueControl1.Stop = this.Progress;
            this.issueControl1.MainForm = this.MainForm;

            this.EnableIssuesPage(false);

            // 2010/4/27
            this.issueControl1.InputItemsBarcode = this.MainForm.AppInfo.GetBoolean(
                "entity_form",
                "issueControl_input_item_barcode",
                true);
            // 2011/9/8
            this.issueControl1.SetProcessingState = this.MainForm.AppInfo.GetBoolean(
                "entity_form",
                "issueControl_set_processing_state",
                true);
            // 2012/5/7
            this.issueControl1.CreateCallNumber = this.MainForm.AppInfo.GetBoolean(
                "entity_form",
                "create_callnumber",
                false);

            // 初始化采购控件
            this.orderControl1.GetMacroValue -= new GetMacroValueHandler(issueControl1_GetMacroValue);
            this.orderControl1.GetMacroValue += new GetMacroValueHandler(issueControl1_GetMacroValue);

            this.orderControl1.ContentChanged -= new ContentChangedEventHandler(issueControl1_ContentChanged);
            this.orderControl1.ContentChanged += new ContentChangedEventHandler(issueControl1_ContentChanged);

            this.orderControl1.EnableControlsEvent -= new EnableControlsHandler(entityControl1_EnableControls);
            this.orderControl1.EnableControlsEvent += new EnableControlsHandler(entityControl1_EnableControls);

            this.orderControl1.GenerateEntity -= new GenerateEntityEventHandler(orderControl1_GenerateEntity);
            this.orderControl1.GenerateEntity += new GenerateEntityEventHandler(orderControl1_GenerateEntity);

            // 2008/11/4 
            this.orderControl1.OpenTargetRecord -= new OpenTargetRecordEventHandler(orderControl1_OpenTargetRecord);
            this.orderControl1.OpenTargetRecord += new OpenTargetRecordEventHandler(orderControl1_OpenTargetRecord);

            this.orderControl1.HilightTargetItem -= new HilightTargetItemsEventHandler(orderControl1_HilightTargetItem);
            this.orderControl1.HilightTargetItem += new HilightTargetItemsEventHandler(orderControl1_HilightTargetItem);

            // 2009/11/8 
            this.orderControl1.SetTargetRecPath -= new SetTargetRecPathEventHandler(orderControl1_SetTargetRecPath);
            this.orderControl1.SetTargetRecPath += new SetTargetRecPathEventHandler(orderControl1_SetTargetRecPath);

            // 2009/11/23 
            this.orderControl1.LoadRecord -= new LoadRecordHandler(entityControl1_LoadRecord111);
            this.orderControl1.LoadRecord += new LoadRecordHandler(entityControl1_LoadRecord111);

            this.orderControl1.VerifyLibraryCode -= new VerifyLibraryCodeEventHandler(orderControl1_VerifyLibraryCode);
            this.orderControl1.VerifyLibraryCode += new VerifyLibraryCodeEventHandler(orderControl1_VerifyLibraryCode);

            ////this.orderControl1.Channel = this.Channel;
            this.orderControl1.Stop = this.Progress;
            this.orderControl1.MainForm = this.MainForm;

            this.EnableOrdersPage(false);

            // 初始化评注控件
            this.commentControl1.GetMacroValue -= new GetMacroValueHandler(issueControl1_GetMacroValue);
            this.commentControl1.GetMacroValue += new GetMacroValueHandler(issueControl1_GetMacroValue);

            this.commentControl1.ContentChanged -= new ContentChangedEventHandler(issueControl1_ContentChanged);
            this.commentControl1.ContentChanged += new ContentChangedEventHandler(issueControl1_ContentChanged);

            this.commentControl1.EnableControlsEvent -= new EnableControlsHandler(entityControl1_EnableControls);
            this.commentControl1.EnableControlsEvent += new EnableControlsHandler(entityControl1_EnableControls);

            /*
            this.commentControl1.GenerateEntity -= new GenerateEntityEventHandler(orderControl1_GenerateEntity);
            this.commentControl1.GenerateEntity += new GenerateEntityEventHandler(orderControl1_GenerateEntity);

            this.commentControl1.OpenTargetRecord -= new OpenTargetRecordEventHandler(orderControl1_OpenTargetRecord);
            this.commentControl1.OpenTargetRecord += new OpenTargetRecordEventHandler(orderControl1_OpenTargetRecord);

            this.commentControl1.HilightTargetItem -= new HilightTargetItemsEventHandler(orderControl1_HilightTargetItem);
            this.commentControl1.HilightTargetItem += new HilightTargetItemsEventHandler(orderControl1_HilightTargetItem);

            this.commentControl1.SetTargetRecPath -= new SetTargetRecPathEventHandler(orderControl1_SetTargetRecPath);
            this.commentControl1.SetTargetRecPath += new SetTargetRecPathEventHandler(orderControl1_SetTargetRecPath);

            */
            this.commentControl1.LoadRecord -= new LoadRecordHandler(entityControl1_LoadRecord111);
            this.commentControl1.LoadRecord += new LoadRecordHandler(entityControl1_LoadRecord111);

            this.CommentControl.AddSubject -= new AddSubjectEventHandler(CommentControl_AddSubject);
            this.CommentControl.AddSubject += new AddSubjectEventHandler(CommentControl_AddSubject);

            ////this.commentControl1.Channel = this.Channel;
            this.commentControl1.Stop = this.Progress;
            this.commentControl1.MainForm = this.MainForm;
            // this.commentControl1.WebExternalHost = this.m_webExternalHost_comment;

            this.EnableCommentsPage(false);

            // 初始化对象控件
            if (this.Cataloging == true)
            {
                Program.MainForm.StreamProgressChanged += MainForm_StreamProgressChanged;

                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.Channel = this.Channel;
                this.binaryResControl1.Stop = this.Progress;

                this.binaryResControl1.RightsCfgFileName = Path.Combine(this.MainForm.UserDir, "objectrights.xml");

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

                // 2009/2/24 
                this.binaryResControl1.GenerateData -= new GenerateDataEventHandler(entityControl1_GenerateData);
                this.binaryResControl1.GenerateData += new GenerateDataEventHandler(entityControl1_GenerateData);

                this.binaryResControl1.TempDir = this.MainForm.UserTempDir;

                LoadFontToMarcEditor();

                this.m_marcEditor.AppInfo = this.MainForm.AppInfo;    // 2009/9/18 
            }



            if (this.AcceptMode == true)
            {
                this.flowLayoutPanel_query.Visible = false;
            }
            else
            {
                this.flowLayoutPanel_query.Visible = this.MainForm.AppInfo.GetBoolean(
"entityform",
"queryPanel_visibie",
true);
            }

            this.panel_itemQuickInput.Visible = this.MainForm.AppInfo.GetBoolean(
"entityform",
"itemQuickInputPanel_visibie",
true);

            // 
            this.EnableControls(true);  // 促使“保存”按钮状态被设置

            // API.PostMessage(this.Handle, WM_LOADLAYOUT, 0, 0);


            // 2008/11/2 
            // RegisterType
            {
                string strRegisterType = this.MainForm.AppInfo.GetString("entity_form",
                    "register_type",
                    "");
                if (String.IsNullOrEmpty(strRegisterType) == false)
                {
                    try
                    {
                        this.RegisterType = (RegisterType)Enum.Parse(typeof(RegisterType), strRegisterType, true);
                    }
                    catch
                    {
                    }
                }
            }

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

        }
Exemplo n.º 2
0
        private void EntityRegisterWizard_Load(object sender, EventArgs e)
        {
            _biblio.MainForm = this.MainForm;
            _base.MainForm = this.MainForm;

            if (this._imageManager != null)
                this._imageManager.TempFileDir = this.MainForm.UserTempDir;

            this._originTitle = this.Text;

            SetTitle();
            SetButtonState();

            LoadServerXml();

#if NO
            {
                _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;
            }
#endif

#if NO
            this.MainForm.Move += new EventHandler(MainForm_Move);
#endif
            this.MainForm.Activated += MainForm_Activated;
            this.MainForm.Deactivate += MainForm_Deactivate;

            // this.MainForm.MessageFilter += MainForm_MessageFilter;

            {
                this.UiState = this.MainForm.AppInfo.GetString("entityRegisterWizard", "uistate", "");
                // 缺省值 检索途径
                if (string.IsNullOrEmpty(this.comboBox_from.Text) == true
                    && this.comboBox_from.Items.Count > 0)
                    this.comboBox_from.Text = this.comboBox_from.Items[0] as string;
#if NO
                // 缺省值 书目重要字段
                if (string.IsNullOrEmpty(this.textBox_settings_importantFields.Text) == true)
                    this.textBox_settings_importantFields.Text = "010,200,210,215,686,69*,7**".Replace(",", "\r\n");
#endif
            }

            SetControlsColor(this._colorStyle);

            this._genData = new GenerateData(this, this);
            this._genData.ScriptFileName = "dp2circulation_marc_autogen_2.cs";
            this._genData.DetailHostType = typeof(BiblioItemsHost);

            // 刚打开窗口,设定输入焦点
            this.BeginInvoke(new Action(SetStartFocus));
        }