private void LoadData_Click(object sender, RoutedEventArgs e)
        {
            TabletModelInformation tmi = HobNumber.Text.Length > 0 ? new TabletModelInformation(HobNumber.Text) : new TabletModelInformation();

            DieNumber.Text = tmi.DieNumber;
            HobNumber.Text = tmi.HobNumber;

            // Check if hob or die exists
            var  _         = new NAT01Context();
            bool hobExists = _.HobList.Any(h => h.HobNo == tmi.HobNumber && h.TipQty == short.Parse(TipQuantity.Text) && h.BoreCircle == float.Parse(BoreCircle.Text));
            bool dieExists = _.DieList.Any(d => d.DieId == tmi.DieNumber);

            _.Dispose();

            // Change Add Hob button to Update Hob if hob exists
            AddHobButton.Content = hobExists ? "Update Hob" : "Add Hob";

            // Change Add Die button to Update Die if die exists
            AddDieButton.Content = dieExists ? "Update Die" : "Add Die";

            TipQuantity.Text = "1";
            bool dieInfoFilled = FillDieInfo();

            // If die does not exist, pull in info from model
            if (!dieInfoFilled)
            {
                // Load die info from model
                Width.Text            = tmi.Width.ToString("#.0000");
                WidthMetric.Text      = (tmi.Width * 25.4).ToString("#.00");
                Length.Text           = tmi.Length.ToString("#.0000");
                LengthMetric.Text     = (tmi.Length * 25.4).ToString("#.00");
                EndRadius.Text        = tmi.EndRadius.ToString("#.0000");
                EndRadiusMetric.Text  = (tmi.EndRadius * 25.4).ToString("#.00");
                SideRadius.Text       = tmi.SideRadius.ToString("#.0000");
                SideRadiusMetric.Text = (tmi.SideRadius * 25.4).ToString("#.00");
            }

            BoreCircle.Text      = "0.0000";
            HobStatus.Text       = "D";
            Size.Text            = ""; // TODO: Build size string
            Shape.Text           = ""; // TODO: Build shape string
            CupDepth.Text        = tmi.CupDepth.ToString("#.0000");
            CupDepthMetric.Text  = (tmi.CupDepth * 25.4).ToString("#.00");
            CupRadius.Text       = tmi.CupRadius.ToString("#.0000");
            CupRadiusMetric.Text = (tmi.CupRadius * 25.4).ToString("#.00");
            Land.Text            = tmi.Land.ToString("#.0000");
            LandMetric.Text      = (tmi.Land * 25.4).ToString("#.00");
            LandRange.Text       = "0.0000";
            LandRangeMetric.Text = "0.00";
            // Measurable Cup Depth
            // Cup Code
            // Bisect Code
            Owner.Text        = ""; // TODO: Get owner customer number
            DateDesigned.Text = DateTime.Now.ToShortDateString();
            // Hob Class
            DrawingYN.Text   = "Y";
            DrawingType.Text = "SW";
            // Program/Project Number
            NNumber.Text = "0";
        }
 private void TypingTimer_Elapsed(object sender, ElapsedEventArgs e)
 {
     try
     {
         //if (!String.IsNullOrWhiteSpace(editedText))
         //{
         Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Input, new Action(() =>
         {
             if (DieNumber.IsFocused)
             {
                 typingTimer.Stop();
                 bool dieInfoFilled = FillDieInfo();
                 if (dieInfoFilled)
                 {
                     AddDieButton.Content = "Update Die";
                 }
                 else
                 {
                     AddDieButton.Content = "Add Die";
                 }
             }
             else if (HobNumber.IsFocused)
             {
                 typingTimer.Stop();
                 bool hobInfoFilled = FillHobInfo();
                 if (hobInfoFilled && openedHobNumber != HobNumber.Text)
                 {
                     AddHobButton.Content       = "Update Hob";
                     TabletModelInformation tmi = new TabletModelInformation(HobNumber.Text);
                     openedHobNumber            = HobNumber.Text;
                     DieNumber.Text             = tmi.DieNumber;
                     bool dieInfoFilled         = FillDieInfo();
                     CheckMatch(tmi.Width.ToString("#.0000"), Width.Text, Width);
                     CheckMatch((tmi.Width * 25.4).ToString("#.000"), WidthMetric.Text, WidthMetric);
                     CheckMatch(tmi.Length.ToString("#.0000"), Length.Text, Length);
                     CheckMatch((tmi.Length * 25.4).ToString("#.000"), LengthMetric.Text, LengthMetric);
                     CheckMatch(tmi.EndRadius.ToString("#.0000"), EndRadius.Text, EndRadius);
                     CheckMatch((tmi.EndRadius * 25.4).ToString("#.000"), EndRadiusMetric.Text, EndRadiusMetric);
                     CheckMatch(tmi.SideRadius.ToString("#.0000"), SideRadius.Text, SideRadius);
                     CheckMatch((tmi.SideRadius * 25.4).ToString("#.000"), SideRadiusMetric.Text, SideRadiusMetric);
                     CheckMatch(tmi.CupDepth.ToString("#.0000"), CupDepth.Text, CupDepth);
                     CheckMatch((tmi.CupDepth * 25.4).ToString("#.000"), CupDepthMetric.Text, CupDepthMetric);
                     CheckMatch(tmi.Land.ToString("#.0000"), Land.Text, Land);
                     CheckMatch((tmi.Land * 25.4).ToString("#.000"), LandMetric.Text, LandMetric);
                 }
             }
         }));
         //}
     }
     catch (Exception ex)
     {
     }
     typingTimer.Stop();
 }