Add project files.
This commit is contained in:
21
OemanTrader.WPF/App.xaml
Normal file
21
OemanTrader.WPF/App.xaml
Normal file
@ -0,0 +1,21 @@
|
||||
<Application x:Class="OemanTrader.WPF.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:viewmodels="clr-namespace:OemanTrader.WPF.ViewModels"
|
||||
xmlns:views="clr-namespace:OemanTrader.WPF.Views"
|
||||
xmlns:local="clr-namespace:OemanTrader.WPF">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="/Styles/Common.xaml" />
|
||||
<ResourceDictionary Source="/Styles/NavigationBar.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<DataTemplate DataType="{x:Type viewmodels:HomeViewModel}">
|
||||
<views:HomeView />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type viewmodels:PortfolioViewModel}">
|
||||
<views:PortfolioView />
|
||||
</DataTemplate>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
44
OemanTrader.WPF/App.xaml.cs
Normal file
44
OemanTrader.WPF/App.xaml.cs
Normal file
@ -0,0 +1,44 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using OemanTrader.FinantialModelingPrepAPI.Services;
|
||||
using OemanTrader.WPF.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace OemanTrader.WPF
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
//new MajorIndexService().GetMajorIndex(Domain.Models.MajorIndexType.DowJones).ContinueWith((t) =>
|
||||
//{
|
||||
// var index = t.Result;
|
||||
//});
|
||||
|
||||
Window window = new MainWindow();
|
||||
window.DataContext = new MainViewModel();
|
||||
window.Show();
|
||||
|
||||
base.OnStartup(e);
|
||||
}
|
||||
|
||||
private IServiceProvider CreateServiceProvider()
|
||||
{
|
||||
// 1. Singelton - one instance per application
|
||||
// 2. Transient - different instance everytime
|
||||
// 3. Scoped - one instance per "scope"
|
||||
|
||||
IServiceCollection services = new ServiceCollection();
|
||||
return services.BuildServiceProvider();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
10
OemanTrader.WPF/AssemblyInfo.cs
Normal file
10
OemanTrader.WPF/AssemblyInfo.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using System.Windows;
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
48
OemanTrader.WPF/Commands/UpdateCurrentViewModelCommand.cs
Normal file
48
OemanTrader.WPF/Commands/UpdateCurrentViewModelCommand.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using OemanTrader.FinantialModelingPrepAPI.Services;
|
||||
using OemanTrader.WPF.State.Navigators;
|
||||
using OemanTrader.WPF.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace OemanTrader.WPF.Commands
|
||||
{
|
||||
public class UpdateCurrentViewModelCommand : ICommand
|
||||
{
|
||||
public event EventHandler? CanExecuteChanged;
|
||||
private INavigator _navigator;
|
||||
|
||||
public UpdateCurrentViewModelCommand(INavigator navigator)
|
||||
{
|
||||
_navigator = navigator;
|
||||
}
|
||||
|
||||
public bool CanExecute(object? parameter)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Execute(object? parameter)
|
||||
{
|
||||
if (parameter is ViewType)
|
||||
{
|
||||
ViewType viewType = (ViewType)parameter;
|
||||
switch (viewType)
|
||||
{
|
||||
case ViewType.Home:
|
||||
// OBS OBS
|
||||
//_navigator.CurrentViewModel = new HomeViewModel(MajorIndexViewModel.LoadMajorIndexViewModel(new MajorIndexService()));
|
||||
break;
|
||||
case ViewType.Portfolio:
|
||||
_navigator.CurrentViewModel = new PortfolioViewModel();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
32
OemanTrader.WPF/Controls/MajorIndexCard.xaml
Normal file
32
OemanTrader.WPF/Controls/MajorIndexCard.xaml
Normal file
@ -0,0 +1,32 @@
|
||||
<UserControl x:Class="OemanTrader.WPF.Controls.MajorIndexCard"
|
||||
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"
|
||||
xmlns:local="clr-namespace:OemanTrader.WPF.Controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Border BorderBrush="LightGray" BorderThickness="1" CornerRadius="10">
|
||||
<Grid Margin="10" >
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="{Binding Type, FallbackValue=Name}" FontSize="18" HorizontalAlignment="Center" />
|
||||
<Grid Grid.Row="1" Margin="0 10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Margin="5" Text="Price" />
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" Margin="5" HorizontalAlignment="Right" Text="{Binding Price, StringFormat={}{0:c}, FallbackValue=$0.00}"/>
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Margin="5" Text="Changes" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" Margin="5" HorizontalAlignment="Right" Text="{Binding Changes, StringFormat={}{0:c}, FallbackValue=$0.00}"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
</UserControl>
|
||||
28
OemanTrader.WPF/Controls/MajorIndexCard.xaml.cs
Normal file
28
OemanTrader.WPF/Controls/MajorIndexCard.xaml.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace OemanTrader.WPF.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MajorIndexCard.xaml
|
||||
/// </summary>
|
||||
public partial class MajorIndexCard : UserControl
|
||||
{
|
||||
public MajorIndexCard()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
26
OemanTrader.WPF/Controls/MajorIndexListing.xaml
Normal file
26
OemanTrader.WPF/Controls/MajorIndexListing.xaml
Normal file
@ -0,0 +1,26 @@
|
||||
<UserControl x:Class="OemanTrader.WPF.Controls.MajorIndexListing"
|
||||
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"
|
||||
xmlns:local="clr-namespace:OemanTrader.WPF.Controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions >
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="Major Indexes" FontSize="18" />
|
||||
<Grid Grid.Row="1" Margin="0 10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<local:MajorIndexCard Grid.Column="0" Margin="10 0" DataContext="{Binding Nasdaq}" />
|
||||
<local:MajorIndexCard Grid.Column="1" Margin="10 0" DataContext="{Binding DowJones}" />
|
||||
<local:MajorIndexCard Grid.Column="2" Margin="10 0" DataContext="{Binding SP500}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
OemanTrader.WPF/Controls/MajorIndexListing.xaml.cs
Normal file
28
OemanTrader.WPF/Controls/MajorIndexListing.xaml.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace OemanTrader.WPF.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MajorIndexListing.xaml
|
||||
/// </summary>
|
||||
public partial class MajorIndexListing : UserControl
|
||||
{
|
||||
public MajorIndexListing()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
40
OemanTrader.WPF/Controls/NavigationBar.xaml
Normal file
40
OemanTrader.WPF/Controls/NavigationBar.xaml
Normal file
@ -0,0 +1,40 @@
|
||||
<UserControl x:Class="OemanTrader.WPF.Controls.NavigationBar"
|
||||
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"
|
||||
xmlns:local="clr-namespace:OemanTrader.WPF.Controls"
|
||||
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>
|
||||
<converters:EqualValueToParameterConverter x:Key="EqualValueToParameterConverter" />
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Padding="10" FontSize="28" Text="Oeman Trader" Foreground="White" Background="{StaticResource BrushPrimary1}"/>
|
||||
<Grid Grid.Row="1" RenderOptions.EdgeMode="Aliased" Background="{StaticResource BrushPrimary2}">
|
||||
<Grid.Resources>
|
||||
<Style TargetType="RadioButton" BasedOn="{StaticResource NavButton}"/>
|
||||
</Grid.Resources>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<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}" />
|
||||
<RadioButton Grid.Column="2" Content="Buy" />
|
||||
<RadioButton Grid.Column="3" Content="Sell" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
OemanTrader.WPF/Controls/NavigationBar.xaml.cs
Normal file
28
OemanTrader.WPF/Controls/NavigationBar.xaml.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace OemanTrader.WPF.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for NavigationBar.xaml
|
||||
/// </summary>
|
||||
public partial class NavigationBar : UserControl
|
||||
{
|
||||
public NavigationBar()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
26
OemanTrader.WPF/Converters/EqualValueToParameterConverter.cs
Normal file
26
OemanTrader.WPF/Converters/EqualValueToParameterConverter.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace OemanTrader.WPF.Converters
|
||||
{
|
||||
public class EqualValueToParameterConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
string valueString = value.ToString();
|
||||
string parameterString = parameter.ToString();
|
||||
|
||||
return value.ToString() == parameter.ToString();
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
21
OemanTrader.WPF/MainWindow.xaml
Normal file
21
OemanTrader.WPF/MainWindow.xaml
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
<Window x:Class="OemanTrader.WPF.MainWindow"
|
||||
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:local="clr-namespace:OemanTrader.WPF"
|
||||
xmlns:controls="clr-namespace:OemanTrader.WPF.Controls"
|
||||
|
||||
mc:Ignorable="d"
|
||||
Title="Oeman Trader" Height="450" Width="800">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<controls:NavigationBar Grid.Row="0" DataContext="{Binding Navigator}"/>
|
||||
<ContentControl Content="{Binding Navigator.CurrentViewModel}" Grid.Row="1" />
|
||||
</Grid>
|
||||
</Window>
|
||||
28
OemanTrader.WPF/MainWindow.xaml.cs
Normal file
28
OemanTrader.WPF/MainWindow.xaml.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace OemanTrader.WPF
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
18
OemanTrader.WPF/Models/ObservableObject.cs
Normal file
18
OemanTrader.WPF/Models/ObservableObject.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OemanTrader.WPF.Models
|
||||
{
|
||||
public class ObservableObject : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
protected void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
16
OemanTrader.WPF/OemanTrader.WPF.csproj
Normal file
16
OemanTrader.WPF/OemanTrader.WPF.csproj
Normal file
@ -0,0 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\OemanTrader.Domain\OemanTrader.Domain.csproj" />
|
||||
<ProjectReference Include="..\OemanTrader.EntityFramework\OemanTrader.EntityFramework.csproj" />
|
||||
<ProjectReference Include="..\OemanTrader.FinantialModelingPrepAPI\OemanTrader.FinantialModelingPrepAPI.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
21
OemanTrader.WPF/State/Navigators/INavigator.cs
Normal file
21
OemanTrader.WPF/State/Navigators/INavigator.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using OemanTrader.WPF.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace OemanTrader.WPF.State.Navigators
|
||||
{
|
||||
public enum ViewType
|
||||
{
|
||||
Home,
|
||||
Portfolio
|
||||
}
|
||||
public interface INavigator
|
||||
{
|
||||
ViewModelBase CurrentViewModel { get; set; }
|
||||
ICommand UpdateCurrentViewModelCommand { get; }
|
||||
}
|
||||
}
|
||||
34
OemanTrader.WPF/State/Navigators/Navigator.cs
Normal file
34
OemanTrader.WPF/State/Navigators/Navigator.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using OemanTrader.WPF.Commands;
|
||||
using OemanTrader.WPF.Models;
|
||||
using OemanTrader.WPF.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace OemanTrader.WPF.State.Navigators
|
||||
{
|
||||
public class Navigator : ObservableObject, INavigator
|
||||
{
|
||||
private ViewModelBase _currentViewModel;
|
||||
public ViewModelBase CurrentViewModel
|
||||
{
|
||||
get
|
||||
{
|
||||
return _currentViewModel;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_currentViewModel = value;
|
||||
OnPropertyChanged(nameof(CurrentViewModel));
|
||||
}
|
||||
}
|
||||
public ICommand UpdateCurrentViewModelCommand => new UpdateCurrentViewModelCommand(this);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
10
OemanTrader.WPF/Styles/Common.xaml
Normal file
10
OemanTrader.WPF/Styles/Common.xaml
Normal file
@ -0,0 +1,10 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!--Colors-->
|
||||
<Color x:Key="ColorPrimary1">#799540</Color>
|
||||
<Color x:Key="ColorPrimary2">#50632b</Color>
|
||||
|
||||
<!--Brushes-->
|
||||
<SolidColorBrush x:Key="BrushPrimary1" Color="{StaticResource ColorPrimary1}"/>
|
||||
<SolidColorBrush x:Key="BrushPrimary2" Color="{StaticResource ColorPrimary2}"/>
|
||||
</ResourceDictionary>
|
||||
43
OemanTrader.WPF/Styles/NavigationBar.xaml
Normal file
43
OemanTrader.WPF/Styles/NavigationBar.xaml
Normal file
@ -0,0 +1,43 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<Style x:Key="NavButton" TargetType="RadioButton" >
|
||||
<Setter Property="Foreground" Value="white"/>
|
||||
<Setter Property="Padding" Value="10 5"/>
|
||||
<Setter Property="FontSize" Value="18"/>
|
||||
<Setter Property="Background" Value="{StaticResource BrushPrimary2}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="RadioButton">
|
||||
<Grid x:Name="gridMain" Background="{TemplateBinding Background}">
|
||||
<TextBlock Text="{TemplateBinding Content}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter Property="Background" Value="{StaticResource BrushPrimary1}" TargetName="gridMain"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<EventTrigger RoutedEvent="MouseEnter">
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<ColorAnimation To="{StaticResource ColorPrimary1}" Duration="0:0:0.1" Storyboard.TargetProperty="Background.Color"/>
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</EventTrigger>
|
||||
<EventTrigger RoutedEvent="MouseLeave">
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<ColorAnimation To="{StaticResource ColorPrimary2}" Duration="0:0:0.1" Storyboard.TargetProperty="Background.Color"/>
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</EventTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
18
OemanTrader.WPF/ViewModels/HomeViewModel.cs
Normal file
18
OemanTrader.WPF/ViewModels/HomeViewModel.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OemanTrader.WPF.ViewModels
|
||||
{
|
||||
public class HomeViewModel : ViewModelBase
|
||||
{
|
||||
public MajorIndexListingViewModel MajorIndexListingViewModel { get; set; }
|
||||
|
||||
public HomeViewModel(MajorIndexListingViewModel majorIndexListingViewModel)
|
||||
{
|
||||
MajorIndexListingViewModel = majorIndexListingViewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
19
OemanTrader.WPF/ViewModels/MainViewModel.cs
Normal file
19
OemanTrader.WPF/ViewModels/MainViewModel.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using OemanTrader.WPF.State.Navigators;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OemanTrader.WPF.ViewModels
|
||||
{
|
||||
public class MainViewModel : ViewModelBase
|
||||
{
|
||||
public INavigator Navigator { get; set; } = new Navigator();
|
||||
|
||||
public MainViewModel()
|
||||
{
|
||||
Navigator.UpdateCurrentViewModelCommand.Execute(ViewType.Home);
|
||||
}
|
||||
}
|
||||
}
|
||||
84
OemanTrader.WPF/ViewModels/MajorIndexListingViewModel.cs
Normal file
84
OemanTrader.WPF/ViewModels/MajorIndexListingViewModel.cs
Normal file
@ -0,0 +1,84 @@
|
||||
using OemanTrader.Domain.Models;
|
||||
using OemanTrader.Domain.Services;
|
||||
using OemanTrader.FinantialModelingPrepAPI.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OemanTrader.WPF.ViewModels
|
||||
{
|
||||
public class MajorIndexListingViewModel : ViewModelBase
|
||||
{
|
||||
private readonly IMajorIndexService _majorIndexService;
|
||||
|
||||
|
||||
private MajorIndex _dowJones;
|
||||
public MajorIndex DowJones {
|
||||
get { return _dowJones; }
|
||||
set {
|
||||
_dowJones = value;
|
||||
OnPropertyChanged(nameof(DowJones));
|
||||
}
|
||||
}
|
||||
|
||||
private MajorIndex _nasdaq;
|
||||
public MajorIndex Nasdaq
|
||||
{
|
||||
get { return _nasdaq; }
|
||||
set
|
||||
{
|
||||
_nasdaq = value;
|
||||
OnPropertyChanged(nameof(Nasdaq));
|
||||
}
|
||||
}
|
||||
|
||||
private MajorIndex _sp500;
|
||||
public MajorIndex SP500
|
||||
{
|
||||
get { return _sp500; }
|
||||
set
|
||||
{
|
||||
_sp500 = value;
|
||||
OnPropertyChanged(nameof(SP500));
|
||||
}
|
||||
}
|
||||
|
||||
public MajorIndexListingViewModel(IMajorIndexService majorIndexService)
|
||||
{
|
||||
_majorIndexService = majorIndexService;
|
||||
}
|
||||
|
||||
public static MajorIndexListingViewModel LoadMajorIndexViewModel(IMajorIndexService majorIndexService)
|
||||
{
|
||||
MajorIndexListingViewModel majorIndexViewModel = new MajorIndexListingViewModel(majorIndexService);
|
||||
majorIndexViewModel.LoadMajorIndexes();
|
||||
return majorIndexViewModel;
|
||||
}
|
||||
|
||||
private void LoadMajorIndexes()
|
||||
{
|
||||
_majorIndexService.GetMajorIndex(MajorIndexType.DowJones).ContinueWith(task =>
|
||||
{
|
||||
if(task.Exception == null) {
|
||||
DowJones = task.Result;
|
||||
}
|
||||
});
|
||||
_majorIndexService.GetMajorIndex(MajorIndexType.Nasdaq).ContinueWith(task =>
|
||||
{
|
||||
if (task.Exception == null)
|
||||
{
|
||||
Nasdaq = task.Result;
|
||||
}
|
||||
});
|
||||
_majorIndexService.GetMajorIndex(MajorIndexType.SP500).ContinueWith(task =>
|
||||
{
|
||||
if (task.Exception == null)
|
||||
{
|
||||
SP500 = task.Result;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
13
OemanTrader.WPF/ViewModels/PortfolioViewModel.cs
Normal file
13
OemanTrader.WPF/ViewModels/PortfolioViewModel.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OemanTrader.WPF.ViewModels
|
||||
{
|
||||
public class PortfolioViewModel : ViewModelBase
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
13
OemanTrader.WPF/ViewModels/ViewModelBase.cs
Normal file
13
OemanTrader.WPF/ViewModels/ViewModelBase.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using OemanTrader.WPF.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OemanTrader.WPF.ViewModels
|
||||
{
|
||||
public class ViewModelBase : ObservableObject
|
||||
{
|
||||
}
|
||||
}
|
||||
18
OemanTrader.WPF/Views/HomeView.xaml
Normal file
18
OemanTrader.WPF/Views/HomeView.xaml
Normal file
@ -0,0 +1,18 @@
|
||||
<UserControl x:Class="OemanTrader.WPF.Views.HomeView"
|
||||
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"
|
||||
xmlns:local="clr-namespace:OemanTrader.WPF.Views"
|
||||
xmlns:controls="clr-namespace:OemanTrader.WPF.Controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Text="Home"/>
|
||||
<controls:MajorIndexListing Grid.Row="1" Margin="0 10" HorizontalAlignment="Center" DataContext="{Binding MajorIndexListingViewModel}" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
OemanTrader.WPF/Views/HomeView.xaml.cs
Normal file
28
OemanTrader.WPF/Views/HomeView.xaml.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace OemanTrader.WPF.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for HomeView.xaml
|
||||
/// </summary>
|
||||
public partial class HomeView : UserControl
|
||||
{
|
||||
public HomeView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
12
OemanTrader.WPF/Views/PortfolioView.xaml
Normal file
12
OemanTrader.WPF/Views/PortfolioView.xaml
Normal file
@ -0,0 +1,12 @@
|
||||
<UserControl x:Class="OemanTrader.WPF.Views.PortfolioView"
|
||||
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"
|
||||
xmlns:local="clr-namespace:OemanTrader.WPF.Views"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<TextBlock Text="Portfolio"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
OemanTrader.WPF/Views/PortfolioView.xaml.cs
Normal file
28
OemanTrader.WPF/Views/PortfolioView.xaml.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace OemanTrader.WPF.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for PortfolioView.xaml
|
||||
/// </summary>
|
||||
public partial class PortfolioView : UserControl
|
||||
{
|
||||
public PortfolioView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user