TrakHound_Dashboard.Controls.TabHeader.ChangeWidth C# (CSharp) Method

ChangeWidth() private method

private ChangeWidth ( double width, System.Windows.Controls.TextBlock txt ) : void
width double
txt System.Windows.Controls.TextBlock
return void
        private void ChangeWidth(double width, TextBlock txt)
        {
            //Dispatcher.BeginInvoke(new Action(() =>
            //{
            //    double maxWidth = MAX_TEXT_WIDTH;
            //    if (MaxWidth < MAX_WIDTH)
            //    {
            //        maxWidth = MaxWidth - 120;
            //        maxWidth = Math.Min(MAX_TEXT_WIDTH, maxWidth);
            //        maxWidth = Math.Max(10, maxWidth);
            //    }

            //    if (width > maxWidth)
            //    {
            //        string t = Text;

            //        if (t != null)
            //        {
            //            double textWidth = GetFormattedText(t).Width;

            //            if (textWidth > maxWidth)
            //            {
            //                // Keep removing characters from the string until the max width is met
            //                while (textWidth > maxWidth)
            //                {
            //                    t = t.Substring(0, t.Length - 1);
            //                    textWidth = GetFormattedText(t).Width;
            //                }

            //                // Make sure the last character is not a space
            //                if (t[t.Length - 1] == ' ' && txt.Text.Length > t.Length + 2) t = txt.Text.Substring(0, t.Length + 2);

            //                // Add the ...
            //                txt.Text = t + "...";
            //            }
            //            else txt.Text = Text;
            //        }
            //    }
            //    else txt.Text = Text;

            //}), MainWindow.PRIORITY_CONTEXT_IDLE, new object[] { });
        }