Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make currency type editable when pricing #1067

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Procurement/Controls/ItemDisplay.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@ private void buyoutView_SaveClicked(string amount, string orbType)
{
var abbreviation = CurrencyAbbreviationMap.Instance.FromCurrency(orbType);

if (string.IsNullOrEmpty(abbreviation))
abbreviation = orbType;

var vm = DataContext as ItemDisplayViewModel;
var item = vm.Item;

Expand Down
22 changes: 11 additions & 11 deletions Procurement/Controls/SetBuyoutView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="40"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="60"/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="120" />
<ColumnDefinition Width="75" />
<ColumnDefinition Width="95" />
<ColumnDefinition Width="170" />
</Grid.ColumnDefinitions>

<!--Buyouts-->
Expand All @@ -29,7 +29,7 @@
<Button Content="+" Height="25" Width="20" Command="{Binding Path=BuyoutInfo.IncreaseValue}" IsEnabled="{Binding BuyoutInfo.Enabled, Mode=TwoWay}"/>
<Button Content="-" Height="25" Width="20" Command="{Binding Path=BuyoutInfo.DecreaseValue}" IsEnabled="{Binding BuyoutInfo.Enabled, Mode=TwoWay}"/>
</StackPanel>
<ComboBox Grid.Column="2" Grid.Row="0" Height="25" x:Name="OrbType" IsEnabled="{Binding BuyoutInfo.Enabled, Mode=TwoWay}" ItemsSource="{Binding OrbTypes}" SelectedItem="{Binding BuyoutInfo.Orb}" />
<ComboBox IsEditable="True" Grid.Column="2" Grid.Row="0" Height="25" x:Name="OrbType" IsEnabled="{Binding BuyoutInfo.Enabled, Mode=TwoWay}" ItemsSource="{Binding OrbTypes}" Text="{Binding BuyoutInfo.Orb}" IsTextSearchEnabled="False" />

<!--Current Offer-->
<CheckBox Content="Offer" Grid.Row="1" Foreground="#FFAB9066" FontSize="14" FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Center" IsChecked="{Binding OfferInfo.Enabled, Mode=TwoWay}"/>
Expand All @@ -38,7 +38,7 @@
<Button Content="+" Height="25" Width="20" Command="{Binding Path=OfferInfo.IncreaseValue}" IsEnabled="{Binding OfferInfo.Enabled, Mode=TwoWay}" />
<Button Content="-" Height="25" Width="20" Command="{Binding Path=OfferInfo.DecreaseValue}" IsEnabled="{Binding OfferInfo.Enabled, Mode=TwoWay}"/>
</StackPanel>
<ComboBox Grid.Column="2" Grid.Row="1" Height="25" IsEnabled="{Binding OfferInfo.Enabled, Mode=TwoWay}" ItemsSource="{Binding OrbTypes}" SelectedItem="{Binding OfferInfo.Orb}"/>
<ComboBox IsEditable="True" Grid.Column="2" Grid.Row="1" Height="25" IsEnabled="{Binding OfferInfo.Enabled, Mode=TwoWay}" ItemsSource="{Binding OrbTypes}" Text="{Binding OfferInfo.Orb}" IsTextSearchEnabled="False" />

<!--Price-->
<CheckBox Content="Price" Grid.Row="2" Foreground="#FFAB9066" FontSize="14" FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Center" IsChecked="{Binding PriceInfo.Enabled, Mode=TwoWay}"/>
Expand All @@ -47,12 +47,12 @@
<Button Content="+" Height="25" Width="20" Command="{Binding Path=PriceInfo.IncreaseValue}" IsEnabled="{Binding PriceInfo.Enabled, Mode=TwoWay}"/>
<Button Content="-" Height="25" Width="20" Command="{Binding Path=PriceInfo.DecreaseValue}" IsEnabled="{Binding PriceInfo.Enabled, Mode=TwoWay}"/>
</StackPanel>
<ComboBox Grid.Column="2" Grid.Row="2" Height="25" IsEnabled="{Binding PriceInfo.Enabled, Mode=TwoWay}" ItemsSource="{Binding OrbTypes}" SelectedItem="{Binding PriceInfo.Orb}" />
<ComboBox IsEditable="True" Grid.Column="2" Grid.Row="2" Height="25" IsEnabled="{Binding PriceInfo.Enabled, Mode=TwoWay}" ItemsSource="{Binding OrbTypes}" Text="{Binding PriceInfo.Orb}" IsTextSearchEnabled="False" />


<TextBlock Grid.Row="3" Foreground="#FFAB9066" Text="Notes:" />
<TextBlock Grid.Row="3" Foreground="#FFAB9066" Text="Notes:" VerticalAlignment="Center" />

<TextBlock Grid.Row="3" Foreground="#FFAB9066" Text="POB Data copied to Clipboard" Grid.Column="1" Grid.ColumnSpan="2" Visibility="{Binding IsDataInClipboard, Converter={StaticResource bc}}"/>
<TextBlock Grid.Row="3" Foreground="#FFAB9066" Text="POB Data copied to clipboard." HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Column="1" Grid.ColumnSpan="2" Visibility="{Binding IsDataInClipboard, Converter={StaticResource bc}}"/>

<Button Content="Export to POB" ToolTip="Copy item data to clipboard in Path of Building format"
Grid.Column="2" Height="25" Command="{Binding PobDataGenerationCommand}" Grid.Row="3" Visibility="{Binding IsDataInClipboard, Converter={StaticResource bc}, ConverterParameter=Invert}"
Expand All @@ -65,12 +65,12 @@
<ColumnDefinition Width="5" />
<ColumnDefinition Width="110" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="90" />
<ColumnDefinition Width="110" />
</Grid.ColumnDefinitions>

<Button Content="Save" Grid.Column="0" Height="25" Width="110" Click="Save_Clicked"/>
<Button Content="Save Image" Grid.Column="2" Height="25" Width="110" Click="SaveImage_Click" HorizontalAlignment="Left" />
<Button Content="Timestamp" Grid.Column="4" Height="25" Width="90" Click="Timestamp_Click" HorizontalAlignment="Left" />
<Button Content="Timestamp" Grid.Column="4" Height="25" Width="110" Click="Timestamp_Click" HorizontalAlignment="Left" />
</Grid>
</Grid>
</UserControl>
16 changes: 8 additions & 8 deletions Procurement/Controls/SetTabBuyoutView.xaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Window x:Class="Procurement.Controls.SetTabBuyoutView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Set Tabwide Buyout" WindowStyle="None" ResizeMode="NoResize" Width="340" Height="90">
Title="Set Tabwide Buyout" WindowStyle="None" ResizeMode="NoResize" Width="370" Height="90">
<Window.Resources>
<ResourceDictionary Source="/Procurement;component/Controls/ExpressionDark.xaml" />
</Window.Resources>
Expand All @@ -13,8 +13,8 @@
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="120" />
<ColumnDefinition Width="95" />
<ColumnDefinition Width="170" />
</Grid.ColumnDefinitions>

<!--Buyouts-->
Expand All @@ -24,16 +24,16 @@
<Button Content="+" Height="25" Width="20" Command="{Binding Path=BuyoutInfo.IncreaseValue}" IsEnabled="{Binding BuyoutInfo.Enabled, Mode=TwoWay}"/>
<Button Content="-" Height="25" Width="20" Command="{Binding Path=BuyoutInfo.DecreaseValue}" IsEnabled="{Binding BuyoutInfo.Enabled, Mode=TwoWay}"/>
</StackPanel>
<ComboBox Grid.Column="2" Grid.Row="0" Height="25" x:Name="OrbType" IsEnabled="{Binding BuyoutInfo.Enabled, Mode=TwoWay}" ItemsSource="{Binding OrbTypes}" SelectedItem="{Binding BuyoutInfo.Orb}" />
<ComboBox IsEditable="True" Grid.Column="2" Grid.Row="0" Height="25" x:Name="OrbType" IsEnabled="{Binding BuyoutInfo.Enabled, Mode=TwoWay}" ItemsSource="{Binding OrbTypes}" Text="{Binding BuyoutInfo.Orb}" IsTextSearchEnabled="False" />

<Grid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="160" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="160" />
<ColumnDefinition Width="175" />
<ColumnDefinition Width="20" />
<ColumnDefinition Width="175" />
</Grid.ColumnDefinitions>

<Button Content="Save" Grid.Column="0" Height="25" Width="150" Click="Save_Clicked"/>
<Button Content="Save" Grid.Column="0" Height="25" Width="150" Click="Save_Clicked" HorizontalAlignment="Right" />
<Button Content="Cancel" Grid.Column="2" Height="25" Width="150" Click="Cancel_Click" HorizontalAlignment="Left" />

</Grid>
Expand Down
14 changes: 11 additions & 3 deletions Procurement/ViewModel/PricingInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,23 @@ public void Update(string info)
value = valueOrbPair[0];
orb = CurrencyAbbreviationMap.Instance.FromAbbreviation(valueOrbPair[1]);

enabled = value != string.Empty;
if (string.IsNullOrEmpty(orb))
orb = valueOrbPair[1];

enabled = !string.IsNullOrEmpty(value) && !string.IsNullOrEmpty(orb);
}

public string GetSaveText()
{
if (!enabled || (string.IsNullOrEmpty(value) && string.IsNullOrEmpty(orb)))
if (!enabled)
return string.Empty;

return $"{value} {CurrencyAbbreviationMap.Instance.FromCurrency(orb)}";
string abbreviation = CurrencyAbbreviationMap.Instance.FromCurrency(orb);

if (string.IsNullOrEmpty(abbreviation))
return $"{value} {orb}";

return $"{value} {abbreviation}";
}
}
}
2 changes: 1 addition & 1 deletion Procurement/ViewModel/SetBuyoutViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private void GetPobData(object o)

private bool CanGetPobData(object o)
{
return item.GetType() == typeof(Gear);
return item.GetType() == typeof(Gear) && item.ItemLevel > 0;
}
}
}