Beispiel #1
0
        private void button_excute_Click(object sender, EventArgs e)
        {
            if (Actions == null || this.TriggerAction == null)
            {
                return;
            }

            if (this._processing > 0)
            {
                MessageBox.Show(this, "正在处理中,请稍后再重新启动执行");
                return;
            }

            if (this.ActionTable.SelectedRows.Count == 0)
            {
                MessageBox.Show(this, "尚未选择要执行的事项...");
                return;
            }

            this.ActionTable.Focus();   // 如果没有这个语句, 功能执行完后会把书目查询窗给翻起来

            if (this.CloseWhenComplete == true)
            {
                this.Hide();
            }

            BeginProcess();
            try
            {
                List <DpRow> selections = new List <DpRow>();
                selections.AddRange(this.ActionTable.SelectedRows);

                foreach (DpRow row in selections)
                {
                    ScriptAction action = (ScriptAction)row.Tag;
                    Debug.Assert(action != null, "");

                    if (action != null &&
                        this.TriggerAction != null)
                    {
                        TriggerActionArgs e1 = new TriggerActionArgs();
                        e1.EntryName = action.ScriptEntry;
                        e1.sender    = this.sender;
                        e1.e         = this.e;
                        this.TriggerAction(this, e1);
                    }
                }
            }
            finally
            {
                EndProcess();
            }

            if (this.CloseWhenComplete == true)
            {
                this.Close();
            }
        }
Beispiel #2
0
        private void ActionTable_DoubleClick(object sender, EventArgs e)
        {
            if (this._processing > 0)
            {
                MessageBox.Show(this, "正在处理中,请稍后再重新启动执行");
                return;
            }
            if (this.ActionTable.SelectedRows.Count == 0)
            {
                MessageBox.Show(this, "尚未选择事项...");
                return;
            }

            this.SelectedAction = (ScriptAction)this.ActionTable.SelectedRows[0].Tag;
            if (this.SelectedAction == null)
            {
                return; // 一般是因为双击了错误信息行
            }
            Debug.Assert(this.SelectedAction != null, "");

            this.SelectedIndex = this.Actions.IndexOf(this.SelectedAction);

            if (this.CloseWhenComplete == true)
            {
                this.Hide();
            }

            if (this.SelectedAction != null &&
                this.TriggerAction != null)
            {
                BeginProcess();
                try
                {
                    TriggerActionArgs e1 = new TriggerActionArgs();
                    e1.EntryName = this.SelectedAction.ScriptEntry;
                    e1.sender    = this.sender;
                    e1.e         = this.e;
                    this.TriggerAction(this, e1);
                }
                finally
                {
                    EndProcess();
                }
            }

            if (this.CloseWhenComplete == true)
            {
                this.Close();
            }
        }
Beispiel #3
0
        void m_genDataViewer_TriggerAction(object sender, TriggerActionArgs e)
        {
            string strError = "";
            if (this.m_detailHostObj != null)
            {
                if (this.IsDisposed == true)
                {
                    if (this.m_genDataViewer != null)
                    {
                        this.m_genDataViewer.Clear();
                        this.m_genDataViewer.Close();
                        this.m_genDataViewer = null;
                        return;
                    }
                }
                if (String.IsNullOrEmpty(e.EntryName) == false)
                {
                    try
                    {
                        this.m_detailHostObj.Invoke(e.EntryName,
                            e.sender,
                            e.e);
                    }
                    catch(Exception ex)
                    {
                        // 2015/8/24
                        strError = "MARC记录窗的记录 '"+this.SavePath+"' 在执行创建数据脚本的时候出现异常: " + ExceptionUtil.GetDebugText(ex)
                            + "\r\n\r\n建议检查此书目记录相关的 dp2catalog_marc_autogen.cs 配置文件,试着刷新相关书目库定义,或者与数字平台的工程师取得联系";
                        goto ERROR1;
                    }
                }

                if (this.m_genDataViewer != null)
                    this.m_genDataViewer.RefreshState();
            }
            return;
        ERROR1:
            // MessageBox.Show(this, strError);
            {
                bool bSendReport = true;
                DialogResult result = MessageDlg.Show(this,
        "dp2Catalog 发生异常:\r\n\r\n" + strError,
        "dp2Catalog 发生异常",
        MessageBoxButtons.OK,
        MessageBoxDefaultButton.Button1,
        ref bSendReport,
        new string[] { "确定" },
        "将信息发送给开发者");
                // 发送异常报告
                if (bSendReport)
                    Program.CrashReport(strError);
            }
        }
