示例#1
0
        public ShellWindow()
        {
            InitializeComponent();

            //  Do:加载图片浏览主键
            this.grid_center.Children.Add(_imgOperate.BuildEntity());

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

            //  Do:注册编辑标定事件
            _imgOperate.ImgMarkOperateEvent += l =>
            {
                string fn = System.IO.Path.GetFileNameWithoutExtension(this._imgOperate.BuildEntity().Current.Value);

                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:注册风格化处理事件
            _imgOperate.ImgProcessEvent += (l, k) =>
            {
                Debug.WriteLine("图片路径:" + l);

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

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

            _imgOperate.PreviousImgEvent += () =>
            {
                Debug.WriteLine("PreviousImgEvent");
            };

            _imgOperate.NextImgEvent += () =>
            {
                Debug.WriteLine("NextImgEvent");
            };
        }
示例#2
0
        public ShellWindow()
        {
            InitializeComponent();

            //  Do:加载图片浏览主键
            this.grid_center.Children.Add(_imgOperate.BuildEntity());

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

            //  Do:注册编辑标定事件
            _imgOperate.ImgMarkOperateEvent += l =>
            {
                //string fn = System.IO.Path.GetFileNameWithoutExtension(this._imgOperate.BuildEntity().Current.Value);

                string fn = "TT";

                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:注册风格化处理事件
            _imgOperate.ImgProcessEvent += (l, k) =>
            {
                Debug.WriteLine("图片路径:" + l);

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

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

            _imgOperate.PreviousImgEvent += () =>
            {
                Debug.WriteLine("PreviousImgEvent");
            };

            _imgOperate.NextImgEvent += () =>
            {
                Debug.WriteLine("NextImgEvent");
            };

            _imgOperate.DrawMarkedMouseUp += (l, k) =>
            {
                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();
            };
        }
示例#3
0
        public ShellWindow()
        {
            InitializeComponent();

            //  Message:设置初始速度
            _imgOperate.Speed = 4;

            _imgOperate.WheelScale = 0.05;

            //  Do:加载图片浏览主键
            this.grid_center.Children.Add(_imgOperate.BuildEntity());

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

            //  Do:注册编辑标定事件
            _imgOperate.ImgMarkOperateEvent += (l, k) =>
            {
                string fn = System.IO.Path.GetFileNameWithoutExtension(this._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:注册风格化处理事件
            _imgOperate.ImgProcessEvent += (l, k) =>
            {
                Debug.WriteLine("图片路径:" + l);

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

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

            _imgOperate.PreviousImgEvent += () =>
            {
                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);

                collection = collection.Take(1);

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

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

                    //foreach (var c in list)
                    //{
                    //    c.Code = Guid.NewGuid().ToString();
                    //}

                    _imgOperate.LoadMarkEntitys(list);
                }
            };

            _imgOperate.NextImgEvent += () =>
            {
                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);

                collection = collection.Take(1);

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

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

                    //foreach (var c in list)
                    //{
                    //    c.Code = Guid.NewGuid().ToString();
                    //}

                    _imgOperate.LoadMarkEntitys(list);
                }
            };

            _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);

                string path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "_cache", Guid.NewGuid().ToString() + ".jpg");

                if (!Directory.Exists(System.IO.Path.GetDirectoryName(path)))
                {
                    Directory.CreateDirectory(System.IO.Path.GetDirectoryName(path));
                }

                BitmapImage bitmapImage = SystemUtils.ByteArrayToBitmapImage(l.PicData);

                SystemUtils.SaveBitmapImageIntoFile(bitmapImage, path);

                //_imgOperate.CancelAddMark();
            };


            _imgOperate.MarkEntitySelectChanged += (l, k) =>
            {
                Debug.WriteLine("MarkEntitySelectChanged" + l);
            };

            _imgOperate.FullScreenChangedEvent += (l, k) =>
            {
                Debug.WriteLine("DoubleClickFullScreenHandle" + l);
            };

            this.Loaded += ShellWindow_Loaded;
        }