Skip to content

Commit

Permalink
Rective programming
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksanderwlodarczyk committed Apr 11, 2022
1 parent d2f845f commit 04d3aee
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Shop1/ShopLogic/PromotionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ internal class PromotionManager : IPromotionManager
{
public PromotionManager(IWarehouse warehouse)
{
PromotionTimer = new System.Timers.Timer(2000);
PromotionTimer = new System.Timers.Timer(10000);
PromotionTimer.Elapsed += GetNewPromotion;
PromotionTimer.AutoReset = true;
PromotionTimer.Enabled = true;
Expand Down
6 changes: 3 additions & 3 deletions Shop1/ShopPresentation/GraphicalUserInterface/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<Image Source="apple.png" Margin="50 0"></Image>
<TextBlock VerticalAlignment="Center" FontSize="25" Margin="50 0" Text="{Binding Name}"></TextBlock>
<TextBlock VerticalAlignment="Center" FontSize="25" Margin="50 0" Text="{Binding Price, StringFormat='0. PLN'}"></TextBlock>
<TextBlock VerticalAlignment="Center" FontSize="25" Margin="50 0" Text="{Binding Price, StringFormat='0.00 PLN'}"></TextBlock>
</StackPanel>
</Button>
</DataTemplate>
Expand All @@ -62,7 +62,7 @@
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<Image Source="apple.png" Margin="50 0"></Image>
<TextBlock VerticalAlignment="Center" FontSize="25" Margin="50 0" Text="{Binding Name}"></TextBlock>
<TextBlock VerticalAlignment="Center" FontSize="25" Margin="50 0" Text="{Binding Price, StringFormat='0. PLN'}"></TextBlock>
<TextBlock VerticalAlignment="Center" FontSize="25" Margin="50 0" Text="{Binding Price, StringFormat='0.00 PLN'}"></TextBlock>
</StackPanel>
</Button>
</DataTemplate>
Expand All @@ -72,7 +72,7 @@
</StackPanel>
<StackPanel Orientation="Horizontal">
<Button Content="Kup" Width="300" Height="200" FontSize="36" Margin="30" Command= "{Binding BuyButtonClick}"></Button>
<TextBlock VerticalAlignment="Center" FontSize="48" Margin="100 0" Text="{Binding BasketSum, StringFormat='0. PLN'}"></TextBlock>
<TextBlock VerticalAlignment="Center" FontSize="48" Margin="100 0" Text="{Binding BasketSum, StringFormat='0.00 PLN'}"></TextBlock>
</StackPanel>

</StackPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ public MainWindowViewModel(ModelAbstractApi modelAbstractApi)
BuyButtonClick = new GalaSoft.MvvmLight.Command.RelayCommand(() => BuyButtonClickHandler());

FruitButtonClick = new RelayCommand<Guid>((id) => FruitButtonClickHandler(id));
timer.Interval = 2;
timer.Interval = 10000;
timer.Enabled = true;
timer.Elapsed += Timer_Elapsed;
}

Expand All @@ -58,8 +59,10 @@ public MainWindowViewModel(ModelAbstractApi modelAbstractApi)

private void Timer_Elapsed(object sender, ElapsedEventArgs e)
{
Fruits.Clear();
foreach (FruitDTO fruit in ModelLayer.WarehousePresentation.GetFruits())
List<FruitDTO> fruitsInShop = ModelLayer.WarehousePresentation.GetFruits();
Fruits = new ObservableCollection<FruitDTO>();

foreach (FruitDTO fruit in fruitsInShop)
{
Fruits.Add(fruit);
}
Expand Down

0 comments on commit 04d3aee

Please sign in to comment.