Add initial project structure with basic view models, views, and resources
This commit is contained in:
@@ -0,0 +1,209 @@
|
||||
<ContentPage xmlns="https://github.com/avaloniaui"
|
||||
xmlns:avalonia="using:Material.Icons.Avalonia"
|
||||
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="using:CryptoPortfolio_Tracker.ViewModels"
|
||||
xmlns:lvc="using:LiveChartsCore.SkiaSharpView.Avalonia"
|
||||
xmlns:models="clr-namespace:CryptoPortfolio_Tracker.Models"
|
||||
mc:Ignorable="d" d:DesignWidth="1280" d:DesignHeight="720"
|
||||
Header="CryptoProfile Tracker"
|
||||
x:DataType="vm:HomeViewModel"
|
||||
x:Class="CryptoPortfolio_Tracker.Views.HomeView">
|
||||
<Design.DataContext>
|
||||
<vm:HomeViewModel />
|
||||
</Design.DataContext>
|
||||
|
||||
<ContentPage.Styles>
|
||||
<Style Selector="Border.Card">
|
||||
<Setter Property="Height" Value="100" />
|
||||
<Setter Property="BorderThickness" Value="2" />
|
||||
<Setter Property="CornerRadius" Value="10" />
|
||||
<Setter Property="Padding" Value="10" />
|
||||
<Setter Property="BorderBrush" Value="{StaticResource PrimaryColor}" />
|
||||
<Setter Property="Background" Value="#232429" />
|
||||
</Style>
|
||||
</ContentPage.Styles>
|
||||
|
||||
<Grid RowDefinitions="Auto, Auto, Auto, *" RowSpacing="15" ShowGridLines="False">
|
||||
<Grid ColumnDefinitions="*, Auto" Margin="15 15 15 0">
|
||||
<TextBlock Text="{Binding UserName}" VerticalAlignment="Center"
|
||||
FontWeight="Bold" FontSize="18" />
|
||||
<Button Grid.Column="1" Classes="Danger" Theme="{StaticResource OutlineButton}"
|
||||
Command="{Binding LogoutCommand}">
|
||||
<avalonia:MaterialIcon Kind="Logout" />
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
<Border ClipToBounds="True" Grid.Row="1" Margin="15 0">
|
||||
<Grid ColumnDefinitions="*,*,*,*" ColumnSpacing="15">
|
||||
<Border Classes="Card">
|
||||
<Grid RowDefinitions="*,*" RowSpacing="10" VerticalAlignment="Center">
|
||||
<TextBlock Text="Портфель" FontWeight="Bold" HorizontalAlignment="Center" TextWrapping="Wrap"
|
||||
TextAlignment="Center" />
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<TextBlock Grid.Row="1" Text="{Binding DollarBalance, StringFormat='{}{0:F2}'}"
|
||||
FontWeight="Bold" HorizontalAlignment="Center" TextWrapping="Wrap" />
|
||||
<avalonia:MaterialIcon Kind="CurrencyUsd" Height="18" VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Border Classes="Card" Grid.Column="1">
|
||||
<Grid RowDefinitions="*,*" RowSpacing="10" VerticalAlignment="Center">
|
||||
<TextBlock Text="Портфель" FontWeight="Bold" HorizontalAlignment="Center" TextWrapping="Wrap"
|
||||
TextAlignment="Center" />
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<TextBlock Text="{Binding BitcoinBalance, StringFormat='{}{0:F2}'}" FontWeight="Bold"
|
||||
HorizontalAlignment="Center" TextWrapping="Wrap" />
|
||||
<avalonia:MaterialIcon Kind="CurrencyBtc" Height="18" VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Border Classes="Card" Grid.Column="2">
|
||||
<Grid RowDefinitions="*,*" RowSpacing="10" VerticalAlignment="Center">
|
||||
<TextBlock Text="Прибыль/Убытки" FontWeight="Bold" HorizontalAlignment="Center"
|
||||
TextWrapping="Wrap" TextAlignment="Center" />
|
||||
<TextBlock Grid.Row="1" Text="{Binding ProfitLoss, StringFormat='{}{0:F2} $'}"
|
||||
FontWeight="Bold" HorizontalAlignment="Center" TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Border Classes="Card" Grid.Column="3">
|
||||
<Grid RowDefinitions="Auto,*" RowSpacing="10" VerticalAlignment="Center">
|
||||
<TextBlock Text="Валюты" FontWeight="Bold" HorizontalAlignment="Center" TextWrapping="Wrap"
|
||||
TextAlignment="Center" />
|
||||
<TextBlock Grid.Row="1" Text="{Binding CoinNames}" FontWeight="Bold"
|
||||
HorizontalAlignment="Center" TextWrapping="Wrap" TextTrimming="CharacterEllipsis" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Border ClipToBounds="True" Grid.Row="2" Margin="20 0">
|
||||
<Grid ColumnDefinitions="*, Auto, Auto, Auto, Auto, Auto" ColumnSpacing="10">
|
||||
<TextBox PlaceholderText="Поиск" />
|
||||
<DropDownButton Grid.Column="1" Foreground="{DynamicResource PrimaryColor}" CornerRadius="10"
|
||||
Padding="10">
|
||||
<DropDownButton.Flyout>
|
||||
<MenuFlyout>
|
||||
<ComboBox HorizontalAlignment="Stretch" Width="200" />
|
||||
</MenuFlyout>
|
||||
</DropDownButton.Flyout>
|
||||
<avalonia:MaterialIcon Kind="Filter" />
|
||||
</DropDownButton>
|
||||
<Button Grid.Column="2" Classes="WithIcon" VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource PrimaryColor}"
|
||||
Command="{Binding LoadCryptocurrenciesCommand}">
|
||||
<avalonia:MaterialIcon Kind="Refresh" />
|
||||
</Button>
|
||||
<Button Grid.Column="3" Classes="WithIcon" Theme="{DynamicResource SolidButton}"
|
||||
Background="{DynamicResource PrimaryColor}"
|
||||
BorderBrush="{StaticResource PrimaryColor}" CornerRadius="10" Padding="10">
|
||||
<avalonia:MaterialIcon Kind="Plus" />
|
||||
</Button>
|
||||
<Button Grid.Column="4" Classes="WithIcon"
|
||||
Foreground="{StaticResource PrimaryColor}" CornerRadius="10" Padding="10">
|
||||
<avalonia:MaterialIcon Kind="Edit" />
|
||||
</Button>
|
||||
<Button Grid.Column="5" Classes="WithIcon Danger" Theme="{DynamicResource SolidButton}"
|
||||
Background="{DynamicResource PrimaryColor}"
|
||||
BorderBrush="{StaticResource PrimaryColor}" CornerRadius="10" Padding="10">
|
||||
<avalonia:MaterialIcon Kind="Trash" />
|
||||
</Button>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Grid Grid.Row="3" Margin="20 0 20 20">
|
||||
<ProgressBar IsIndeterminate="True" VerticalAlignment="Top" Margin="0 -5 0 0" Height="1"
|
||||
Foreground="{DynamicResource PrimaryColor}"
|
||||
IsVisible="{Binding IsCryptoLoading}" />
|
||||
<TableView x:Name="CryptoTable"
|
||||
CornerRadius="10"
|
||||
ItemsSource="{Binding Cryptocurrencies}"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Hidden"
|
||||
SelectionMode="Single"
|
||||
SelectionChanged="CryptoTable_OnSelectionChanged">
|
||||
<TableView.Columns>
|
||||
<TableViewColumn Binding="{Binding Image}" CanUserResize="True" Width="50">
|
||||
<TableViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Image Source="{Binding Image}" Margin="0" Height="17" />
|
||||
</DataTemplate>
|
||||
</TableViewColumn.CellTemplate>
|
||||
</TableViewColumn>
|
||||
<TableViewColumn Header="Символ"
|
||||
Binding="{Binding Symbol}" Width="100" />
|
||||
<TableViewColumn Header="Название"
|
||||
Binding="{Binding Name}" Width="125" />
|
||||
<TableViewColumn Header="Курс"
|
||||
Binding="{Binding CurrentPriceUsd, StringFormat='{}{0:N2} $'}"
|
||||
Width="135" />
|
||||
<TableViewColumn Header="Изменения за 24ч"
|
||||
Binding="{Binding PriceChange24H, StringFormat='{}{0:N2} $'}">
|
||||
<TableViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Spacing="5" Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Text="{Binding PriceChangePercentage24H, StringFormat='{}{0:N2} %'}"
|
||||
Classes.Success="{Binding IsPositive}"
|
||||
Classes.Danger="{Binding IsNegative}" />
|
||||
|
||||
<TextBlock
|
||||
Text="{Binding PriceChange24H, StringFormat='{}({0:N2} $)'}"
|
||||
Classes.Success="{Binding IsPositive}"
|
||||
Classes.Danger="{Binding IsNegative}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</TableViewColumn.CellTemplate>
|
||||
</TableViewColumn>
|
||||
|
||||
<TableViewColumn Header="График за 24ч"
|
||||
Width="160">
|
||||
<TableViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Border Name="ChartBorder">
|
||||
<lvc:CartesianChart
|
||||
Width="140"
|
||||
Height="17"
|
||||
LegendPosition="Hidden"
|
||||
TooltipPosition="Hidden"
|
||||
ZoomMode="None"
|
||||
Padding="0"
|
||||
AnimationsSpeed="0:00:00">
|
||||
|
||||
<lvc:CartesianChart.Series>
|
||||
<lvc:XamlLineSeries
|
||||
Values="{Binding PriceHistory24H}"
|
||||
GeometrySize="0"
|
||||
Fill="{x:Null}"
|
||||
GeometryFill="{x:Null}"
|
||||
GeometryStroke="{x:Null}"
|
||||
LineSmoothness="0.5"
|
||||
Classes.Success="{Binding IsPositive}"
|
||||
Classes.Danger="{Binding IsNegative}"/>
|
||||
</lvc:CartesianChart.Series>
|
||||
|
||||
<lvc:CartesianChart.XAxes>
|
||||
<lvc:XamlAxis IsVisible="False" />
|
||||
</lvc:CartesianChart.XAxes>
|
||||
|
||||
<lvc:CartesianChart.YAxes>
|
||||
<lvc:XamlAxis IsVisible="False" />
|
||||
</lvc:CartesianChart.YAxes>
|
||||
|
||||
</lvc:CartesianChart>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</TableViewColumn.CellTemplate>
|
||||
</TableViewColumn>
|
||||
<TableViewColumn Header="Рыночная капитализация"
|
||||
Binding="{Binding MarketCapUsd, StringFormat='{}{0:N2} $'}" />
|
||||
<TableViewColumn Header="Объём торгов" Binding="{Binding Volume24HUsd, StringFormat='{}{0:N2} $'}" />
|
||||
</TableView.Columns>
|
||||
</TableView>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</ContentPage>
|
||||
Reference in New Issue
Block a user