internal void Show(PendingProgress pendingProgress) { bool flag; this.bufSize = this.rawui.BufferSize; int width = this.bufSize.Width; Size windowSize = this.rawui.WindowSize; int num = Math.Max(5, windowSize.Height / 3); string[] strArrays = pendingProgress.Render(width, num, this.rawui); if (strArrays != null) { BufferCell[,] bufferCellArray = this.rawui.NewBufferCellArray(strArrays, this.ui.ProgressForegroundColor, this.ui.ProgressBackgroundColor); if (this.progressRegion != null) { if (bufferCellArray.GetLength(0) != this.progressRegion.GetLength(0) || bufferCellArray.GetLength(1) != this.progressRegion.GetLength(1)) { flag = true; } else { flag = false; } bool flag1 = flag; this.progressRegion = bufferCellArray; if (!flag1) { this.rawui.SetBufferContents(this.location, this.progressRegion); return; } else { if (this.IsShowing) { this.Hide(); } this.Show(); return; } } else { this.progressRegion = bufferCellArray; this.Show(); return; } } else { this.Hide(); this.progressRegion = null; return; } }
internal void Show(PendingProgress pendingProgress) { bool flag; this.bufSize = this.rawui.BufferSize; int width = this.bufSize.Width; Size windowSize = this.rawui.WindowSize; int num = Math.Max(5, windowSize.Height / 3); string[] strArrays = pendingProgress.Render(width, num, this.rawui); if (strArrays != null) { BufferCell[,] bufferCellArray = this.rawui.NewBufferCellArray(strArrays, this.ui.ProgressForegroundColor, this.ui.ProgressBackgroundColor); if (this.progressRegion != null) { if (bufferCellArray.GetLength(0) != this.progressRegion.GetLength(0) || bufferCellArray.GetLength(1) != this.progressRegion.GetLength(1)) { flag = true; } else { flag = false; } bool flag1 = flag; this.progressRegion = bufferCellArray; if (!flag1) { this.rawui.SetBufferContents(this.location, this.progressRegion); return; } else { if (this.IsShowing) { this.Hide(); } this.Show(); return; } } else { this.progressRegion = bufferCellArray; this.Show(); return; } } else { this.Hide(); this.progressRegion = null; return; } }
Show(PendingProgress pendingProgress) { Dbg.Assert(pendingProgress != null, "pendingProgress may not be null"); _bufSize = _rawui.BufferSize; // In order to keep from slicing any CJK double-cell characters that might be present in the screen buffer, // we use the full width of the buffer. int maxWidth = _bufSize.Width; int maxHeight = Math.Max(5, _rawui.WindowSize.Height / 3); string[] contents = pendingProgress.Render(maxWidth, maxHeight, _rawui); if (contents == null) { // There's nothing to show. Hide(); _progressRegion = null; return; } // NTRAID#Windows OS Bugs-1061752-2004/12/15-sburns should read a skin setting here... BufferCell[,] newRegion = _rawui.NewBufferCellArray(contents, _ui.ProgressForegroundColor, _ui.ProgressBackgroundColor); Dbg.Assert(newRegion != null, "NewBufferCellArray has failed!"); if (_progressRegion == null) { // we've never shown this pane before. _progressRegion = newRegion; Show(); } else { // We have shown the pane before. We have to be smart about when we restore the saved region to minimize // flicker. We need to decide if the new contents will change the dimensions of the progress pane // currently being shown. If it will, then restore the saved region, and show the new one. Otherwise, // just blast the new one on top of the last one shown. // We're only checking size, not content, as we assume that the content will always change upon receipt // of a new ProgressRecord. That's not guaranteed, of course, but it's a good bet. So checking content // would usually result in detection of a change, so why bother? bool sizeChanged = (newRegion.GetLength(0) != _progressRegion.GetLength(0)) || (newRegion.GetLength(1) != _progressRegion.GetLength(1)) ? true : false; _progressRegion = newRegion; if (sizeChanged) { if (IsShowing) { Hide(); } Show(); } else { _rawui.SetBufferContents(_location, _progressRegion); } } }
Show(PendingProgress pendingProgress) { Dbg.Assert(pendingProgress != null, "pendingProgress may not be null"); _bufSize = _rawui.BufferSize; // In order to keep from slicing any CJK double-cell characters that might be present in the screen buffer, // we use the full width of the buffer. int maxWidth = _bufSize.Width; int maxHeight = Math.Max(5, _rawui.WindowSize.Height / 3); string[] contents = pendingProgress.Render(maxWidth, maxHeight, _rawui); if (contents == null) { // There's nothing to show. Hide(); _progressRegion = null; return; } // NTRAID#Windows OS Bugs-1061752-2004/12/15-sburns should read a skin setting here... BufferCell[,] newRegion = _rawui.NewBufferCellArray(contents, _ui.ProgressForegroundColor, _ui.ProgressBackgroundColor); Dbg.Assert(newRegion != null, "NewBufferCellArray has failed!"); if (_progressRegion == null) { // we've never shown this pane before. _progressRegion = newRegion; Show(); } else { // We have shown the pane before. We have to be smart about when we restore the saved region to minimize // flicker. We need to decide if the new contents will change the dimensions of the progress pane // currently being shown. If it will, then restore the saved region, and show the new one. Otherwise, // just blast the new one on top of the last one shown. // We're only checking size, not content, as we assume that the content will always change upon receipt // of a new ProgressRecord. That's not guaranteed, of course, but it's a good bet. So checking content // would usually result in detection of a change, so why bother? bool sizeChanged = (newRegion.GetLength(0) != _progressRegion.GetLength(0)) || (newRegion.GetLength(1) != _progressRegion.GetLength(1)) ? true : false; _progressRegion = newRegion; if (sizeChanged) { if (IsShowing) { Hide(); } Show(); } else { _rawui.SetBufferContents(_location, _progressRegion); } } }
Show(PendingProgress pendingProgress) { Dbg.Assert(pendingProgress != null, "pendingProgress may not be null"); _bufSize = _rawui.BufferSize; // In order to keep from slicing any CJK double-cell characters that might be present in the screen buffer, // we use the full width of the buffer. int maxWidth = _bufSize.Width; int maxHeight = Math.Max(5, _rawui.WindowSize.Height / 3); _content = pendingProgress.Render(maxWidth, maxHeight, _rawui); if (_content == null) { // There's nothing to show. Hide(); _progressRegion = null; return; } BufferCell[,] newRegion; if (ProgressNode.IsMinimalProgressRenderingEnabled()) { // Legacy progress rendering relies on a BufferCell which defines a character, foreground color, and background color // per cell. This model doesn't work with ANSI escape sequences. However, there is existing logic on rendering that // relies on the existence of the BufferCell to know if something has been rendered previously. Here we are creating // an empty BufferCell, but using the second dimension to capture the number of rows so that we can clear that many // elsewhere in Hide(). newRegion = new BufferCell[0, _content.Length]; } else { newRegion = _rawui.NewBufferCellArray(_content, _ui.ProgressForegroundColor, _ui.ProgressBackgroundColor); } Dbg.Assert(newRegion != null, "NewBufferCellArray has failed!"); if (_progressRegion == null) { // we've never shown this pane before. _progressRegion = newRegion; Show(); } else { // We have shown the pane before. We have to be smart about when we restore the saved region to minimize // flicker. We need to decide if the new contents will change the dimensions of the progress pane // currently being shown. If it will, then restore the saved region, and show the new one. Otherwise, // just blast the new one on top of the last one shown. // We're only checking size, not content, as we assume that the content will always change upon receipt // of a new ProgressRecord. That's not guaranteed, of course, but it's a good bet. So checking content // would usually result in detection of a change, so why bother? bool sizeChanged = (newRegion.GetLength(0) != _progressRegion.GetLength(0)) || (newRegion.GetLength(1) != _progressRegion.GetLength(1)); _progressRegion = newRegion; if (sizeChanged) { if (IsShowing) { Hide(); } Show(); } else { if (ProgressNode.IsMinimalProgressRenderingEnabled()) { WriteContent(); } else { _rawui.SetBufferContents(_location, _progressRegion); } } } }