change networkservice to communitytoolkit networkhelper

This commit is contained in:
2024-03-04 00:49:15 +01:00
Unverified
parent 3ddb8e73e3
commit f949954130
10 changed files with 14 additions and 44 deletions

View File

@@ -1,5 +1,6 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.WinUI.Helpers;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -11,7 +12,6 @@ using VDownload.Services.Data.Configuration;
using VDownload.Services.Data.Settings;
using VDownload.Services.UI.Dialogs;
using VDownload.Services.UI.StringResources;
using VDownload.Services.Utility.Network;
using VDownload.Sources;
using VDownload.Sources.Common;
using VDownload.Sources.Twitch.Configuration.Models;
@@ -52,7 +52,6 @@ namespace VDownload.Core.ViewModels.Home
protected readonly ISettingsService _settingsService;
protected readonly IStringResourcesService _stringResourcesService;
protected readonly ISearchService _searchService;
protected readonly INetworkService _networkService;
protected readonly IDialogsService _dialogsService;
protected readonly IDownloadTaskManager _downloadTaskManager;
@@ -113,13 +112,12 @@ namespace VDownload.Core.ViewModels.Home
#region CONSTRUCTORS
public HomeViewModel(IConfigurationService configurationService, ISettingsService settingsService, IStringResourcesService stringResourcesService, ISearchService searchService, INetworkService networkService, IDialogsService dialogsService, IDownloadTaskManager downloadTaskManager, HomeVideoViewModel videoViewModel, HomePlaylistViewModel playlistViewModel)
public HomeViewModel(IConfigurationService configurationService, ISettingsService settingsService, IStringResourcesService stringResourcesService, ISearchService searchService, IDialogsService dialogsService, IDownloadTaskManager downloadTaskManager, HomeVideoViewModel videoViewModel, HomePlaylistViewModel playlistViewModel)
{
_configurationService = configurationService;
_settingsService = settingsService;
_stringResourcesService = stringResourcesService;
_searchService = searchService;
_networkService = networkService;
_dialogsService = dialogsService;
_downloadTaskManager = downloadTaskManager;
@@ -267,7 +265,7 @@ namespace VDownload.Core.ViewModels.Home
[RelayCommand]
public async Task Download()
{
if (_downloadTaskManager.Tasks.Count > 0 && _networkService.IsMetered)
if (_downloadTaskManager.Tasks.Count > 0 && NetworkHelper.Instance.ConnectionInformation.IsInternetOnMeteredConnection)
{
string title = _stringResourcesService.CommonResources.Get("StartAtMeteredConnectionDialogTitle");
string message = _stringResourcesService.CommonResources.Get("StartAtMeteredConnectionDialogMessage");