Skip to content

Commit

Permalink
update 3.9.2.6
Browse files Browse the repository at this point in the history
- made currency exchange more readable
- added minimum stock value to currency exchange
  • Loading branch information
redSol committed Jan 12, 2020
1 parent 426f113 commit 6920cbc
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 31 deletions.
29 changes: 29 additions & 0 deletions Contracts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,35 @@ internal class PriceData

[DataMember(Name = "currency")]
internal string Currency = "";

[DataMember(Name = "exchange")]
internal ExchangeInfo Exchange = new ExchangeInfo();

[DataMember(Name = "item")]
internal ItemInfo Item = new ItemInfo();
}

[DataContract]
internal class ExchangeInfo
{
[DataMember(Name = "currency")]
internal string Currency = "";

[DataMember(Name = "amount")]
internal double Amount = 0;
}

[DataContract]
internal class ItemInfo
{
[DataMember(Name = "currency")]
internal string Currency = "";

[DataMember(Name = "amount")]
internal double Amount = 0;

[DataMember(Name = "stock")]
internal int Stock = 0;
}

[DataContract]
Expand Down
13 changes: 7 additions & 6 deletions MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<Button Content="EN" HorizontalAlignment="Left" Margin="245,479,0,-2" VerticalAlignment="Top" Height="19" Width="19" Tag="1" Click="Button_Click_2" Visibility="Hidden" />
<Button x:Name="btnClose" Content="Close" HorizontalAlignment="Left" Margin="307,470,0,0" VerticalAlignment="Top" Width="95" Height="38" Click="Button_Click_1" IsDefault="True" FontWeight="Bold" />

<TabControl x:Name="tabControl1" BorderThickness="0 1" Height="380" Margin="0,75,-2,0" VerticalAlignment="Top" TabStripPlacement="Bottom" SelectionChanged="tabControl1_SelectionChanged" HorizontalAlignment="Left" Width="404">
<TabControl x:Name="tabControl1" BorderThickness="0 1" Height="380" Margin="0,75,0,0" VerticalAlignment="Top" TabStripPlacement="Bottom" SelectionChanged="tabControl1_SelectionChanged" HorizontalAlignment="Left" Width="402">
<TabControl.Resources>
<Style TargetType="{x:Type TabPanel}">
<Setter Property="HorizontalAlignment" Value="Right"/>
Expand Down Expand Up @@ -269,12 +269,11 @@
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<ListBox x:Name="liPrice" Grid.IsSharedSizeScope="True" Height="{Binding ActualHeight, ElementName=grPriceLayout}" BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}" BorderThickness="0,0,0,1" >
</ListBox>
<ListBox x:Name="liPrice" Grid.IsSharedSizeScope="True" Height="{Binding ActualHeight, ElementName=grPriceLayout}" BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}" BorderThickness="0,0,0,1" Margin="0,0,-17,0" />
</Grid>

<Label Content="Min Value:" HorizontalAlignment="Left" Margin="155,288,0,0" VerticalAlignment="Top" />
<TextBox x:Name="tbPriceFilterMin" HorizontalAlignment="Left" Height="22" Margin="221,290,0,0" Text="" VerticalAlignment="Top" Width="33" BorderThickness="0,0,0,1" PreviewMouseLeftButtonDown="TbOpt0_0_PreviewMouseLeftButtonDown" />
<Label Content="Min Value:" HorizontalAlignment="Left" Margin="155,288,0,0" VerticalAlignment="Top" Visibility="Hidden"/>
<TextBox x:Name="tbPriceFilterMin" HorizontalAlignment="Left" Height="22" Margin="221,290,0,0" Text="" VerticalAlignment="Top" Width="33" BorderThickness="0,0,0,1" PreviewMouseLeftButtonDown="TbOpt0_0_PreviewMouseLeftButtonDown" Visibility="Hidden"/>

<Label Content="Result Count:" HorizontalAlignment="Left" Margin="251,288,0,0" VerticalAlignment="Top" />
<ComboBox x:Name="cbPriceListCount" HorizontalAlignment="Left" Margin="334,290,0,0" VerticalAlignment="Top" MaxDropDownHeight="282" Width="50">
Expand All @@ -287,7 +286,9 @@
<Border BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}" BorderThickness="1" HorizontalAlignment="Left" Height="1" Margin="0,319,0,0" VerticalAlignment="Top" Width="385" RenderTransformOrigin="0.5,0.5" />

