ME3Explorer.CurveEd.CurveGraph.TextBox_TextChanged C# (CSharp) Method

TextBox_TextChanged() private method

private TextBox_TextChanged ( object sender, System.Windows.Controls.TextChangedEventArgs e ) : void
sender object
e System.Windows.Controls.TextChangedEventArgs
return void
        private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            TextBox b = sender as TextBox;
            double d = 0;
            //SirCxyrtyx: doing a stack trace to resolve a circular calling situation is horrible, I know. I'm so sorry about this.
            if (double.TryParse(b.Text, out d) && b.IsFocused && b.IsKeyboardFocused && !KFreonLib.Misc.Methods.FindInStack("Anchor"))
            {
                Anchor a = graph.Children.OfType<Anchor>().FirstOrDefault(x => x.IsSelected);
                if (a != null && b.Name == "xTextBox")
                {
                    float next = a.point.Next?.Value.InVal ?? float.MaxValue;
                    float prev = a.point.Previous?.Value.InVal ?? float.MinValue;
                    if (d > prev && d < next)
                    {
                        a.point.Value.InVal = (float)d;
                        a.X = localX(d);
                        Paint(true);
                    }
                }
                else if (a != null && b.Name == "yTextBox")
                {
                    a.Y = localY(d);
                    Paint(true);
                }
            }
        }