Microsoft.Phone.Applications.UnitConverter.View.CategorySelection.DisplayPivot C# (CSharp) Method

DisplayPivot() private method

Background thread process to check for when we should display the pivot. This is to work around a Pivot Control known issue where we can't set the PivotIndex to any value or we get an argument null exception. If we are navigating to a pivot item that is not the default, there can be a delay in the header display animation. To make sure that the animation has completed, we will check the state of the pivotLayoutUpdate flag. If it has been set, we clear the flag and wait to see if there will be any further pivot updates. If not, we then will show the pivot control
private DisplayPivot ( object sender, DoWorkEventArgs e ) : void
sender object worker thread object
e System.ComponentModel.DoWorkEventArgs Standard Pattern
return void
        private void DisplayPivot(object sender, DoWorkEventArgs e)
        {
            while (true)
            {
                Thread.Sleep(125);
                lock (this.threadLock)
                {
                    if (this.pivotLayoutUpdate)
                    {
                        this.pivotLayoutUpdate = false;
                        continue;
                    }
                }
                Dispatcher.BeginInvoke(() =>
                    {
                        this.pivot.LayoutUpdated -= new EventHandler(pivot_LayoutUpdated);
                        this.pivot.Opacity = 1;
                    });
                break;
            }
        }