<TextBlock x:Name="tkPriceCount2" Text="0" HorizontalAlignment="Left" Margin="4,325,0,0" VerticalAlignment="Top" />
<TextBlock x:Name="tkPriceInfo2" TextAlignment="Right" Margin="5,325,5,0" Text="TextBlock" MouseEnter="TkPrice_Mouse_EnterOrLeave" MouseLeave="TkPrice_Mouse_EnterOrLeave" Cursor="Hand" MouseLeftButtonDown="TkPrice_MouseLeftButtonDown" MouseRightButtonDown="tkPriceInfo_MouseRightButtonDown" />
<TextBlock x:Name="tkPriceInfo2" TextAlignment="Right" Margin="5,325,5,0" Text="TextBlock" MouseEnter="TkPrice_Mouse_EnterOrLeave" MouseLeave="TkPrice_Mouse_EnterOrLeave" Cursor="Hand" MouseLeftButtonDown="TkPrice_MouseLeftButtonDown" MouseRightButtonDown="tkPriceInfo_MouseRightButtonDown" />
<Label x:Name="lbPriceMinStock" Content="Minimum Stock:" HorizontalAlignment="Left" Margin="1,288,0,0" VerticalAlignment="Top"/>
<TextBox x:Name="tbPriceMinStock" HorizontalAlignment="Left" Height="22" Margin="99,290,0,0" Text="" VerticalAlignment="Top" Width="33" BorderThickness="0,0,0,1" PreviewMouseLeftButtonDown="TbOpt0_0_PreviewMouseLeftButtonDown"/>
</Grid>
</TabItem>

Expand Down
13 changes: 9 additions & 4 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,15 @@ private void Button_Click(object sender, RoutedEventArgs e)
string url = "";
string[] exchange = null;
string accountState = (string)cbAccountState.SelectedValue;

if (bdExchange.Visibility == Visibility.Visible && (cbOrbs.SelectedIndex > 0 || cbSplinters.SelectedIndex > 0))
{
exchange = new string[2];
exchange[0] = Restr.lExchangeCurrency[mItemBaseName.TypeEN];
exchange[1] = Restr.lExchangeCurrency[(string)(cbOrbs.SelectedIndex > 0 ? cbOrbs.SelectedValue : cbSplinters.SelectedValue)];
int minimumStock = int.Parse(tbPriceMinStock.Text);
url = Restr.ExchangeApi[Restr.ServerLang] + Restr.ServerType + "/?redirect&source=";
url += Uri.EscapeDataString("{\"exchange\":{\"status\":{\"option\":\"" + accountState + "\"},\"have\":[\"" + exchange[0] + "\"],\"want\":[\"" + exchange[1] + "\"]}}");
url += Uri.EscapeDataString("{\"exchange\":{\"status\":{\"option\":\"" + accountState + "\"},\"have\":[\"" + exchange[0] + "\"],\"want\":[\"" + exchange[1] + "\"],\"minimum\":"+ minimumStock + "}}");
Process.Start(url);
}
else
Expand Down Expand Up @@ -382,8 +384,11 @@ private void TkPrice_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
exchange[0] = Restr.lExchangeCurrency[mItemBaseName.TypeEN];
exchange[1] = Restr.lExchangeCurrency[(string)(cbOrbs.SelectedIndex > 0 ? cbOrbs.SelectedValue : cbSplinters.SelectedValue)];
}

PriceUpdateThreadWorker(exchange != null ? null : GetItemOptions(), exchange, (string)cbAccountState.SelectedValue);
lbPriceMinStock.Visibility = Visibility.Visible;
tbPriceMinStock.Visibility = Visibility.Visible;
tbPriceMinStock.IsEnabled = true;

PriceUpdateThreadWorker(exchange != null ? null : GetItemOptions(), exchange, (string)cbAccountState.SelectedValue, int.Parse(tbPriceMinStock.Text));
}

private void tkPriceInfo_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
Expand Down Expand Up @@ -415,7 +420,7 @@ private void tbOpt0_Checked(object sender, RoutedEventArgs e)
{
try
{
PriceUpdateThreadWorker(GetItemOptions(), null, (string)cbAccountState.SelectedValue);
PriceUpdateThreadWorker(GetItemOptions(), null, (string)cbAccountState.SelectedValue, 0);
}
catch (Exception)
{
Expand Down
Loading

0 comments on commit 6920cbc

Please sign in to comment.