restructure project for part 2

This commit is contained in:
TheXamlGuy
2024-01-27 10:55:53 +00:00
parent a322893166
commit 48925b89ff
96 changed files with 383 additions and 351 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
x:Class="Hyperbar.Windows.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="using:Hyperbar.Windows.UI">
xmlns:ui="using:Hyperbar.UI.Windows">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
+11 -34
View File
@@ -1,27 +1,30 @@
using Hyperbar.Widget;
using Hyperbar.Windows.Controls;
using Hyperbar.Windows.Interop;
using Hyperbar.Windows.UI;
using CustomExtensions.WinUI;
using Hyperbar.Controls.Windows;
using Hyperbar.Interop.Windows;
using Hyperbar.UI.Windows;
using Hyperbar.Widget;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.Json;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.UI.Dispatching;
using Microsoft.UI.Xaml;
using System;
using System.Reflection;
using Windows.Media.Control;
namespace Hyperbar.Windows;
public partial class App :
Application
{
public App() => InitializeComponent();
public App()
{
InitializeComponent();
ApplicationExtensionHost.Initialize(this);
}
protected override async void OnLaunched(LaunchActivatedEventArgs args)
{
base.OnLaunched(args);
IHost? host = new HostBuilder()
.UseContentRoot(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
Assembly.GetEntryAssembly()?.GetName().Name!), true)
@@ -71,35 +74,9 @@ public partial class App :
services.AddContentTemplate<WidgetButtonViewModel, WidgetButtonView>();
services.AddContentTemplate<WidgetSplitButtonViewModel, WidgetSplitButtonView>();
}));
//services.AddTransient(provider =>
//{
// static IEnumerable<WidgetContainerViewModel> Resolve(IServiceProvider services)
// {
// int index = 0;
// foreach (WidgetContext widgetContext in services.GetServices<WidgetContext>())
// {
// if (widgetContext.ServiceProvider.GetService<IWidget>() is IWidget widget)
// {
// if (widgetContext.ServiceProvider.GetServices<IWidgetViewModel>() is
// IEnumerable<IWidgetViewModel> viewModels)
// {
// yield return (WidgetContainerViewModel)ActivatorUtilities.CreateInstance(widgetContext.ServiceProvider,
// typeof(WidgetContainerViewModel), viewModels, index % 2 == 1, widget.Id);
// index++;
// }
// }
// }
// }
// return Resolve(provider);
//});
})
.Build();
var d = host.Services.GetService<JsonConfigurationProvider>();
await host.RunAsync();
}
}
+7 -5
View File
@@ -32,10 +32,12 @@
<PackageReference Include="CommunityToolkit.WinUI" Version="7.1.2" />
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls" Version="7.1.2" />
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls.Primitives" Version="7.1.2" />
<PackageReference Include="CustomExtensions.WinUI" Version="0.1.10-beta" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.231202003-experimental1" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.25936-preview" />
<PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.9" /> <Manifest Include="$(ApplicationManifest)" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26031-preview" />
<PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.9" />
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>
<ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
<ProjectCapability Include="Msix" />
@@ -44,10 +46,10 @@
<HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Hyperbar.Controls.Windows\Hyperbar.Controls.Windows.csproj" />
<ProjectReference Include="..\Hyperbar.Interop.Windows\Hyperbar.Interop.Windows.csproj" />
<ProjectReference Include="..\Hyperbar.UI.Windows\Hyperbar.UI.Windows.csproj" />
<ProjectReference Include="..\Hyperbar.Widget\Hyperbar.Widget.csproj" />
<ProjectReference Include="..\Hyperbar.Windows.Controls\Hyperbar.Windows.Controls.csproj" />
<ProjectReference Include="..\Hyperbar.Windows.Interop\Hyperbar.Windows.Interop.csproj" />
<ProjectReference Include="..\Hyperbar.Windows.UI\Hyperbar.Windows.UI.csproj" />
<ProjectReference Include="..\Hyperbar\Hyperbar.csproj" />
</ItemGroup>
</Project>
@@ -1,4 +1,4 @@
using Hyperbar.Windows.Controls;
using Hyperbar.Controls.Windows;
namespace Hyperbar.Windows;
@@ -1,5 +1,5 @@
using Hyperbar.Widget;
using Hyperbar.Windows.Controls;
using Hyperbar.Controls.Windows;
using Hyperbar.Widget;
using Microsoft.Extensions.DependencyInjection;
namespace Hyperbar.Windows;
@@ -1,4 +1,4 @@
using Hyperbar.Windows.Controls;
using Hyperbar.Controls.Windows;
namespace Hyperbar.Windows;
@@ -1,59 +0,0 @@
using Hyperbar.Windows.Interop;
using Hyperbar.Windows.UI;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace Hyperbar.Windows
{
//public static class IServiceCollectionExtensions
//{
// public static IServiceCollection AddWidget<TWidget>(this IServiceCollection services)
// where TWidget :
// IWidget,
// new()
// {
// IHost? host = new HostBuilder()
// .UseContentRoot(AppContext.BaseDirectory)
// .ConfigureAppConfiguration(config =>
// {
// config.SetBasePath(AppContext.BaseDirectory);
// config.AddJsonFile("Settings.json", true, true);
// })
// .ConfigureServices((context, isolatedServices) =>
// {
// isolatedServices.AddScoped<IServiceFactory>(provider =>
// new ServiceFactory((type, parameters) => ActivatorUtilities.CreateInstance(provider, type, parameters!)));
// isolatedServices.AddHostedService<WidgetService>();
// isolatedServices.AddTransient<ITemplateFactory, TemplateFactory>();
// isolatedServices.AddScoped<IMediator, Mediator>();
// isolatedServices.AddScoped<IDisposer, Disposer>();
// isolatedServices.AddSingleton<IDispatcher, Dispatcher>();
// isolatedServices.AddScoped<IVirtualKeyboard, VirtualKeyboard>();
// isolatedServices.AddHandler<KeyAcceleratorHandler>();
// isolatedServices.AddHandler<StartProcessHandler>();
// isolatedServices.AddTransient<IWidgetView, WidgetView>();
// isolatedServices.AddContentTemplate<WidgetContainerViewModel, WidgetContainerView>();
// isolatedServices.AddContentTemplate<WidgetButtonViewModel, WidgetButtonView>();
// isolatedServices.AddContentTemplate<WidgetSplitButtonViewModel, WidgetSplitButtonView>();
// TWidget widget = new();
// IWidgetBuilder builder = widget.Create();
// isolatedServices.AddRange(builder.Services);
// }).Build();
// services.AddTransient(provider => new WidgetContext(host.Services));
// host.Start();
// return services;
// }
//}
}
@@ -1,4 +1,4 @@
using Hyperbar.Windows.Interop;
using Hyperbar.Interop.Windows;
namespace Hyperbar.Windows;
+1 -1
View File
@@ -3,7 +3,7 @@
x:Class="Hyperbar.Windows.WidgetBarView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="using:Hyperbar.Windows.UI">
xmlns:ui="using:Hyperbar.UI.Windows">
<ItemsControl ItemTemplateSelector="{Binding Converter={ui:DataTemplateConverter}}" ItemsSource="{Binding}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
@@ -5,7 +5,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:interactions="using:Microsoft.Xaml.Interactions.Core"
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:ui="using:Hyperbar.Windows.UI">
xmlns:ui="using:Hyperbar.UI.Windows">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
+1 -1
View File
@@ -5,7 +5,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:interactions="using:Microsoft.Xaml.Interactions.Core"
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:ui="using:Hyperbar.Windows.UI">
xmlns:ui="using:Hyperbar.UI.Windows">
<Grid>
<ItemsControl ItemTemplateSelector="{Binding Converter={ui:DataTemplateConverter}}" ItemsSource="{Binding Mode=TwoWay}">
<ItemsControl.ItemsPanel>