/// <summary>
        /// 菜单点击确定 生成缺陷和样本
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            SampleVieModel sample = new SampleVieModel();

            sample.Name = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");

            sample.Code = this.cb_code.Text;

            //  Do:根据选择的样本类型来生成缺陷/样本
            if (this.r_defect.IsChecked.HasValue && this.r_defect.IsChecked.Value)
            {
                DefectShape resultStroke = new DefectShape(this._dynamic);
                sample.Flag       = "\xe688";
                sample.Type       = "0";
                resultStroke.Name = sample.Name;
                resultStroke.Code = sample.Code;
                resultStroke.Draw(this.canvas);
                sample.Add(resultStroke);
            }
            else
            {
                SampleShape resultStroke = new SampleShape(this._dynamic);
                sample.Flag       = "\xeaf3";
                sample.Type       = "1";
                resultStroke.Name = sample.Name;
                resultStroke.Code = sample.Code;
                resultStroke.Draw(this.canvas);
                sample.Add(resultStroke);
            }

            this.ViewModel.Add(sample);

            this.popup.IsOpen = false;
        }
Beispiel #2
0
        internal void AddMark(ImgMarkEntity imgMarkEntity)
        {
            SampleVieModel sample = new SampleVieModel();

            //sample.Name = imgMarkEntity.Name;

            //sample.Code = imgMarkEntity.PHMCodes;

            sample.Model = imgMarkEntity;

            //  Do:根据选择的样本类型来生成缺陷/样本
            if (this.ImageOprateCtrEntity.MarkType == MarkType.Defect)
            {
                DefectShape resultStroke = new DefectShape(this._dynamic);
                sample.Flag       = "\xe688";
                sample.Type       = "0";
                sample.Code       = imgMarkEntity.PHMCodes;
                resultStroke.Name = sample.Name;
                resultStroke.Code = sample.Code;
                resultStroke.Draw(this.canvas);
                sample.Add(resultStroke);
            }
            else if (this.ImageOprateCtrEntity.MarkType == MarkType.Sample)
            {
                SampleShape resultStroke = new SampleShape(this._dynamic);
                sample.Flag       = "\xeaf3";
                sample.Type       = "1";
                sample.Code       = imgMarkEntity.PHMCodes;
                resultStroke.Name = sample.Name;
                resultStroke.Code = sample.Code;
                resultStroke.Draw(this.canvas);
                sample.Add(resultStroke);
            }



            this.ViewModel.Add(sample);

            //  Do:触发新增事件
            this.ImageOprateCtrEntity.OnImgMarkOperateEvent(sample.Model);

            //  Do:清除动态框
            _dynamic.BegionMatch(false);
        }