Table of Contents

Class Filter<TValue, TFilter>

Namespace
ATAS.Indicators
Assembly
ATAS.Indicators.dll

Generic filter class that implements the IFilterValue interface.

public class Filter<TValue, TFilter> : FilterBase, IFilterValue, IFilter where TFilter : FilterBase, IFilterValue

Type Parameters

TValue

The type of the filter value.

TFilter

The type of the derived filter.

Inheritance
object
Filter<TValue, TFilter>
Implements
Derived
Inherited Members
Extension Methods

Constructors

Filter()

Initializes a new instance of the Filter<TValue, TFilter> class with default parameters.

public Filter()

Filter(bool, bool)

Initializes a new instance of the Filter<TValue, TFilter> class with the specified parameters.

public Filter(bool enabledVisible, bool asScale = false)

Parameters

enabledVisible bool

Specifies whether the "Enabled" property is visible to users.

asScale bool

Specifies whether the filter operates in scalar mode.

Properties

Value

Gets or sets the value of the filter.

[Display(ResourceType = typeof(Strings), Name = "Filter", Order = 2)]
public TValue Value { get; set; }

Property Value

TValue

Methods

Clone()

public override object Clone()

Returns

object

CreateNew()

Creates a new instance of the derived filter type.

protected virtual TFilter CreateNew()

Returns

TFilter

The new instance of the derived filter type.

Equals(Filter<TValue, TFilter>)

Determines whether this filter has the same Value and Enabled state as another filter.

protected bool Equals(Filter<TValue, TFilter> other)

Parameters

other Filter<TValue, TFilter>

The filter to compare with.

Returns

bool

true if both the values and the enabled states are equal; otherwise, false.

Equals(object?)

Determines whether the specified object is a filter of the same type with the same Value and Enabled state.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with.

Returns

bool

true if the object is the same instance or an equal filter; otherwise, false.

GetHashCode()

Returns a hash code computed from Value and Enabled.

public override int GetHashCode()

Returns

int

The hash code of the filter.

GetRealValue(TValue?)

Normalizes a value before it is assigned to Value; the result is then passed to ValueOnChanging(TValue?, TValue?). The base implementation returns the value unchanged.

protected virtual TValue? GetRealValue(TValue? value)

Parameters

value TValue

The value being assigned.

Returns

TValue

The value to store.

GetStringValue()

Added in ATAS 8.0.15.

public virtual string GetStringValue()

Returns

string

The string representation of the value.

RaiseValueOnChanged()

Raises the PropertyChanged event for the Value property and invokes the value changed action.

protected void RaiseValueOnChanged()

RefreshValue()

Asks bindings to reread Value without changing it or invoking the value-changed action. This also restores an editor whose uncommitted input is invalid.

Not in ATAS 8.0.15 yet: available from the next version.

public void RefreshValue()

SetValueSilently(TValue)

Sets value of Value property. Returns false when new value equals new value

public bool SetValueSilently(TValue value)

Parameters

value TValue

Returns

bool

ToString()

Converts the filter to its string representation.

public override string ToString()

Returns

string

A string that represents the filter.

ValueOnChanged(Action<TValue>)

Sets an action to be invoked when the value of the filter has changed.

public TFilter ValueOnChanged(Action<TValue> onChanged)

Parameters

onChanged Action<TValue>

The action to be invoked.

Returns

TFilter

The current filter instance.

ValueOnChanging(Func<ValueChangingEventArgs<TValue>, TValue>)

Sets a function to be invoked when the value of the filter is changing.

public TFilter ValueOnChanging(Func<ValueChangingEventArgs<TValue>, TValue> onChanging)

Parameters

onChanging Func<ValueChangingEventArgs<TValue>, TValue>

The function to be invoked.

Returns

TFilter

The current filter instance.

ValueOnChanging(TValue?, TValue?)

Invoked when the value of the filter is changing.

protected virtual TValue ValueOnChanging(TValue? oldValue, TValue? newValue)

Parameters

oldValue TValue

The old value of the filter.

newValue TValue

The new value of the filter.

Returns

TValue

The new value to be set for the filter.

Operators

operator ==(Filter<TValue, TFilter>?, Filter<TValue, TFilter>?)

Determines whether two filters are equal by Value and Enabled state.

public static bool operator ==(Filter<TValue, TFilter>? left, Filter<TValue, TFilter>? right)

Parameters

left Filter<TValue, TFilter>

The first filter.

right Filter<TValue, TFilter>

The second filter.

Returns

bool

true if the filters are equal or both are null; otherwise, false.

explicit operator TValue(Filter<TValue, TFilter>)

Converts the Filter<TValue, TFilter> to its value of type TValue.

public static explicit operator TValue(Filter<TValue, TFilter> other)

Parameters

other Filter<TValue, TFilter>

The filter to convert.

Returns

TValue

operator !=(Filter<TValue, TFilter>?, Filter<TValue, TFilter>?)

Determines whether two filters differ by Value or Enabled state.

public static bool operator !=(Filter<TValue, TFilter>? left, Filter<TValue, TFilter>? right)

Parameters

left Filter<TValue, TFilter>

The first filter.

right Filter<TValue, TFilter>

The second filter.

Returns

bool

true if the filters are not equal; otherwise, false.