diff --git a/.idea/.idea.PSCHelpdesk/.idea/avalonia.xml b/.idea/.idea.PSCHelpdesk/.idea/avalonia.xml
index 163796a..36b649d 100644
--- a/.idea/.idea.PSCHelpdesk/.idea/avalonia.xml
+++ b/.idea/.idea.PSCHelpdesk/.idea/avalonia.xml
@@ -11,6 +11,7 @@
+
diff --git a/.idea/.idea.PSCHelpdesk/.idea/workspace.xml b/.idea/.idea.PSCHelpdesk/.idea/workspace.xml
index 395a60a..42d0573 100644
--- a/.idea/.idea.PSCHelpdesk/.idea/workspace.xml
+++ b/.idea/.idea.PSCHelpdesk/.idea/workspace.xml
@@ -13,23 +13,610 @@
-
-
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
@@ -45,9 +632,14 @@
+
+
-
+
+
+
+
@@ -56,9 +648,6 @@
-
-
-
@@ -258,7 +847,9 @@
-
+
+
+
@@ -276,7 +867,15 @@
1732211861007
-
+
+
+ 1732644534156
+
+
+
+ 1732644534156
+
+
@@ -298,7 +897,8 @@
-
+
+
@@ -401,17 +1001,95 @@
- file://$PROJECT_DIR$/HetznerServer/ViewModels/ServerViewModel.cs
- 99
-
+ file://$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/Views/MainDockWindow.axaml.cs
+ 43
+
-
+
-
+
-
+
+
+
+ file://$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/Views/MainDockWindow.axaml.cs
+ 50
+
+
+
+
+
+
+
+
+
+
+
+ file://$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/Views/MainDockWindow.axaml.cs
+ 60
+
+
+
+
+
+
+
+
+
+
+
+ file://$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/Views/MainDockWindow.axaml.cs
+ 62
+
+
+
+
+
+
+
+
+
+
+
+ file://$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/Views/MainDockWindow.axaml.cs
+ 64
+
+
+
+
+
+
+
+
+
+
+
+ file://$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/Views/MainDockWindow.axaml.cs
+ 67
+
+
+
+
+
+
+
+
+
+
+
+ file://$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/Views/MainDockWindow.axaml.cs
+ 75
+
+
+
+
+
+
+
+
+
diff --git a/HetznerServer/ViewModels/ServerViewModel.cs b/HetznerServer/ViewModels/ServerViewModel.cs
index 8a5d038..b388f0d 100644
--- a/HetznerServer/ViewModels/ServerViewModel.cs
+++ b/HetznerServer/ViewModels/ServerViewModel.cs
@@ -7,7 +7,6 @@ using CommunityToolkit.Mvvm.DependencyInjection;
using CommunityToolkit.Mvvm.Input;
using DynamicData;
using DynamicData.Binding;
-using HetznerCloudApi;
using PSCHelpdesk.Plugins.HetznerServer.Models;
using PSCHelpdesk.Plugins.HetznerServer.Service;
using PSCHelpdesk.Plugins.HetznerServer.Views;
diff --git a/PSCHelpdesk.sln.DotSettings.user b/PSCHelpdesk.sln.DotSettings.user
index 991050e..288e94e 100644
--- a/PSCHelpdesk.sln.DotSettings.user
+++ b/PSCHelpdesk.sln.DotSettings.user
@@ -21,6 +21,8 @@
ForceIncluded
ForceIncluded
ForceIncluded
+ ForceIncluded
+ ForceIncluded
ForceIncluded
ForceIncluded
ForceIncluded
@@ -30,6 +32,7 @@
ForceIncluded
ForceIncluded
ForceIncluded
+ ForceIncluded
ForceIncluded
ForceIncluded
ForceIncluded
@@ -37,6 +40,7 @@
ForceIncluded
ForceIncluded
ForceIncluded
+ ForceIncluded
ForceIncluded
ForceIncluded
ForceIncluded
@@ -70,6 +74,7 @@
ForceIncluded
ForceIncluded
ForceIncluded
+ ForceIncluded
ForceIncluded
ForceIncluded
ForceIncluded
diff --git a/PSCHelpdesk/PSCHelpdesk/Converter/AvaloniaPluginResultConverter.cs b/PSCHelpdesk/PSCHelpdesk/Converter/AvaloniaPluginResultConverter.cs
deleted file mode 100644
index 4819829..0000000
--- a/PSCHelpdesk/PSCHelpdesk/Converter/AvaloniaPluginResultConverter.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using Prise.Proxy;
-
-namespace PSCHelpdesk.Converter;
-
-public class AvaloniaPluginResultConverter : ResultConverter
-{
- public override object Deserialize(Type localType, Type remoteType, object value)
- {
- // No conversion, no backwards compatibility
- // When the host upgrades any Avalonia dependency, it will break
- return value;
- }
-}
\ No newline at end of file
diff --git a/PSCHelpdesk/PSCHelpdesk/PSCHelpdesk.csproj b/PSCHelpdesk/PSCHelpdesk/PSCHelpdesk.csproj
index 2d5a5b5..115596d 100644
--- a/PSCHelpdesk/PSCHelpdesk/PSCHelpdesk.csproj
+++ b/PSCHelpdesk/PSCHelpdesk/PSCHelpdesk.csproj
@@ -49,9 +49,17 @@
MenuItem.axaml
Code
+
+ TestTemplateControl.axaml
+ Code
+
+
+
+
+
diff --git a/PSCHelpdesk/PSCHelpdesk/Services/PluginService.cs b/PSCHelpdesk/PSCHelpdesk/Services/PluginService.cs
deleted file mode 100644
index cf07469..0000000
--- a/PSCHelpdesk/PSCHelpdesk/Services/PluginService.cs
+++ /dev/null
@@ -1,120 +0,0 @@
-using System;
-using System.Linq;
-using Avalonia.Controls;
-using CommunityToolkit.Mvvm.DependencyInjection;
-using Microsoft.Extensions.DependencyInjection;
-using PSCHelpdesk.Shared.Menu;
-using PSCHelpdesk.Shared.Plugin;
-using PSCHelpdesk.Shared.Service;
-using PSCHelpdesk.Shared.Tasks;
-
-namespace PSCHelpdesk.Services;
-
-using System.Collections.Generic;
-using System.IO;
-using System.Reflection;
-using Avalonia;
-using Prise;
-
-public class PluginService
-{
- private List toLoadPlugins = new List();
- private Dictionary loadedPlugins = new Dictionary();
- private Dictionary foundPlugins = new Dictionary();
- private Dictionary controls = new Dictionary();
-
- public PluginService()
- {
- //this.scanPlugins();
- //this.LoadPlugin("HetznerServer");
- this.LoadPlugin("Nextcloud");
- }
- public Dictionary GetPlugins()
- {
- return this.foundPlugins;
- }
- async private void scanPlugins()
- {
- var pluginLoader = Ioc.Default.GetService();
- var dist = getPluginPath();
- var pluginScanResults = await pluginLoader.FindPlugins(dist);
-
- var menuService = Ioc.Default.GetService();
-
- //components = new Dictionary();
- foreach (var pluginScanResult in pluginScanResults)
- {
- this.foundPlugins.Add(Path.GetFileNameWithoutExtension(pluginScanResult.AssemblyName), pluginScanResult.AssemblyPath);
- }
- }
- private string getPluginPath()
- {
- var pathToThisProgram = Assembly.GetExecutingAssembly() // this assembly location (/bin/Debug/netcoreapp3.1)
- .Location;
- var pathToExecutingDir = Path.GetDirectoryName(pathToThisProgram);
- //return Path.GetFullPath(Path.Combine(pathToExecutingDir, "../../../../../_dist"));
- return pathToExecutingDir;
- }
- async public void LoadPlugin(string pluginName)
- {
- if(this.loadedPlugins.ContainsKey(pluginName))
- {
- return;
- }
- this.toLoadPlugins.Add(pluginName);
-
- var pluginLoader = Ioc.Default.GetService(typeof(IPluginLoader)) as IPluginLoader;
- var menuService = Ioc.Default.GetRequiredService();
- var settingsService = Ioc.Default.GetRequiredService();
- var settingsManager = Ioc.Default.GetRequiredService();
- var taskManager = Ioc.Default.GetRequiredService();
- var testService = Ioc.Default.GetRequiredService();
- var appService = Ioc.Default.GetService(typeof(AppService)) as AppService;
-
- var pluginAssemblies = await pluginLoader.FindPlugins(getPluginPath());
- var pluginToEnable = pluginAssemblies.FirstOrDefault(p => Path.GetFileNameWithoutExtension(p.AssemblyName) == pluginName);
-
- if (pluginToEnable != null)
- {
- var plugin = await pluginLoader.LoadPlugin(pluginToEnable, configure: (context) =>
- {
- context
- .AddHostTypes(new[] {typeof(Application), typeof(Item)})
- .AddRemoteTypes(new []{typeof(Item)})
- .AddHostService(menuService)
- .AddHostService(settingsService)
- .AddHostService(settingsManager)
- .AddHostService(taskManager)
- .AddHostService(testService)
- //.AddHostService(settingsService)
-
- ;
- });
-
-
- if (!this.loadedPlugins.ContainsKey(pluginName))
- {
- loadedPlugins.Add(plugin.GetName(), plugin);
- plugin.Configure();
- var items = plugin.LoadViews();
- foreach (var item in items)
- {
- this.controls.Add(item.FullName, item);
- }
-
- appService.AppIsStarted();
- }
- }
- }
-
- public UserControl GetView(string viewName)
- {
- return (UserControl)Activator.CreateInstance(this.controls[viewName]);
- }
-
- public bool ViewExists(string viewName)
- {
- return this.controls.ContainsKey(viewName);
- }
-
-}
diff --git a/PSCHelpdesk/PSCHelpdesk/Startup.cs b/PSCHelpdesk/PSCHelpdesk/Startup.cs
index 2af4562..a07b974 100644
--- a/PSCHelpdesk/PSCHelpdesk/Startup.cs
+++ b/PSCHelpdesk/PSCHelpdesk/Startup.cs
@@ -3,9 +3,6 @@ using Microsoft.Extensions.DependencyInjection;
using NP.Ava.UniDock;
using NP.Ava.UniDock.Factories;
using NP.Ava.UniDockService;
-using Prise.DependencyInjection;
-using Prise.Proxy;
-using PSCHelpdesk.Converter;
using PSCHelpdesk.Services;
using PSCHelpdesk.Shared.Service;
using PSCHelpdesk.Shared.Setting;
@@ -32,7 +29,6 @@ class Startup
var te = new ServiceCollection()
.AddSingleton()
- .AddFactory(()=> new AvaloniaPluginResultConverter())
.AddSingleton()
.AddSingleton(settingsManager)
.AddSingleton(settingsService)
diff --git a/PSCHelpdesk/PSCHelpdesk/ViewModels/MainDockWindowViewModel.cs b/PSCHelpdesk/PSCHelpdesk/ViewModels/MainDockWindowViewModel.cs
index 06fb2f8..0eb36b6 100644
--- a/PSCHelpdesk/PSCHelpdesk/ViewModels/MainDockWindowViewModel.cs
+++ b/PSCHelpdesk/PSCHelpdesk/ViewModels/MainDockWindowViewModel.cs
@@ -33,13 +33,19 @@ public class MainDockWindowViewModel : ViewModelBase, IViewModelBase
public ReactiveCommand ClickMenu { get; }
public ReactiveCommand OpenPlugins { get; }
+ public ReactiveCommand SaveLayout { get; }
+ public ReactiveCommand LoadLayout { get; }
public EventHandler openTab;
+ public EventHandler LoadHandler;
+ public EventHandler SaveHandler;
public MainDockWindowViewModel()
{
ClickMenu = ReactiveCommand.Create(SelectMenu);
OpenPlugins = ReactiveCommand.Create(openPlugins);
+ SaveLayout = ReactiveCommand.Create(saveLayout);
+ LoadLayout = ReactiveCommand.Create(loadLayout);
this.MenuItems = new List- ();
MenuService = (MenuService)Ioc.Default.GetService(typeof(IMenuService));
@@ -100,9 +106,19 @@ public class MainDockWindowViewModel : ViewModelBase, IViewModelBase
DockId = "plugins",
Header = "Plugins",
DefaultDockGroupId = "Tabs",
- Content = new PluginListViewModel(Ioc.Default.GetService())
- }
+ Content = new PluginListViewModel()
+ }
});
}
+
+ void loadLayout()
+ {
+ this.LoadHandler?.Invoke(this, EventArgs.Empty);
+ }
+
+ void saveLayout()
+ {
+ this.SaveHandler?.Invoke(this, EventArgs.Empty);
+ }
}
\ No newline at end of file
diff --git a/PSCHelpdesk/PSCHelpdesk/ViewModels/MainWindowViewModel.cs b/PSCHelpdesk/PSCHelpdesk/ViewModels/MainWindowViewModel.cs
index b903a8f..5dcdb39 100644
--- a/PSCHelpdesk/PSCHelpdesk/ViewModels/MainWindowViewModel.cs
+++ b/PSCHelpdesk/PSCHelpdesk/ViewModels/MainWindowViewModel.cs
@@ -124,7 +124,7 @@ public class MainWindowViewModel : ViewModelBase, IViewModelBase
{
if (TabItems.Count(x => x.Header == "Plugins") == 0)
TabItems.Add(new TabItemViewModel("Plugins",
- new PluginListViewModel(Ioc.Default.GetService())));
+ new PluginListViewModel()));
SelectedTabItem = TabItems.Last();
}
diff --git a/PSCHelpdesk/PSCHelpdesk/ViewModels/PluginListViewModel.cs b/PSCHelpdesk/PSCHelpdesk/ViewModels/PluginListViewModel.cs
index f474f86..3668465 100644
--- a/PSCHelpdesk/PSCHelpdesk/ViewModels/PluginListViewModel.cs
+++ b/PSCHelpdesk/PSCHelpdesk/ViewModels/PluginListViewModel.cs
@@ -1,5 +1,6 @@
using Avalonia.Collections;
using Avalonia.Controls;
+using CommunityToolkit.Mvvm.DependencyInjection;
using CommunityToolkit.Mvvm.Input;
using NP.Ava.UniDockService;
using PSCHelpdesk.Services;
@@ -7,7 +8,7 @@ using PSCHelpdesk.Shared.ViewModels;
namespace PSCHelpdesk.ViewModels;
-class PluginListViewModel : ViewModelBase, IViewModelBase
+public class PluginListViewModel : ViewModelBase, IViewModelBase
{
public RelayCommand