Add project files.
This commit is contained in:
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
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user