ui: Indicate price discrep w/ subtler visual than qty discrep

This commit is contained in:
John Colvin committed 2022-06-09 13:49:55 -04:00
1 parent 497abfb443
commit 3da0f4eedc
3 files changed
+67 -5

No files matched your search

@@ -0,0 +1,12 @@
#nullable enable
namespace Spark.Trading {
using System;
[Flags]
enum ReconcileReportMatchType {
None = 0,
Quantity = 1,
Price = 1 << 1
}
}
@@ -55,6 +55,18 @@ namespace Spark.Trading {
public double exchange_quantity => _data.exch_quantity();
public double price => _data.sys_price();
public double exchange_price => _data.exch_price();
public ReconcileReportMatchType match_type {
get {
var mt = ReconcileReportMatchType.None;
if (quantity.epsilon_equals(exchange_quantity)) {
mt |= ReconcileReportMatchType.Quantity;
}
if (price.epsilon_equals(exchange_price)) {
mt |= ReconcileReportMatchType.Price;
}
return mt;
}
}
public bts.api.domain.TickDisplaySettingsImmutable quantity_display {
get => _quantity_display;
@@ -19,8 +19,10 @@
<ResourceDictionary Source="/view/Controls/DataGridEx/Filters/Views/FilterTemplates.xaml"/>
</ResourceDictionary.MergedDictionaries>
<cv:ValueMap x:Key="MatchStateConverter" Default="IsMatch">
<cv:KeyValue Key="{u:False}" Value="NotMatch" />
<cv:ValueMap x:Key="MatchStateConverter" Default="Match_All">
<cv:KeyValue Key="{x:Static trading:ReconcileReportMatchType.Quantity}" Value="Match_Quantity" />
<cv:KeyValue Key="{x:Static trading:ReconcileReportMatchType.Price}" Value="Match_Price" />
<cv:KeyValue Key="{x:Static trading:ReconcileReportMatchType.None}" Value="Match_None" />
</cv:ValueMap>
<cv:BooleanToObjectConverter
@@ -94,7 +96,7 @@
<u:StateGroupsManager AttachToMembers="True">
<u:StateDefinitionCollection>
<u:StateDefinition State="{Binding
Path='(u:StateDefinition.Group).(u:StateGroupsManager.Target).(FrameworkElement.DataContext).is_match',
Path='(u:StateDefinition.Group).(u:StateGroupsManager.Target).(FrameworkElement.DataContext).match_type',
RelativeSource={RelativeSource Self},
Converter={StaticResource MatchStateConverter}}" />
</u:StateDefinitionCollection>
@@ -102,8 +104,42 @@
</u:StateManager.Groups>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup Name="MatchStates">
<VisualState Name="IsMatch" />
<VisualState Name="NotMatch">
<!-- Price and Quantity match -->
<VisualState Name="Match_All" />
<!-- Quantity matches (but not Price) -->
<VisualState Name="Match_Quantity">
<Storyboard>
<ObjectAnimationUsingKeyFrames
Storyboard.TargetName="PriceView"
Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame
KeyTime="0"
Value="{x:Static u:BTSColors.danger_brush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames
Storyboard.TargetName="ExchangePriceView"
Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame
KeyTime="0"
Value="{x:Static u:BTSColors.danger_brush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<!-- Price matches (but not Quantity) -->
<VisualState Name="Match_Price">
<Storyboard>
<ColorAnimation
Storyboard.TargetName="RowView"
Storyboard.TargetProperty="Background.Color"
To="{u:Color UI.danger, Opacity=0.33}"
Duration="0" />
</Storyboard>
</VisualState>
<!-- Nothing matches -->
<VisualState Name="Match_None">
<Storyboard>
<ColorAnimation
Storyboard.TargetName="RowView"
@@ -148,6 +184,7 @@
</c:TextCell>
<c:TextCell
x:Name="PriceView"
c:DIYGrid.ColumnKey="{x:Static trading:ReconcileReportColumnType.Price}"
Style="{StaticResource TextCell}">
<c:TextCell.Text>
@@ -159,6 +196,7 @@
</c:TextCell>
<c:TextCell
x:Name="ExchangePriceView"
c:DIYGrid.ColumnKey="{x:Static trading:ReconcileReportColumnType.ExchangePrice}"
Style="{StaticResource TextCell}">
<c:TextCell.Text>