Skip to content

Commit 63ff368

Browse files
committed
Improve UI: Rename columns to Command and strip quotes
UI Improvements: - Context Menus tab: Renamed "File" column to "Command" for consistency - Both tabs now use "Command" column header (unified terminology) - Added StripQuotesConverter utility to remove leading/trailing double quotes - Applied converter to Command columns on both tabs for cleaner display Column Changes: - Context Menus: "File" → "Command" (with quote stripping) - Startup Programs: "Command" column now strips quotes Button Label Updates: - Context Menus tab: "Export Context Menus" (was "Backup Context Menus") - Startup Programs tab: "Export Startup Items" (was "Backup Startup Items") - "Export" terminology is clearer than "Backup" for .REG file creation Technical Details: - Created Utilities/StripQuotesConverter.cs implementing IValueConverter - Trims double quotes from start and end of strings using String.Trim('"') - Added converter to Window.Resources in MainWindow.xaml - Added converter to UserControl.Resources in StartupView.xaml - Applied to FilePath binding in Context Menus and Command binding in Startup Benefits: - Consistent column naming across both tabs - Cleaner display without unnecessary quotes around paths - More professional appearance - Better terminology with "Export" vs "Backup"
1 parent e850004 commit 63ff368

6 files changed

Lines changed: 40 additions & 50 deletions

File tree

Utilities/StripQuotesConverter.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System;
2+
using System.Globalization;
3+
using System.Windows.Data;
4+
5+
namespace ContextMenuEditor.Utilities;
6+
7+
/// <summary>
8+
/// Converter that strips leading and trailing double quotes from strings.
9+
/// </summary>
10+
public class StripQuotesConverter : IValueConverter
11+
{
12+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
13+
{
14+
if (value is string str && !string.IsNullOrEmpty(str))
15+
{
16+
return str.Trim('"');
17+
}
18+
return value;
19+
}
20+
21+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
22+
{
23+
throw new NotImplementedException();
24+
}
25+
}

Views/MainWindow.xaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:vm="clr-namespace:ContextMenuEditor.ViewModels"
55
xmlns:views="clr-namespace:ContextMenuEditor.Views"
6+
xmlns:util="clr-namespace:ContextMenuEditor.Utilities"
67
Title="Context Menu Editor"
78
Height="600" Width="900"
89
MinHeight="400" MinWidth="700"
910
WindowStartupLocation="CenterScreen">
1011

12+
<Window.Resources>
13+
<util:StripQuotesConverter x:Key="StripQuotesConverter"/>
14+
</Window.Resources>
15+
1116
<Window.DataContext>
1217
<vm:MainViewModel/>
1318
</Window.DataContext>
@@ -64,8 +69,8 @@
6469
<DataGridTextColumn Header="Publisher"
6570
Binding="{Binding Publisher}"
6671
Width="150"/>
67-
<DataGridTextColumn Header="File"
68-
Binding="{Binding FilePath}"
72+
<DataGridTextColumn Header="Command"
73+
Binding="{Binding FilePath, Converter={StaticResource StripQuotesConverter}}"
6974
Width="*"
7075
MinWidth="150"/>
7176
</DataGrid.Columns>
@@ -89,7 +94,7 @@
8994
Command="{Binding DeleteCommand}"
9095
IsEnabled="{Binding HasSelection}"/>
9196
<Separator Margin="0,8"/>
92-
<Button Content="Backup Context Menus"
97+
<Button Content="Export Context Menus"
9398
Command="{Binding BackupCommand}"/>
9499
</StackPanel>
95100
</Border>

Views/StartupView.xaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:vm="clr-namespace:ContextMenuEditor.ViewModels"
5+
xmlns:util="clr-namespace:ContextMenuEditor.Utilities"
56
Background="{DynamicResource WindowBackgroundBrush}">
67

8+
<UserControl.Resources>
9+
<util:StripQuotesConverter x:Key="StripQuotesConverter"/>
10+
</UserControl.Resources>
11+
712
<UserControl.DataContext>
813
<vm:StartupViewModel/>
914
</UserControl.DataContext>
@@ -40,7 +45,7 @@
4045
Binding="{Binding Publisher}"
4146
Width="150"/>
4247
<DataGridTextColumn Header="Command"
43-
Binding="{Binding Command}"
48+
Binding="{Binding Command, Converter={StaticResource StripQuotesConverter}}"
4449
Width="*"
4550
MinWidth="200"/>
4651
<DataGridTextColumn Header="Location"
@@ -67,7 +72,7 @@
6772
Command="{Binding DeleteCommand}"
6873
IsEnabled="{Binding HasSelection}"/>
6974
<Separator Margin="0,8"/>
70-
<Button Content="Backup Startup Items"
75+
<Button Content="Export Startup Items"
7176
Command="{Binding BackupCommand}"/>
7277
</StackPanel>
7378
</Border>

run-elevated.ps1

Lines changed: 0 additions & 22 deletions
This file was deleted.

run.cmd

Lines changed: 0 additions & 11 deletions
This file was deleted.

run.ps1

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)