-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml
177 lines (158 loc) · 14.2 KB
/
MainWindow.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<Window x:Class="Business_System_Laboration_4.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Business_System_Laboration_4"
d:DataContext="{d:DesignInstance Type=local:ViewModelBase}"
mc:Ignorable="d"
Height="900" Width="1440" WindowStartupLocation="CenterScreen" Background="#CD4954" Foreground="#F5F9F9" BorderThickness="0" Title="Laboration 4" WindowStyle="ThreeDBorderWindow" ResizeMode="NoResize" local:WindowEvents.EnableClosing="True" local:WindowEvents.EnableLoading="True">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Styles/Styles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid>
<TabControl Margin="0 10 0 0" Style="{StaticResource CustomTabControlStyle}">
<TabItem Header="Kassa" Style="{StaticResource TabStyle}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="250"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition/>
<RowDefinition Height="40"/>
<RowDefinition/>
<RowDefinition Height="40"/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Grid.Column="0" Text="Böcker" VerticalAlignment="Center" Margin="10,0,0,0" Grid.ColumnSpan="2" Style="{StaticResource TextTitleStyles}"/>
<TextBlock Grid.Row="2" Grid.Column="0" Text="Dataspel" VerticalAlignment="Center" Margin="10,0,0,0" Grid.ColumnSpan="2" Style="{StaticResource TextTitleStyles}"/>
<TextBlock Grid.Row="4" Grid.Column="0" Text="Filmer" VerticalAlignment="Center" Margin="10,0,0,0" Grid.ColumnSpan="2" Style="{StaticResource TextTitleStyles}"/>
<DockPanel LastChildFill="False" Grid.Column="2" Grid.Row="0" Margin="0,0,10,0">
<TextBlock Text="Varukorg" VerticalAlignment="Center" DockPanel.Dock="Left" Style="{StaticResource TextTitleStyles}"/>
<Label Content="{Binding Cart.TotalPrice}" ContentStringFormat="Totalt: {0:C}" Language="sv-SE" VerticalAlignment="Center" DockPanel.Dock="Right"/>
<Label Content="{Binding Cart.TotalQuantity}" ContentStringFormat="Antal: {0}" VerticalAlignment="Center" DockPanel.Dock="Left"/>
</DockPanel>
<ListBox ItemsSource="{Binding Cart.CartItems}" Grid.Column="1" Grid.Row="1" Margin="0 0 10 10" Style="{StaticResource ListBoxStyle}">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Content="{Binding CartQuantity}" ContentStringFormat=" {0}x" Padding="10,0,10,0" VerticalAlignment="Center"/>
<TextBlock Grid.Column="1" Text="{Binding Name}" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<Button Grid.Column="2" Content="X" HorizontalAlignment="Right" Style="{StaticResource RemoveButtonStyle}" CommandParameter="{Binding}" Padding="10,0,10,0"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Button Content="Genomför Köp" Command="{Binding ConfirmPurchase, Mode=OneWay}" Style="{StaticResource ButtonStyle}" Grid.Column="1" Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0 0 10 0"/>
<DataGrid Grid.Row="1" Grid.Column="0" Margin="10,0,10,10" ItemsSource="{Binding Path=ProdHandler.Books, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource DataGridStyle}">
<DataGrid.Columns>
<DataGridTemplateColumn Header="">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="{Binding Price}" Command="{Binding DataContext.AddItemToCart, RelativeSource={RelativeSource AncestorType=DataGrid}}" Language="sv-SE" CommandParameter="{Binding}" Style="{StaticResource PurchaseButtonStyle}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="Namn" IsReadOnly="True" Width="300" Binding="{Binding Name}"/>
<DataGridTextColumn Header="Författare" IsReadOnly="True" Width="*" Binding="{Binding Author}"/>
<DataGridTextColumn Header="Genre" IsReadOnly="True" Width="*" Binding="{Binding Genre}"/>
<DataGridTextColumn Header="Format" IsReadOnly="True" Width="*" Binding="{Binding FormatDescription}"/>
<DataGridTextColumn Header="Språk" IsReadOnly="True" Width="*" Binding="{Binding Language}"/>
</DataGrid.Columns>
</DataGrid>
<DataGrid Grid.Row="3" Grid.Column="0" Margin="10,0,10,10" ItemsSource="{Binding Path=ProdHandler.VideoGames, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource DataGridStyle}">
<DataGrid.Columns>
<DataGridTemplateColumn Header="">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="{Binding Price}" Command="{Binding DataContext.AddItemToCart, RelativeSource={RelativeSource AncestorType=DataGrid}}" Language="sv-SE" CommandParameter="{Binding}" Style="{StaticResource PurchaseButtonStyle}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="Namn" IsReadOnly="True" Width="300" Binding="{Binding Name}"/>
<DataGridTextColumn Header="Plattform" IsReadOnly="True" Width="*" Binding="{Binding FormatDescription}"/>
</DataGrid.Columns>
</DataGrid>
<DataGrid Grid.Row="5" Grid.Column="0" Margin="10,0,10,10" ItemsSource="{Binding Path=ProdHandler.Movies, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource DataGridStyle}">
<DataGrid.Columns>
<DataGridTemplateColumn Header="">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="{Binding Price}" Command="{Binding DataContext.AddItemToCart, RelativeSource={RelativeSource AncestorType=DataGrid}}" Language="sv-SE" CommandParameter="{Binding}" Style="{StaticResource PurchaseButtonStyle}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="Namn" IsReadOnly="True" Width="300" Binding="{Binding Name}"/>
<DataGridTextColumn Header="Format" IsReadOnly="True" Width="*" Binding="{Binding FormatDescription}"/>
<DataGridTextColumn Header="Speltid (min.)" IsReadOnly="True" Width="*" Binding="{Binding PlayTime}"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
</TabItem>
<TabItem Header="Lager" Style="{StaticResource TabStyle}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="30"/>
<RowDefinition/>
<RowDefinition Height="30"/>
<RowDefinition/>
<RowDefinition Height="30"/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel x:Name="buttonStack" Grid.Row="0" Orientation="Horizontal">
<Button Content="Lägg till produkt" Style="{StaticResource ButtonStyle}" Command="{Binding AddProduct}"/>
<Button Content="Ta bort produkt" Style="{StaticResource ButtonStyle}" Command="{Binding RemoveProduct}"/>
<Button Content="Lägg till leverans" Style="{StaticResource ButtonStyle}" Command="{Binding HandleDelivery}"/>
<Button Content="Synka med centrallager" Style="{StaticResource ButtonStyle}" Command="{Binding SyncWithCentral}"/>
</StackPanel>
<TextBlock Grid.Row="1" Text="Böcker" VerticalAlignment="Center" Margin="10,0,0,0" Style="{StaticResource TextTitleStyles}"/>
<TextBlock Grid.Row="3" Text="Dataspel" VerticalAlignment="Center" Margin="10,0,0,0" Style="{StaticResource TextTitleStyles}"/>
<TextBlock Grid.Row="5" Text="Filmer" VerticalAlignment="Center" Margin="10,0,0,0" Style="{StaticResource TextTitleStyles}"/>
<DataGrid Grid.Row="2" Margin="10,0,10,10" ItemsSource="{Binding Path=ProdHandler.Books, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource DataGridStyle}">
<DataGrid.Columns>
<DataGridTextColumn Header="Varunummer" IsReadOnly="True" CanUserResize="False" Width="Auto" Binding="{Binding Id}" CellStyle="{StaticResource DataGridNumberCellStyle}"/>
<DataGridTextColumn Header="Antal" IsReadOnly="True" MinWidth="100" Binding="{Binding Amount}" CellStyle="{StaticResource DataGridNumberCellStyle}"/>
<DataGridTextColumn Header="Pris" IsReadOnly="True" MinWidth="100" Binding="{Binding Price, StringFormat={}{0:C}, ConverterCulture=sv-SE}"/>
<DataGridTextColumn Header="Namn" IsReadOnly="True" MinWidth="300" Binding="{Binding Name}"/>
<DataGridTextColumn Header="Författare" IsReadOnly="True" Width="*" Binding="{Binding Author}"/>
<DataGridTextColumn Header="Genre" IsReadOnly="True" Width="*" Binding="{Binding Genre}"/>
<DataGridTextColumn Header="Format" IsReadOnly="True" Width="*" Binding="{Binding FormatDescription}"/>
<DataGridTextColumn Header="Språk" IsReadOnly="True" Width="*" Binding="{Binding Language}"/>
</DataGrid.Columns>
</DataGrid>
<DataGrid Grid.Row="4" Margin="10,0,10,10" ItemsSource="{Binding Path=ProdHandler.VideoGames, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource DataGridStyle}">
<DataGrid.Columns>
<DataGridTextColumn Header="Varunummer" IsReadOnly="True" CanUserResize="False" Width="Auto" Binding="{Binding Id}" CellStyle="{StaticResource DataGridNumberCellStyle}"/>
<DataGridTextColumn Header="Antal" IsReadOnly="True" MinWidth="100" Binding="{Binding Amount}" CellStyle="{StaticResource DataGridNumberCellStyle}"/>
<DataGridTextColumn Header="Pris" IsReadOnly="True" MinWidth="100" Binding="{Binding Price, StringFormat={}{0:C}, ConverterCulture=sv-SE}"/>
<DataGridTextColumn Header="Namn" IsReadOnly="True" MinWidth="300" Binding="{Binding Name}"/>
<DataGridTextColumn Header="Plattform" IsReadOnly="True" Width="*" Binding="{Binding FormatDescription}"/>
</DataGrid.Columns>
</DataGrid>
<DataGrid Grid.Row="6" Margin="10,0,10,10" ItemsSource="{Binding Path=ProdHandler.Movies, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource DataGridStyle}">
<DataGrid.Columns>
<DataGridTextColumn Header="Varunummer" IsReadOnly="True" CanUserResize="False" Width="Auto" Binding="{Binding Id}" CellStyle="{StaticResource DataGridNumberCellStyle}"/>
<DataGridTextColumn Header="Antal" IsReadOnly="True" MinWidth="100" Binding="{Binding Amount}" CellStyle="{StaticResource DataGridNumberCellStyle}"/>
<DataGridTextColumn Header="Pris" IsReadOnly="True" MinWidth="100" Binding="{Binding Price, StringFormat={}{0:C}, ConverterCulture=sv-SE}"/>
<DataGridTextColumn Header="Namn" IsReadOnly="True" MinWidth="300" Binding="{Binding Name}"/>
<DataGridTextColumn Header="Format" IsReadOnly="True" Width="*" Binding="{Binding FormatDescription}"/>
<DataGridTextColumn Header="Speltid" IsReadOnly="True" Width="*" Binding="{Binding PlayTime}"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
</TabItem>
</TabControl>
</Grid>
</Window>