Skip to content

Commit

Permalink
Download funciton
Browse files Browse the repository at this point in the history
  • Loading branch information
MeetMichal committed Dec 24, 2023
1 parent fd954e9 commit 76c351a
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions DeBankUI/Client/Program.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using BlazorDownloadFile;
using DeBankUI;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
Expand Down
4 changes: 2 additions & 2 deletions DeBankUI/DeBankUI.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
Expand All @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BlazorDownloadFileFast" Version="1.0.0-preview-01" />
<PackageReference Include="BlazorDownloadFile" Version="2.4.0.2" />
<PackageReference Include="CsvHelper" Version="30.0.1" />
<PackageReference Include="LiveChartsCore.SkiaSharpView.Blazor" Version="2.0.0-rc2" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.0" />
Expand Down
6 changes: 3 additions & 3 deletions DeBankUI/Pages/Michal/DeBankUsersPage.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
using SkiaSharp;
using DeBankUI.Utils;
using DeBankUI.Components;
using Blazor.DownloadFileFast.Interfaces;
using Microsoft.AspNetCore.Components;
using DeBankUI.Shared.Michal;
using BlazorDownloadFile;

namespace DeBankUI.Pages.Michal
{
Expand All @@ -24,8 +24,8 @@ public partial class DeBankUsersPage

public async Task DownloadChartData(BaseChartComponent baseComponent, string title)
{
var data = baseComponent.DownloadChartData();
await BlazorDownloadFileService.DownloadFileAsync(title, data);
byte[] data = baseComponent.DownloadChartData();
await BlazorDownloadFileService.DownloadFile(title, data, "application/octet-stream");
}
}
}
4 changes: 2 additions & 2 deletions DeBankUI/Pages/Michal/LuckyDrawsPage.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
using SkiaSharp;
using DeBankUI.Utils;
using DeBankUI.Components;
using Blazor.DownloadFileFast.Interfaces;
using Microsoft.AspNetCore.Components;
using DeBankUI.Shared.Michal;
using BlazorDownloadFile;

namespace DeBankUI.Pages.Michal
{
Expand All @@ -26,7 +26,7 @@ public partial class LuckyDrawsPage
public async Task DownloadChartData(BaseChartComponent baseComponent, string title)
{
var data = baseComponent.DownloadChartData();
await BlazorDownloadFileService.DownloadFileAsync(title, data);
await BlazorDownloadFileService.DownloadFile(title, data, "application/octet-stream");
}
}
}
4 changes: 2 additions & 2 deletions DeBankUI/Pages/Michal/OtherDataPage.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
using SkiaSharp;
using DeBankUI.Utils;
using DeBankUI.Components;
using Blazor.DownloadFileFast.Interfaces;
using Microsoft.AspNetCore.Components;
using DeBankUI.Shared.Michal;
using BlazorDownloadFile;

namespace DeBankUI.Pages.Michal
{
Expand All @@ -23,7 +23,7 @@ public partial class OtherDataPage
public async Task DownloadChartData(BaseChartComponent baseComponent, string title)
{
var data = baseComponent.DownloadChartData();
await BlazorDownloadFileService.DownloadFileAsync(title, data);
await BlazorDownloadFileService.DownloadFile(title, data, "application/octet-stream");
}
}
}
4 changes: 2 additions & 2 deletions DeBankUI/Pages/Michal/RewardPoolsPage.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
using SkiaSharp;
using DeBankUI.Utils;
using DeBankUI.Components;
using Blazor.DownloadFileFast.Interfaces;
using Microsoft.AspNetCore.Components;
using DeBankUI.Shared.Michal;
using BlazorDownloadFile;

namespace DeBankUI.Pages.Michal
{
Expand All @@ -24,7 +24,7 @@ public partial class RewardPoolsPage
public async Task DownloadChartData(BaseChartComponent baseComponent, string title)
{
var data = baseComponent.DownloadChartData();
await BlazorDownloadFileService.DownloadFileAsync(title, data);
await BlazorDownloadFileService.DownloadFile(title, data, "application/octet-stream");
}
}
}
4 changes: 2 additions & 2 deletions DeBankUI/Pages/Michal/StreamActivityPage.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
using SkiaSharp;
using DeBankUI.Utils;
using DeBankUI.Components;
using Blazor.DownloadFileFast.Interfaces;
using Microsoft.AspNetCore.Components;
using DeBankUI.Shared.Michal;
using BlazorDownloadFile;

namespace DeBankUI.Pages.Michal
{
Expand All @@ -24,7 +24,7 @@ public partial class StreamActivityPage
public async Task DownloadChartData(BaseChartComponent baseComponent, string title)
{
var data = baseComponent.DownloadChartData();
await BlazorDownloadFileService.DownloadFileAsync(title, data);
await BlazorDownloadFileService.DownloadFile(title, data, "application/octet-stream");
}
}
}
1 change: 0 additions & 1 deletion DeBankUI/Pages/Michal/TopDepositsPage.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using SkiaSharp;
using DeBankUI.Utils;
using DeBankUI.Components;
using Blazor.DownloadFileFast.Interfaces;
using Microsoft.AspNetCore.Components;
using DeBankUI.Shared.Michal;

Expand Down
5 changes: 3 additions & 2 deletions DeBankUI/Pages/Nett/Top100Users.razor.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using Blazor.DownloadFileFast.Interfaces;
using BlazorDownloadFile;
using DeBankUI.Components;
using DeBankUI.Data;
using DeBankUI.Model;
using DeBankUI.Utils;
using Microsoft.AspNetCore.Components;
using static System.Runtime.InteropServices.JavaScript.JSType;

namespace DeBankUI.Pages.Nett
{
Expand All @@ -25,7 +26,7 @@ protected override async Task OnInitializedAsync()
public async Task DownloadData(string title)
{
var stream = await HttpClient.GetStreamAsync("top100.csv");
await BlazorDownloadFileService.DownloadFileAsync(title, stream.ReadFully());
await BlazorDownloadFileService.DownloadFile(title, stream.ReadFully(), "application/octet-stream");
}
}
}

0 comments on commit 76c351a

Please sign in to comment.