diff --git a/VDownload.Core/VDownload.Core.Strings/StringResource.cs b/VDownload.Core/VDownload.Core.Strings/StringResource.cs new file mode 100644 index 0000000..86dec6d --- /dev/null +++ b/VDownload.Core/VDownload.Core.Strings/StringResource.cs @@ -0,0 +1,37 @@ +using Microsoft.Windows.ApplicationModel.Resources; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace VDownload.Core.Strings +{ + public class StringResource + { + #region FIELDS + + protected ResourceLoader _resourceLoader; + + #endregion + + + + #region CONSTRUCTORS + + internal StringResource(ResourceLoader resourceLoader) + { + _resourceLoader = resourceLoader; + } + + #endregion + + + + #region PUBLIC METHODS + + public string Get(string key) => _resourceLoader.GetString(key); + + #endregion + } +} diff --git a/VDownload.Core/VDownload.Core.Strings/StringResourcesManager.cs b/VDownload.Core/VDownload.Core.Strings/StringResourcesManager.cs new file mode 100644 index 0000000..f5913b3 --- /dev/null +++ b/VDownload.Core/VDownload.Core.Strings/StringResourcesManager.cs @@ -0,0 +1,44 @@ +using Microsoft.UI.Xaml; +using Microsoft.Windows.ApplicationModel.Resources; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace VDownload.Core.Strings +{ + public static class StringResourcesManager + { + #region PROPERTIES + + public static StringResource BaseView { get; } = BuildResource("BaseViewResources"); + public static StringResource HomeView { get; } = BuildResource("HomeViewResources"); + public static StringResource HomeVideoView { get; } = BuildResource("HomeVideoViewResources"); + public static StringResource HomeVideoCollectionView { get; } = BuildResource("HomeVideoCollectionViewResources"); + public static StringResource HomeDownloadsView { get; } = BuildResource("HomeDownloadsViewResources"); + public static StringResource AuthenticationView { get; } = BuildResource("AuthenticationViewResources"); + public static StringResource Notifications { get; } = BuildResource("NotificationsResources"); + public static StringResource Search { get; } = BuildResource("SearchResources"); + public static StringResource Common { get; } = BuildResource("CommonResources"); + public static StringResource DialogButtons { get; } = BuildResource("DialogButtonsResources"); + public static StringResource SettingsView { get; } = BuildResource("SettingsViewResources"); + public static StringResource FilenameTemplate { get; } = BuildResource("FilenameTemplateResources"); + public static StringResource AboutView { get; } = BuildResource("AboutViewResources"); + public static StringResource SubscriptionsView { get; } = BuildResource("SubscriptionsViewResources"); + + #endregion + + + + #region PRIVATE METHODS + + private static StringResource BuildResource(string resourceName) + { + ResourceLoader loader = new ResourceLoader(resourceName); + return new StringResource(loader); + } + + #endregion + } +} diff --git a/VDownload.Services/VDownload.Services.UI/VDownload.Services.UI.StringResources/StringResourcesService.cs b/VDownload.Services/VDownload.Services.UI/VDownload.Services.UI.StringResources/StringResourcesService.cs index e7bf3e0..97f9e2c 100644 --- a/VDownload.Services/VDownload.Services.UI/VDownload.Services.UI.StringResources/StringResourcesService.cs +++ b/VDownload.Services/VDownload.Services.UI/VDownload.Services.UI.StringResources/StringResourcesService.cs @@ -82,7 +82,11 @@ namespace VDownload.Services.UI.StringResources #region PRIVATE METHODS - protected StringResources BuildResource(string resourceName) => new StringResources(ResourceLoader.GetForViewIndependentUse($"{_configurationService.Common.StringResourcesAssembly}/{resourceName}")); + protected StringResources BuildResource(string resourceName) + { + ResourceLoader loader = new ResourceLoader($"{_configurationService.Common.StringResourcesAssembly}/{resourceName}"); + return new StringResources(loader); + } #endregion } diff --git a/VDownload/Activation/ActivationService.cs b/VDownload/Activation/ActivationService.cs index 6cbd3af..1cb9125 100644 --- a/VDownload/Activation/ActivationService.cs +++ b/VDownload/Activation/ActivationService.cs @@ -1,6 +1,7 @@ using Microsoft.UI.Xaml; using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -73,14 +74,19 @@ namespace VDownload.Activation public async Task ActivateAsync(object activationArgs) { + File.AppendAllText("C:\\Users\\mateusz\\Desktop\\test.txt", "testactivate\n"); await InitializeAsync(); ViewModelToViewConverter.Initialize((App.Current as App)!.Host.Services); + File.AppendAllText("C:\\Users\\mateusz\\Desktop\\test.txt", "test1\n"); await HandleActivationAsync(activationArgs); + File.AppendAllText("C:\\Users\\mateusz\\Desktop\\test.txt", "test2\n"); _window = App.GetService(); + File.AppendAllText("C:\\Users\\mateusz\\Desktop\\test.txt", "test3\n"); _window.RootLoaded += Window_RootLoaded; _window.Activate(); + File.AppendAllText("C:\\Users\\mateusz\\Desktop\\test.txt", "test4\n"); await StartupAsync(); } diff --git a/VDownload/App.xaml.cs b/VDownload/App.xaml.cs index 5bed22b..a766bef 100644 --- a/VDownload/App.xaml.cs +++ b/VDownload/App.xaml.cs @@ -2,11 +2,13 @@ using Microsoft.Extensions.Configuration.Json; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; using Microsoft.Toolkit.Uwp.Notifications; using Microsoft.UI; using Microsoft.UI.Xaml; using Microsoft.Windows.AppNotifications; using System; +using System.IO; using System.Net; using System.Net.Http; using System.Threading.Tasks; @@ -87,6 +89,10 @@ namespace VDownload Path = "configuration.json" }); }) + .ConfigureLogging((builder) => + { + builder.AddConsole(); + }) .ConfigureServices((context, services) => { BuildCore(services); @@ -117,11 +123,14 @@ namespace VDownload { base.OnLaunched(args); + File.AppendAllText("C:\\Users\\mateusz\\Desktop\\test.txt", "testlaunched\n"); + await GetService().ActivateAsync(args); } protected void UnhandledExceptionCatched(object sender, Microsoft.UI.Xaml.UnhandledExceptionEventArgs e) { + File.AppendAllText("C:\\Users\\mateusz\\Desktop\\test.txt", $"test {e.Message}\n"); throw new NotImplementedException(); } diff --git a/VDownload/VDownload.csproj b/VDownload/VDownload.csproj index df49035..efaa3fc 100644 --- a/VDownload/VDownload.csproj +++ b/VDownload/VDownload.csproj @@ -189,8 +189,12 @@ + + + + @@ -206,8 +210,12 @@ + + + +