Exemple #1
0
 /// <summary>
 /// 鼠标移出控件,清除鼠标移动个体
 /// </summary>
 private void userControl_MouseLeave(object sender, MouseEventArgs e)
 {
     if (MouseMoveItem != null)
     {
         MouseMoveItem.IsMouseMove = false;
         MouseMoveItem             = null;
     }
 }
Exemple #2
0
        /// <summary>
        /// 图谱初始化
        /// </summary>
        /// <param name="rowCount">行数</param>
        /// <param name="columnCount">列数</param>
        /// <param name="dic_DieState_Color">芯片状态-颜色 字典</param>
        /// <param name="initialDieState">初始状态</param>
        public void Initial(int rowCount, int columnCount, List <InspectionDataView> list_InspectionDataView)
        {
            DataCollection.Clear();
            ExampleCollection.Clear();
            double cellWidth, cellHeight;

            RowCount    = rowCount;
            ColumnCount = columnCount;
            SetCellSize(RowCount, ColumnCount, out cellWidth, out cellHeight);
            for (int i = 0; i < rowCount; i++)
            {
                for (int j = 0; j < columnCount; j++)
                {
                    MappingData data = new MappingData();
                    data.BorderThickness   = DefaultBorderThickness;
                    data.Width             = cellWidth;
                    data.Height            = cellHeight;
                    data.VariableX         = j * data.Width;
                    data.VariableY         = i * data.Height;
                    data.RowIndex          = i;
                    data.ColumnIndex       = j;
                    data.DieState          = InspectionResult.SKIP;
                    data.NormalBorderColor = DefaultBorderColor;
                    DataCollection.Add(data);
                }
            }
            foreach (InspectionDataView dataView in list_InspectionDataView)
            {
                DataCollection[dataView.RowIndex * ColumnCount + dataView.ColumnIndex].DieState = dataView.InspectionResult;
                if (dataView.List_DefectData.Count != 0)
                {
                    string[] defectTypeStrings = new string[dataView.List_DefectData.Count];
                    for (int i = 0; i < dataView.List_DefectData.Count; i++)
                    {
                        defectTypeStrings[i] = dataView.List_DefectData[i].ToString();
                    }
                    DataCollection[dataView.RowIndex * ColumnCount + dataView.ColumnIndex].DefectTypeIndexString = string.Join(";", defectTypeStrings);
                }
            }
            double fontSize = SetFontSize(cellWidth, cellHeight);

            foreach (MappingData data in DataCollection)
            {
                data.FontSize = fontSize;
            }

            foreach (KeyValuePair <InspectionResult, Color> kv in MappingData.Dict_DieState_Color)
            {
                ExampleData data = new ExampleData();
                data.DieState    = InspectionResultsConverter.ToString(kv.Key);
                data.FillColor   = kv.Value.ToString();
                data.BorderColor = DefaultBorderColor.ToString();
                data.Count       = DataCollection.Where(d => d.DieState == kv.Key).Count();
                ExampleCollection.Add(data);
            }
        }
Exemple #3
0
 /// <summary>
 /// 将单元格移动到视野内
 /// </summary>
 private void ScrollToView(MappingData data)
 {
     if (scrollViewer.ComputedHorizontalScrollBarVisibility == Visibility.Visible)
     {
         double viewWidth = scrollViewer.ActualWidth;
         if (scrollViewer.ComputedVerticalScrollBarVisibility == Visibility.Visible)
         {
             viewWidth = scrollViewer.ActualWidth - SystemParameters.VerticalScrollBarWidth;
         }
         double cellLeft  = data.VariableX;
         double cellRight = data.VariableX + data.Width;
         if (cellLeft < scrollViewer.HorizontalOffset || cellRight > scrollViewer.HorizontalOffset + viewWidth)
         {
             double cellCenter       = data.VariableX + data.Width / 2;
             double horizontalOffset = cellCenter - viewWidth / 2;
             if (horizontalOffset < 0)
             {
                 horizontalOffset = 0;
             }
             else if (horizontalOffset > scrollViewer.ScrollableWidth)
             {
                 horizontalOffset = scrollViewer.ScrollableWidth;
             }
             scrollViewer.ScrollToHorizontalOffset(horizontalOffset);
         }
     }
     if (scrollViewer.ComputedVerticalScrollBarVisibility == Visibility.Visible)
     {
         double viewHeight = scrollViewer.ActualHeight;
         if (scrollViewer.ComputedHorizontalScrollBarVisibility == Visibility.Visible)
         {
             viewHeight = scrollViewer.ActualHeight - SystemParameters.HorizontalScrollBarHeight;
         }
         double cellTop    = data.VariableY;
         double cellButton = data.VariableY + data.Height;
         if (cellTop < scrollViewer.VerticalOffset || cellButton > scrollViewer.VerticalOffset + viewHeight)
         {
             double cellCenter     = data.VariableY + data.Height / 2;
             double verticalOffset = cellCenter - viewHeight / 2;
             if (verticalOffset < 0)
             {
                 verticalOffset = 0;
             }
             else if (verticalOffset > scrollViewer.ScrollableHeight)
             {
                 verticalOffset = scrollViewer.ScrollableHeight;
             }
             scrollViewer.ScrollToVerticalOffset(verticalOffset);
         }
     }
 }
