change networkservice to communitytoolkit networkhelper
This commit is contained in:
@@ -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;
|
||||
@@ -9,7 +10,6 @@ using System.Threading.Tasks;
|
||||
using VDownload.Core.Tasks;
|
||||
using VDownload.Services.UI.Dialogs;
|
||||
using VDownload.Services.UI.StringResources;
|
||||
using VDownload.Services.Utility.Network;
|
||||
|
||||
namespace VDownload.Core.ViewModels.Home
|
||||
{
|
||||
@@ -19,7 +19,6 @@ namespace VDownload.Core.ViewModels.Home
|
||||
|
||||
protected readonly IDownloadTaskManager _tasksManager;
|
||||
|
||||
protected readonly INetworkService _networkService;
|
||||
protected readonly IDialogsService _dialogsService;
|
||||
protected readonly IStringResourcesService _stringResourcesService;
|
||||
|
||||
@@ -40,12 +39,11 @@ namespace VDownload.Core.ViewModels.Home
|
||||
|
||||
#region CONSTRUCTORS
|
||||
|
||||
public HomeDownloadsViewModel(IDownloadTaskManager tasksManager, INetworkService networkService, IDialogsService dialogsService, IStringResourcesService stringResourcesService)
|
||||
public HomeDownloadsViewModel(IDownloadTaskManager tasksManager, IDialogsService dialogsService, IStringResourcesService stringResourcesService)
|
||||
{
|
||||
_tasksManager = tasksManager;
|
||||
_tasksManager.TaskCollectionChanged += Tasks_CollectionChanged;
|
||||
|
||||
_networkService = networkService;
|
||||
_dialogsService = dialogsService;
|
||||
_stringResourcesService = stringResourcesService;
|
||||
|
||||
@@ -71,7 +69,7 @@ namespace VDownload.Core.ViewModels.Home
|
||||
if (idleStatuses.Contains(task.Status))
|
||||
{
|
||||
bool continueEnqueue = true;
|
||||
if (_networkService.IsMetered)
|
||||
if (NetworkHelper.Instance.ConnectionInformation.IsInternetOnMeteredConnection)
|
||||
{
|
||||
string title = _stringResourcesService.CommonResources.Get("StartAtMeteredConnectionDialogTitle");
|
||||
string message = _stringResourcesService.CommonResources.Get("StartAtMeteredConnectionDialogMessage");
|
||||
|
||||
@@ -19,7 +19,7 @@ using System.Text.RegularExpressions;
|
||||
using VDownload.Services.Utility.Filename;
|
||||
using VDownload.Services.UI.Dialogs;
|
||||
using VDownload.Services.UI.StringResources;
|
||||
using VDownload.Services.Utility.Network;
|
||||
using CommunityToolkit.WinUI.Helpers;
|
||||
|
||||
namespace VDownload.Core.ViewModels.Home
|
||||
{
|
||||
@@ -32,7 +32,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;
|
||||
|
||||
@@ -180,13 +179,12 @@ namespace VDownload.Core.ViewModels.Home
|
||||
|
||||
#region CONSTRUCTORS
|
||||
|
||||
public HomePlaylistViewModel(IDownloadTaskManager tasksManager, ISettingsService settingsService, IStoragePickerService storagePickerService, IFilenameService filenameService, INetworkService networkService, IDialogsService dialogsService, IStringResourcesService stringResourcesService)
|
||||
public HomePlaylistViewModel(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;
|
||||
|
||||
@@ -293,7 +291,7 @@ namespace VDownload.Core.ViewModels.Home
|
||||
|
||||
protected async Task CreateTasks(bool download)
|
||||
{
|
||||
if (download && _networkService.IsMetered)
|
||||
if (download && NetworkHelper.Instance.ConnectionInformation.IsInternetOnMeteredConnection)
|
||||
{
|
||||
string title = _stringResourcesService.CommonResources.Get("StartAtMeteredConnectionDialogTitle");
|
||||
string message = _stringResourcesService.CommonResources.Get("StartAtMeteredConnectionDialogMessage");
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user