private void MenuItem_Click_Delete(object sender, RoutedEventArgs e)
        {
            if (tempEp.Name != null && tempEp.Name != "")
            {
                canvas.UnregisterName(tempEp.Name);
                this.canvas.Children.Remove(tempEp);

                SQliteDbContext.DeleteOneExPin(tempEp.Name.Substring(1, tempEp.Name.Length - 1), (App.Current.Resources["Locator"] as ViewModelLocator).ExcelPaper.Fixture.FixtureType);
                ExcelPin p = (App.Current.Resources["Locator"] as ViewModelLocator).ExcelPaper.Pins.ToList().Find(x => x.PinNO == tempEp.Name.Substring(1, tempEp.Name.Length - 1));
                (App.Current.Resources["Locator"] as ViewModelLocator).ExcelPaper.Pins.Remove(p);
            }
        }
        private void Ellipse_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Ellipse ep = sender as Ellipse;

            mousedown = true;
            if (Operator != Operation.Create)
            {
                if (tempEp != null)
                {
                    tempEp.Fill = TempBruhes;
                }
                tempEp     = ep;
                TempBruhes = ep.Fill;
                ep.Fill    = Brushes.LawnGreen;

                ep.CaptureMouse();
            }
            if (Operator == Operation.Delete)
            {
                ep.ReleaseMouseCapture();
                canvas.UnregisterName(ep.Name);
                canvas.Children.Remove(ep);

                if (ep.Name != null && ep.Name != "")
                {
                    SQliteDbContext.DeleteOneExPin(ep.Name.Substring(1, ep.Name.Length - 1), (App.Current.Resources["Locator"] as ViewModelLocator).ExcelPaper.Fixture.FixtureType);
                    ExcelPin p = (App.Current.Resources["Locator"] as ViewModelLocator).ExcelPaper.Pins.ToList().Find(x => x.PinNO == ep.Name.Substring(1, ep.Name.Length - 1));
                    (App.Current.Resources["Locator"] as ViewModelLocator).ExcelPaper.Pins.Remove(p);
                }
            }
            if (Operator == Operation.Modify)
            {
                if (tempEp != null)
                {
                    int value = 0;
                    int.TryParse(txtDia.Text, out value);
                    if (cbDia.IsChecked.HasValue && cbDia.IsChecked.Value)
                    {
                        tempEp.Height = value;
                        tempEp.Width  = value;
                    }
                    if (cbDia.IsChecked.HasValue && cbColor.IsChecked.Value)
                    {
                        tempEp.Fill = clpk.SelectedBrush;
                    }
                }
                if (tempEp.Name == "")
                {
                    ExcelPin p = new ExcelPin();
                    p.PinEX  = canvas.RenderSize.Width;
                    p.PinEY  = canvas.RenderSize.Height;
                    p.PinSX  = Canvas.GetLeft(tempEp);
                    p.PinSY  = Canvas.GetTop(tempEp);
                    p.Radius = tempEp.ActualHeight;
                    if (tempEp.Fill.ToString().Trim().Length > 0 && tempEp.Fill.ToString() != "0")
                    {
                        p.DrawColor = tempEp.Fill.ToString();
                    }
                    else
                    {
                        p.DrawColor = "#FF0000";
                    }

                    if ((App.Current.Resources["Locator"] as ViewModelLocator).ExcelPaper.Fixture == null)
                    {
                        MessageBox.Show("请选择一个治具型号后再创建!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
                        return;
                    }
                    p.FixtureType = (App.Current.Resources["Locator"] as ViewModelLocator).ExcelPaper.Fixture.FixtureType;
                    (App.Current.Resources["Locator"] as ViewModelLocator).ExcelPaper.Pin = p;
                    ExcelPinWindow codeWindow = new ExcelPinWindow(false);
                    codeWindow.ShowDialog();
                    // tempEp.Name = "P" + p.PinNO;
                    //canvas.RegisterName(tempEp.Name, tempEp);
                    tempEp.Fill = TempBruhes;
                }
                else
                {
                    ExcelPin p = SQliteDbContext.GetOneExPin((App.Current.Resources["Locator"] as ViewModelLocator).ExcelPaper.Fixture.FixtureType, tempEp.Name.Substring(1, tempEp.Name.Length - 1));
                    if (p == null)
                    {
                        return;
                    }
                    p.PinEX  = canvas.RenderSize.Width;
                    p.PinEY  = canvas.RenderSize.Height;
                    p.PinSX  = Canvas.GetLeft(tempEp);
                    p.PinSY  = Canvas.GetTop(tempEp);
                    p.Radius = tempEp.ActualHeight;
                    (App.Current.Resources["Locator"] as ViewModelLocator).ExcelPaper.Pin = p;


                    ExcelPinWindow codeWindow = new ExcelPinWindow(true);

                    //  SQliteDbContext.UpdatOneExPin(p);
                    codeWindow.ShowDialog();
                    tempEp.Name = "P" + p.PinNO;
                }
            }
        }