File tree Expand file tree Collapse file tree 5 files changed +57
-14
lines changed
DevToys.Blazor/BuiltInTools/Settings Expand file tree Collapse file tree 5 files changed +57
-14
lines changed Original file line number Diff line number Diff line change 224224 <data name =" PasteClearsTextStateDescriptionWhenOn" xml : space =" preserve" >
225225 <value >Replace text when pasting</value >
226226 </data >
227+ <data name =" RecentTools" xml : space =" preserve" >
228+ <value >Show most recent used tools</value >
229+ </data >
230+ <data name =" RecentToolsDescription" xml : space =" preserve" >
231+ <value >Display the last 3 used tools in the menu. The change will take effect after restarting the app.</value >
232+ </data >
227233 <data name =" RenderWhitespace" xml : space =" preserve" >
228234 <value >Render white space</value >
229235 </data >
Original file line number Diff line number Diff line change @@ -129,6 +129,14 @@ public UIToolView View
129129 _settingsProvider ,
130130 PredefinedSettings . CheckForUpdate ) ,
131131
132+ Setting ( "recenttools-setting" )
133+ . Icon ( "FluentSystemIcons" , '\uED83 ' )
134+ . Title ( Settings . RecentTools )
135+ . Description ( Settings . RecentToolsDescription )
136+ . Handle (
137+ _settingsProvider ,
138+ PredefinedSettings . ShowMostRecentTools ) ,
139+
132140 SettingGroup ( "smart-detection-settings" )
133141 . Icon ( "FluentSystemIcons" , '\uF4D5 ' )
134142 . Title ( Settings . SmartDetection )
Original file line number Diff line number Diff line change @@ -94,6 +94,14 @@ public static readonly SettingDefinition<string> RecentTool3
9494 name : nameof ( RecentTool3 ) ,
9595 defaultValue : string . Empty ) ;
9696
97+ /// <summary>
98+ /// Whether the most recent tools should be displayed.
99+ /// </summary>
100+ public static readonly SettingDefinition < bool > ShowMostRecentTools
101+ = new (
102+ name : nameof ( ShowMostRecentTools ) ,
103+ defaultValue : true ) ;
104+
97105 /// <summary>
98106 /// Whether the app should automatically check for updates.
99107 /// </summary>
Original file line number Diff line number Diff line change @@ -158,23 +158,26 @@ public void SetMostRecentUsedTool(GuiToolInstance guiToolInstance)
158158 /// </summary>
159159 public IEnumerable < GuiToolInstance > GetMostRecentUsedTools ( )
160160 {
161- GuiToolInstance ? recentTool1 = GetToolFromInternalName ( _settingsProvider . GetSetting ( PredefinedSettings . RecentTool1 ) ) ;
162- GuiToolInstance ? recentTool2 = GetToolFromInternalName ( _settingsProvider . GetSetting ( PredefinedSettings . RecentTool2 ) ) ;
163- GuiToolInstance ? recentTool3 = GetToolFromInternalName ( _settingsProvider . GetSetting ( PredefinedSettings . RecentTool3 ) ) ;
164-
165- if ( recentTool1 is not null )
161+ if ( _settingsProvider . GetSetting ( PredefinedSettings . ShowMostRecentTools ) )
166162 {
167- yield return recentTool1 ;
168- }
163+ GuiToolInstance ? recentTool1 = GetToolFromInternalName ( _settingsProvider . GetSetting ( PredefinedSettings . RecentTool1 ) ) ;
164+ GuiToolInstance ? recentTool2 = GetToolFromInternalName ( _settingsProvider . GetSetting ( PredefinedSettings . RecentTool2 ) ) ;
165+ GuiToolInstance ? recentTool3 = GetToolFromInternalName ( _settingsProvider . GetSetting ( PredefinedSettings . RecentTool3 ) ) ;
169166
170- if ( recentTool2 is not null )
171- {
172- yield return recentTool2 ;
173- }
167+ if ( recentTool1 is not null )
168+ {
169+ yield return recentTool1 ;
170+ }
174171
175- if ( recentTool3 is not null )
176- {
177- yield return recentTool3 ;
172+ if ( recentTool2 is not null )
173+ {
174+ yield return recentTool2 ;
175+ }
176+
177+ if ( recentTool3 is not null )
178+ {
179+ yield return recentTool3 ;
180+ }
178181 }
179182 }
180183
You can’t perform that action at this time.
0 commit comments