Exemple #4
0
        /// <summary>
        /// 鼠标右键菜单选择 复看错误代码
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Rectangle_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
            Grid        grid = sender as Grid;
            MappingData data = grid.DataContext as MappingData;

            data.IsSelected = true;

            GlobalRow    = data.RowIndex;
            GlobalColumn = data.ColumnIndex;


            //与数据库的复看数据进行比较 当前芯片是否被复看NG过 然后显示 取消
            bool IsEditNG = false;

            foreach (ReviewEditData reviewEditData in List_editData)
            {
                if (reviewEditData.Row == data.RowIndex && reviewEditData.Col == data.ColumnIndex)
                {
                    IsEditNG = true;
                }
            }

            // 判断是OK 才执行右键菜单事件 或者是之前复看成NG的
            if (data.DieState == InspectionResult.OK || IsEditNG)
            {
                ContextMenu menu = new ContextMenu();
                //Menu menu = new Menu();
                MenuItem EditErrCode = new MenuItem();
                EditErrCode.Header = "编辑错误码";
                foreach (KeyValuePair <int, string> kvp in Dict_DefectType)
                {
                    MenuItem DefectType = new MenuItem();
                    DefectType.Header = kvp.Key + "_" + kvp.Value;
                    DefectType.Click += DefectType_Click;
                    EditErrCode.Items.Add(DefectType);
                }

                menu.Items.Add(EditErrCode);

                MenuItem CancelErrCode = new MenuItem();
                CancelErrCode.Header    = "取消错误复判";
                CancelErrCode.Click    += CancelErrCode_Click;
                CancelErrCode.IsEnabled = IsEditNG;

                menu.Items.Add(CancelErrCode);

                menu.IsOpen = true;
            }
        }
Exemple #5
0
        public void ChangeSelectedDieExternal(int rowIndex, int columnIndex)
        {
            MappingData data = DataCollection[rowIndex * ColumnCount + columnIndex];

            data.IsSelected = true;
            if (SelectedItem == null)
            {
                SelectedItem = data;
                mappingViewModel.ChangeSelectedText(data.RowIndex, data.ColumnIndex, data.DieState);
                return;
            }
            if (SelectedItem != null && data != SelectedItem)
            {
                SelectedItem.IsSelected = false;
                SelectedItem            = data;
                mappingViewModel.ChangeSelectedText(data.RowIndex, data.ColumnIndex, data.DieState);
            }
            ScrollToView(data);
        }
Exemple #6
0
        /// <summary>
        /// 鼠标选中事件,更改选中单元格颜色,调用变化委托
        /// </summary>
        private void Rectangle_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Grid        grid = sender as Grid;
            MappingData data = grid.DataContext as MappingData;

            data.IsSelected = true;
            if (SelectedItem == null)
            {
                SelectedItem = data;
                SelectedDieChanged(SelectedItem.RowIndex, SelectedItem.ColumnIndex, SelectedItem.DieState);
                return;
            }
            if (SelectedItem != null && data != SelectedItem)
            {
                SelectedItem.IsSelected = false;
                SelectedItem            = data;
                SelectedDieChanged(SelectedItem.RowIndex, SelectedItem.ColumnIndex, SelectedItem.DieState);
            }
        }
Exemple #7
0
        /// <summary>
        /// 鼠标移动事件,更改移动单元格颜色
        /// </summary>
        private void Rectangle_MouseMove(object sender, MouseEventArgs e)
        {
            //Rectangle rectangle = sender as Rectangle;
            //MappingData data = rectangle.DataContext as MappingData;
            Grid        grid = sender as Grid;
            MappingData data = grid.DataContext as MappingData;

            data.IsMouseMove = true;
            if (MouseMoveItem == null)
            {
                MouseMoveItem = data;
                return;
            }
            if (MouseMoveItem != null && data != MouseMoveItem)
            {
                MouseMoveItem.IsMouseMove = false;
                MouseMoveItem             = data;
            }
        }
Exemple #8
0
        /// <summary>
        /// 修改芯片状态
        /// </summary>
        /// <param name="rowIndex">行序号,从0开始</param>
        /// <param name="columnIndex">列序号,从0开始</param>
        /// <param name="state">芯片状态</param>
        public void SetDieState(int rowIndex, int columnIndex, InspectionResult inspectionResult)
        {
            if (!IsInitialized)
            {
                return;
            }
            MappingData data = DataCollection[rowIndex * ColumnCount + columnIndex];

            ExampleData example = ExampleCollection.Where(e => e.DieState == InspectionResultsConverter.ToString(data.DieState)).FirstOrDefault();

            example.Count--;

            data.DieState = inspectionResult;

            example = ExampleCollection.Where(e => e.DieState == InspectionResultsConverter.ToString(data.DieState)).FirstOrDefault();
            example.Count++;
            mappingViewModel.ChangeSelectedText(rowIndex, columnIndex, inspectionResult);

            ScrollToView(data);
        }