public void AddGroup(string name, StepUI.ProgressBarGroup group) { if (group != null) { group.ProgressChanged += GroupProgressChanged; } _groups.Add(group); // Set up a new TextBlock for the label TextBlock groupLabel = new TextBlock(); groupLabel.Text = name.ToUpper(); groupLabel.FontFamily = new FontFamily("Segoe UI"); const double PixelsPerPoint = 96.0 / 72.0; groupLabel.FontSize = 6.75 * PixelsPerPoint; groupLabel.FontWeight = FontWeights.SemiBold; // Set the TextBlock's color based on whether or not it is the first label // Also set the current group if (gridItems.Children.Count == 0) { groupLabel.Foreground = _selectedBrush; _currentGroup = 0; } else { groupLabel.Foreground = _unselectedBrush; } // Fit the label to its contents classInfo.applicationExtra.fitTextBlock(groupLabel); _totalLabelWidth += groupLabel.Width; // Add the label, realign everything, and update the progress bar gridItems.Children.Add(groupLabel); AlignLabels(); UpdateBar(0); }
private void GroupProgressChanged(StepUI.ProgressBarGroup group, double progress) { _currentGroup = _groups.IndexOf(group); UpdateBar(progress); }