Skip to content

Commit 1130e41

Browse files
committed
Chore: UI stuff
1 parent 8059013 commit 1130e41

File tree

4 files changed

+98
-0
lines changed

4 files changed

+98
-0
lines changed

Source/NETworkManager.Localization/Resources/Strings.Designer.cs

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Source/NETworkManager.Localization/Resources/Strings.resx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3894,4 +3894,16 @@ Right-click for more options.</value>
38943894
<data name="Disable" xml:space="preserve">
38953895
<value>Disable</value>
38963896
</data>
3897+
<data name="EditEntry" xml:space="preserve">
3898+
<value>Edit entry</value>
3899+
</data>
3900+
<data name="EditEntryDots" xml:space="preserve">
3901+
<value>Edit entry...</value>
3902+
</data>
3903+
<data name="EnableEntry" xml:space="preserve">
3904+
<value>Enable entry</value>
3905+
</data>
3906+
<data name="DisableEntry" xml:space="preserve">
3907+
<value>Disable entry</value>
3908+
</data>
38973909
</root>

Source/NETworkManager/ViewModels/HostsFileEditorViewModel.cs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,46 @@ await _dialogCoordinator.ShowMessageAsync(this, Strings.Error,
249249
await _dialogCoordinator.ShowMetroDialogAsync(this, customDialog);
250250
}
251251

252+
public ICommand EnableEntryCommand => new RelayCommand(_ => EnableEntryAction().ConfigureAwait(false), ModifyEntry_CanExecute);
253+
254+
private async Task EnableEntryAction()
255+
{
256+
Debug.WriteLine("Enable entry action: " + SelectedResult?.Line);
257+
}
258+
259+
public ICommand DisableEntryCommand => new RelayCommand(_ => DisableEntryAction().ConfigureAwait(false), ModifyEntry_CanExecute);
260+
261+
private async Task DisableEntryAction()
262+
{
263+
Debug.WriteLine("Disable entry action: " + SelectedResult?.Line);
264+
}
265+
266+
public ICommand AddEntryCommand => new RelayCommand(_ => AddEntryAction().ConfigureAwait(false), ModifyEntry_CanExecute);
267+
268+
private async Task AddEntryAction()
269+
{
270+
Debug.WriteLine("Adding entry...");
271+
}
272+
273+
public ICommand DeleteEntryCommand => new RelayCommand(_ => DeleteEntryAction().ConfigureAwait(false), ModifyEntry_CanExecute);
274+
275+
private async Task DeleteEntryAction()
276+
{
277+
Debug.WriteLine("Delete entry action: " + SelectedResult?.Line);
278+
}
279+
280+
public ICommand EditEntryCommand => new RelayCommand(_ => EditEntryAction().ConfigureAwait(false), ModifyEntry_CanExecute);
281+
282+
private async Task EditEntryAction()
283+
{
284+
Debug.WriteLine("Edit entry action: " + SelectedResult?.Line);
285+
}
286+
287+
private bool ModifyEntry_CanExecute(object obj)
288+
{
289+
return ConfigurationManager.Current.IsAdmin;
290+
}
291+
252292
public ICommand RestartAsAdminCommand => new RelayCommand(_ => RestartAsAdminAction().ConfigureAwait(false));
253293

254294
private async Task RestartAsAdminAction()

Source/NETworkManager/Views/HostsFileEditorView.xaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@
6565
</Rectangle>
6666
</MenuItem.Icon>
6767
</MenuItem>
68+
<MenuItem Header="{x:Static Member=localization:Strings.EditDots}"
69+
Command="{Binding Path=EditEntryCommand}">
70+
<MenuItem.Icon>
71+
<Rectangle Width="16" Height="16" Fill="{DynamicResource ResourceKey=MahApps.Brushes.Gray3}">
72+
<Rectangle.OpacityMask>
73+
<VisualBrush Stretch="Uniform" Visual="{iconPacks:Modern Kind=Edit}" />
74+
</Rectangle.OpacityMask>
75+
</Rectangle>
76+
</MenuItem.Icon>
77+
</MenuItem>
6878
<MenuItem Header="{x:Static Member=localization:Strings.Delete}"
6979
Command="{Binding Path=DeleteEntryCommand}">
7080
<MenuItem.Icon>

0 commit comments

Comments
 (0)