private void CreateCommands() { GenerateReportFromStrategy = new RelayCommand <IList>(GenReportFromStrategy); GenerateReportFromTags = new RelayCommand <IList>(GenReportFromTags); GenerateReportFromTrades = new RelayCommand <IList>(GenReportFromTrades); LoadStatementFromWeb = new RelayCommand <string>(async x => { await StatementHandler.LoadFromWeb(x).ConfigureAwait(true); PostStatementLoadProcedures(); }); LoadStatementFromFile = new RelayCommand <string>(async x => { await StatementHandler.LoadFromFile(x).ConfigureAwait(true); PostStatementLoadProcedures(); }); }
public MainViewModel(IDBContext context, IDataSourcer datasourcer, IDialogService dialogService) : base(dialogService) { Context = context; Datasourcer = datasourcer; StatementHandler = new StatementHandler( context, dialogService, datasourcer); CreateSubViewModels(); SelectedPageViewModel = OpenPositionsPageViewModel; CreateCommands(); }
private void CreateCommands() { GenerateReportFromStrategy = new RelayCommand <IList>(GenReportFromStrategy); GenerateReportFromTags = new RelayCommand <IList>(GenReportFromTags); GenerateReportFromTrades = new RelayCommand <IList>(GenReportFromTrades); LoadStatementFromWeb = new RelayCommand <string>(async x => { await StatementHandler.LoadFromWeb(x); RefreshCurrentPage(); }); LoadStatementFromFile = new RelayCommand <string>(async x => { await StatementHandler.LoadFromFile(x); RefreshCurrentPage(); }); }
public MainViewModel(IDBContext context, IDataSourcer datasourcer, IDialogCoordinator dialogService) : base(dialogService) { Context = context; Datasourcer = datasourcer; TradesRepository = new TradesRepository(context, datasourcer, Properties.Settings.Default.optionsCapitalUsageMultiplier); StatementHandler = new StatementHandler( context, dialogService, datasourcer, TradesRepository, this); CreateSubViewModels(); SelectedPageViewModel = OpenPositionsPageViewModel; CreateCommands(); ScriptRunner = new ScriptRunner(TradesRepository); }
public MainViewModel(IContextFactory contextFactory, IDataSourcer datasourcer, IDialogCoordinator dialogService, IAppSettings settings, DataContainer data) : base(dialogService) { Datasourcer = datasourcer; Settings = settings; Data = data; _tradesRepository = new TradesRepository(contextFactory, datasourcer, settings); StatementHandler = new StatementHandler( dialogService, contextFactory, settings, this); this._contextFactory = contextFactory; ScriptRunner = new ScriptRunner(contextFactory, _tradesRepository, data); CreateCommands(); CreateSubViewModels(); SelectedPageViewModel = OpenPositionsPageViewModel; }
private void CreateCommands() { GenerateReportFromStrategy = new RelayCommand <IList>(GenReportFromStrategy); GenerateReportFromTags = new RelayCommand <IList>(GenReportFromTags); GenerateReportFromTrades = new RelayCommand <IList>(GenReportFromTrades); LoadStatementFromWeb = ReactiveCommand.CreateFromTask <string>(async x => { var progressDialog = await DialogService.ShowProgressAsync(this, "Load Statement from Web", "Downloading").ConfigureAwait(false); var newData = await StatementHandler.LoadFromWeb(x, progressDialog); if (newData == null) { await progressDialog.CloseAsync(); return; } await PostStatementLoadProcedures(newData, progressDialog); }); LoadStatementFromFile = ReactiveCommand.CreateFromTask <string>(async x => { var progressDialog = await DialogService.ShowProgressAsync(this, "Load Statement from File", "Opening File"); var newData = await StatementHandler.LoadFromFile(x, progressDialog); if (newData == null) { await progressDialog.CloseAsync(); return; } await PostStatementLoadProcedures(newData, progressDialog); }); LoadStatementFromFile.ThrownExceptions.Subscribe(ex => { _logger.Error(ex, "Error on file load"); DialogService.ShowMessageAsync(this, "Error", ex.Message); }); }