领胜LDS 键盘AOI检测项目
wells.liu
2020-09-07 1491846b4736bc2e79604086acfd8544aa3ba384
src/Bro.UI.Model.Winform/UI/Canvas.cs
@@ -77,7 +77,7 @@
            set => stsStatus.Visible = value;
        }
        private async void OnMouseLocationUpdated(Point screenPoint, Point imagePoint, string colorDesc)
        private void OnMouseLocationUpdated(Point screenPoint, Point imagePoint, string colorDesc)
        {
            //await Task.Run(() => tsslLocation.Text = $"屏幕坐标X:{screenPoint.X},Y:{screenPoint.Y}    图片坐标X:{imagePoint.X},Y:{imagePoint.Y}   颜色:{colorDesc}");
            this.Invoke(new Action(() =>
@@ -237,7 +237,7 @@
            {
                ele.IsEnabled = e.CheckedState;
            }
            OnElementChanged();
            OnElementChanged(null);
        }
        private void dgElements_SelectionChanged(object sender, EventArgs e)
@@ -270,7 +270,7 @@
        private void Elements_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            OnElementChanged();
            OnElementChanged(null);
            foreach (IShapeElement ele in Elements)
            {
@@ -281,14 +281,17 @@
        private void Ele_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            OnElementChanged();
            OnElementChanged(sender as IShapeElement);
        }
        private void OnElementChanged()
        private void OnElementChanged(IShapeElement ele)
        {
            if (ele != null)
                OnElementChangedHandle?.Invoke(ele);
            if (InvokeRequired)
            {
                Invoke(new Action(() => OnElementChanged()));
                Invoke(new Action(() => OnElementChanged(ele)));
            }
            else
            {
@@ -381,17 +384,17 @@
        private void tsmiUnselectElements_Click(object sender, EventArgs e)
        {
            if (MouseState == MouseState.SelectedElement)
            {
                MouseState = MouseState.Normal;
            //if (MouseState == MouseState.SelectedElement)
            //{
            //    MouseState = MouseState.Normal;
                //Elements.ForEach(ele =>
                foreach (IShapeElement ele in Elements)
                {
                    ele.State = ElementState.Normal;
                }
                //);
            }
            //    //Elements.ForEach(ele =>
            //    foreach (IShapeElement ele in Elements)
            //    {
            //        ele.State = ElementState.Normal;
            //    }
            //    //);
            //}
        }
        #endregion
@@ -543,5 +546,9 @@
            }
        }
        #endregion
        #region 事件
        public event Action<IShapeElement> OnElementChangedHandle;
        #endregion
    }
}