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
TValueThe type of the filter value.
TFilterThe type of the derived filter.
- Inheritance
-
objectFilter<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
enabledVisibleboolSpecifies whether the "Enabled" property is visible to users.
asScaleboolSpecifies 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>)
protected bool Equals(Filter<TValue, TFilter> other)
Parameters
otherFilter<TValue, TFilter>The filter to compare with.
Returns
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
objobjectThe object to compare with.
Returns
GetHashCode()
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
valueTValueThe 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
valueTValue
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
onChangedAction<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
onChangingFunc<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
oldValueTValueThe old value of the filter.
newValueTValueThe new value of the filter.
Returns
- TValue
The new value to be set for the filter.
Operators
operator ==(Filter<TValue, TFilter>?, Filter<TValue, TFilter>?)
public static bool operator ==(Filter<TValue, TFilter>? left, Filter<TValue, TFilter>? right)
Parameters
Returns
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
otherFilter<TValue, TFilter>The filter to convert.
Returns
- TValue
operator !=(Filter<TValue, TFilter>?, Filter<TValue, TFilter>?)
public static bool operator !=(Filter<TValue, TFilter>? left, Filter<TValue, TFilter>? right)