Esempio n. 1
0
        private void Operate_DeleteImgEvent(string obj, IImgOperate operate)
        {
            int index = this.MediaSources.FindIndex(l => l.ImagePlayerService?.GetImgOperate() == operate);

            this.ImageIndexDeletedClicked?.Invoke(obj, index);

            Debug.WriteLine("Operate_DeleteImgEvent");
        }
Esempio n. 2
0
        private void Item_DrawMarkedMouseUp(ImgMarkEntity markEntity, MarkType type, IImgOperate operate)
        {
            int index = this.MediaSources.FindIndex(l => l.ImagePlayerService?.GetImgOperate() == operate);

            this.ImageIndexDrawMarkedMouseUp?.Invoke(markEntity, type, index);

            Debug.WriteLine("Item_DrawMarkedMouseUp");
        }
Esempio n. 3
0
        private void Operate_ImgMarkOperateEvent(ImgMarkEntity markEntity, IImgOperate operate)
        {
            int index = this.MediaSources.FindIndex(l => l.ImagePlayerService?.GetImgOperate() == operate);

            this.ImageIndexMarkOperateEvent?.Invoke(markEntity, index);

            Debug.WriteLine("Operate_ImgMarkOperateEvent");
        }
Esempio n. 4
0
        private void Operate_MarkEntitySelectChanged(ImgMarkEntity obj, IImgOperate operate)
        {
            int index = this.MediaSources.FindIndex(l => l.ImagePlayerService?.GetImgOperate() == operate);

            this.ImageMarkEntitySelectChanged?.Invoke(obj, index);

            Debug.WriteLine("Operate_MarkEntitySelectChanged");
        }
Esempio n. 5
0
        private void Operate_FullScreenChangedEvent(bool obj, IImgOperate operate)
        {
            int index = this.MediaSources.FindIndex(l => l.ImagePlayerService?.GetImgOperate() == operate);

            this.ImageIndexFullScreenEvent?.Invoke(index);

            Debug.WriteLine("Operate_FullScreenChangedEvent");
        }
 private void Image_control_DoubleClickFullScreenHandle(bool obj, IImgOperate arg2)
 {
     this.FullScreenHandle?.Invoke();
 }
Esempio n. 7
0
        public MainWindow()
        {
            InitializeComponent();

            IImgOperate _imgOperate = this.image.GetImgOperate();

            List <ImgMarkEntity> temp = new List <ImgMarkEntity>();

            //  Do:1、注册编辑标定事件 包括新增、删除
            _imgOperate.ImgMarkOperateEvent += (l, k) =>
            {
                temp.Clear();

                string fn = System.IO.Path.GetFileNameWithoutExtension(_imgOperate.GetCurrentUrl());

                string file = this.GetMarkFileName(fn);

                string str = l.markOperateType.ToString();

                Debug.WriteLine(str + ":" + l.Name + "-" + l.Code + $"({l.X},{l.Y}) {l.Width}*{l.Height}");

                temp.Add(l);

                string result = JsonConvert.SerializeObject(temp);

                File.WriteAllText(file, result);

                MessageBox.Show(str + ":" + l.Name + "-" + l.Code + $"({l.X},{l.Y}) {l.Width}*{l.Height}", "保存成功");
            };

            //  Do:2、注册风格化处理事件
            _imgOperate.ImgProcessEvent += (l, k) =>
            {
                Debug.WriteLine("图片路径:" + l);

                Debug.WriteLine("操作参数:" + k);

                MessageBox.Show(k.ToString());
            };

            //  Do:3、注册上一页事件 需要在此处加载上一页的标定 ImgMarkEntity
            _imgOperate.PreviousImgEvent += () =>
            {
                Debug.WriteLine("PreviousImgEvent");

                //  Message:加载Mark 20190105050908[2019-01-06-01-58-42].mark

                string current = _imgOperate.GetCurrentUrl();

                string fileName = System.IO.Path.GetFileNameWithoutExtension(current);

                var foder = Directory.CreateDirectory(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "\\Marks"));

                var collection = foder.GetFiles().Where(l => l.Name.StartsWith(fileName)).Select(l => l.FullName);

                foreach (var item in collection)
                {
                    string marks = File.ReadAllText(item);

                    var list = JsonConvert.DeserializeObject <List <ImgMarkEntity> >(marks);

                    _imgOperate.LoadMarkEntitys(list);
                }
            };

            //  Do:4、注册上一页事件 需要在此处加载下一页的标定 ImgMarkEntity
            _imgOperate.NextImgEvent += () =>
            {
                Debug.WriteLine("NextImgEvent");

                //  Message:加载Mark

                //  Message:加载Mark 20190105050908[2019-01-06-01-58-42].mark

                string current = _imgOperate.GetCurrentUrl();

                string fileName = System.IO.Path.GetFileNameWithoutExtension(current);

                var foder = Directory.CreateDirectory(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "\\Marks"));

                var collection = foder.GetFiles().Where(l => l.Name.StartsWith(fileName)).Select(l => l.FullName);

                foreach (var item in collection)
                {
                    string marks = File.ReadAllText(item);

                    var list = JsonConvert.DeserializeObject <List <ImgMarkEntity> >(marks);

                    _imgOperate.LoadMarkEntitys(list);
                }
            };

            //  Do:5、注册绘制矩形框结束事件 需要在此处弹出缺陷管理控件,并设置如下参数
            _imgOperate.DrawMarkedMouseUp += (l, k, m) =>
            {
                //Debug.WriteLine(l);
                //Debug.WriteLine(k);

                //  Do:选择的责任工区
                l.SelectResponsibilityWorkArea = new TyeBaseDepartmentEntity();
                //  Do:选择的责任车间
                l.SelectResponsibilityWorkshop = new TyeBaseDepartmentEntity();
                //  Do:选择的单元
                l.SelectBasicUnit = new TyeBasePillarEntity();
                //  Do:选择的站
                l.SelectDedicatedStation = new TyeBaseSiteEntity();
                //  Do:选择的段
                l.SelectDedicatedLine = new TyeBaseLineEntity();
                //  Do:选择的铁路局顺序码
                l.SelectRailwaySsequence = new TyeBaseRailwaystationEntity();
                //  Do:选择的数据采集方式
                l.SelectDataAcquisitionMode = new TyeBaseDatacollecttypeEntity();
                //  Do:PHM编码(基本由界面属性组合而成)
                l.PHMCodes = "PHM编码(基本由界面属性组合而成)";
                //  Do:当前用户
                l.tyeAdminUserEntity = new TyeAdminUserEntity();
                //  Do:检测日期
                l.DetectDate = DateTime.Now;
                //  Do:公里标
                l.KmLog = "公里标";
                //  Do:检测车辆
                l.DetectionVehicles = "检测车辆";

                //  Do:选择的缺陷
                l.SelectDefectOrMarkCodes = new TyeEncodeDeviceEntity();

                //  Do:选择的历史信息
                l.SelectCommonHistoricalDefectsOrMark = new DefectCommonUsed();

                _imgOperate.AddMark(l);

                //_imgOperate.CancelAddMark();
            };
        }