Merge branch 'master' into SP-23-Dorman2
This commit is contained in:
commit
1d68aa7fa8
6 files changed
+361
-183
No files matched your search
@@ -4,6 +4,10 @@ weight = 3
|
||||
sort_by = "weight"
|
||||
insert_anchor_links = "right"
|
||||
+++
|
||||
## 2.7.2
|
||||
### User Visible Changes
|
||||
- Changed the login dialog to avoid leaking workspace names from other users.
|
||||
|
||||
## 2.7.1
|
||||
### User Visible Changes
|
||||
- Fixed some issues with the Cover algo, where in some circumstances
|
||||
|
||||
@@ -1,143 +1,265 @@
|
||||
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
x:Class="mbts.ui.shell.LoginView"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:ui="clr-namespace:mbts.ui"
|
||||
xmlns:uicore="clr-namespace:mbts.ui"
|
||||
xmlns:converters="clr-namespace:mbts.ui.converters"
|
||||
xmlns:autocomplete="clr-namespace:WPFTextBoxAutoComplete;assembly=WPFTextBoxAutoComplete"
|
||||
mc:Ignorable="d" MouseDown="Window_MouseDown"
|
||||
Width="500" Height="309" WindowStyle="None" ResizeMode="NoResize" WindowStartupLocation="CenterScreen"
|
||||
ui:StateManager.VisualState="{Binding VisualState}">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<converters:BooleanToVisibilityConverter x:Key="InverseBoolToVisibility" VisibilityForFalse="Visible" VisibilityForTrue="Collapsed" />
|
||||
<converters:StringToBrushConverter x:Key="ErrorStringToBrush" />
|
||||
<converters:NullToVisibilityConverter x:Key="NullToVisibilityConverter" VisibilityForNull="Hidden" />
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<Window
|
||||
x:Class="mbts.ui.shell.LoginView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="clr-namespace:mbts.ui"
|
||||
xmlns:uicore="clr-namespace:mbts.ui"
|
||||
xmlns:shell="clr-namespace:mbts.ui.shell"
|
||||
xmlns:c="clr-namespace:mbts.ui.controls"
|
||||
xmlns:converters="clr-namespace:mbts.ui.converters"
|
||||
xmlns:autocomplete="clr-namespace:WPFTextBoxAutoComplete;assembly=WPFTextBoxAutoComplete"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
x:Name="_login_view"
|
||||
Width="460"
|
||||
Height="254"
|
||||
WindowStyle="None"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
MouseDown="Window_MouseDown"
|
||||
>
|
||||
<ui:StateManager.Groups>
|
||||
<ui:StateGroupsManager>
|
||||
<ui:StateDefinitionCollection>
|
||||
<ui:StateDefinition State="{Binding DataContext.login_status, Source={ui:DirectReference _login_view}, Converter={x:Static shell:LoginView.LoginStatusVisualStateConverter}}"/>
|
||||
<ui:StateDefinition State="{Binding DataContext.SelectedWorkspace, Source={ui:DirectReference _login_view}, Converter={x:Static shell:LoginView.WorkspaceVisualStateConverter}}"/>
|
||||
</ui:StateDefinitionCollection>
|
||||
</ui:StateGroupsManager>
|
||||
</ui:StateManager.Groups>
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<sys:Double x:Key="LoginControlPaddingLeft">40</sys:Double>
|
||||
<sys:Double x:Key="LoginControlPaddingTop">10</sys:Double>
|
||||
<sys:Double x:Key="LoginControlPaddingRight">22</sys:Double>
|
||||
<converters:BooleanToVisibilityConverter x:Key="InverseBoolToVisibility" VisibilityForFalse="Visible" VisibilityForTrue="Collapsed"/>
|
||||
<converters:StringToBrushConverter x:Key="ErrorStringToBrush"/>
|
||||
<converters:NullToVisibilityConverter x:Key="NullToVisibilityConverter" VisibilityForNull="Hidden"/>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
|
||||
<Window.Background>
|
||||
<StaticResource ResourceKey="CommonBackground"/>
|
||||
</Window.Background>
|
||||
<Window.Background>
|
||||
<StaticResource ResourceKey="CommonBackground"/>
|
||||
</Window.Background>
|
||||
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
<VisualState x:Name="LoginState">
|
||||
<Storyboard>
|
||||
<DoubleAnimation Storyboard.TargetName="_login_controls" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:0.5" />
|
||||
<BooleanAnimationUsingKeyFrames Storyboard.TargetName="_login_controls" Storyboard.TargetProperty="IsHitTestVisible">
|
||||
<DiscreteBooleanKeyFrame KeyTime="0:0:0" Value="True" />
|
||||
</BooleanAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="ErrorState">
|
||||
<Storyboard>
|
||||
<DoubleAnimation Storyboard.TargetName="_error_control" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:0.5" />
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Loading">
|
||||
<Storyboard>
|
||||
<DoubleAnimation Storyboard.TargetName="_login_controls" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="0:0:0.5" />
|
||||
<DoubleAnimation Storyboard.TargetName="_loading_control" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:0.5" BeginTime="0:0:0.5" />
|
||||
<BooleanAnimationUsingKeyFrames Storyboard.TargetName="login_button" Storyboard.TargetProperty="IsEnabled" >
|
||||
<DiscreteBooleanKeyFrame KeyTime="0:0:0" Value="False" />
|
||||
</BooleanAnimationUsingKeyFrames>
|
||||
<BooleanAnimationUsingKeyFrames Storyboard.TargetName="cancel_button" Storyboard.TargetProperty="IsEnabled" >
|
||||
<DiscreteBooleanKeyFrame KeyTime="0:0:0" Value="False" />
|
||||
</BooleanAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
<VisualStateGroup x:Name="LoginError">
|
||||
<VisualState x:Name="BadPassword">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="_password" Storyboard.TargetProperty="BorderBrush" >
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Brushes.Red}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup Name="{x:Static GroupName, MemberType={ui:Nested shell:LoginView.VisualStateNames.LoginStatus}}">
|
||||
<VisualState Name="{x:Static Initializing, MemberType={ui:Nested shell:LoginView.VisualStateNames.LoginStatus}}"/>
|
||||
<VisualState Name="{x:Static Ready, MemberType={ui:Nested shell:LoginView.VisualStateNames.LoginStatus}}">
|
||||
<Storyboard>
|
||||
<DoubleAnimation Storyboard.TargetName="_login_controls" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:0.5"/>
|
||||
<BooleanAnimationUsingKeyFrames Storyboard.TargetName="_login_controls" Storyboard.TargetProperty="IsHitTestVisible">
|
||||
<DiscreteBooleanKeyFrame KeyTime="0:0:0" Value="True" />
|
||||
</BooleanAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState Name="{x:Static Error, MemberType={ui:Nested shell:LoginView.VisualStateNames.LoginStatus}}">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="_error_control" Storyboard.TargetProperty="Visibility">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<DoubleAnimation Storyboard.TargetName="_error_control" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:0.5"/>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState Name="{x:Static Loading, MemberType={ui:Nested shell:LoginView.VisualStateNames.LoginStatus}}">
|
||||
<Storyboard>
|
||||
<DoubleAnimation Storyboard.TargetName="_login_controls" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="0:0:0.5"/>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="_loading_control" Storyboard.TargetProperty="Visibility">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<DoubleAnimation Storyboard.TargetName="_loading_control" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:0.5" BeginTime="0:0:0.5"/>
|
||||
<DoubleAnimation Storyboard.TargetName="_login_button" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="0:0:0.5"/>
|
||||
<DoubleAnimation Storyboard.TargetName="_cancel_button" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="0:0:0.5"/>
|
||||
<BooleanAnimationUsingKeyFrames Storyboard.TargetName="_dialog_skirt" Storyboard.TargetProperty="IsHitTestVisible">
|
||||
<DiscreteBooleanKeyFrame KeyTime="0" Value="False"/>
|
||||
</BooleanAnimationUsingKeyFrames>
|
||||
<BooleanAnimationUsingKeyFrames Storyboard.TargetName="_dialog_skirt" Storyboard.TargetProperty="IsHitTestVisible">
|
||||
<DiscreteBooleanKeyFrame KeyTime="0" Value="False"/>
|
||||
</BooleanAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState Name="{x:Static Rejected, MemberType={ui:Nested shell:LoginView.VisualStateNames.LoginStatus}}">
|
||||
<Storyboard>
|
||||
<DoubleAnimation Storyboard.TargetName="_login_controls" Storyboard.TargetProperty="Opacity" To="1" Duration="0"/>
|
||||
<BooleanAnimationUsingKeyFrames Storyboard.TargetName="_login_controls" Storyboard.TargetProperty="IsHitTestVisible">
|
||||
<DiscreteBooleanKeyFrame KeyTime="0:0:0" Value="True" />
|
||||
</BooleanAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="_username" Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Brushes.Red}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="_password" Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Brushes.Red}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="_reject_message" Storyboard.TargetProperty="Visibility">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
<VisualStateGroup Name="{x:Static GroupName, MemberType={ui:Nested shell:LoginView.VisualStateNames.Workspace}}">
|
||||
<VisualState Name="{x:Static Active, MemberType={ui:Nested shell:LoginView.VisualStateNames.Workspace}}"/>
|
||||
<VisualState Name="{x:Static Inactive, MemberType={ui:Nested shell:LoginView.VisualStateNames.Workspace}}">
|
||||
<Storyboard>
|
||||
<BooleanAnimationUsingKeyFrames Storyboard.TargetName="_resume_workspace_checkbox" Storyboard.TargetProperty="(ToggleButton.IsChecked)">
|
||||
<DiscreteBooleanKeyFrame KeyTime="0" Value="False"/>
|
||||
</BooleanAnimationUsingKeyFrames>
|
||||
<BooleanAnimationUsingKeyFrames Storyboard.TargetName="_resume_workspace_checkbox" Storyboard.TargetProperty="(UIElement.IsEnabled)">
|
||||
<DiscreteBooleanKeyFrame KeyTime="0" Value="False"/>
|
||||
</BooleanAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
|
||||
<Border BorderBrush="{x:Static uicore:BTSColors.form_border_brush}" BorderThickness="1">
|
||||
<Grid ClipToBounds="True">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border BorderBrush="{x:Static uicore:BTSColors.form_border_brush}" BorderThickness="1">
|
||||
<Grid ClipToBounds="True">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Login details -->
|
||||
<Grid Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" x:Name="_login_controls" Opacity="0" IsHitTestVisible="False">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition /> <!-- User -->
|
||||
<RowDefinition /> <!-- Workspace -->
|
||||
<RowDefinition /> <!-- Pass -->
|
||||
<RowDefinition Height="Auto" /> <!-- message -->
|
||||
<RowDefinition /><!-- buttons -->
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<!-- Login details -->
|
||||
<Grid
|
||||
x:Name="_login_controls"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
Opacity="0"
|
||||
IsHitTestVisible="False"
|
||||
>
|
||||
<Grid.Margin>
|
||||
<Thickness Left="{StaticResource LoginControlPaddingLeft}" Top="30" Right="{StaticResource LoginControlPaddingRight}"/>
|
||||
</Grid.Margin>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="{Binding Source={StaticResource LoginControlPaddingTop}}"/>
|
||||
<!-- User -->
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="{Binding Source={StaticResource LoginControlPaddingTop}}"/>
|
||||
<!-- Workspace -->
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="{Binding Source={StaticResource LoginControlPaddingTop}}"/>
|
||||
<!-- Pass -->
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="{Binding Source={StaticResource LoginControlPaddingTop}}"/>
|
||||
<!-- message -->
|
||||
<RowDefinition/>
|
||||
<!-- buttons -->
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBox
|
||||
Grid.ColumnSpan="2"
|
||||
autocomplete:AutoCompleteBehavior.AutoCompleteItemsSource="{Binding KnownUsers}"
|
||||
Margin="10"
|
||||
Width="160"
|
||||
Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}"
|
||||
/>
|
||||
<ComboBox ItemsSource="{Binding Workspaces}" Grid.Row="1" Grid.ColumnSpan="2" Margin="10" SelectedItem="{Binding SelectedWorkspace, Mode=TwoWay}" Width="160" MaxWidth="160" />
|
||||
<TextBox
|
||||
x:Name="_username"
|
||||
autocomplete:AutoCompleteBehavior.AutoCompleteItemsSource="{Binding KnownUsers}"
|
||||
HorizontalAlignment="Stretch"
|
||||
Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}"
|
||||
>
|
||||
</TextBox>
|
||||
<!--Password-->
|
||||
<PasswordBox
|
||||
x:Name="_password"
|
||||
Grid.Row="2"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
Style="{DynamicResource PasswordBoxStyle1}"
|
||||
PasswordChanged="_passwordChanged"
|
||||
>
|
||||
<PasswordBox.BorderBrush>
|
||||
<LinearGradientBrush EndPoint="0,20" MappingMode="Absolute" StartPoint="0,0">
|
||||
<GradientStop Color="#ABADB3" Offset="0.05"/>
|
||||
<GradientStop Color="#E2E3EA" Offset="0.07"/>
|
||||
<GradientStop Color="#E3E9EF" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</PasswordBox.BorderBrush>
|
||||
</PasswordBox>
|
||||
<TextBlock
|
||||
x:Name="_pw_mark"
|
||||
Grid.Row="2"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Margin="4,0,0,0"
|
||||
IsHitTestVisible="False"
|
||||
Opacity="0.5"
|
||||
Text="Password"
|
||||
Visibility="{Binding IsFocused, Converter={StaticResource InverseBoolToVisibility}, ElementName=_password}"
|
||||
/>
|
||||
|
||||
<PasswordBox Grid.Row="2" Margin="10" MinWidth="120" Grid.ColumnSpan="2" x:Name="_password" PasswordChanged="_passwordChanged" Style="{DynamicResource PasswordBoxStyle1}" Width="160">
|
||||
<PasswordBox.BorderBrush>
|
||||
<LinearGradientBrush EndPoint="0,20" MappingMode="Absolute" StartPoint="0,0">
|
||||
<GradientStop Color="#ABADB3" Offset="0.05"/>
|
||||
<GradientStop Color="#E2E3EA" Offset="0.07"/>
|
||||
<GradientStop Color="#E3E9EF" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</PasswordBox.BorderBrush>
|
||||
</PasswordBox>
|
||||
<TextBlock Text="Password" Grid.Row="2" Grid.ColumnSpan="2" Margin="15,10,10,10" Opacity="0.5"
|
||||
IsHitTestVisible="False" HorizontalAlignment="Left" x:Name="_pw_mark"
|
||||
Visibility="{Binding IsFocused, Converter={StaticResource InverseBoolToVisibility}, ElementName=_password}" />
|
||||
<CheckBox x:Name="_resume_workspace_checkbox" Grid.Row="4" HorizontalAlignment="Left" IsChecked="{Binding resume_workspace}" IsEnabled="True" ToolTip="{Binding SelectedWorkspace}">
|
||||
Load last workspace
|
||||
</CheckBox>
|
||||
|
||||
<Button Content="Cancel" x:Name="cancel_button" Grid.Row="4" Grid.Column="0" MinWidth="60" Margin="10" IsCancel="True" Command="{Binding CancelCommand}" />
|
||||
<Button Content="Login" x:Name="login_button" Grid.Row="4" Grid.Column="1" MinWidth="60" Margin="10" IsDefault="True" Command="{Binding LoginCommand}" />
|
||||
|
||||
<!-- Background="{StaticResource CommonBackground}"-->
|
||||
<Border Grid.Row="3" Grid.ColumnSpan="2" Visibility="{Binding WarningMessage, Converter={StaticResource NullToVisibilityConverter}}">
|
||||
<TextBlock Text="{Binding WarningMessage}" HorizontalAlignment="Center" Foreground="Firebrick" FontWeight="Bold" TextWrapping="Wrap" Margin="5" MaxWidth="160" />
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<!-- Fatal error display -->
|
||||
<StackPanel Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" x:Name="_error_control" Margin="10" Opacity="0" Visibility="{Binding ErrorMessage, Converter={StaticResource NullToVisibilityConverter}}">
|
||||
<TextBlock Text="The application is currently unavailable." FontWeight="Bold" TextWrapping="Wrap" Margin="0,0,0,10" />
|
||||
<TextBlock TextWrapping="Wrap">
|
||||
<Run>Please call BTS Support at </Run>
|
||||
<Run FontWeight="Bold">(919) 913-0860</Run>
|
||||
<Run>or email</Run>
|
||||
<Hyperlink CommandParameter="mailto:support@bluetradingsystems.com" Command="{Binding EmailCommand}">support@bluetradingsystems.com</Hyperlink>
|
||||
</TextBlock>
|
||||
<TextBlock Text="Error Details:" Margin="0,10,0,0" />
|
||||
<TextBlock Text="{Binding ErrorMessage}" TextWrapping="Wrap" Margin="5" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- Loading -->
|
||||
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" x:Name="_loading_control" IsHitTestVisible="False" Opacity="0">
|
||||
<ui:BusySpinner Width="64" Height="64" />
|
||||
<TextBlock Text="Loading..." HorizontalAlignment="Center" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- logo -->
|
||||
<Image Grid.ColumnSpan="2" HorizontalAlignment="Left" Source="/Images/Icons/BTS.png" Width="220" Stretch="Uniform" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="HighQuality" x:Name="_logo" Margin="32,0,0,0" />
|
||||
|
||||
|
||||
<Button Grid.ColumnSpan="2" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="5" Command="{Binding CancelCommand}" Style="{StaticResource RoundCloseButton}" />
|
||||
<TextBlock
|
||||
x:Name="_reject_message"
|
||||
Grid.Row="6"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding WarningMessage}"
|
||||
Foreground="Firebrick"
|
||||
FontWeight="Bold"
|
||||
TextWrapping="Wrap"
|
||||
Visibility="Hidden"
|
||||
/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Window>
|
||||
<!-- Fatal error display -->
|
||||
<StackPanel
|
||||
x:Name="_error_control"
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
Visibility="Hidden"
|
||||
Opacity="0"
|
||||
>
|
||||
<TextBlock Text="The application is currently unavailable." FontWeight="Bold" TextWrapping="Wrap" Margin="0,0,0,10" />
|
||||
<TextBlock TextWrapping="Wrap">
|
||||
<Run>Please call BTS Support at </Run>
|
||||
<Run FontWeight="Bold">(919) 913-0860</Run>
|
||||
<Run>or email</Run>
|
||||
<Hyperlink CommandParameter="mailto:support@bluetradingsystems.com" Command="{Binding EmailCommand}">support@bluetradingsystems.com</Hyperlink>
|
||||
</TextBlock>
|
||||
<TextBlock Text="Error Details:" Margin="0,10,0,0" />
|
||||
<TextBlock Text="{Binding ErrorMessage}" TextWrapping="Wrap" Margin="5" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- Loading -->
|
||||
<StackPanel
|
||||
x:Name="_loading_control"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
IsHitTestVisible="False"
|
||||
Opacity="0"
|
||||
Visibility="Hidden"
|
||||
>
|
||||
<ui:BusySpinner Width="64" Height="64"/>
|
||||
<TextBlock Text="Loading..." HorizontalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- logo -->
|
||||
<Image
|
||||
x:Name="_logo"
|
||||
RenderOptions.BitmapScalingMode="HighQuality"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Margin="32,0,0,0"
|
||||
Width="220"
|
||||
Source="/Images/Icons/BTS.png"
|
||||
Stretch="Uniform"
|
||||
SnapsToDevicePixels="True"
|
||||
/>
|
||||
<Button Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="5" Command="{Binding CancelCommand}" Style="{StaticResource RoundCloseButton}"/>
|
||||
<c:DialogSkirt x:Name="_dialog_skirt" Grid.Row="1" Grid.ColumnSpan="2" HorizontalAlignment="Stretch" VerticalAlignment="Bottom">
|
||||
<c:DialogSkirt.RightItems>
|
||||
<x:Array Type="{x:Type Button}">
|
||||
<Button x:Name="_login_button" Width="60" Margin="10" IsDefault="True" IsHitTestVisible="True" Command="{Binding LoginCommand}">
|
||||
Login
|
||||
</Button>
|
||||
<Button x:Name="_cancel_button" Width="60" Margin="10" IsCancel="True" IsHitTestVisible="True" Command="{Binding CancelCommand}">
|
||||
Cancel
|
||||
</Button>
|
||||
</x:Array>
|
||||
</c:DialogSkirt.RightItems>
|
||||
</c:DialogSkirt>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Window>
|
||||
@@ -1,15 +1,43 @@
|
||||
using System;
|
||||
using bts;
|
||||
using mbts.ui.converters;
|
||||
using mbts.ui.native;
|
||||
using mbts.utils;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media.Imaging;
|
||||
using mbts.ui.native;
|
||||
using bts;
|
||||
|
||||
namespace mbts.ui.shell {
|
||||
public partial class LoginView : Window
|
||||
{
|
||||
public partial class LoginView : Window {
|
||||
public enum LoginStatus {
|
||||
Initializing,
|
||||
Ready,
|
||||
Error,
|
||||
Rejected,
|
||||
LoggingIn
|
||||
}
|
||||
|
||||
public static IValueConverter WorkspaceVisualStateConverter =>
|
||||
ValueConverter.create<string, string>(workspace =>
|
||||
!string.IsNullOrEmpty(workspace) && workspace != LoginViewModel.NEW_WORKSPACE_NAME ?
|
||||
VisualStateNames.Workspace.Active :
|
||||
VisualStateNames.Workspace.Inactive);
|
||||
|
||||
public static IValueConverter LoginStatusVisualStateConverter =>
|
||||
ValueConverter.create<LoginStatus, string>(status => {
|
||||
switch (status) {
|
||||
case LoginStatus.Initializing: return VisualStateNames.LoginStatus.Initializing;
|
||||
case LoginStatus.Ready: return VisualStateNames.LoginStatus.Ready;
|
||||
case LoginStatus.LoggingIn: return VisualStateNames.LoginStatus.Loading;
|
||||
case LoginStatus.Rejected: return VisualStateNames.LoginStatus.Rejected;
|
||||
case LoginStatus.Error: return VisualStateNames.LoginStatus.Error;
|
||||
default: throw ExceptionBuilder.Argument.unexpected_case(status, nameof(status));
|
||||
}
|
||||
});
|
||||
|
||||
public LoginView(LoginViewModel model) {
|
||||
this.DataContext = model;
|
||||
if (model is IRequestViewClose) {
|
||||
@@ -65,6 +93,24 @@ namespace mbts.ui.shell {
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
}
|
||||
public static class VisualStateNames {
|
||||
public static class LoginStatus {
|
||||
public const string GroupName = nameof(LoginStatus);
|
||||
public static readonly string
|
||||
Initializing = $"{GroupName}{nameof(Initializing)}",
|
||||
Ready = $"{GroupName}{nameof(Ready)}",
|
||||
Loading = $"{GroupName}{nameof(Loading)}",
|
||||
Rejected = $"{GroupName}{nameof(Rejected)}",
|
||||
Error = $"{GroupName}{nameof(Error)}";
|
||||
}
|
||||
|
||||
}
|
||||
public static class Workspace {
|
||||
public const string GroupName = nameof(Workspace);
|
||||
|
||||
public static readonly string
|
||||
Active = $"{GroupName}{VisualStates.Active}",
|
||||
Inactive = $"{GroupName}{VisualStates.Inactive}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,16 +2,15 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Threading;
|
||||
using LoginStatus = mbts.ui.shell.LoginView.LoginStatus;
|
||||
|
||||
namespace mbts.ui.shell
|
||||
{
|
||||
namespace mbts.ui.shell {
|
||||
public class LoginViewModel : ViewModelBase, IRequestViewClose
|
||||
{
|
||||
public const string NEW_WORKSPACE_NAME = "New workspace...";
|
||||
private LoginModel _model;
|
||||
private Dispatcher _dispatcher;
|
||||
public LoginViewModel(LoginModel model, Dispatcher disp) {
|
||||
@@ -42,7 +41,7 @@ namespace mbts.ui.shell
|
||||
void _model_Ready() {
|
||||
_dispatcher.BeginInvoke(() => {
|
||||
if (!_model.HasFatalError) {
|
||||
this.VisualState = "LoginState";
|
||||
login_status = LoginStatus.Ready;
|
||||
load_username();
|
||||
if (!string.IsNullOrEmpty(_name))
|
||||
KnownUsers.Add(_name);
|
||||
@@ -50,16 +49,21 @@ namespace mbts.ui.shell
|
||||
}
|
||||
else {
|
||||
ErrorMessage = _model.ErrorMessage;
|
||||
VisualState = "ErrorState";
|
||||
login_status = LoginStatus.Error;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private string _vstate = "Normal";
|
||||
public string VisualState { get { return _vstate; } set { _vstate = value; RaisePropertyChanged("VisualState"); } }
|
||||
LoginStatus _login_status;
|
||||
public LoginStatus login_status { get => _login_status; private set => Set(ref _login_status, value); }
|
||||
|
||||
/// <see cref="KnownUsers"/> should only contain the user-name of the last login (if none exists, it should be empty).
|
||||
public ObservableCollection<string> KnownUsers { get; } = new ObservableCollection<string>();
|
||||
bool _resume_workspace = true;
|
||||
public bool resume_workspace {
|
||||
get => _resume_workspace;
|
||||
set => Set(ref _resume_workspace, value);
|
||||
}
|
||||
private string _name;
|
||||
public string Name {
|
||||
get { return _name; }
|
||||
@@ -82,7 +86,7 @@ namespace mbts.ui.shell
|
||||
public string SelectedWorkspace { get; set; }
|
||||
private async void update_workspaces(string name) {
|
||||
Workspaces.Clear();
|
||||
Workspaces.Add("New workspace...");
|
||||
Workspaces.Add(NEW_WORKSPACE_NAME);
|
||||
SelectedWorkspace = Workspaces.First();
|
||||
if (_model.try_get_user(name, out var user)) {
|
||||
var to_add = await _model.workspaces_for(user);
|
||||
@@ -136,15 +140,13 @@ namespace mbts.ui.shell
|
||||
|
||||
private async void OnLogin(object arg) {
|
||||
save_selection();
|
||||
string selected_workspace = SelectedWorkspace;
|
||||
if (selected_workspace == "New workspace...") {
|
||||
selected_workspace = null;
|
||||
}
|
||||
string selected_workspace = _resume_workspace && SelectedWorkspace != NEW_WORKSPACE_NAME ?
|
||||
SelectedWorkspace : null;
|
||||
var result = await _model.do_login(Name, selected_workspace, Password);
|
||||
if (result.success) { VisualState = "Loading"; }
|
||||
if (result.success) { login_status = LoginStatus.LoggingIn; }
|
||||
if (!result.success && !string.IsNullOrEmpty(result.reason)) {
|
||||
WarningMessage = result.reason;
|
||||
VisualState = "BadPassword";
|
||||
login_status = LoginStatus.Rejected;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(result.reason)) {
|
||||
// Login was successful but we have a message for the user
|
||||
|
||||
@@ -253,15 +253,18 @@ namespace mbts.ui {
|
||||
sd.StateChanged += on_state_changed;
|
||||
return Disposable.Create(() => sd.StateChanged -= on_state_changed);
|
||||
void on_state_changed(string oldval, string newval) => transition(newval);
|
||||
async void transition(string state) {
|
||||
void transition(string state) {
|
||||
version++;
|
||||
if (target.IsLoaded)
|
||||
StateManager.GoToState(target, state);
|
||||
else {
|
||||
int v = version;
|
||||
await target.LoadedAsync();
|
||||
if (v == version)
|
||||
StateManager.GoToState(target, state);
|
||||
target.Loaded += on_loaded;
|
||||
void on_loaded(object sender, RoutedEventArgs e) {
|
||||
target.Loaded -= on_loaded;
|
||||
if (v == version)
|
||||
StateManager.GoToState(target, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,3 +1,14 @@
|
||||
This needs sim market data **not** to be merged with replay (or
|
||||
cert), so we can create our own markets. Use the following key to set
|
||||
market data up:
|
||||
|
||||
ExchangeSim {
|
||||
value {
|
||||
merge_with_md: false
|
||||
forward_implied: false
|
||||
}
|
||||
}
|
||||
|
||||
Algo Studio lets you combine algos together and save it as an order type:
|
||||
|
||||
To test this, we will create a common algo combination and test to make sure it's working as desired.
|
||||
@@ -6,42 +17,32 @@ To test this, we will create a common algo combination and test to make sure it'
|
||||
Let's start by creating the Algo:
|
||||
|
||||
Launch Algo Studio
|
||||
Click on top right icon to "add algo"
|
||||
Click on top left icon to "add algo"
|
||||
Give it a name, call it T_C and give the abbrev a title of T_C as well.
|
||||
Create a Top with Cover, so the very top algos with be a "top" (top thresh 10) and it's child will be a cover (Hedge Ticks 2)
|
||||
Leave both Hedge and Child as limits of the child
|
||||
|
||||
|
||||
Use a very liquid market with recorded data to test, I suggest something like ES or CL.
|
||||
|
||||
On the ladder, go to settings, then algo favorites and click add and choose your T_C algo.
|
||||
|
||||
This will display it on the ladder for quick deployment
|
||||
|
||||
click on algo, then enter an order on the best bid
|
||||
1.) Create a 20 lot bid/ask market 1 tick apart.
|
||||
2.) Place a 5 lot T_C (top cover algo) buy order on the best bid market.
|
||||
3.) Place another 5 lot buy limit order on the best bid
|
||||
4.) Place a 25 lot sell limit order on the best bid, filling the orders placed in 1 and 2
|
||||
5.) Verify that the cover order was deployed.
|
||||
|
||||
wait until it fills, once fills, it should submit the cover order 2 ticks above the price you got filled at.
|
||||
|
||||
try this with a sell order following the same procedure.
|
||||
Repeat steps 1 through 5 with a sell order.
|
||||
|
||||
Additionally, we will add a "lean" into the mix as the child of the cover.
|
||||
|
||||
go back to your algo studio, and change the hedge of the cover to be that of lean.
|
||||
|
||||
What will happen is once the cover order is submitted, it will include the lean logic on that cover order. Meaning, it'll lean into the market and cross once the cross thresh is reach.
|
||||
|
||||
Set the parameters to a cross thresh of 10, max chase ticks 0 and on toward no change
|
||||
|
||||
save the algo, and send an order and wait for it to be filled.
|
||||
|
||||
Once filled, it will remain working until the market flips, which means it ticks up a level. Once it flips and there is 1 remaining, the order should cross.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Go back to your algo studio, and change the hedge of the cover to be that of lean.
|
||||
|
||||
What will happen is once the cover order is submitted, it will include the lean logic on that cover order.
|
||||
|
||||
Set the parameters to a cross thresh of 10, max chase ticks 0 and on toward no change.
|
||||
|
||||
Save the algo, and repeat steps 1 through 5 again.
|
||||
|
||||
This time the hedge should get filled immediately, as it will lean into the market that we just reduced below it's threshold size.
|
||||
Reference in new issue
Block a user