Beispiel #4
0
        private void ActionTable_KeyDown(object sender, KeyEventArgs e)
        {
            Debug.Assert(this.Actions != null, "");

            char key = (char)e.KeyValue;

            if (key == (char)Keys.Enter)
            {
                this.ActionTable_DoubleClick(this, null);
                return;
            }
            else if (key == (char)Keys.Escape)
            {
                this.Close();
                return;
            }
            else if (char.IsLetter(key) == true)
            {
                foreach (ScriptAction action in this.Actions)
                {
                    if (Char.ToUpper(key) == Char.ToUpper(action.ShortcutKey))
                    {
                        this.SelectedIndex  = this.Actions.IndexOf(action);
                        this.SelectedAction = action;

                        if (this.CloseWhenComplete == true)
                        {
                            this.Hide();
                        }

                        if (this.SelectedAction != null &&
                            this.TriggerAction != null)
                        {
                            if (this._processing > 0)
                            {
                                MessageBox.Show(this, "正在处理中,请稍后再重新启动执行");
                                return;
                            }

                            BeginProcess();
                            try
                            {
                                TriggerActionArgs e1 = new TriggerActionArgs();
                                e1.EntryName = this.SelectedAction.ScriptEntry;
                                e1.sender    = this.sender;
                                e1.e         = this.e;
                                this.TriggerAction(this, e1);
                            }
                            finally
                            {
                                EndProcess();
                            }
                        }

                        if (this.CloseWhenComplete == true)
                        {
                            this.Close();
                        }

                        return;
                    }
                }

                // Console.Beep();
            }
        }
Beispiel #5
0
        private void button_excute_Click(object sender, EventArgs e)
        {
            if (Actions == null || this.TriggerAction == null)
                return;

            if (this._processing > 0)
            {
                MessageBox.Show(this, "正在处理中,请稍后再重新启动执行");
                return;
            }

            if (this.ActionTable.SelectedRows.Count == 0)
            {
                MessageBox.Show(this, "尚未选择要执行的事项...");
                return;
            }

            if (this.CloseWhenComplete == true)
                this.Close();

            this.ActionTable.Focus();   // 如果没有这个语句, 功能执行完后会把书目查询窗给翻起来

            BeginProcess();
            try
            {

                List<DpRow> selections = new List<DpRow>();
                selections.AddRange(this.ActionTable.SelectedRows);

                foreach (DpRow row in selections)
                {
                    ScriptAction action = (ScriptAction)row.Tag;
                    Debug.Assert(action != null, "");

                    if (action != null
                        && this.TriggerAction != null)
                    {
                        TriggerActionArgs e1 = new TriggerActionArgs();
                        e1.EntryName = action.ScriptEntry;
                        e1.sender = this.sender;
                        e1.e = this.e;
                        this.TriggerAction(this, e1);
                    }
                }

            }
            finally
            {
                EndProcess();
            }
        }
Beispiel #6
0
        private void ActionTable_KeyDown(object sender, KeyEventArgs e)
        {
            Debug.Assert(this.Actions != null, "");

            char key = (char)e.KeyValue;
            if (key == (char)Keys.Enter)
            {
                this.ActionTable_DoubleClick(this, null);
                return;
            }
            else if (key == (char)Keys.Escape)
            {
                this.Close();
                return;
            }
            else if (char.IsLetter(key) == true)
            {
                foreach (ScriptAction action in this.Actions)
                {
                    if (Char.ToUpper(key) == Char.ToUpper(action.ShortcutKey))
                    {
                        this.SelectedIndex = this.Actions.IndexOf(action);
                        this.SelectedAction = action;

                        if (this.CloseWhenComplete == true)
                            this.Close();

                        if (this.SelectedAction != null
                            && this.TriggerAction != null)
                        {
                            if (this._processing > 0)
                            {
                                MessageBox.Show(this, "正在处理中,请稍后再重新启动执行");
                                return;
                            }

                            BeginProcess();
                            try
                            {
                                TriggerActionArgs e1 = new TriggerActionArgs();
                                e1.EntryName = this.SelectedAction.ScriptEntry;
                                e1.sender = this.sender;
                                e1.e = this.e;
                                this.TriggerAction(this, e1);
                            }
                            finally
                            {
                                EndProcess();
                            }
                        }
                        return;
                    }
                }

                // Console.Beep();
            }

        }
Beispiel #7
0
        private void ActionTable_DoubleClick(object sender, EventArgs e)
        {
            if (this._processing > 0)
            {
                MessageBox.Show(this, "正在处理中,请稍后再重新启动执行");
                return;
            }
            if (this.ActionTable.SelectedRows.Count == 0)
            {
                MessageBox.Show(this, "尚未选择事项...");
                return;
            }

            this.SelectedAction = (ScriptAction)this.ActionTable.SelectedRows[0].Tag;
            if (this.SelectedAction == null)
                return; // 一般是因为双击了错误信息行

            Debug.Assert(this.SelectedAction != null, "");

            this.SelectedIndex = this.Actions.IndexOf(this.SelectedAction);

            if (this.CloseWhenComplete == true)
                this.Close();

            if (this.SelectedAction != null
                && this.TriggerAction != null)
            {
                BeginProcess();
                try
                {
                    TriggerActionArgs e1 = new TriggerActionArgs();
                    e1.EntryName = this.SelectedAction.ScriptEntry;
                    e1.sender = this.sender;
                    e1.e = this.e;
                    this.TriggerAction(this, e1);
                }
                finally
                {
                    EndProcess();
                }
            }
        }