diff --git a/VDownload.Core/VDownload.Core.ViewModels/Home/HomeDownloadsViewModel.cs b/VDownload.Core/VDownload.Core.ViewModels/Home/HomeDownloadsViewModel.cs
index 44aed75..cf82579 100644
--- a/VDownload.Core/VDownload.Core.ViewModels/Home/HomeDownloadsViewModel.cs
+++ b/VDownload.Core/VDownload.Core.ViewModels/Home/HomeDownloadsViewModel.cs
@@ -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");
diff --git a/VDownload.Core/VDownload.Core.ViewModels/Home/HomePlaylistViewModel.cs b/VDownload.Core/VDownload.Core.ViewModels/Home/HomePlaylistViewModel.cs
index 0319b62..b4ed119 100644
--- a/VDownload.Core/VDownload.Core.ViewModels/Home/HomePlaylistViewModel.cs
+++ b/VDownload.Core/VDownload.Core.ViewModels/Home/HomePlaylistViewModel.cs
@@ -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");
diff --git a/VDownload.Core/VDownload.Core.ViewModels/Home/HomeVideoViewModel.cs b/VDownload.Core/VDownload.Core.ViewModels/Home/HomeVideoViewModel.cs
index f0494bf..724bf32 100644
--- a/VDownload.Core/VDownload.Core.ViewModels/Home/HomeVideoViewModel.cs
+++ b/VDownload.Core/VDownload.Core.ViewModels/Home/HomeVideoViewModel.cs
@@ -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");
diff --git a/VDownload.Core/VDownload.Core.ViewModels/Home/HomeViewModel.cs b/VDownload.Core/VDownload.Core.ViewModels/Home/HomeViewModel.cs
index 62d6c23..a9b9d75 100644
--- a/VDownload.Core/VDownload.Core.ViewModels/Home/HomeViewModel.cs
+++ b/VDownload.Core/VDownload.Core.ViewModels/Home/HomeViewModel.cs
@@ -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");
diff --git a/VDownload.Core/VDownload.Core.ViewModels/VDownload.Core.ViewModels.csproj b/VDownload.Core/VDownload.Core.ViewModels/VDownload.Core.ViewModels.csproj
index 5b32417..0b5a68b 100644
--- a/VDownload.Core/VDownload.Core.ViewModels/VDownload.Core.ViewModels.csproj
+++ b/VDownload.Core/VDownload.Core.ViewModels/VDownload.Core.ViewModels.csproj
@@ -10,6 +10,7 @@
+
@@ -18,7 +19,6 @@
-
diff --git a/VDownload.Services.Utility.Network/NetworkService.cs b/VDownload.Services/VDownload.Services.Utility/VDownload.Services.Utility.Network/NetworkService.cs
similarity index 100%
rename from VDownload.Services.Utility.Network/NetworkService.cs
rename to VDownload.Services/VDownload.Services.Utility/VDownload.Services.Utility.Network/NetworkService.cs
diff --git a/VDownload.Services.Utility.Network/VDownload.Services.Utility.Network.csproj b/VDownload.Services/VDownload.Services.Utility/VDownload.Services.Utility.Network/VDownload.Services.Utility.Network.csproj
similarity index 84%
rename from VDownload.Services.Utility.Network/VDownload.Services.Utility.Network.csproj
rename to VDownload.Services/VDownload.Services.Utility/VDownload.Services.Utility.Network/VDownload.Services.Utility.Network.csproj
index ee3a055..3fe9a7d 100644
--- a/VDownload.Services.Utility.Network/VDownload.Services.Utility.Network.csproj
+++ b/VDownload.Services/VDownload.Services.Utility/VDownload.Services.Utility.Network/VDownload.Services.Utility.Network.csproj
@@ -1,7 +1,7 @@
- netcoreapp3.1
+ net8.0
enable
enable
diff --git a/VDownload.sln b/VDownload.sln
index 9acb368..f4a954f 100644
--- a/VDownload.sln
+++ b/VDownload.sln
@@ -71,8 +71,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VDownload.Services.Utility.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VDownload.Services.Utility.Filename", "VDownload.Services\VDownload.Services.Utility\VDownload.Services.Utility.Filename\VDownload.Services.Utility.Filename.csproj", "{4647EFB5-A206-4F47-976D-BAED11B52579}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VDownload.Services.Utility.Network", "VDownload.Services.Utility.Network\VDownload.Services.Utility.Network.csproj", "{08AEC43D-34C3-4B19-A577-B69FF755BD7F}"
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -523,22 +521,6 @@ Global
{4647EFB5-A206-4F47-976D-BAED11B52579}.Release|x64.Build.0 = Release|Any CPU
{4647EFB5-A206-4F47-976D-BAED11B52579}.Release|x86.ActiveCfg = Release|Any CPU
{4647EFB5-A206-4F47-976D-BAED11B52579}.Release|x86.Build.0 = Release|Any CPU
- {08AEC43D-34C3-4B19-A577-B69FF755BD7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {08AEC43D-34C3-4B19-A577-B69FF755BD7F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {08AEC43D-34C3-4B19-A577-B69FF755BD7F}.Debug|ARM64.ActiveCfg = Debug|Any CPU
- {08AEC43D-34C3-4B19-A577-B69FF755BD7F}.Debug|ARM64.Build.0 = Debug|Any CPU
- {08AEC43D-34C3-4B19-A577-B69FF755BD7F}.Debug|x64.ActiveCfg = Debug|Any CPU
- {08AEC43D-34C3-4B19-A577-B69FF755BD7F}.Debug|x64.Build.0 = Debug|Any CPU
- {08AEC43D-34C3-4B19-A577-B69FF755BD7F}.Debug|x86.ActiveCfg = Debug|Any CPU
- {08AEC43D-34C3-4B19-A577-B69FF755BD7F}.Debug|x86.Build.0 = Debug|Any CPU
- {08AEC43D-34C3-4B19-A577-B69FF755BD7F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {08AEC43D-34C3-4B19-A577-B69FF755BD7F}.Release|Any CPU.Build.0 = Release|Any CPU
- {08AEC43D-34C3-4B19-A577-B69FF755BD7F}.Release|ARM64.ActiveCfg = Release|Any CPU
- {08AEC43D-34C3-4B19-A577-B69FF755BD7F}.Release|ARM64.Build.0 = Release|Any CPU
- {08AEC43D-34C3-4B19-A577-B69FF755BD7F}.Release|x64.ActiveCfg = Release|Any CPU
- {08AEC43D-34C3-4B19-A577-B69FF755BD7F}.Release|x64.Build.0 = Release|Any CPU
- {08AEC43D-34C3-4B19-A577-B69FF755BD7F}.Release|x86.ActiveCfg = Release|Any CPU
- {08AEC43D-34C3-4B19-A577-B69FF755BD7F}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -573,7 +555,6 @@ Global
{3BE998A3-1126-4496-BF60-80D0CEA4D24F} = {8539067C-9968-4AEB-928C-FEDC43989A79}
{A3166F8A-ECAD-4D4B-9BE3-96FEC799B27B} = {1020167A-4101-496E-82CF-41B65769DD28}
{4647EFB5-A206-4F47-976D-BAED11B52579} = {1020167A-4101-496E-82CF-41B65769DD28}
- {08AEC43D-34C3-4B19-A577-B69FF755BD7F} = {1020167A-4101-496E-82CF-41B65769DD28}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9FD7B842-C3E2-4FD0-AD8A-C8E619280AB7}
diff --git a/VDownload/App.xaml.cs b/VDownload/App.xaml.cs
index 0643854..2e9b054 100644
--- a/VDownload/App.xaml.cs
+++ b/VDownload/App.xaml.cs
@@ -28,7 +28,6 @@ using VDownload.Services.Utility.Encryption;
using VDownload.Services.Utility.FFmpeg;
using VDownload.Services.Utility.Filename;
using VDownload.Services.Utility.HttpClient;
-using VDownload.Services.Utility.Network;
using VDownload.Sources;
using VDownload.Sources.Twitch;
using VDownload.Sources.Twitch.Api;
@@ -123,7 +122,6 @@ namespace VDownload
services.AddSingleton();
services.AddSingleton();
services.AddSingleton();
- services.AddSingleton();
}
protected void BuildSourcesServices(IServiceCollection services)
diff --git a/VDownload/VDownload.csproj b/VDownload/VDownload.csproj
index 8856ca1..8a756cf 100644
--- a/VDownload/VDownload.csproj
+++ b/VDownload/VDownload.csproj
@@ -170,7 +170,6 @@
-