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.Collections.ObjectModel;
@@ -14,7 +15,6 @@ using VDownload.Services.UI.Dialogs;
using VDownload.Services.UI.StoragePicker;
using VDownload.Services.UI.StringResources;
using VDownload.Services.Utility.Filename;
using VDownload.Services.Utility.Network;
namespace VDownload.Core.ViewModels.Home
{
@@ -27,7 +27,6 @@ namespace VDownload.Core.ViewModels.Home
protected readonly ISettingsService _settingsService;
protected readonly IStoragePickerService _storagePickerService;
protected readonly IFilenameService _filenameService;
protected readonly INetworkService _networkService;
protected readonly IDialogsService _dialogsService;
protected readonly IStringResourcesService _stringResourcesService;
@@ -97,13 +96,12 @@ namespace VDownload.Core.ViewModels.Home
#region CONSTRUCTORS
public HomeVideoViewModel(IDownloadTaskManager tasksManager, ISettingsService settingsService, IStoragePickerService storagePickerService, IFilenameService filenameService, INetworkService networkService, IDialogsService dialogsService, IStringResourcesService stringResourcesService)
public HomeVideoViewModel(IDownloadTaskManager tasksManager, ISettingsService settingsService, IStoragePickerService storagePickerService, IFilenameService filenameService, IDialogsService dialogsService, IStringResourcesService stringResourcesService)
{
_tasksManager = tasksManager;
_settingsService = settingsService;
_storagePickerService = storagePickerService;
_filenameService = filenameService;
_networkService = networkService;
_dialogsService = dialogsService;
_stringResourcesService = stringResourcesService;
}
@@ -163,7 +161,7 @@ namespace VDownload.Core.ViewModels.Home
protected async Task CreateTask(bool download)
{
if (download && _networkService.IsMetered)
if (download && NetworkHelper.Instance.ConnectionInformation.IsInternetOnMeteredConnection)
{
string title = _stringResourcesService.CommonResources.Get("StartAtMeteredConnectionDialogTitle");
string message = _stringResourcesService.CommonResources.Get("StartAtMeteredConnectionDialogMessage");