fix profit adjustment window

This commit is contained in:
Florian Stinglmayr 2022-11-29 18:05:08 +01:00
parent 7f73159bb0
commit 454af4ad8f
2 changed files with 11 additions and 4 deletions

View File

@ -73,7 +73,7 @@
<TextBlock Text="{Binding Faction}" FontWeight="DemiBold" Visibility="{Binding HasFaction}"/> <TextBlock Text="{Binding Faction}" FontWeight="DemiBold" Visibility="{Binding HasFaction}"/>
</StackPanel> </StackPanel>
<Separator Visibility="Hidden" Grid.Column="1" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" /> <Separator Visibility="Hidden" Grid.Column="1" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" />
<StackPanel Grid.Column="2"> <StackPanel Grid.Column="2" HorizontalAlignment="Right">
<Button x:Name="AddCombatZone" Content="Add Combat Zone" Click="AddCombatZone_Click" /> <Button x:Name="AddCombatZone" Content="Add Combat Zone" Click="AddCombatZone_Click" />
</StackPanel> </StackPanel>
</Grid> </Grid>
@ -89,13 +89,14 @@
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Stretch"> <StackPanel Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Stretch">
<CheckBox Focusable="False" IsChecked="{Binding IsEnabled}" VerticalAlignment="Center"/> <CheckBox Focusable="False" IsChecked="{Binding IsEnabled}" VerticalAlignment="Center"/>
<TextBlock Text="{Binding CompletedAt}" Margin="5,0,5,0" HorizontalAlignment="Right" TextAlignment="Center"/> <TextBlock Text="{Binding CompletedAt}" Margin="5,0,5,0" HorizontalAlignment="Right" TextAlignment="Center"/>
<TextBlock Text="{Binding Name}" FontWeight="DemiBold" TextAlignment="Center"/> <TextBlock Text="{Binding Name}" FontWeight="DemiBold" TextAlignment="Center"/>
</StackPanel> </StackPanel>
<Separator Visibility="Hidden" Grid.Column="1" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" /> <!--<Separator Visibility="Hidden" Grid.Column="1" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" />-->
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" x:Name="CombatZone" Visibility="{Binding IsCombatZone}"> <StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" x:Name="CombatZone" Visibility="{Binding IsCombatZone}">
<ToggleButton x:Name="CapitalShip" Margin="2,0,2,0" Content="Capital Ship" Visibility="{Binding IsShipCombatZone}" IsChecked="{Binding HasCapitalShip, Mode=TwoWay}" IsThreeState="False"/> <ToggleButton x:Name="CapitalShip" Margin="2,0,2,0" Content="Capital Ship" Visibility="{Binding IsShipCombatZone}" IsChecked="{Binding HasCapitalShip, Mode=TwoWay}" IsThreeState="False"/>
<ToggleButton x:Name="Captain" Margin="2,0,2,0" Content="Captain" Visibility="{Binding IsShipCombatZone}" IsChecked="{Binding HasCaptain, Mode=TwoWay}" IsThreeState="False"/> <ToggleButton x:Name="Captain" Margin="2,0,2,0" Content="Captain" Visibility="{Binding IsShipCombatZone}" IsChecked="{Binding HasCaptain, Mode=TwoWay}" IsThreeState="False"/>
@ -114,7 +115,7 @@
</StackPanel> </StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" x:Name="SellCargo" Visibility="{Binding IsSellCargo}"> <StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" x:Name="SellCargo" Visibility="{Binding IsSellCargo}">
<TextBlock Text="Adjust Profit: " TextAlignment="Center" /> <TextBlock Text="Adjust Profit: " TextAlignment="Center" />
<TextBox x:Name="Profit" MinWidth="80" HorizontalContentAlignment="Right" Text="{Binding Profit, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" TextChanged="Profit_TextChanged"/> <TextBox x:Name="Profit" MinWidth="80" HorizontalContentAlignment="Right" Text="{Binding Profit, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" LostFocus="Profit_LostFocus" KeyUp="Profit_KeyUp"/>
</StackPanel> </StackPanel>
</Grid> </Grid>
</HierarchicalDataTemplate> </HierarchicalDataTemplate>

View File

@ -329,7 +329,13 @@ public partial class MainWindow : Window {
RefreshView(); RefreshView();
} }
private void Profit_TextChanged(object sender, TextChangedEventArgs e) { private void Profit_LostFocus(object sender, RoutedEventArgs e) {
RefreshView(); RefreshView();
} }
private void Profit_KeyUp(object sender, System.Windows.Input.KeyEventArgs e) {
if (e.Key == Key.Enter) {
RefreshView();
}
}
} }