示例#1
0
        private void tsmiPanelDelete(object sender, EventArgs e)
        {
            try
            {
                int id = (int)cmsMarkPanelMenu.Tag;
                markOperation = MarkOperation.Delete;

                //用户权限判断
                if (IsUserLimited(id, MarkType.MarkPanel))
                {
                    Dialogs.Show("权限受限!", false);
                    return;
                }

                MarkOperator op = new MarkOperator();
                op.Type      = MarkType.MarkPanel;
                op.Mark      = markAreaDao.GetMarkAreaById(id);
                op.Operation = MarkOperation.Delete;
                stackMarkOperator.Push(op);

                DeleteMarkPanel(id);
            }
            catch (Exception ex)
            {
                LogHelper.AppLoger.Error(ex);
            }
        }
示例#2
0
        private void tsmiRect_Click(object sender, EventArgs e)
        {
            try
            {
                markOperation = MarkOperation.Add;

                //插入数据库
                MarkArea area = new MarkArea();
                area.SlideId    = txtSlideId.Text;
                area.SwathId    = txtCurSwath.Text;
                area.FieldId    = txtCurSequence.Text;
                area.RectX      = ConstDef.ImageX;
                area.RectY      = ConstDef.ImageY;
                area.Width      = Convert.ToInt32((double)MarkPanel.PanelDefaultSize / pbImageView.Width * pbImageView.Image.Width);
                area.Height     = Convert.ToInt32((double)MarkPanel.PanelDefaultSize / pbImageView.Height * pbImageView.Image.Height);
                area.UserId     = ConstDef.UserID;
                area.CreateTime = DateTime.Now;

                if (markAreaDao.Insert(area))
                {
                    MarkArea areaBack = markAreaDao.GetMarkAreaByTime(area.CreateTime);
                    DropMarkPanel(areaBack);

                    MarkOperator op = new MarkOperator();
                    op.Type      = MarkType.MarkPanel;
                    op.Mark      = areaBack;
                    op.Operation = MarkOperation.Add;
                    stackMarkOperator.Push(op);
                }
                else
                {
                    MessageBox.Show("插入区域失败!");
                }
            }
            catch (Exception ex)
            {
                LogHelper.AppLoger.Error(ex);
            }
        }
示例#3
0
        public void btnMarkUndo_Click()
        {
            try
            {
                if (stackMarkOperator.Count > 0)
                {
                    MarkOperator op = stackMarkOperator.Pop();
                    switch (op.Type)
                    {
                    case MarkType.MarkLabel:
                    {
                        MarkCell markcell = (MarkCell)op.Mark;
                        if (op.Operation == MarkOperation.Add)
                        {
                            DeleteMarkLabel(markcell.Id);
                        }
                        else if (op.Operation == MarkOperation.Delete)
                        {
                            markCellDao.Insert(markcell);
                            DropMarkLabel(markcell, true);
                            UpdateMarkGrid();
                        }
                        else if (op.Operation == MarkOperation.Modify)
                        {
                            ModifyMarkLabel(markcell);
                        }
                    }
                    break;

                    case MarkType.MarkPanel:
                    {
                        MarkArea markarea = (MarkArea)op.Mark;
                        if (op.Operation == MarkOperation.Add)
                        {
                            markOperation = MarkOperation.Delete;
                            DeleteMarkPanel(markarea.Id);
                        }
                        else if (op.Operation == MarkOperation.Delete)
                        {
                            markOperation = MarkOperation.Add;
                            markAreaDao.Insert(markarea);
                            DropMarkPanel(markarea);
                        }
                        else if (op.Operation == MarkOperation.Modify)
                        {
                            markOperation = MarkOperation.Modify;
                            ModifyMarkPanel(markarea);
                        }
                    }
                    break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.AppLoger.Error(ex);
            }
        }
示例#4
0
        void ApplyFindingColoring(AssemblyFinding finding, MarkOperation mark)
        {
            if (finding != null && finding.LineNumber != int.MinValue && finding.LineNumber >= 0 && finding.LineNumber < mInstructions.Count)
            {
                ProcessedSourceLine processedLine = mInstructions[finding.LineNumber];
                int lineTextIndex = processedLine.LineTextIndex;
                int length        = 0;

                switch (finding.LineSection)
                {
                case LineSection.LocationField:
                    if (finding.Length <= 0)
                    {
                        lineTextIndex = processedLine.LocTextIndex;
                        length        = processedLine.SourceLine.LocationField.Length;

                        break;
                    }

                    lineTextIndex = processedLine.LocTextIndex + finding.StartCharIndex;
                    length        = finding.Length;

                    break;

                case LineSection.OpField:
                    if (finding.Length <= 0)
                    {
                        lineTextIndex = processedLine.OpTextIndex;
                        length        = processedLine.SourceLine.OpField.Length;

                        break;
                    }

                    lineTextIndex = processedLine.OpTextIndex + finding.StartCharIndex;
                    length        = finding.Length;

                    break;

                case LineSection.AddressField:
                    if (finding.Length <= 0)
                    {
                        lineTextIndex = processedLine.AddressTextIndex;
                        length        = processedLine.SourceLine.AddressField.Length;

                        break;
                    }

                    lineTextIndex = processedLine.AddressTextIndex + finding.StartCharIndex;
                    length        = finding.Length;

                    break;

                case LineSection.CommentField:
                    if (finding.Length <= 0)
                    {
                        lineTextIndex = processedLine.CommentTextIndex;
                        length        = processedLine.SourceLine.Comment.Length;

                        break;
                    }

                    lineTextIndex = processedLine.CommentTextIndex + finding.StartCharIndex;
                    length        = finding.Length;

                    break;

                case LineSection.EntireLine:
                    length = processedLine.LineTextLength;

                    break;
                }

                mSourceBox.Select(lineTextIndex, length);

                if (length != 0)
                {
                    if (mark == MarkOperation.Mark)
                    {
                        Font font = mSourceBox.Font;

                        mSourceBox.SelectionFont = new Font(font.Name, font.Size, FontStyle.Underline, font.Unit, font.GdiCharSet);
                        mSourceBox.Focus();
                        mSourceBox.ScrollToCaret();
                    }
                    else if (mark == MarkOperation.Unmark)
                    {
                        mSourceBox.SelectionFont = mSourceBox.Font;
                    }

                    mSourceBox.SelectionColor  = findingColors[(int)finding.Severity];
                    mSourceBox.SelectionLength = 0;
                }
            }
        }