-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml
269 lines (230 loc) · 15.3 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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
<Window x:Class="CryptoCurrencie.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:CryptoCurrencie"
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
mc:Ignorable="d"
Title="Portfolio Calculator" Height="670" Width="626">
<Grid>
<!-- Colonne de la barre de navigation (première colonne) -->
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- Barre de navigation -->
<Border Background="LightGray" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
<!-- Contenu de la barre de navigation -->
<TabControl TabStripPlacement="Left" Background="#F0F0F0">
<TabControl.Resources>
<Style TargetType="TabItem">
<Setter Property="Padding" Value="17,6"/>
<Setter Property="Background" Value="LightGray"/>
<Setter Property="Foreground" Value="Black"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TabItem">
<Border x:Name="Border" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}">
<ContentPresenter ContentSource="Header" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="Border" Property="Background" Value="#EFEFEF"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</TabControl.Resources>
<TabItem Header="Top">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Text="Top Cryptos" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center" Width="100" Margin="0,6,0,6"/>
<ListBox Grid.Row="1" ItemsSource="{Binding CryptoCurrencies}">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Height="80" Margin="5">
<!-- Première colonne (logo) -->
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Source="{Binding ThumbImage.Url}" Width="50" Height="100" VerticalAlignment="Center" Margin="0,0,15,0"/>
<!-- Deuxième colonne (texte) -->
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="33*"/>
<RowDefinition Height="33*"/>
<RowDefinition Height="33*"/>
</Grid.RowDefinitions>
<!-- Première moitié de la colonne -->
<StackPanel Grid.Row="0" Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Text="Name: " Margin="5,0,5,0"/>
<TextBlock Text="{Binding name}" FontWeight="Bold"/>
</StackPanel>
<!-- Deuxième moitié de la colonne -->
<StackPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Text="Last 24h : " Margin="5,0,5,0"/>
<TextBlock Text="{Binding change_percent_last_day}" FontWeight="Bold"/>
<TextBlock Text="%" FontWeight="Bold" Margin="0,0,5,0"/>
<TextBlock Text="(" FontWeight="Bold" Margin="0,0,0,0"/>
<TextBlock Text="$" Margin="0,0,1,0"/>
<TextBlock Text="{Binding change_price_last_day}"/>
<TextBlock Text=")" FontWeight="Bold"/>
</StackPanel>
<StackPanel Grid.Row="2" Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Text="Last 7days : " Margin="5,0,5,0"/>
<TextBlock Text="{Binding change_percent_last_week}" FontWeight="Bold"/>
<TextBlock Text="%" FontWeight="Bold" Margin="0,0,5,0"/>
</StackPanel>
</Grid>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</TabItem>
<TabItem Header="Portfeuille">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="80*"/>
<RowDefinition Height="20*"/>
</Grid.RowDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Text="All Positions et Assets" Width="145" FontWeight="Bold" Margin="0,5,0,5" FontSize="14"/>
<ListBox ItemsSource="{Binding UserPortfolio.Positions}" Grid.Row="1" VerticalAlignment="Top">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<TextBlock Text="Name : " FontWeight="Bold"/>
<TextBlock Text="{Binding CoinName}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Purchase Price : " FontWeight="Bold"/>
<TextBlock Text="{Binding PurchasePrice}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Actual Market Price : " FontWeight="Bold"/>
<TextBlock Text="{Binding CurrentPrice}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Quantity : " FontWeight="Bold"/>
<TextBlock Text="{Binding Quantity}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Total Cost : " FontWeight="Bold"/>
<TextBlock Text="{Binding TotalCost}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Profit : " FontWeight="Bold"/>
<TextBlock Text="{Binding ProfitLoss}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Is Risky Position : " FontWeight="Bold"/>
<TextBlock Text="{Binding IsRisky}" />
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
<StackPanel Grid.Row="1">
<StackPanel Orientation="Horizontal">
<TextBlock FontWeight="Bold" Text="Total investments : "/>
<TextBlock Text="$"/>
<TextBlock Text="{Binding UserPortfolio.CalculateTotalInvestment}"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock FontWeight="Bold" Text="Current Value : "/>
<TextBlock Text="$"/>
<TextBlock Text="{Binding UserPortfolio.CalculateCurrentValue}"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock FontWeight="Bold" Text="Total Assets : "/>
<TextBlock Text="{Binding UserPortfolio.CalculateTotalAssets}"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock FontWeight="Bold" Text="Total Profits : "/>
<TextBlock Text="$"/>
<TextBlock Text="{Binding UserPortfolio.CalculateTotalProfits}"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock FontWeight="Bold" Text="Risky portfolio : "/>
<TextBlock Text="{Binding UserPortfolio.IsPortfolioRisky}"/>
</StackPanel>
</StackPanel>
</Grid>
</TabItem>
<TabItem Header="Ajout positions">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="Ajouter un Assets dans le portfolio" Width="230" Grid.Row="0" FontWeight="Bold" Margin="0,5,0,5" FontSize="14"/>
<Label Content="Nom de l'assets:" Grid.Row="1" Margin="5,5,5,0"/>
<TextBox x:Name="txtCoinName" Grid.Row="2" Margin="5,5,5,0"/>
<Label Content="Prix d'achat:" Grid.Row="3" Margin="5,5,5,0"/>
<TextBox x:Name="txtPurchasePrice" Grid.Row="4" Margin="5,5,5,0"/>
<Label Content="Prix actuel:" Grid.Row="5" Margin="5,5,5,0"/>
<TextBox x:Name="txtCurrentPrice" Grid.Row="6" Margin="5,5,5,0"/>
<Label Content="Quantité:" Grid.Row="7" Margin="5,5,5,0"/>
<TextBox x:Name="txtQuantity" Grid.Row="8" Margin="5,5,5,15"/>
<Button Content="Ajouter Position" Width="150" Grid.Row="10" Margin="5" Click="OnAddPositionClicked"/>
</Grid>
</TabItem>
<TabItem Header="Graphiques">
<lvc:CartesianChart Series="{Binding SeriesCollection}">
<lvc:CartesianChart.AxisY>
<lvc:Axis Title="Y Axis" MinValue="0" />
</lvc:CartesianChart.AxisY>
</lvc:CartesianChart>
</TabItem>
<TabItem Header="Projections Future">
<Grid Margin="6,0,6,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label Content="Sélectionner une période de temps:" Grid.Row="0"/>
<ComboBox x:Name="cmbTimePeriod" Grid.Row="1" SelectedIndex="0" Margin="0,0,0,8">
<ComboBoxItem Content="Months"/>
<ComboBoxItem Content="Years"/>
</ComboBox>
<Label Content="Nombres de (mois/années) prévision:" Grid.Row="2"/>
<TextBox x:Name="txtNumberOfPeriods" Grid.Row="3" Margin="0,0,0,8"/>
<Label Content="Entrer un % de profit (par mois/années):" Grid.Row="4"/>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Grid.Row="5" Margin="0,0,0,20">
<TextBox x:Name="txtProfitPercentage" Width="50" Margin="0,0,5,0" />
<TextBlock Text="%" VerticalAlignment="Center"/>
</StackPanel>
<Button Content="Generate Projection Graph" Width="230" Grid.Row="7" Click="GenerateGraph_Click"/>
</Grid>
</TabItem>
</TabControl>
</Border>
</Grid>
</Window>