public Task <StreamDownloadResponse> DownloadStream(StreamDownloadRequest request) { MemoryStream stream = NetHelper.SerializeToStream <Workers>(ViewModel.Instance.Workers); return(Task.FromResult(new StreamDownloadResponse { Stream = stream })); }
public async Task <StreamDownloadResponse> GetPriceHistoryAsync(StreamDownloadRequest request) { try { var task = Task.Run(async() => { var vm = ViewModel.Instance; await vm.UpdatePriceHistory(); return(ViewModel.ReadHistoricalData(request.Period)); }); var history = await task; MemoryStream stream = NetHelper.SerializeToStream <List <HistoricalData> >(history); return(new StreamDownloadResponse { Stream = stream }); } catch (Exception ex) { throw new FaultException(ex.Message); } }