debugging

This commit is contained in:
2024-03-14 18:58:05 +01:00
Unverified
parent c9d81fe966
commit 8ff6071c1d
6 changed files with 109 additions and 1 deletions

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}

View File

@@ -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<BaseWindow>();
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();
}

View File

@@ -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<IActivationService>().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();
}

View File

@@ -189,8 +189,12 @@
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VDownload.Core\VDownload.Core.Strings\VDownload.Core.Strings.csproj" />
<ProjectReference Include="..\VDownload.Core\VDownload.Core.Tasks\VDownload.Core.Tasks.csproj" />
<ProjectReference Include="..\VDownload.Core\VDownload.Core.ViewModels\VDownload.Core.ViewModels.csproj" />
<ProjectReference Include="..\VDownload.Core\VDownload.Core.Views\VDownload.Core.Views.csproj" />
<ProjectReference Include="..\VDownload.Models\VDownload.Models.csproj" />
<ProjectReference Include="..\VDownload.Services\VDownload.Services.Common\VDownload.Services.Common.csproj" />
<ProjectReference Include="..\VDownload.Services\VDownload.Services.Data\VDownload.Services.Data.Application\VDownload.Services.Data.Application.csproj" />
<ProjectReference Include="..\VDownload.Services\VDownload.Services.Data\VDownload.Services.Data.Authentication\VDownload.Services.Data.Authentication.csproj" />
<ProjectReference Include="..\VDownload.Services\VDownload.Services.Data\VDownload.Services.Data.Configuration\VDownload.Services.Data.Configuration.csproj" />
@@ -206,8 +210,12 @@
<ProjectReference Include="..\VDownload.Services\VDownload.Services.Utility\VDownload.Services.Utility.FFmpeg\VDownload.Services.Utility.FFmpeg.csproj" />
<ProjectReference Include="..\VDownload.Services\VDownload.Services.Utility\VDownload.Services.Utility.Filename\VDownload.Services.Utility.Filename.csproj" />
<ProjectReference Include="..\VDownload.Services\VDownload.Services.Utility\VDownload.Services.Utility.HttpClient\VDownload.Services.Utility.HttpClient.csproj" />
<ProjectReference Include="..\VDownload.Sources\VDownload.Sources.Common\VDownload.Sources.Common.csproj" />
<ProjectReference Include="..\VDownload.Sources\VDownload.Sources.Twitch\VDownload.Sources.Twitch.Api\VDownload.Sources.Twitch.Api.csproj" />
<ProjectReference Include="..\VDownload.Sources\VDownload.Sources.Twitch\VDownload.Sources.Twitch.Authentication\VDownload.Sources.Twitch.Authentication.csproj" />
<ProjectReference Include="..\VDownload.Sources\VDownload.Sources.Twitch\VDownload.Sources.Twitch.Configuration\VDownload.Sources.Twitch.Configuration.csproj" />
<ProjectReference Include="..\VDownload.Sources\VDownload.Sources.Twitch\VDownload.Sources.Twitch.Models\VDownload.Sources.Twitch.Models.csproj" />
<ProjectReference Include="..\VDownload.Sources\VDownload.Sources.Twitch\VDownload.Sources.Twitch.Settings\VDownload.Sources.Twitch.Settings.csproj" />
<ProjectReference Include="..\VDownload.Sources\VDownload.Sources.Twitch\VDownload.Sources.Twitch\VDownload.Sources.Twitch.csproj" />
<ProjectReference Include="..\VDownload.Sources\VDownload.Sources\VDownload.Sources.csproj" />
</ItemGroup>