Files
Encelado/DesktopBot/Views/MainView.xaml
T
2026-06-09 18:29:41 +02:00

276 lines
17 KiB
XML

<Window x:Class="DesktopBot.Views.MainView"
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:vm="clr-namespace:DesktopBot.ViewModels"
xmlns:views="clr-namespace:DesktopBot.Views"
xmlns:conv="clr-namespace:DesktopBot.Converters"
mc:Ignorable="d"
Title="Trading Bot"
Height="800" Width="1200"
MinHeight="600" MinWidth="900"
WindowStyle="SingleBorderWindow"
ResizeMode="CanResize"
Background="{StaticResource BackgroundDarkBrush}"
WindowStartupLocation="CenterScreen">
<Window.Resources>
<ResourceDictionary>
<!-- DataTemplate: mappa ogni ViewModel alla View corrispondente -->
<DataTemplate DataType="{x:Type vm:DashboardViewModel}">
<views:DashboardView/>
</DataTemplate>
<DataTemplate DataType="{x:Type vm:BotsManagerViewModel}">
<views:BotsManagerView/>
</DataTemplate>
<DataTemplate DataType="{x:Type vm:LiveLogViewModel}">
<views:LiveLogView/>
</DataTemplate>
<DataTemplate DataType="{x:Type vm:WalletViewModel}">
<views:WalletView/>
</DataTemplate>
<DataTemplate DataType="{x:Type vm:SettingsViewModel}">
<views:SettingsView/>
</DataTemplate>
<DataTemplate DataType="{x:Type vm:BalanceViewModel}">
<views:BalanceView/>
</DataTemplate>
<DataTemplate DataType="{x:Type vm:PositionsViewModel}">
<views:PositionsView/>
</DataTemplate>
<DataTemplate DataType="{x:Type vm:OrdersViewModel}">
<views:OrdersView/>
</DataTemplate>
</ResourceDictionary>
</Window.Resources>
<!-- Contenitore principale -->
<Grid>
<Grid.ColumnDefinitions>
<!-- Barra navigazione verticale sinistra -->
<ColumnDefinition Width="220"/>
<!-- Contenuto principale -->
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- ========================== -->
<!-- BARRA NAVIGAZIONE SINISTRA -->
<!-- ========================== -->
<Border Grid.Column="0"
Background="{StaticResource BackgroundPanelBrush}"
BorderBrush="{StaticResource BorderBrush}"
BorderThickness="0,0,1,0">
<DockPanel>
<!-- Logo / Equity nella parte alta -->
<Border DockPanel.Dock="Top"
Padding="20,20,20,16"
BorderBrush="{StaticResource BorderBrush}"
BorderThickness="0,0,0,1">
<StackPanel>
<TextBlock Text="Equity"
Style="{StaticResource LabelSecondary}"
FontFamily="Segoe UI"
Margin="0,0,0,4"/>
<TextBlock Text="{Binding DashboardVM.Equity, StringFormat='${0:N2}'}"
Foreground="{StaticResource AccentGreenBrush}"
FontFamily="Segoe UI"
FontSize="22"
FontWeight="Bold"/>
<!-- Ping Alpaca -->
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<Ellipse Width="8" Height="8" VerticalAlignment="Center" Margin="0,0,6,0"
Fill="{Binding PingVM.StatusColor, Mode=OneWay}"/>
<TextBlock Style="{StaticResource LabelSecondary}" FontSize="10"
VerticalAlignment="Center">
<Run Text="Alpaca "/>
<Run Text="{Binding PingVM.StatusText, Mode=OneWay, FallbackValue='---'}"
Foreground="{Binding PingVM.StatusColor, Mode=OneWay}"/>
</TextBlock>
</StackPanel>
</StackPanel>
</Border>
<!-- Menu di navigazione verticale -->
<StackPanel DockPanel.Dock="Top" Margin="0,16,0,0">
<!-- Dashboard -->
<Button Command="{Binding NavigateCommand}"
CommandParameter="Dashboard">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource NavItem}">
<Style.Triggers>
<DataTrigger Binding="{Binding SelectedTab}" Value="Dashboard">
<Setter Property="Background" Value="{StaticResource NavActiveBrush}"/>
<Setter Property="Foreground" Value="{StaticResource AccentGreenBrush}"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
<StackPanel Orientation="Horizontal">
<TextBlock Text="⬛" FontSize="14" Margin="0,0,12,0" VerticalAlignment="Center"/>
<TextBlock Text="Dashboard" FontFamily="Segoe UI" FontSize="13" VerticalAlignment="Center"/>
</StackPanel>
</Button>
<!-- Bot -->
<Button Command="{Binding NavigateCommand}"
CommandParameter="Bot">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource NavItem}">
<Style.Triggers>
<DataTrigger Binding="{Binding SelectedTab}" Value="Bot">
<Setter Property="Background" Value="{StaticResource NavActiveBrush}"/>
<Setter Property="Foreground" Value="{StaticResource AccentGreenBrush}"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
<StackPanel Orientation="Horizontal">
<TextBlock Text="🤖" FontSize="14" Margin="0,0,12,0" VerticalAlignment="Center"/>
<TextBlock Text="Bot" FontFamily="Segoe UI" FontSize="13" VerticalAlignment="Center"/>
</StackPanel>
</Button>
<!-- Live Log -->
<Button Command="{Binding NavigateCommand}"
CommandParameter="LiveLog">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource NavItem}">
<Style.Triggers>
<DataTrigger Binding="{Binding SelectedTab}" Value="LiveLog">
<Setter Property="Background" Value="{StaticResource NavActiveBrush}"/>
<Setter Property="Foreground" Value="{StaticResource AccentGreenBrush}"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
<StackPanel Orientation="Horizontal">
<TextBlock Text="📋" FontSize="14" Margin="0,0,12,0" VerticalAlignment="Center"/>
<TextBlock Text="Log" FontFamily="Segoe UI" FontSize="13" VerticalAlignment="Center"/>
</StackPanel>
</Button>
<!-- Wallet / Positions -->
<Button Command="{Binding NavigateCommand}"
CommandParameter="Wallet">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource NavItem}">
<Style.Triggers>
<DataTrigger Binding="{Binding SelectedTab}" Value="Wallet">
<Setter Property="Background" Value="{StaticResource NavActiveBrush}"/>
<Setter Property="Foreground" Value="{StaticResource AccentGreenBrush}"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
<StackPanel Orientation="Horizontal">
<TextBlock Text="💼" FontSize="14" Margin="0,0,12,0" VerticalAlignment="Center"/>
<TextBlock Text="Wallet" FontFamily="Segoe UI" FontSize="13" VerticalAlignment="Center"/>
</StackPanel>
</Button>
<!-- Balance -->
<Button Command="{Binding NavigateCommand}"
CommandParameter="Balance">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource NavItem}">
<Style.Triggers>
<DataTrigger Binding="{Binding SelectedTab}" Value="Balance">
<Setter Property="Background" Value="{StaticResource NavActiveBrush}"/>
<Setter Property="Foreground" Value="{StaticResource AccentGreenBrush}"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#x1F4B0;" FontSize="14" Margin="0,0,12,0" VerticalAlignment="Center"/>
<TextBlock Text="Balance" FontFamily="Segoe UI" FontSize="13" VerticalAlignment="Center"/>
</StackPanel>
</Button>
<!-- Positions -->
<Button Command="{Binding NavigateCommand}"
CommandParameter="Positions">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource NavItem}">
<Style.Triggers>
<DataTrigger Binding="{Binding SelectedTab}" Value="Positions">
<Setter Property="Background" Value="{StaticResource NavActiveBrush}"/>
<Setter Property="Foreground" Value="{StaticResource AccentGreenBrush}"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#x1F4C8;" FontSize="14" Margin="0,0,12,0" VerticalAlignment="Center"/>
<TextBlock Text="Posizioni" FontFamily="Segoe UI" FontSize="13" VerticalAlignment="Center"/>
</StackPanel>
</Button>
<!-- Orders -->
<Button Command="{Binding NavigateCommand}"
CommandParameter="Orders">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource NavItem}">
<Style.Triggers>
<DataTrigger Binding="{Binding SelectedTab}" Value="Orders">
<Setter Property="Background" Value="{StaticResource NavActiveBrush}"/>
<Setter Property="Foreground" Value="{StaticResource AccentGreenBrush}"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#x1F4CB;" FontSize="14" Margin="0,0,12,0" VerticalAlignment="Center"/>
<TextBlock Text="Ordini" FontFamily="Segoe UI" FontSize="13" VerticalAlignment="Center"/>
</StackPanel>
</Button>
<!-- Separatore -->
<Separator Background="{StaticResource BorderBrush}" Margin="16,8"/>
<!-- Impostazioni -->
<Button Command="{Binding NavigateCommand}"
CommandParameter="Settings">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource NavItem}">
<Style.Triggers>
<DataTrigger Binding="{Binding SelectedTab}" Value="Settings">
<Setter Property="Background" Value="{StaticResource NavActiveBrush}"/>
<Setter Property="Foreground" Value="{StaticResource AccentGreenBrush}"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
<StackPanel Orientation="Horizontal">
<TextBlock Text="🔑" FontSize="14" Margin="0,0,12,0" VerticalAlignment="Center"/>
<TextBlock Text="Impostazioni" FontFamily="Segoe UI" FontSize="13" VerticalAlignment="Center"/>
</StackPanel>
</Button>
</StackPanel>
<!-- Spacer -->
<Grid DockPanel.Dock="Top"/>
</DockPanel>
</Border>
<!-- ========================== -->
<!-- AREA CONTENUTO PRINCIPALE -->
<!-- ========================== -->
<ContentControl x:Name="MainContent"
Grid.Column="1"
Content="{Binding CurrentViewModel}"
Margin="0"/>
</Grid>
</Window>