185 lines
8.5 KiB
XML
185 lines
8.5 KiB
XML
<UserControl x:Class="DesktopBot.Views.PriceChartView"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
mc:Ignorable="d"
|
|
d:DesignHeight="600" d:DesignWidth="900"
|
|
Background="#1E1E1E">
|
|
|
|
<Grid Margin="20">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="*"/>
|
|
<RowDefinition Height="Auto"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<!-- Header con prezzo corrente -->
|
|
<StackPanel Grid.Row="0" Margin="0,0,0,20">
|
|
<TextBlock Text="GRAFICO PREZZI REAL-TIME"
|
|
FontSize="24" FontWeight="Bold"
|
|
Foreground="#E0E0E0" Margin="0,0,0,10"/>
|
|
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<!-- Simbolo e prezzo -->
|
|
<StackPanel Grid.Column="0" Orientation="Horizontal">
|
|
<TextBlock Text="{Binding Symbol}"
|
|
FontSize="28" FontWeight="Bold"
|
|
Foreground="#FFFFFF" Margin="0,0,15,0"/>
|
|
<TextBlock Text="{Binding CurrentPrice, StringFormat=C2}"
|
|
FontSize="28" FontWeight="Bold"
|
|
Foreground="#00E676"/>
|
|
</StackPanel>
|
|
|
|
<!-- Variazione prezzo -->
|
|
<StackPanel Grid.Column="1" Orientation="Horizontal"
|
|
HorizontalAlignment="Left" Margin="20,0,0,0">
|
|
<TextBlock Text="{Binding PriceChangeIcon}"
|
|
FontSize="20"
|
|
Foreground="{Binding PriceChangeColor}"/>
|
|
<TextBlock Text="{Binding PriceChange, StringFormat=F2}"
|
|
FontSize="18"
|
|
Foreground="{Binding PriceChangeColor}"
|
|
Margin="5,0,10,0"/>
|
|
<TextBlock Text="{Binding PriceChangePercent, StringFormat=({0:F2}%)}"
|
|
FontSize="18"
|
|
Foreground="{Binding PriceChangeColor}"/>
|
|
</StackPanel>
|
|
|
|
<!-- Controlli -->
|
|
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right">
|
|
<ComboBox Width="120" Margin="0,0,10,0"
|
|
Background="#2D2D30" Foreground="#E0E0E0"
|
|
BorderBrush="#3E3E42"
|
|
SelectedIndex="0">
|
|
<ComboBoxItem Content="1 Minuto"/>
|
|
<ComboBoxItem Content="5 Minuti"/>
|
|
<ComboBoxItem Content="1 Ora"/>
|
|
</ComboBox>
|
|
|
|
<Button Content="▶ START"
|
|
Width="100" Height="35"
|
|
Background="#00E676" Foreground="#000000"
|
|
FontWeight="Bold"
|
|
Command="{Binding StartStreamCommand}"
|
|
Margin="0,0,5,0"/>
|
|
|
|
<Button Content="■ STOP"
|
|
Width="100" Height="35"
|
|
Background="#FF5252" Foreground="#FFFFFF"
|
|
FontWeight="Bold"
|
|
Command="{Binding StopStreamCommand}"/>
|
|
</StackPanel>
|
|
</Grid>
|
|
</StackPanel>
|
|
|
|
<!-- Status bar -->
|
|
<Border Grid.Row="1"
|
|
Background="#252526"
|
|
Padding="10,8"
|
|
CornerRadius="4"
|
|
Margin="0,0,0,15">
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="*"/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<Ellipse Grid.Column="0"
|
|
Width="12" Height="12"
|
|
Margin="0,0,10,0"
|
|
VerticalAlignment="Center">
|
|
<Ellipse.Fill>
|
|
<SolidColorBrush Color="{Binding IsStreaming, Converter={StaticResource BoolToStreamColorConverter}}"/>
|
|
</Ellipse.Fill>
|
|
</Ellipse>
|
|
|
|
<TextBlock Grid.Column="1"
|
|
Text="{Binding StatusMessage}"
|
|
FontSize="13"
|
|
Foreground="#B0B0B0"
|
|
VerticalAlignment="Center"/>
|
|
</Grid>
|
|
</Border>
|
|
|
|
<!-- Area grafico (placeholder - qui si integrerebbe LiveCharts/OxyPlot) -->
|
|
<Border Grid.Row="2"
|
|
Background="#252526"
|
|
BorderBrush="#3E3E42"
|
|
BorderThickness="1"
|
|
CornerRadius="8"
|
|
Padding="20">
|
|
<Grid>
|
|
<!-- Griglia con dati tabulari temporanea -->
|
|
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
|
<ItemsControl ItemsSource="{Binding PriceData}">
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate>
|
|
<Grid Margin="0,2">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="180"/>
|
|
<ColumnDefinition Width="*"/>
|
|
</Grid.ColumnDefinitions>
|
|
<TextBlock Grid.Column="0"
|
|
Text="{Binding Timestamp, StringFormat=dd/MM/yyyy HH:mm:ss}"
|
|
Foreground="#B0B0B0" FontSize="11"/>
|
|
<TextBlock Grid.Column="1"
|
|
Text="{Binding Price, StringFormat=C2}"
|
|
Foreground="#00E676" FontSize="12" FontWeight="Bold"/>
|
|
</Grid>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
</ScrollViewer>
|
|
|
|
<!-- Messaggio per integrare libreria charting -->
|
|
<Border Background="#1E1E1E"
|
|
BorderBrush="#FFD700"
|
|
BorderThickness="2"
|
|
CornerRadius="8"
|
|
Padding="30"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
Opacity="0.95">
|
|
<StackPanel>
|
|
<TextBlock Text="📊 GRAFICO VISUALE"
|
|
FontSize="20" FontWeight="Bold"
|
|
Foreground="#FFD700"
|
|
HorizontalAlignment="Center"
|
|
Margin="0,0,0,15"/>
|
|
<TextBlock TextWrapping="Wrap"
|
|
Foreground="#E0E0E0"
|
|
TextAlignment="Center"
|
|
MaxWidth="400">
|
|
Per visualizzare il grafico dei prezzi in tempo reale,
|
|
<LineBreak/>
|
|
installare una libreria di charting come:
|
|
<LineBreak/><LineBreak/>
|
|
<Bold>• LiveCharts2</Bold> (NuGet: LiveChartsCore.SkiaSharpView.WPF)
|
|
<LineBreak/>
|
|
<Bold>• OxyPlot</Bold> (NuGet: OxyPlot.Wpf)
|
|
<LineBreak/><LineBreak/>
|
|
I dati sono già disponibili in <Bold>PriceData</Bold>.
|
|
</TextBlock>
|
|
</StackPanel>
|
|
</Border>
|
|
</Grid>
|
|
</Border>
|
|
|
|
<!-- Footer info -->
|
|
<TextBlock Grid.Row="3"
|
|
Text="Dati forniti da Alpaca Markets (feed IEX) • Aggiornamento ogni 5 secondi"
|
|
FontSize="11"
|
|
Foreground="#707070"
|
|
HorizontalAlignment="Center"
|
|
Margin="0,15,0,0"/>
|
|
</Grid>
|
|
</UserControl>
|