Compare commits

...

2 Commits

Author SHA1 Message Date
bfae0adcae declutter GUI with expanders 2022-11-29 18:15:30 +01:00
454af4ad8f fix profit adjustment window 2022-11-29 18:05:08 +01:00
2 changed files with 33 additions and 20 deletions

View File

@ -65,7 +65,7 @@
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal">
<StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center" Margin="0,5,0,5">
<CheckBox Focusable="False" IsChecked="{Binding IsEnabled}" VerticalAlignment="Center"/>
<TextBlock Text="System: " Visibility="{Binding HasSystem}" Margin="5,0,0,0"/>
<TextBlock Text="{Binding System}" FontWeight="DemiBold" Visibility="{Binding HasSystem}"/>
@ -73,7 +73,7 @@
<TextBlock Text="{Binding Faction}" FontWeight="DemiBold" Visibility="{Binding HasFaction}"/>
</StackPanel>
<Separator Visibility="Hidden" Grid.Column="1" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" />
<StackPanel Grid.Column="2">
<StackPanel Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Center">
<Button x:Name="AddCombatZone" Content="Add Combat Zone" Click="AddCombatZone_Click" />
</StackPanel>
</Grid>
@ -89,32 +89,39 @@
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Stretch">
<StackPanel Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Stretch" 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 Name}" FontWeight="DemiBold" TextAlignment="Center"/>
</StackPanel>
<Separator Visibility="Hidden" Grid.Column="1" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" />
<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="Captain" Margin="2,0,2,0" Content="Captain" Visibility="{Binding IsShipCombatZone}" IsChecked="{Binding HasCaptain, Mode=TwoWay}" IsThreeState="False"/>
<ToggleButton x:Name="Correspondent" Margin="2,0,2,0" Content="Correspondent" Visibility="{Binding IsShipCombatZone}" IsChecked="{Binding HasCorrespondent, Mode=TwoWay}" IsThreeState="False"/>
<ToggleButton x:Name="SpecOps" Margin="2,0,2,0" Content="Spec Ops" Visibility="{Binding IsShipCombatZone}" IsChecked="{Binding HasSpecOps, Mode=TwoWay}" IsThreeState="False"/>
<Separator Margin="2,0,2,0" VerticalAlignment="Top"/>
<Button x:Name="Low" Content="Low" Click="Low_Click"/>
<Separator Margin="2,0,2,0" VerticalAlignment="Top"/>
<Button Content="Med" x:Name="Med" Click="Med_Click" />
<Separator Margin="2,0,2,0" VerticalAlignment="Top"/>
<Button Content="High" x:Name="High" Click="High_Click"/>
<Separator Margin="2,0,2,0" VerticalAlignment="Top"/>
<Button Content="Ground" x:Name="Ground" Click="Ground_Click"/>
<Separator Margin="2,0,2,0" VerticalAlignment="Top"/>
<Button Content="Ship" x:Name="Ship" Click="Ship_Click"/>
<Expander Header="Optional Objectives">
<StackPanel Orientation="Vertical">
<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="Correspondent" Margin="2,0,2,0" Content="Correspondent" Visibility="{Binding IsShipCombatZone}" IsChecked="{Binding HasCorrespondent, Mode=TwoWay}" IsThreeState="False"/>
<ToggleButton x:Name="SpecOps" Margin="2,0,2,0" Content="Spec Ops" Visibility="{Binding IsShipCombatZone}" IsChecked="{Binding HasSpecOps, Mode=TwoWay}" IsThreeState="False"/>
</StackPanel>
</Expander>
<Expander Header="Difficulty">
<StackPanel Orientation="Vertical">
<Button x:Name="Low" Content="Low" Click="Low_Click"/>
<Button x:Name="Med" Content="Med" Click="Med_Click"/>
<Button x:Name="High" Content="High" Click="High_Click"/>
</StackPanel>
</Expander>
<Expander Header="Type">
<StackPanel Orientation="Vertical">
<Button Content="Ground" x:Name="Ground" Click="Ground_Click"/>
<Button Content="Ship" x:Name="Ship" Click="Ship_Click"/>
</StackPanel>
</Expander>
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" x:Name="SellCargo" Visibility="{Binding IsSellCargo}">
<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>
</Grid>
</HierarchicalDataTemplate>

View File

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