diff --git a/Terminal.Gui/FileServices/FileDialogStyle.cs b/Terminal.Gui/FileServices/FileDialogStyle.cs index 298740240..66ddc3089 100644 --- a/Terminal.Gui/FileServices/FileDialogStyle.cs +++ b/Terminal.Gui/FileServices/FileDialogStyle.cs @@ -21,7 +21,7 @@ namespace Terminal.Gui { /// Gets or sets the default value to use for . /// This can be populated from .tui config files via /// - [SerializableConfigurationProperty(Scope = typeof (SettingsScope))] + [SerializableConfigurationProperty (Scope = typeof (SettingsScope))] public static bool DefaultUseColors { get; set; } /// @@ -42,20 +42,20 @@ namespace Terminal.Gui { /// Gets or sets the class responsible for determining which symbol /// to use to represent files and directories. /// - public FileSystemIconProvider IconProvider { get; set;} = new FileSystemIconProvider(); + public FileSystemIconProvider IconProvider { get; set; } = new FileSystemIconProvider (); /// /// Gets or sets the class thatis responsible for determining which color /// to use to represent files and directories when is /// . /// - public FileSystemColorProvider ColorProvider { get;set;} = new FileSystemColorProvider(); + public FileSystemColorProvider ColorProvider { get; set; } = new FileSystemColorProvider (); /// /// Gets or sets the culture to use (e.g. for number formatting). /// Defaults to . /// - public CultureInfo Culture {get;set;} = CultureInfo.CurrentUICulture; + public CultureInfo Culture { get; set; } = CultureInfo.CurrentUICulture; /// /// Gets or sets the header text displayed in the Filename column of the files table. @@ -184,7 +184,7 @@ namespace Terminal.Gui { } - private Dictionary DefaultTreeRootGetter () + private Dictionary DefaultTreeRootGetter () { var roots = new Dictionary (); try { @@ -192,7 +192,7 @@ namespace Terminal.Gui { var dir = _fileSystem.DirectoryInfo.New (d); - if (!roots.ContainsKey(dir)) { + if (!roots.ContainsKey (dir)) { roots.Add (dir, d); } } @@ -206,14 +206,14 @@ namespace Terminal.Gui { try { var path = Environment.GetFolderPath (special); - if(string.IsNullOrWhiteSpace (path)) { + if (string.IsNullOrWhiteSpace (path)) { continue; } var dir = _fileSystem.DirectoryInfo.New (path); if (!roots.ContainsKey (dir) && dir.Exists) { - roots.Add (dir, special.ToString()); + roots.Add (dir, special.ToString ()); } } catch (Exception) { // Special file exists but contents are unreadable (permissions?) diff --git a/Terminal.Gui/Views/FileDialog.cs b/Terminal.Gui/Views/FileDialog.cs index ae886f627..bbc6cd22d 100644 --- a/Terminal.Gui/Views/FileDialog.cs +++ b/Terminal.Gui/Views/FileDialog.cs @@ -105,7 +105,7 @@ namespace Terminal.Gui { private int currentSortColumn; private bool currentSortIsAsc = true; - private Dictionary _treeRoots = new Dictionary(); + private Dictionary _treeRoots = new Dictionary (); /// /// Event fired when user attempts to confirm a selection (or multi selection). @@ -374,13 +374,13 @@ namespace Terminal.Gui { { var fsi = (IFileSystemInfo)o; - if(o is IDirectoryInfo dir && _treeRoots.ContainsKey(dir)) { + if (o is IDirectoryInfo dir && _treeRoots.ContainsKey (dir)) { // Directory has a special name e.g. 'Pictures' return _treeRoots [dir]; } - return (Style.IconProvider.GetIconWithOptionalSpace(fsi) + fsi.Name).Trim(); + return (Style.IconProvider.GetIconWithOptionalSpace (fsi) + fsi.Name).Trim (); } private void OnTableViewMouseClick (object sender, MouseEventEventArgs e) @@ -647,8 +647,8 @@ namespace Terminal.Gui { this.btnForward.Text = this.GetForwardButtonText (); this.btnToggleSplitterCollapse.Text = this.GetToggleSplitterText (false); - if(Style.FlipOkCancelButtonLayoutOrder) { - btnCancel.X = Pos.Function(this.CalculateOkButtonPosX); + if (Style.FlipOkCancelButtonLayoutOrder) { + btnCancel.X = Pos.Function (this.CalculateOkButtonPosX); btnOk.X = Pos.Right (btnCancel) + 1; @@ -1187,13 +1187,13 @@ namespace Terminal.Gui { } - var color = Style.ColorProvider.GetTrueColor(stats.FileSystemInfo) - ?? TrueColor.FromConsoleColor(Color.White); - var black = TrueColor.FromConsoleColor(Color.Black); + var color = Style.ColorProvider.GetTrueColor (stats.FileSystemInfo) + ?? TrueColor.FromConsoleColor (Color.White); + var black = TrueColor.FromConsoleColor (Color.Black); // TODO: Add some kind of cache for this - return new ColorScheme{ - Normal = new Attribute (color,black), + return new ColorScheme { + Normal = new Attribute (color, black), HotNormal = new Attribute (color, black), Focus = new Attribute (black, color), HotFocus = new Attribute (black, color), diff --git a/UICatalog/Scenarios/FileDialogExamples.cs b/UICatalog/Scenarios/FileDialogExamples.cs index 99ffb145d..8a0fcf11e 100644 --- a/UICatalog/Scenarios/FileDialogExamples.cs +++ b/UICatalog/Scenarios/FileDialogExamples.cs @@ -123,13 +123,13 @@ namespace UICatalog.Scenarios { }); Win.Add (new Label ("Buttons") { X = x++, Y = y++ }); - Win.Add(new Label("Ok Text:") { X = x, Y = y++ }); + Win.Add (new Label ("Ok Text:") { X = x, Y = y++ }); tbOkButton = new TextField () { X = x, Y = y++, Width = 12 }; Win.Add (tbOkButton); Win.Add (new Label ("Cancel Text:") { X = x, Y = y++ }); tbCancelButton = new TextField () { X = x, Y = y++, Width = 12 }; Win.Add (tbCancelButton); - cbFlipButtonOrder = new CheckBox ("Flip Order") { X = x, Y = y++}; + cbFlipButtonOrder = new CheckBox ("Flip Order") { X = x, Y = y++ }; Win.Add (cbFlipButtonOrder); var btn = new Button ($"Run Dialog") { @@ -187,7 +187,7 @@ namespace UICatalog.Scenarios { if (cbDrivesOnlyInTree.Checked ?? false) { fd.Style.TreeRootGetter = () => { - return System.Environment.GetLogicalDrives ().ToDictionary(dirInfoFactory.New,k=>k); + return System.Environment.GetLogicalDrives ().ToDictionary (dirInfoFactory.New, k => k); }; } @@ -204,9 +204,9 @@ namespace UICatalog.Scenarios { fd.Style.OkButtonText = tbOkButton.Text; } if (!string.IsNullOrWhiteSpace (tbCancelButton.Text)) { - fd.Style.CancelButtonText= tbCancelButton.Text; + fd.Style.CancelButtonText = tbCancelButton.Text; } - if(cbFlipButtonOrder.Checked ?? false) { + if (cbFlipButtonOrder.Checked ?? false) { fd.Style.FlipOkCancelButtonLayoutOrder = true; }