/// <summary>
        /// 点击
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OvenView_MouseDown(object sender, MouseButtonEventArgs e)
        {
            MachinePlatform mach = sender as MachinePlatform;

            if (mach != null)
            {
                int row = (int)mach.GetValue(Grid.RowProperty);
                int col = (int)mach.GetValue(Grid.ColumnProperty);
                ImgMachine.Visibility = Visibility.Visible;
                ChangeImgAddress(row > 0 ? row - 1 : row + 1, col, 1);


                //OvenViewModel model = mach.DataContext as OvenViewModel;
                //model.ImgSource = "pack://application:,,,/TengDa.UserControls;component/image/redlight.png";
                //model.TipInfo = "提示";
            }
            OvenView oven = sender as OvenView;

            if (oven != null)
            {
                int row = (int)oven.GetValue(Grid.RowProperty);
                int col = (int)oven.GetValue(Grid.ColumnProperty);
                ImgMachine.Visibility = Visibility.Visible;
                ChangeImgAddress(row > 0 ? row - 1 : row + 1, col, 2);

                OvenViewModel model = oven.DataContext as OvenViewModel;
                model.ImgSource = "pack://application:,,,/TengDa.UserControls;component/image/redlight.png";
                model.TipInfo   = "提示";
            }
        }
        /// <summary>
        /// 动态生成页面
        /// </summary>
        void CreateView()
        {
            var AllList    = fixtureFurnaceMainDB.GetAllData();
            var topList    = AllList.Where(a => a.FFMBerthPosition == 1).OrderBy(b => b.FFMRowSort).ToList(); //查询上面机台数量
            var bottomList = AllList.Where(a => a.FFMBerthPosition == 2).ToList();                            //查询下面机台数量

            int countNum = topList.Count() > bottomList.Count() ? topList.Count() : bottomList.Count();

            CreateGrid(countNum);
            //for (int i = 0; i < 3; i++)
            //{
            //    Image img = new Image();
            //    img.Source = new BitmapImage(new Uri("/TengDa.UserControls/assets/stop.png", UriKind.Relative));
            //    img.Width = 130;
            //   // img.Source = new Uri("pack://application:,,,/TengDa.UserControls;component/image/ToBottom.png", UriKind.Absolute);
            //    MainView.Children.Add(img); //添加到Grid控件
            //    img.SetValue(Grid.RowProperty, 0); //设置按钮所在Grid控件的行
            //    img.SetValue(Grid.ColumnProperty, 2); //设置按钮所在Grid控件的列
            //                                                                     //machinePlatform.MouseDown += OvenView_MouseDown;
            //}
            for (int i = 0; i < countNum; i++)
            {
                if (i + 1 <= topList.Count() && topList[i].FFMBerthPosition == 1) //生成顶部机台
                {
                    if (topList[i].FFMCreateType == 1)                            //生成炉子
                    {
                        TengDa.UserControls.OvenView ovenView = new OvenView();
                        ovenView.EBtnMethod += OvenView_EBtnMethod;
                        ovenView.Name        = string.Format("button" + topList[i].FFMId);
                        ovenView.CreateKilnInfo(Convert.ToInt32(topList[i].FFMCountLayer), topList[i].FFMName, topList[i].FFMNumber.ToString());
                        ovenView.VerticalAlignment = VerticalAlignment.Center;
                        ovenView.Width             = 130;                                        //MainView.RowDefinitions[0].Height.Value;
                        MainView.Children.Add(ovenView);                                         //添加到Grid控件
                        ovenView.SetValue(Grid.RowProperty, 0);                                  //设置按钮所在Grid控件的行
                        ovenView.SetValue(Grid.ColumnProperty, (topList[i].FFMRowSort - 1) * 2); //设置按钮所在Grid控件的列
                        ovenView.MouseDown += OvenView_MouseDown;
                    }
                    else if (topList[i].FFMCreateType == 2)//生成上下料平台
                    {
                        TengDa.UserControls.MachinePlatform machinePlatform = new MachinePlatform();
                        machinePlatform.MouseDown += OvenView_MouseDown;
                        machinePlatform.EBtnInfo  += MachinePlatform_EBtnMethod;
                        machinePlatform.Name       = string.Format("button" + topList[i].FFMId);
                        machinePlatform.CreateKilnInfo(Convert.ToInt32(topList[i].FFMCountLayer), topList[i].FFMName, topList[i].FFMNumber.ToString());
                        machinePlatform.VerticalAlignment = VerticalAlignment.Center;
                        machinePlatform.Width             = 130;                                        //MainView.RowDefinitions[0].Height.Value;
                        MainView.Children.Add(machinePlatform);                                         //添加到Grid控件
                        machinePlatform.SetValue(Grid.RowProperty, 0);                                  //设置按钮所在Grid控件的行
                        machinePlatform.SetValue(Grid.ColumnProperty, (topList[i].FFMRowSort - 1) * 2); //设置按钮所在Grid控件的列
                        //machinePlatform.MouseDown += OvenView_MouseDown;
                    }
                }
                if (i + 1 <= bottomList.Count() && bottomList[i].FFMBerthPosition == 2) //生成顶部机台
                {
                    if (bottomList[i].FFMCreateType == 1)                               //生成炉子
                    {
                        TengDa.UserControls.OvenView ovenView = new OvenView();
                        ovenView.EBtnMethod += OvenView_EBtnMethod;
                        ovenView.Name        = string.Format("button" + bottomList[i].FFMId);
                        ovenView.CreateKilnInfo(Convert.ToInt32(bottomList[i].FFMCountLayer), bottomList[i].FFMName, bottomList[i].FFMNumber);
                        ovenView.VerticalAlignment = VerticalAlignment.Center;
                        ovenView.Width             = 130;                                           //MainView.RowDefinitions[0].Height.Value;
                        MainView.Children.Add(ovenView);                                            //添加到Grid控件
                        ovenView.SetValue(Grid.RowProperty, 2);                                     //设置按钮所在Grid控件的行
                        ovenView.SetValue(Grid.ColumnProperty, (bottomList[i].FFMRowSort - 1) * 2); //设置按钮所在Grid控件的列
                        ovenView.MouseDown += OvenView_MouseDown;
                    }
                    else if (bottomList[i].FFMCreateType == 2)//生成上下料平台
                    {
                        TengDa.UserControls.MachinePlatform machinePlatform = new MachinePlatform();
                        machinePlatform.EBtnInfo  += MachinePlatform_EBtnMethod;
                        machinePlatform.MouseDown += OvenView_MouseDown;
                        machinePlatform.Name       = string.Format("button" + bottomList[i].FFMId);
                        machinePlatform.CreateKilnInfo(Convert.ToInt32(bottomList[i].FFMCountLayer), bottomList[i].FFMName, bottomList[i].FFMNumber.ToString());
                        machinePlatform.VerticalAlignment = VerticalAlignment.Center;
                        machinePlatform.Width             = 130;                                                                                        //MainView.RowDefinitions[0].Height.Value;
                        MainView.Children.Add(machinePlatform);                                                                                         //添加到Grid控件
                        machinePlatform.SetValue(Grid.RowProperty, 2);                                                                                  //设置按钮所在Grid控件的行
                        machinePlatform.SetValue(Grid.ColumnProperty, (bottomList[i].FFMRowSort - 1) * 2 < 0 ? 1 : (bottomList[i].FFMRowSort - 1) * 2); //设置按钮所在Grid控件的列
                                                                                                                                                        //machinePlatform.MouseDown += OvenView_MouseDown;
                    }
                }
            }



            #region 机器人图片属性设置
            ImgMachine = new Image();
            MainView.Children.Add(ImgMachine); //添加到Grid控件

            ImgMachineAlarm = new Image();
            MainView.Children.Add(ImgMachineAlarm); //添加到Grid控件

            ImgMachineAlarm.Stretch             = Stretch.None;
            ImgMachineAlarm.Margin              = new Thickness(0, 0, 5, 0);
            ImgMachineAlarm.HorizontalAlignment = HorizontalAlignment.Right;
            ImgMachineAlarm.VerticalAlignment   = VerticalAlignment.Top;
            ImgMachineAlarm.ToolTip             = "测试数据";
            #endregion
        }