public FileSelectionWindow(string baseDirectory, MainWindowConfiguration configuration) : base(configuration) { this.baseDirectory = baseDirectory; autocomplete = new DirectoryAutocomplete(baseDirectory); var completions = autocomplete.GetCompletionList(""); RedrawLabels(completions); }
public PasswordSelectionWindow(IEnumerable <string> options, MainWindowConfiguration configuration) : base(configuration) { foreach (var option in options) { var label = CreateLabel(option); AddLabel(label); } Select(Options.First()); }
/// <summary> /// Initialises the window with the provided options. /// </summary> protected MainWindow(MainWindowConfiguration configuration) { this.configuration = configuration; StyleConfig = ConfigManager.Config.Interface.Style; InitializeComponent(); if (configuration.Orientation == Orientation.Vertical) { WrapPanel.Orientation = Orientation.Vertical; // In order to prevent its content from wrapping, the WrapPanel should be added to a ScrollViewer. var scrollViewer = new ScrollViewer { VerticalScrollBarVisibility = ScrollBarVisibility.Hidden, Content = WrapPanel, Margin = new Thickness { Top = 25, Right = WrapPanel.Margin.Right, Bottom = WrapPanel.Margin.Bottom, Left = WrapPanel.Margin.Left } }; // The WrapPanel must be removed from the grid before its ScrollViewer can be added. Grid.Children.Remove(WrapPanel); Grid.Children.Add(scrollViewer); // Reorient the searchbox so its margins match those of the WrapPanel. SearchBox.Margin = new Thickness(5, 5, 5, 5); } else { Grid.Children.Remove(SearchBox); WrapPanel.Children.Add(SearchBox); } SearchBox.CaretBrush = BrushFromColourString(StyleConfig.CaretColour); SearchBox.Background = BrushFromColourString(StyleConfig.Search.BackgroundColour); SearchBox.Foreground = BrushFromColourString(StyleConfig.Search.TextColour); SearchBox.BorderThickness = new Thickness(StyleConfig.Search.BorderWidth); SearchBox.BorderBrush = BrushFromColourString(StyleConfig.Search.BorderColour); SearchBox.FontSize = StyleConfig.FontSize; SearchBox.FontFamily = new FontFamily(StyleConfig.FontFamily); Background = BrushFromColourString(StyleConfig.BackgroundColour); BorderBrush = BrushFromColourString(StyleConfig.BorderColour); BorderThickness = new Thickness(1); }