Sviluppo TradingBot
This commit is contained in:
@@ -0,0 +1,426 @@
|
||||
<UserControl x:Class="DesktopBot.Views.SettingsView"
|
||||
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"
|
||||
mc:Ignorable="d"
|
||||
Background="{StaticResource BackgroundDarkBrush}">
|
||||
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" Padding="32">
|
||||
<StackPanel MaxWidth="540" HorizontalAlignment="Left">
|
||||
|
||||
<!-- Titolo sezione -->
|
||||
<TextBlock Text="Impostazioni API"
|
||||
Foreground="{StaticResource TextPrimaryBrush}"
|
||||
FontFamily="Segoe UI"
|
||||
FontSize="22" FontWeight="SemiBold"
|
||||
Margin="0,0,0,4"/>
|
||||
<TextBlock Text="Configura le credenziali per la connessione ad Alpaca Markets"
|
||||
Foreground="{StaticResource TextSecondaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="13"
|
||||
Margin="0,0,0,32"/>
|
||||
|
||||
<!-- Card credenziali -->
|
||||
<Border Background="{StaticResource BackgroundPanelBrush}"
|
||||
BorderBrush="{StaticResource BorderBrush}"
|
||||
BorderThickness="1" CornerRadius="8"
|
||||
Padding="24" Margin="0,0,0,16">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Credenziali Alpaca"
|
||||
Foreground="{StaticResource TextPrimaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="15" FontWeight="SemiBold"
|
||||
Margin="0,0,0,20"/>
|
||||
|
||||
<!-- API Key -->
|
||||
<TextBlock Text="API KEY"
|
||||
Foreground="{StaticResource TextSecondaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="11" FontWeight="SemiBold"
|
||||
Margin="0,0,0,6"/>
|
||||
<TextBox x:Name="ApiKeyBox"
|
||||
Text="{Binding ApiKey, UpdateSourceTrigger=PropertyChanged}"
|
||||
Background="#1A1A2E"
|
||||
Foreground="{StaticResource TextPrimaryBrush}"
|
||||
BorderBrush="{StaticResource BorderBrush}"
|
||||
BorderThickness="1"
|
||||
FontFamily="Consolas" FontSize="13"
|
||||
Padding="10,8"
|
||||
CaretBrush="White"
|
||||
Margin="0,0,0,16"/>
|
||||
|
||||
<!-- API Secret -->
|
||||
<TextBlock Text="API SECRET"
|
||||
Foreground="{StaticResource TextSecondaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="11" FontWeight="SemiBold"
|
||||
Margin="0,0,0,6"/>
|
||||
<PasswordBox x:Name="ApiSecretBox"
|
||||
Background="#1A1A2E"
|
||||
Foreground="{StaticResource TextPrimaryBrush}"
|
||||
BorderBrush="{StaticResource BorderBrush}"
|
||||
BorderThickness="1"
|
||||
FontFamily="Consolas" FontSize="13"
|
||||
Padding="10,8"
|
||||
CaretBrush="White"
|
||||
Margin="0,0,0,24"
|
||||
PasswordChanged="ApiSecretBox_PasswordChanged"/>
|
||||
|
||||
<!-- Modalità Paper / Live -->
|
||||
<TextBlock Text="MODALITÀ DI TRADING"
|
||||
Foreground="{StaticResource TextSecondaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="11" FontWeight="SemiBold"
|
||||
Margin="0,0,0,10"/>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,24">
|
||||
<RadioButton x:Name="PaperRadio"
|
||||
Content="Paper Trading (simulazione)"
|
||||
IsChecked="{Binding IsPaper}"
|
||||
Foreground="{StaticResource TextPrimaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="13"
|
||||
Margin="0,0,24,0">
|
||||
<RadioButton.Style>
|
||||
<Style TargetType="RadioButton">
|
||||
<Setter Property="Foreground" Value="{StaticResource TextPrimaryBrush}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter Property="Foreground" Value="{StaticResource AccentGreenBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</RadioButton.Style>
|
||||
</RadioButton>
|
||||
<RadioButton Content="Live Trading ⚠ FONDI REALI"
|
||||
IsChecked="{Binding IsPaper, Converter={StaticResource InverseBoolConverter}}"
|
||||
Foreground="{StaticResource TextPrimaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="13">
|
||||
<RadioButton.Style>
|
||||
<Style TargetType="RadioButton">
|
||||
<Setter Property="Foreground" Value="{StaticResource TextPrimaryBrush}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter Property="Foreground" Value="{StaticResource AccentRedBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</RadioButton.Style>
|
||||
</RadioButton>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Pulsanti azione -->
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Content="💾 Salva Credenziali"
|
||||
Command="{Binding SaveCommand}"
|
||||
Style="{StaticResource PrimaryButton}"
|
||||
Padding="20,10"
|
||||
Margin="0,0,12,0"/>
|
||||
<Button Content="⚡ Test Connessione"
|
||||
Command="{Binding TestConnectionCommand}"
|
||||
Style="{StaticResource OutlineButton}"
|
||||
Padding="20,10"
|
||||
Margin="0,0,12,0"/>
|
||||
<Button Content="🗑 Elimina"
|
||||
Command="{Binding DeleteCredentialsCommand}"
|
||||
Style="{StaticResource DangerButton}"
|
||||
Padding="16,10"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- Card stato connessione -->
|
||||
<Border Background="{StaticResource BackgroundPanelBrush}"
|
||||
BorderBrush="{StaticResource BorderBrush}"
|
||||
BorderThickness="1" CornerRadius="8"
|
||||
Padding="20,16">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<!-- Indicatore stato -->
|
||||
<Ellipse Width="10" Height="10" Margin="0,0,10,0">
|
||||
<Ellipse.Style>
|
||||
<Style TargetType="Ellipse">
|
||||
<Setter Property="Fill" Value="#FF5555"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsConnected}" Value="True">
|
||||
<Setter Property="Fill" Value="{StaticResource AccentGreenBrush}"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsConnecting}" Value="True">
|
||||
<Setter Property="Fill" Value="#FFD700"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Ellipse.Style>
|
||||
</Ellipse>
|
||||
<TextBlock Text="{Binding StatusMessage}"
|
||||
Foreground="{StaticResource TextSecondaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="13"
|
||||
VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- Info sicurezza -->
|
||||
<Border Margin="0,16,0,0" Padding="16,12"
|
||||
Background="#0D1B2A"
|
||||
BorderBrush="#1E3A5F"
|
||||
BorderThickness="1" CornerRadius="6">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="🔒" FontSize="14" Margin="0,0,10,0" VerticalAlignment="Center"/>
|
||||
<TextBlock TextWrapping="Wrap"
|
||||
Foreground="{StaticResource TextSecondaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="12">
|
||||
<Run Text="Le credenziali sono cifrate con Windows DPAPI e salvate localmente in "/>
|
||||
<Run Text="%AppData%\TradingBot\" FontFamily="Consolas" FontWeight="SemiBold"/>
|
||||
<Run Text=". Non vengono mai trasmesse a servizi di terze parti."/>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- Card limiti logging -->
|
||||
<Border Margin="0,24,0,0"
|
||||
Background="{StaticResource BackgroundPanelBrush}"
|
||||
BorderBrush="{StaticResource BorderBrush}"
|
||||
BorderThickness="1" CornerRadius="8"
|
||||
Padding="24">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Configurazione Log"
|
||||
Foreground="{StaticResource TextPrimaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="15" FontWeight="SemiBold"
|
||||
Margin="0,0,0,4"/>
|
||||
<TextBlock Text="Configura i limiti di conservazione dei dati storici e log"
|
||||
Foreground="{StaticResource TextSecondaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="11"
|
||||
Margin="0,0,0,20"/>
|
||||
|
||||
<!-- Max Bot Log Entries -->
|
||||
<Grid Margin="0,0,0,16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="80"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0">
|
||||
<TextBlock Text="LOG BOT"
|
||||
Foreground="{StaticResource TextSecondaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="11" FontWeight="SemiBold"
|
||||
Margin="0,0,0,4"/>
|
||||
<TextBlock Text="Elementi massimi nel log del bot"
|
||||
Foreground="{StaticResource TextSecondaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="10"
|
||||
Opacity="0.8"/>
|
||||
</StackPanel>
|
||||
<Slider Grid.Column="1"
|
||||
Minimum="500" Maximum="10000" SmallChange="100" LargeChange="500"
|
||||
Value="{Binding LoggingSettings.MaxBotLogEntries, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="16,0,16,0" VerticalAlignment="Center"/>
|
||||
<TextBlock Grid.Column="2"
|
||||
Text="{Binding LoggingSettings.MaxBotLogEntries}"
|
||||
Foreground="{StaticResource AccentGreenBrush}"
|
||||
FontFamily="Segoe UI Mono" FontSize="13" FontWeight="SemiBold"
|
||||
TextAlignment="Right" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Max Trade History Entries -->
|
||||
<Grid Margin="0,0,0,16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="80"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0">
|
||||
<TextBlock Text="STORICO TRADE"
|
||||
Foreground="{StaticResource TextSecondaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="11" FontWeight="SemiBold"
|
||||
Margin="0,0,0,4"/>
|
||||
<TextBlock Text="Elementi massimi nello storico trade"
|
||||
Foreground="{StaticResource TextSecondaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="10"
|
||||
Opacity="0.8"/>
|
||||
</StackPanel>
|
||||
<Slider Grid.Column="1"
|
||||
Minimum="500" Maximum="5000" SmallChange="100" LargeChange="500"
|
||||
Value="{Binding LoggingSettings.MaxTradeHistoryEntries, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="16,0,16,0" VerticalAlignment="Center"/>
|
||||
<TextBlock Grid.Column="2"
|
||||
Text="{Binding LoggingSettings.MaxTradeHistoryEntries}"
|
||||
Foreground="{StaticResource AccentGreenBrush}"
|
||||
FontFamily="Segoe UI Mono" FontSize="13" FontWeight="SemiBold"
|
||||
TextAlignment="Right" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Max Activity Log Entries -->
|
||||
<Grid Margin="0,0,0,16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="80"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0">
|
||||
<TextBlock Text="LOG ATTIVITÀ"
|
||||
Foreground="{StaticResource TextSecondaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="11" FontWeight="SemiBold"
|
||||
Margin="0,0,0,4"/>
|
||||
<TextBlock Text="Elementi massimi nel log attività dashboard"
|
||||
Foreground="{StaticResource TextSecondaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="10"
|
||||
Opacity="0.8"/>
|
||||
</StackPanel>
|
||||
<Slider Grid.Column="1"
|
||||
Minimum="1000" Maximum="10000" SmallChange="100" LargeChange="500"
|
||||
Value="{Binding LoggingSettings.MaxActivityLogEntries, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="16,0,16,0" VerticalAlignment="Center"/>
|
||||
<TextBlock Grid.Column="2"
|
||||
Text="{Binding LoggingSettings.MaxActivityLogEntries}"
|
||||
Foreground="{StaticResource AccentGreenBrush}"
|
||||
FontFamily="Segoe UI Mono" FontSize="13" FontWeight="SemiBold"
|
||||
TextAlignment="Right" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Max Live Log Entries -->
|
||||
<Grid Margin="0,0,0,16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="80"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0">
|
||||
<TextBlock Text="LOG LIVE GLOBALE"
|
||||
Foreground="{StaticResource TextSecondaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="11" FontWeight="SemiBold"
|
||||
Margin="0,0,0,4"/>
|
||||
<TextBlock Text="Elementi massimi nel log live globale"
|
||||
Foreground="{StaticResource TextSecondaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="10"
|
||||
Opacity="0.8"/>
|
||||
</StackPanel>
|
||||
<Slider Grid.Column="1"
|
||||
Minimum="2000" Maximum="20000" SmallChange="100" LargeChange="1000"
|
||||
Value="{Binding LoggingSettings.MaxLiveLogEntries, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="16,0,16,0" VerticalAlignment="Center"/>
|
||||
<TextBlock Grid.Column="2"
|
||||
Text="{Binding LoggingSettings.MaxLiveLogEntries}"
|
||||
Foreground="{StaticResource AccentGreenBrush}"
|
||||
FontFamily="Segoe UI Mono" FontSize="13" FontWeight="SemiBold"
|
||||
TextAlignment="Right" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Max Price Data Points -->
|
||||
<Grid Margin="0,0,0,20">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="80"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0">
|
||||
<TextBlock Text="DATI GRAFICO"
|
||||
Foreground="{StaticResource TextSecondaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="11" FontWeight="SemiBold"
|
||||
Margin="0,0,0,4"/>
|
||||
<TextBlock Text="Punti dati massimi nel grafico prezzi"
|
||||
Foreground="{StaticResource TextSecondaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="10"
|
||||
Opacity="0.8"/>
|
||||
</StackPanel>
|
||||
<Slider Grid.Column="1"
|
||||
Minimum="500" Maximum="10000" SmallChange="100" LargeChange="500"
|
||||
Value="{Binding LoggingSettings.MaxPriceDataPoints, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="16,0,16,0" VerticalAlignment="Center"/>
|
||||
<TextBlock Grid.Column="2"
|
||||
Text="{Binding LoggingSettings.MaxPriceDataPoints}"
|
||||
Foreground="{StaticResource AccentGreenBrush}"
|
||||
FontFamily="Segoe UI Mono" FontSize="13" FontWeight="SemiBold"
|
||||
TextAlignment="Right" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Pulsanti azione logging -->
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Content="💾 Salva Configurazione Log"
|
||||
Command="{Binding SaveLoggingCommand}"
|
||||
Style="{StaticResource PrimaryButton}"
|
||||
Padding="20,10"
|
||||
Margin="0,0,12,0"/>
|
||||
<Button Content="↺ Ripristina Default"
|
||||
Command="{Binding ResetLoggingCommand}"
|
||||
Style="{StaticResource OutlineButton}"
|
||||
Padding="20,10"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- Informazioni applicazione -->
|
||||
<Border Margin="0,24,0,0"
|
||||
Background="{StaticResource BackgroundPanelBrush}"
|
||||
BorderBrush="{StaticResource BorderBrush}"
|
||||
BorderThickness="1" CornerRadius="8"
|
||||
Padding="24">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Informazioni"
|
||||
Foreground="{StaticResource TextPrimaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="15" FontWeight="SemiBold"
|
||||
Margin="0,0,0,20"/>
|
||||
|
||||
<!-- Autore -->
|
||||
<Grid Margin="0,0,0,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="AUTORE"
|
||||
Foreground="{StaticResource TextSecondaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="11" FontWeight="SemiBold"
|
||||
VerticalAlignment="Center"/>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Author}"
|
||||
Foreground="{StaticResource TextPrimaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="13"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Versione -->
|
||||
<Grid Margin="0,0,0,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="VERSIONE"
|
||||
Foreground="{StaticResource TextSecondaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="11" FontWeight="SemiBold"
|
||||
VerticalAlignment="Center"/>
|
||||
<TextBlock Grid.Column="1" Text="{Binding AppVersion}"
|
||||
Foreground="{StaticResource AccentGreenBrush}"
|
||||
FontFamily="Segoe UI Mono" FontSize="13" FontWeight="SemiBold"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Data ultima build -->
|
||||
<Grid Margin="0,0,0,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="ULTIMA BUILD"
|
||||
Foreground="{StaticResource TextSecondaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="11" FontWeight="SemiBold"
|
||||
VerticalAlignment="Center"/>
|
||||
<TextBlock Grid.Column="1" Text="{Binding BuildDate}"
|
||||
Foreground="{StaticResource TextPrimaryBrush}"
|
||||
FontFamily="Segoe UI Mono" FontSize="13"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Framework -->
|
||||
<Grid Margin="0,0,0,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="FRAMEWORK"
|
||||
Foreground="{StaticResource TextSecondaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="11" FontWeight="SemiBold"
|
||||
VerticalAlignment="Center"/>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Framework}"
|
||||
Foreground="{StaticResource TextPrimaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="13"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Descrizione -->
|
||||
<Separator Background="{StaticResource BorderBrush}" Margin="0,10,0,14"/>
|
||||
<TextBlock Text="{Binding Description}"
|
||||
Foreground="{StaticResource TextSecondaryBrush}"
|
||||
FontFamily="Segoe UI" FontSize="12"
|
||||
TextWrapping="Wrap" LineHeight="20"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
Reference in New Issue
Block a user