public UiProgressWindow(string title, UiProgressUnits units = UiProgressUnits.Items) { _units = units; #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(Lang.Measurement.Elapsed + ": 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(Lang.Measurement.Remaining + ": 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 UiGameFileCommanderSettingsWindow(bool isExtracting) { #region Construct SizeToContent = SizeToContent.WidthAndHeight; WindowStartupLocation = WindowStartupLocation.CenterScreen; WindowStyle = WindowStyle.None; UiGrid root = UiGridFactory.Create(3, 1); { Thickness margin = new Thickness(3); UiStackPanel maskPanel = UiStackPanelFactory.Create(Orientation.Horizontal); { UiTextBlock maskLabel = UiTextBlockFactory.Create("Маска: "); { maskLabel.Margin = margin; maskLabel.VerticalAlignment = VerticalAlignment.Center; maskPanel.AddUiElement(maskLabel); } _wildcardBox = UiTextBoxFactory.Create("*"); { _wildcardBox.Width = 300; _wildcardBox.Margin = margin; maskPanel.AddUiElement(_wildcardBox); } root.AddUiElement(maskPanel, 0, 0); } UiStackPanel settingsPanel = UiStackPanelFactory.Create(Orientation.Horizontal); { if (!isExtracting) { _compressBox = UiCheckBoxFactory.Create("Сжать", false); { _compressBox.Margin = margin; _compressBox.IsThreeState = true; _compressBox.IsChecked = null; settingsPanel.AddUiElement(_compressBox); } } _convertBox = UiCheckBoxFactory.Create("Конвертировать", false); { _convertBox.Margin = margin; _convertBox.IsThreeState = true; _convertBox.IsChecked = null; settingsPanel.AddUiElement(_convertBox); } root.AddUiElement(settingsPanel, 1, 0); } UiStackPanel buttonsPanel = UiStackPanelFactory.Create(Orientation.Horizontal); { buttonsPanel.HorizontalAlignment = HorizontalAlignment.Right; UiButton okButton = UiButtonFactory.Create("OK"); { okButton.Width = 100; okButton.Margin = margin; okButton.Click += OnOkButtonClick; buttonsPanel.AddUiElement(okButton); } UiButton cancelButton = UiButtonFactory.Create("Отмена"); { cancelButton.Width = 100; cancelButton.Margin = margin; cancelButton.Click += OnCancelButtonClick; buttonsPanel.AddUiElement(cancelButton); } root.AddUiElement(buttonsPanel, 2, 0); } } Content = root; #endregion }