Beispiel #1
0
        private void RefreshBugsList(List <ElementBugInfo> lstElementBugList, List <DocuemntBugInfo> lstDocuemntBugList)
        {
            string szDocTitle = string.Empty;

            if (this.m_documentForm != null && !this.m_documentForm.IsDisposed)
            {
                szDocTitle = this.m_documentForm.DockHandler.TabText;
            }

            for (int index = 0; lstDocuemntBugList != null && index < lstDocuemntBugList.Count; index++)
            {
                DocuemntBugInfo docuemntBugInfo = lstDocuemntBugList[index];
                ListViewItem    item            = new ListViewItem();
                item.Tag = docuemntBugInfo;
                item.SubItems.Add((this.listView1.Items.Count + 1).ToString());
                if (docuemntBugInfo.BugLevel == BugLevel.Warn)
                {
                    item.SubItems.Add("警告");
                    item.ImageIndex = 0;
                }
                else
                {
                    item.SubItems.Add("错误");
                    item.ImageIndex = 1;
                }

                item.SubItems.Add(szDocTitle);
                item.SubItems.Add(docuemntBugInfo.BugDesc);
                this.listView1.Items.Add(item);
            }

            for (int index = 0; lstElementBugList != null && index < lstElementBugList.Count; index++)
            {
                ElementBugInfo elementBugInfo = lstElementBugList[index];
                ListViewItem   item           = new ListViewItem();
                item.Tag = elementBugInfo;
                item.SubItems.Add((this.listView1.Items.Count + 1).ToString());
                item.SubItems.Add("错误");
                item.ImageIndex = 1;
                item.SubItems.Add(szDocTitle);
                item.SubItems.Add(elementBugInfo.BugDesc);
                this.listView1.Items.Add(item);
            }
        }
Beispiel #2
0
        private void listView1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (this.listView1.SelectedItems.Count <= 0)
            {
                return;
            }

            if (this.m_documentForm == null || this.m_documentForm.IsDisposed)
            {
                return;
            }

            this.m_documentForm.DockHandler.Activate();
            if (this.m_documentForm.MedEditor != null && !this.m_documentForm.MedEditor.Focused)
            {
                this.m_documentForm.MedEditor.Focus();
            }

            ListViewItem selectedItem = this.listView1.GetItemAt(e.X, e.Y);

            if (selectedItem == null)
            {
                return;
            }

            GlobalMethods.UI.SetCursor(this, Cursors.WaitCursor);

            ElementBugInfo elementBugInfo = selectedItem.Tag as ElementBugInfo;

            if (elementBugInfo != null)
            {
                if (this.m_documentForm is HerenDocForm)
                {
                    TextField textField = elementBugInfo.Tag as TextField;
                    if (textField != null)
                    {
                        (this.m_documentForm as HerenDocForm).TextEditor.GotoField(textField);
                        (this.m_documentForm as HerenDocForm).TextEditor.SelectCurrentField();
                    }
                    else
                    {
                        (this.m_documentForm as HerenDocForm).GotoElement(elementBugInfo.ElementID, elementBugInfo.ElementName);
                    }
                }
                else
                {
                    MDSDBLib.ElementType type = MDSDBLib.ElementType.SimpleOption;
                    if (elementBugInfo.ElementType == ElementType.CheckBox)
                    {
                        type = MDSDBLib.ElementType.CheckBox;
                    }
                    else if (elementBugInfo.ElementType == ElementType.ComplexOption)
                    {
                        type = MDSDBLib.ElementType.ComplexOption;
                    }
                    else if (elementBugInfo.ElementType == ElementType.InputBox)
                    {
                        type = MDSDBLib.ElementType.InputBox;
                    }
                    else if (elementBugInfo.ElementType == ElementType.Outline)
                    {
                        type = MDSDBLib.ElementType.Outline;
                    }
                    else if (elementBugInfo.ElementType == ElementType.SimpleOption)
                    {
                        type = MDSDBLib.ElementType.SimpleOption;
                    }
                    this.m_documentForm.MedEditor.LocateToElement(type, elementBugInfo.ElementID
                                                                  , elementBugInfo.ElementName);
                }

                GlobalMethods.UI.SetCursor(this, Cursors.Default);
                return;
            }

            DocuemntBugInfo docuemntBugInfo = selectedItem.Tag as DocuemntBugInfo;

            if (docuemntBugInfo != null && !GlobalMethods.Misc.IsEmptyString(docuemntBugInfo.BugKey) &&
                docuemntBugInfo.Response == BUG_RESPONSE_LOCATE)
            {
                if (this.m_documentForm is HerenDocForm)
                {
                    (this.m_documentForm as HerenDocForm).GotoText(docuemntBugInfo.BugKey, docuemntBugInfo.BugIndex);
                }
                else
                {
                    this.m_documentForm.MedEditor.SetCursorPos(false);
                    this.m_documentForm.MedEditor.LocateToText(docuemntBugInfo.BugKey, docuemntBugInfo.BugIndex);
                }
            }
            GlobalMethods.UI.SetCursor(this, Cursors.Default);
        }