~ruther/NosTale-PacketLogger

e80b2c7a5194cdaaf0e9eb9f3cb53ed6f6386502 — Rutherther 2 years ago aad2824
feat: add possibility to deactivate a filter
M src/PacketLogger/ViewModels/PacketLogFilterViewModel.cs => src/PacketLogger/ViewModels/PacketLogFilterViewModel.cs +5 -0
@@ 94,6 94,11 @@ public class PacketLogFilterViewModel : ViewModelBase, IDisposable
    /// </summary>
    public ReactiveCommand<Unit, Unit> AddNew { get; }

    /// <summary>
    /// Gets or sets whether the filter is active.
    /// </summary>
    public bool Active { get; set; } = true;

    /// <inheritdoc />
    public void Dispose()
    {

M src/PacketLogger/ViewModels/PacketLogViewModel.cs => src/PacketLogger/ViewModels/PacketLogViewModel.cs +7 -2
@@ 114,14 114,14 @@ public class PacketLogViewModel : ViewModelBase, IDisposable

        SendFilter.PropertyChanged += (s, e) =>
        {
            if (e.PropertyName == "Whitelist")
            if (e.PropertyName is "Whitelist" or "Active")
            {
                CreateSendRecv();
            }
        };
        RecvFilter.PropertyChanged += (s, e) =>
        {
            if (e.PropertyName == "Whitelist")
            if (e.PropertyName is "Whitelist" or "Active")
            {
                CreateSendRecv();
            }


@@ 236,6 236,11 @@ public class PacketLogViewModel : ViewModelBase, IDisposable

    private IFilter CreateCompound(PacketLogFilterViewModel packetLogFilter)
    {
        if (!packetLogFilter.Active)
        {
            return new CompoundFilter(true);
        }

        List<IFilter> filters = new List<IFilter>();

        foreach (var filter in packetLogFilter.Filters)

M src/PacketLogger/Views/PacketLogFilterView.axaml => src/PacketLogger/Views/PacketLogFilterView.axaml +7 -3
@@ 24,9 24,13 @@
            </DataGrid.Columns>
        </DataGrid>
        
        <RadioButton Grid.Row="1" Grid.Column="0" Content="Whitelist" GroupName="WlBl"></RadioButton>
        <RadioButton Grid.Row="1" Grid.Column="1" Content="Blacklist" GroupName="WlBl" IsChecked="{Binding !Whitelist}"></RadioButton>
 
        <CheckBox Grid.Row="1" Grid.Column="0" Content="Filter active" IsChecked="{Binding Active}" />

        <Grid Grid.Row="1" Grid.Column="1" ColumnDefinitions="*,*">
            <RadioButton Grid.Column="0" Content="Wl" GroupName="WlBl"></RadioButton>
            <RadioButton Grid.Column="1" Content="Bl" GroupName="WlBl" IsChecked="{Binding !Whitelist}"></RadioButton>
        </Grid>

        <TextBox VerticalAlignment="Center" Margin="0, 0, 5, 0" Height="30" Grid.Row="2" Grid.Column="0"
                 Text="{Binding NewFilter}">
        </TextBox>