Sparat innan resan
This commit is contained in:
@ -1,4 +1,8 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using OemanTrader.Domain.Models;
|
||||
using OemanTrader.Domain.Services;
|
||||
using OemanTrader.Domain.Services.TransactionServices;
|
||||
using OemanTrader.EntityFramework.Services;
|
||||
using OemanTrader.FinantialModelingPrepAPI.Services;
|
||||
using OemanTrader.WPF.ViewModels;
|
||||
using System;
|
||||
@ -16,20 +20,32 @@ namespace OemanTrader.WPF
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
protected override async void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
//new MajorIndexService().GetMajorIndex(Domain.Models.MajorIndexType.DowJones).ContinueWith((t) =>
|
||||
//{
|
||||
// var index = t.Result;
|
||||
//});
|
||||
//});
|
||||
|
||||
IDataService<Account> accountService = new AccountDataService(new EntityFramework.OemanTraderDbContextFactory());
|
||||
IStockPriceService stockPriceService = new StockPriceService(new FinantialModelingPrepAPI.FinancialModelingPrepHttpClientFactory("2035d4934632e1d7c38f15982e39d3aa"));
|
||||
IBuyStockService buyStockService = new BuyStockService(stockPriceService, accountService);
|
||||
|
||||
Account buyer = await accountService.Get(1);
|
||||
|
||||
await buyStockService.BuyStock(buyer, "T", 5);
|
||||
|
||||
//new StockPriceService(new FinantialModelingPrepAPI.FinancialModelingPrepHttpClientFactory("2035d4934632e1d7c38f15982e39d3aa")).GetPrice("AAPL");
|
||||
|
||||
|
||||
Window window = new MainWindow();
|
||||
window.DataContext = new MainViewModel();
|
||||
window.Show();
|
||||
|
||||
|
||||
base.OnStartup(e);
|
||||
}
|
||||
|
||||
|
||||
private IServiceProvider CreateServiceProvider()
|
||||
{
|
||||
// 1. Singelton - one instance per application
|
||||
|
||||
@ -34,7 +34,7 @@ namespace OemanTrader.WPF.Commands
|
||||
{
|
||||
case ViewType.Home:
|
||||
// OBS OBS
|
||||
//_navigator.CurrentViewModel = new HomeViewModel(MajorIndexViewModel.LoadMajorIndexViewModel(new MajorIndexService()));
|
||||
_navigator.CurrentViewModel = new HomeViewModel(MajorIndexListingViewModel.LoadMajorIndexViewModel(new MajorIndexService( new FinantialModelingPrepAPI.FinancialModelingPrepHttpClientFactory("2035d4934632e1d7c38f15982e39d3aa"))));
|
||||
break;
|
||||
case ViewType.Portfolio:
|
||||
_navigator.CurrentViewModel = new PortfolioViewModel();
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="{Binding Type, FallbackValue=Name}" FontSize="18" HorizontalAlignment="Center" />
|
||||
<TextBlock Grid.Row="0" Text="{Binding IndexName, FallbackValue=Name}" FontSize="18" HorizontalAlignment="Center" />
|
||||
<Grid Grid.Row="1" Margin="0 10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
xmlns:nav="clr-namespace:OemanTrader.WPF.State.Navigators" d:DataContext="{d:DesignInstance Type=nav:Navigator}"
|
||||
xmlns:vm="clr-namespace:OemanTrader.WPF.ViewModels"
|
||||
xmlns:converters="clr-namespace:OemanTrader.WPF.Converters"
|
||||
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
@ -29,7 +30,9 @@
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<RadioButton Grid.Column="0" Content="Home" IsChecked="{Binding CurrentViewModel, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type vm:HomeViewModel}}"
|
||||
<RadioButton Grid.Column="0" Content="Home" IsChecked="{Binding CurrentViewModel,
|
||||
Converter={StaticResource EqualValueToParameterConverter},
|
||||
ConverterParameter={x:Type vm:HomeViewModel}}"
|
||||
Command="{Binding UpdateCurrentViewModelCommand}"
|
||||
CommandParameter="{x:Static nav:ViewType.Home}" />
|
||||
<RadioButton Grid.Column="1" Content="Portfolio" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:ViewType.Portfolio}" />
|
||||
|
||||
Reference in New Issue
Block a user