-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
disable message keys from message service
- Loading branch information
1 parent
a88087c
commit a3dbb05
Showing
6 changed files
with
60 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
Client/Rubberduck.UI/Shared/Settings/StringListSettingViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using Rubberduck.InternalApi.Settings.Model; | ||
using Rubberduck.UI.Command.Abstract; | ||
using Rubberduck.UI.Services; | ||
using Rubberduck.UI.Shared.Settings.Abstract; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.Linq; | ||
using System.Threading; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Threading; | ||
|
||
namespace Rubberduck.UI.Shared.Settings | ||
{ | ||
public class ListSettingViewModel<T> : SettingViewModel<T[]> | ||
{ | ||
public ListSettingViewModel(UIServiceHelper service, TypedRubberduckSetting<T[]> setting) : base(setting) | ||
{ | ||
ListItems = setting.TypedValue; | ||
RemoveListSettingItemCommand = new DelegateCommand(service, ExecuteRemoveListSettingItemCommand); | ||
} | ||
|
||
private IEnumerable<T> _items = []; | ||
public IEnumerable<T> ListItems | ||
{ | ||
get => _items; | ||
private set | ||
{ | ||
if (_items != value) | ||
{ | ||
_items = value; | ||
OnPropertyChanged(); | ||
} | ||
} | ||
} | ||
|
||
public ICommand RemoveListSettingItemCommand { get; } | ||
|
||
private void ExecuteRemoveListSettingItemCommand(object? parameter) | ||
{ | ||
if (parameter is T value) | ||
{ | ||
ListItems = _items.Except([value]); | ||
Value = _items.ToArray(); | ||
} | ||
} | ||
} | ||
|
||
public class StringListSettingViewModel : ListSettingViewModel<string> | ||
{ | ||
public StringListSettingViewModel(UIServiceHelper service, TypedRubberduckSetting<string[]> setting) | ||
: base(service, setting) { } | ||
} | ||
} |