public UiProgressWindow(string title) { #region Construct Height = 72; Width = 320; WindowStartupLocation = WindowStartupLocation.CenterScreen; WindowStyle = WindowStyle.None; UiGrid root = UiGridFactory.Create(3, 1); root.SetRowsHeight(GridLength.Auto); root.Margin = new Thickness(5); UiTextBlock titleTextBlock = UiTextBlockFactory.Create(title); { titleTextBlock.VerticalAlignment = VerticalAlignment.Center; titleTextBlock.HorizontalAlignment = HorizontalAlignment.Center; root.AddUiElement(titleTextBlock, 0, 0); } _progressBar = UiProgressBarFactory.Create(); { root.AddUiElement(_progressBar, 1, 0); } _progressTextBlock = UiTextBlockFactory.Create("100%"); { _progressTextBlock.VerticalAlignment = VerticalAlignment.Center; _progressTextBlock.HorizontalAlignment = HorizontalAlignment.Center; root.AddUiElement(_progressTextBlock, 1, 0); } _elapsedTextBlock = UiTextBlockFactory.Create("Прошло: 00:00"); { _elapsedTextBlock.HorizontalAlignment = HorizontalAlignment.Left; root.AddUiElement(_elapsedTextBlock, 2, 0); } _processedTextBlock = UiTextBlockFactory.Create("0 / 0"); { _processedTextBlock.HorizontalAlignment = HorizontalAlignment.Center; root.AddUiElement(_processedTextBlock, 2, 0); } _remainingTextBlock = UiTextBlockFactory.Create("Осталось: 00:00"); { _remainingTextBlock.HorizontalAlignment = HorizontalAlignment.Right; root.AddUiElement(_remainingTextBlock, 2, 0); } Content = root; #endregion Loaded += OnLoaded; Closing += OnClosing; _timer = new Timer(500); _timer.Elapsed += OnTimer; }
public static UiGrid Create(int rows, int cols) { Exceptions.CheckArgumentOutOfRangeException(rows, "rows", 1, 1024); Exceptions.CheckArgumentOutOfRangeException(cols, "cols", 1, 1024); UiGrid grid = new UiGrid(); if (rows > 1) { while (rows-- > 0) { grid.RowDefinitions.Add(new RowDefinition()); } } if (cols > 1) { while (cols-- > 0) { grid.ColumnDefinitions.Add(new ColumnDefinition()); } } return(grid); }