This commit is contained in:
Thomas Peterson 2024-11-15 21:56:49 +01:00
parent 03f52307f2
commit 151307c416
23 changed files with 319 additions and 71 deletions

View File

@ -8,6 +8,7 @@
<option value="$PROJECT_DIR$/Nextcloud/_dist" />
<option value="$PROJECT_DIR$/_dist/nextcloud" />
<option value="$PROJECT_DIR$/_dist/hetzner" />
<option value="$PROJECT_DIR$/_dist/fastbill" />
</list>
</option>
</component>

View File

@ -11,18 +11,18 @@
</component>
<component name="ChangeListManager">
<list default="true" id="95257dc5-08bd-4c50-8726-85956b3c2c92" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/.idea.PSCHelpdesk/.idea/riderPublish.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.PSCHelpdesk/.idea/riderPublish.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.idea.PSCHelpdesk/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.PSCHelpdesk/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/HetznerServer/HetznerServer.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/HetznerServer/HetznerServer.csproj" afterDir="false" />
<change beforePath="$PROJECT_DIR$/HetznerServer/Models/Domain.cs" beforeDir="false" afterPath="$PROJECT_DIR$/HetznerServer/Models/Domain.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/FastBill/FastBill.cs" beforeDir="false" afterPath="$PROJECT_DIR$/FastBill/FastBill.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/FastBill/FastBill.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/FastBill/FastBill.csproj" afterDir="false" />
<change beforePath="$PROJECT_DIR$/HetznerServer/Models/Server.cs" beforeDir="false" afterPath="$PROJECT_DIR$/HetznerServer/Models/Server.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/HetznerServer/Service/ServerService.cs" beforeDir="false" afterPath="$PROJECT_DIR$/HetznerServer/Service/ServerService.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/HetznerServer/Views/ServerView.axaml" beforeDir="false" afterPath="$PROJECT_DIR$/HetznerServer/Views/ServerView.axaml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/PSCHelpdesk.sln.DotSettings.user" beforeDir="false" afterPath="$PROJECT_DIR$/PSCHelpdesk.sln.DotSettings.user" afterDir="false" />
<change beforePath="$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk.Desktop/PSCHelpdesk.Desktop.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk.Desktop/PSCHelpdesk.Desktop.csproj" afterDir="false" />
<change beforePath="$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk.Desktop/Program.cs" beforeDir="false" afterPath="$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk.Desktop/Program.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/App.axaml" beforeDir="false" afterPath="$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/App.axaml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/PSCHelpdesk.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/PSCHelpdesk.csproj" afterDir="false" />
<change beforePath="$PROJECT_DIR$/_dist/hetzner/HetznerServer.deps.json" beforeDir="false" afterPath="$PROJECT_DIR$/_dist/hetzner/HetznerServer.deps.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/Services/PluginManager.cs" beforeDir="false" afterPath="$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/Services/PluginManager.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/ViewModels/MainWindowViewModel.cs" beforeDir="false" afterPath="$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/ViewModels/MainWindowViewModel.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/ViewModels/PluginListViewModel.cs" beforeDir="false" afterPath="$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/ViewModels/PluginListViewModel.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/Views/MainWindow.axaml" beforeDir="false" afterPath="$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/Views/MainWindow.axaml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/_dist/hetzner/HetznerServer.dll" beforeDir="false" afterPath="$PROJECT_DIR$/_dist/hetzner/HetznerServer.dll" afterDir="false" />
<change beforePath="$PROJECT_DIR$/_dist/hetzner/HetznerServer.pdb" beforeDir="false" afterPath="$PROJECT_DIR$/_dist/hetzner/HetznerServer.pdb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/_dist/nextcloud/Nextcloud.dll" beforeDir="false" afterPath="$PROJECT_DIR$/_dist/nextcloud/Nextcloud.dll" afterDir="false" />
@ -40,17 +40,12 @@
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="HighlightingSettingsPerFile">
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/41a0cf7c8a374f46b063a4351ae9caba572200/c2/b03cb7ea/MaterialIconKind.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/667004c0a83e47158c9865f6d54f01d91ac00/59/bf99e13a/IPluginLoader.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/749c24062bd743eda4d91dac9e11436b5600/70/b81d515e/MaterialIcon.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/89cb27a4c7a84598bf2c8660f2c1566f7a00/2d/aa1ab2cd/Icon.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/8edaf97dcc544ce3960f853a8b6332e246a200/b9/454418ca/HeroIcon.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/27be5d106a789638721745a2a46f9cb0f7a39905117d644638b6e0d56261be/ReplaySubject.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/2e6883f773fb7c69a15db509adac9a0c068e4ca54fa119e835fd2324311c3b/Ioc.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/86e7f7d5cebacb8f8e37f52cb9a1f6a4b8933239631e3d969a4bc881ae92f9/Brushes.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/9d4f4ac7db6d2c5d183ab2d92602280ed4349fd6e6a1b6313546b3d01fdab5/ServiceProvider.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/b51633fd6f6f512fc661f2514db03960821aad9811e02b34c0dafb2e3abc9fc/KnownColors.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/be37f94ace60e93760f363e28be5136e9e82a6dce891cef5f298e2bcd812c256/IBrush.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/dd582eafcc7da4dc5ece1e7e4de37b1f271b42b4cea54a2aecfe3bda3fd2e5a/HyperlinkButton.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/b4d338c08631a580604cf98f3ead4bcf84405bb3807bfc9f3bc14ac2d2be/Activator.RuntimeType.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/HetznerServer/ViewModels/ServerViewModel.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/HetznerServer/Views/ServerView.axaml" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/HetznerServer/Views/ServerView.axaml.cs" root0="FORCE_HIGHLIGHTING" />
@ -83,42 +78,54 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;.NET Project.PSCHelpdesk.Desktop ohne plugin.executor&quot;: &quot;Run&quot;,
&quot;.NET Project.PSCHelpdesk.Desktop.executor&quot;: &quot;Run&quot;,
&quot;Publish to folder.Build HetznerServer Plugin Debug.executor&quot;: &quot;Run&quot;,
&quot;Publish to folder.Copy Hetzner Target.executor&quot;: &quot;Run&quot;,
&quot;Publish to folder.Copy NextCloud Target.executor&quot;: &quot;Run&quot;,
&quot;Publish to folder.Publish HetznerServer to folder.executor&quot;: &quot;Run&quot;,
&quot;Publish to folder.Publish NextCloud to folder.executor&quot;: &quot;Run&quot;,
&quot;Publish to folder.Publish Nextcloud to folder.executor&quot;: &quot;Run&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;XThreadsFramesViewSplitterKey&quot;: &quot;0.4427131&quot;,
&quot;git-widget-placeholder&quot;: &quot;master&quot;,
&quot;ignore.virus.scanning.warn.message&quot;: &quot;true&quot;,
&quot;last_opened_file_path&quot;: &quot;/home/thomas/RiderProjects/PSCHelpdesk/PSCHelpdesk/PSCHelpdesk.Desktop/bin/Debug/net9.0/plugins&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;SolutionBuilderGeneralOptionsPage&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
".NET Project.PSCHelpdesk.Desktop ohne plugin.executor": "Run",
".NET Project.PSCHelpdesk.Desktop.executor": "Run",
"Publish to folder.Build HetznerServer Plugin Debug.executor": "Run",
"Publish to folder.Copy Fastbill.executor": "Run",
"Publish to folder.Copy Hetzner Target.executor": "Run",
"Publish to folder.Copy Hetzner.executor": "Run",
"Publish to folder.Copy NextCloud Target.executor": "Run",
"Publish to folder.Copy NextCloud.executor": "Run",
"Publish to folder.Copy PrinshopCreator.executor": "Run",
"Publish to folder.Publish HetznerServer to folder.executor": "Run",
"Publish to folder.Publish NextCloud to folder.executor": "Run",
"Publish to folder.Publish Nextcloud to folder.executor": "Run",
"RunOnceActivity.ShowReadmeOnStart": "true",
"XThreadsFramesViewSplitterKey": "0.4427131",
"git-widget-placeholder": "master",
"ignore.virus.scanning.warn.message": "true",
"last_opened_file_path": "/home/thomas/RiderProjects/PSCHelpdesk/PSCHelpdesk/PSCHelpdesk.Desktop/bin/Debug/net9.0/plugins",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"settings.editor.selected.configurable": "SolutionBuilderGeneralOptionsPage",
"vue.rearranger.settings.migration": "true"
},
&quot;keyToStringList&quot;: {
&quot;com.intellij.ide.scratch.ScratchImplUtil$2/New Scratch File&quot;: [
&quot;Shell Script&quot;
"keyToStringList": {
"com.intellij.ide.scratch.ScratchImplUtil$2/New Scratch File": [
"Shell Script"
]
}
}</component>
}]]></component>
<component name="RunManager" selected=".NET Project.PSCHelpdesk.Desktop">
<configuration name="Copy Hetzner Target" type="DotNetFolderPublish" factoryName="Publish to folder">
<riderPublish configuration="Debug" delete_existing_files="true" platform="Any CPU" runtime="Portable" target_folder="$PROJECT_DIR$/_dist/hetzner" target_framework="net9.0" uuid_high="6134591891200954270" uuid_low="-7110083162272853959" />
<configuration name="Copy Fastbill" type="DotNetFolderPublish" factoryName="Publish to folder">
<riderPublish configuration="Debug" platform="Any CPU" runtime="Portable" target_folder="$PROJECT_DIR$/_dist/fastbill" target_framework="net9.0" uuid_high="-7209100147811201171" uuid_low="-5152034027148450759" />
<method v="2" />
</configuration>
<configuration name="Copy NextCloud Target" type="DotNetFolderPublish" factoryName="Publish to folder">
<riderPublish configuration="Debug" delete_existing_files="true" platform="Any CPU" runtime="Portable" target_folder="$PROJECT_DIR$/_dist/nextcloud" target_framework="net9.0" uuid_high="5491264484688088597" uuid_low="-7520256693357449726" />
<configuration name="Copy Hetzner" type="DotNetFolderPublish" factoryName="Publish to folder">
<riderPublish configuration="Debug" platform="Any CPU" runtime="Portable" target_folder="$PROJECT_DIR$/_dist/hetzner" target_framework="net9.0" uuid_high="6134591891200954270" uuid_low="-7110083162272853959" />
<method v="2" />
</configuration>
<configuration name="Copy NextCloud" type="DotNetFolderPublish" factoryName="Publish to folder">
<riderPublish configuration="Debug" platform="Any CPU" runtime="Portable" target_folder="$PROJECT_DIR$/_dist/nextcloud" target_framework="net9.0" uuid_high="5491264484688088597" uuid_low="-7520256693357449726" />
<method v="2" />
</configuration>
<configuration name="Copy PrinshopCreator" type="DotNetFolderPublish" factoryName="Publish to folder">
<riderPublish configuration="Debug" platform="Any CPU" runtime="Portable" target_folder="$PROJECT_DIR$/_dist/printshopcreator" target_framework="net9.0" uuid_high="2845292288445532334" uuid_low="-6080808010956145315" />
<method v="2" />
</configuration>
<configuration name="PSCHelpdesk.Browser" type="DotNetProject" factoryName=".NET Project">
@ -174,8 +181,12 @@
<method v="2">
<option name="Build" default="false" projectName="Nextcloud" projectPath="$PROJECT_DIR$/Nextcloud/Nextcloud.csproj" />
<option name="Build" default="false" projectName="HetznerServer" projectPath="$PROJECT_DIR$/HetznerServer/HetznerServer.csproj" />
<option name="Build" default="false" projectName="FastBill" projectPath="$PROJECT_DIR$/FastBill/FastBill.csproj" />
<option name="Build" default="false" projectName="PrintshopCreator" projectPath="$PROJECT_DIR$/PrintshopCreator/PrintshopCreator.csproj" />
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Copy NextCloud Target" run_configuration_type="DotNetFolderPublish" />
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Copy Hetzner Target" run_configuration_type="DotNetFolderPublish" />
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Copy Fastbill" run_configuration_type="DotNetFolderPublish" />
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Copy PrinshopCreator" run_configuration_type="DotNetFolderPublish" />
<option name="Build" />
</method>
</configuration>
@ -201,8 +212,10 @@
<item itemvalue=".NET Project.PSCHelpdesk.Desktop ohne plugin" />
<item itemvalue="Android.PSCHelpdesk.Android" />
<item itemvalue="iOS.PSCHelpdesk.iOS" />
<item itemvalue="Publish to folder.Copy NextCloud Target" />
<item itemvalue="Publish to folder.Copy Hetzner Target" />
<item itemvalue="Publish to folder.Copy NextCloud" />
<item itemvalue="Publish to folder.Copy Fastbill" />
<item itemvalue="Publish to folder.Copy PrinshopCreator" />
<item itemvalue="Publish to folder.Copy Hetzner" />
</list>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
@ -229,6 +242,7 @@
<workItem from="1731404905147" duration="14283000" />
<workItem from="1731437334002" duration="2883000" />
<workItem from="1731491898307" duration="3676000" />
<workItem from="1731659978668" duration="9478000" />
</task>
<servers />
</component>
@ -364,6 +378,32 @@
</properties>
<option name="timeStamp" value="195" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DotNet Breakpoints">
<url>file://$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/ViewModels/MainWindowViewModel.cs</url>
<line>125</line>
<properties documentPath="C:\Users\info\RiderProjects\pschelpdesk\PSCHelpdesk\PSCHelpdesk\ViewModels\MainWindowViewModel.cs" containingFunctionPresentation="Method 'openPlugins'">
<startOffsets>
<option value="4256" />
</startOffsets>
<endOffsets>
<option value="4384" />
</endOffsets>
</properties>
<option name="timeStamp" value="196" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DotNet Breakpoints">
<url>file://$PROJECT_DIR$/FastBill/FastBill.cs</url>
<line>18</line>
<properties documentPath="C:\Users\info\RiderProjects\pschelpdesk\FastBill\FastBill.cs" containingFunctionPresentation="Method 'Configure'">
<startOffsets>
<option value="365" />
</startOffsets>
<endOffsets>
<option value="438" />
</endOffsets>
</properties>
<option name="timeStamp" value="200" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>

View File

@ -1,4 +1,9 @@
using PSCHelpdesk.Shared.Plugin;
using CommunityToolkit.Mvvm.DependencyInjection;
using FastBill.ViewModels;
using FastBill.Views;
using PSCHelpdesk.Shared.Plugin;
using PSCHelpdesk.Shared.Service;
using PSCHelpdesk.Shared.Setting;
namespace FastBill;
@ -11,11 +16,17 @@ public class FastBill: Contract
public void Configure()
{
var settingsService = Ioc.Default.GetRequiredService<ISettingsService>();
var fastbillSettings = new Item()
{
Header = "Fastbill",
CommandParameter = new SettingsViewModel()
};
settingsService.AddSetting(fastbillSettings);
}
public List<Type> LoadViews()
{
return new List<Type>();
return [typeof(SettingsView)];
}
}

View File

@ -10,4 +10,9 @@
<ProjectReference Include="..\Shared\Shared.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" />
<PackageReference Include="ReactiveUI" Version="20.1.1" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,7 @@
namespace FastBill.Models;
public class Settings
{
public string EMail { get; set; } = string.Empty;
public string ApiKey { get; set; } = string.Empty;
}

View File

@ -0,0 +1,56 @@
using System.Reactive;
using CommunityToolkit.Mvvm.DependencyInjection;
using FastBill.Models;
using PSCHelpdesk.Shared.Service;
using PSCHelpdesk.Shared.Setting;
using PSCHelpdesk.Shared.ViewModels;
using ReactiveUI;
namespace FastBill.ViewModels;
public class SettingsViewModel: ViewModelBase, IViewModelBase
{
private string _email;
private string _apiKey;
private Settings _settings;
public ReactiveCommand<Unit, Unit> SaveSettings { get; }
public string EMail
{
get => _email;
set => SetAndRaisePropertyChanged(ref _email, value);
}
public string ApiKey
{
get => _apiKey;
set => SetAndRaisePropertyChanged(ref _apiKey, value);
}
public Settings Settings
{
get => _settings;
set => SetAndRaisePropertyChanged(ref _settings, value);
}
public SettingsViewModel()
{
Settings = new Settings();
var settingsManager = (SettingsManager)Ioc.Default.GetService<ISettingsManager>();
var _set = new Settings();
settingsManager.LoadPluginSettings("FastbillSettings", _set);
Settings.EMail = _set.EMail;
Settings.ApiKey = _set.ApiKey;
SaveSettings = ReactiveCommand.Create(saveSettings);
}
void saveSettings()
{
var settingsManager = (SettingsManager)Ioc.Default.GetService<ISettingsManager>();
settingsManager.SavePluginSettings("FastbillSettings", Settings);
}
}

View File

@ -0,0 +1,23 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:FastBill.ViewModels"
x:DataType="vm:SettingsViewModel"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="FastBill.Views.SettingsView">
<Design.DataContext>
<vm:SettingsViewModel></vm:SettingsViewModel>
</Design.DataContext>
<StackPanel>
<StackPanel>
<TextBlock Margin="0 5" >UserName</TextBlock>
<TextBox Text="{Binding Settings.EMail}" IsReadOnly="False"></TextBox>
</StackPanel>
<StackPanel>
<TextBlock Margin="0 5" >AppKey</TextBlock>
<TextBox Text="{Binding Settings.ApiKey}" IsReadOnly="False"></TextBox>
</StackPanel>
<Button Margin="0 5" Content="Save Settings" Command="{Binding SaveSettings}"></Button>
</StackPanel>
</UserControl>

View File

@ -0,0 +1,13 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace FastBill.Views;
public partial class SettingsView : UserControl
{
public SettingsView()
{
InitializeComponent();
}
}

View File

@ -11,12 +11,28 @@ public class Server : ReactiveObject
{
public long Id { get; set; }
public string Name { get; set; }
private string _pscApiKey;
public string PscApiKey
{
get => _pscApiKey;
set => this.RaiseAndSetIfChanged(ref _pscApiKey, value);
}
private string _fastBillId;
public string FastBillId
{
get => _fastBillId;
set => this.RaiseAndSetIfChanged(ref _fastBillId, value);
}
public string Status { get; set; }
private string _isGoodIcon = MaterialIconKind.AlertCircleOutline.ToString();
private MaterialIconKind _isGoodIcon = MaterialIconKind.AlertCircleOutline;
public string IsGoodIcon
public MaterialIconKind IsGoodIcon
{
get => _isGoodIcon;
set => this.RaiseAndSetIfChanged(ref _isGoodIcon, value);

View File

@ -1,10 +1,12 @@
using System.Collections.ObjectModel;
using System.Net.Http.Headers;
using Avalonia.Media;
using Avalonia.Threading;
using CommunityToolkit.Mvvm.DependencyInjection;
using DynamicData;
using DynamicData.Binding;
using HetznerCloudApi;
using Material.Icons;
using Newtonsoft.Json.Linq;
using PSCHelpdesk.Plugins.HetznerServer.Models;
using PSCHelpdesk.Shared.Service;
@ -164,6 +166,9 @@ public class ServerService: IServerService
}
}
serv.IsGoodIcon = MaterialIconKind.Check;
serv.IsGoodColor = Brushes.Green;
client.Disconnect();
_toastManager.DisplayNewToast("Server " + serv.Name + " finished");
}

View File

@ -22,6 +22,7 @@ public partial class ServerViewModel : ViewModelBase, IViewModelBase
{
public readonly ServerService ServerService;
public ReactiveCommand<SelectionChangedEventArgs, Unit> SelectionChanged { get; }
public ReactiveCommand<Unit, Unit> SaveServerSettings { get; }
protected readonly ReadOnlyObservableCollection<Server> _server;
public ReadOnlyObservableCollection<Server> Server => _server;
@ -31,6 +32,7 @@ public partial class ServerViewModel : ViewModelBase, IViewModelBase
{
SelectedServer = new Server(1,"","","","","");
SelectionChanged = ReactiveCommand.Create<SelectionChangedEventArgs>(selectionChanged);
SaveServerSettings = ReactiveCommand.Create(saveServerSettings);
_settingsManager = (SettingsManager)Ioc.Default.GetService<ISettingsManager>();
ServerService = _serverService;
ServerService.SourceCache.Connect()
@ -92,4 +94,9 @@ public partial class ServerViewModel : ViewModelBase, IViewModelBase
{
return new ServerView();
}
void saveServerSettings()
{
}
}

View File

@ -0,0 +1,44 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
xmlns:vm="clr-namespace:PSCHelpdesk.Plugins.HetznerServer.ViewModels"
x:Class="PSCHelpdesk.Plugins.HetznerServer.Views.ServerDetailView">
<Design.DataContext>
<vm:ServerViewModel></vm:ServerViewModel>
</Design.DataContext>
<StackPanel>
<TextBlock Text="{Binding SelectedServer.Name}" FontSize="24"/>
<TabControl>
<TabItem Header="Domains">
<StackPanel>
<ListBox ItemsSource="{Binding SelectedServer.Domains}" Margin="0" Padding="0">
<ListBox.Styles>
<Style Selector="ListBoxItem">
<Setter Property="Padding" Value="0" />
</Style>
</ListBox.Styles>
<ListBox.ItemTemplate>
<DataTemplate>
<Border Padding="1" Margin="0">
<!--<TextBox Text="{Binding Name}" DoubleTapped="InputElement_OnDoubleTapped"></TextBox>-->
<HyperlinkButton Content="{Binding LinkDomain}" NavigateUri="{Binding LinkDomain}"></HyperlinkButton>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</TabItem>
<TabItem Header="Settings">
<StackPanel>
<TextBlock Text="PSC ApiKey" Margin="0 5"></TextBlock>
<TextBox Text="{Binding SelectedServer.PscApiKey}"></TextBox>
<TextBlock Text="FastBill Id" Margin="0 5"></TextBlock>
<TextBox Text="{Binding SelectedServer.FastBillId}"></TextBox>
<Button Content="Save" Command="{Binding SaveServerSettings}"></Button>
</StackPanel>
</TabItem>
</TabControl>
</StackPanel>
</UserControl>

View File

@ -0,0 +1,13 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace PSCHelpdesk.Plugins.HetznerServer.Views;
public partial class ServerDetailView : UserControl
{
public ServerDetailView()
{
InitializeComponent();
}
}

View File

@ -7,6 +7,7 @@
xmlns:converter="clr-namespace:PSCHelpdesk.Plugins.HetznerServer.Converter"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="PSCHelpdesk.Plugins.HetznerServer.Views.ServerView"
xmlns:v="clr-namespace:PSCHelpdesk.Plugins.HetznerServer.Views"
x:DataType="vm:ServerViewModel"
Name="Servers">
<Design.DataContext>
@ -96,22 +97,7 @@
</Grid>
<GridSplitter Grid.Column="1" Background="Black" ResizeDirection="Columns"/>
<StackPanel Grid.Column="2" Margin="5 0">
<TextBlock Text="{Binding SelectedServer.Name}" FontSize="24"/>
<ListBox ItemsSource="{Binding SelectedServer.Domains}" Margin="0" Padding="0">
<ListBox.Styles>
<Style Selector="ListBoxItem">
<Setter Property="Padding" Value="0" />
</Style>
</ListBox.Styles>
<ListBox.ItemTemplate>
<DataTemplate>
<Border Padding="1" Margin="0">
<!--<TextBox Text="{Binding Name}" DoubleTapped="InputElement_OnDoubleTapped"></TextBox>-->
<HyperlinkButton Content="{Binding LinkDomain}" NavigateUri="{Binding LinkDomain}"></HyperlinkButton>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<v:ServerDetailView></v:ServerDetailView>
</StackPanel>
</Grid>
</UserControl>

View File

@ -1,4 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AActivator_002ERuntimeType_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fb4d338c08631a580604cf98f3ead4bcf84405bb3807bfc9f3bc14ac2d2be_003FActivator_002ERuntimeType_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AArgumentNullException_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F1c9517d527f614396dfa453346e69acfefb958c4c59d7fbef256bbab3538d_003FArgumentNullException_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AArgumentNullException_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F473d97221b573ab97e6e745d8adae8b9e95a666539d6ed3cc8566b245d93a_003FArgumentNullException_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AArray_002EEnumerators_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F37bd8e7b5e226f349e547a5599819e82461d93768c749730253eeec329288a2b_003FArray_002EEnumerators_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>

View File

@ -14,6 +14,12 @@ public class PluginManager
private List<Type> _pluginTypes;
private Dictionary<string, string> foundPlugins = new Dictionary<string, string>();
public Dictionary<string, string> GetPlugins()
{
return this.foundPlugins;
}
public PluginManager()
{
@ -51,6 +57,7 @@ public class PluginManager
if (pluginType.IsAssignableFrom(type))
{
pluginTypes.Add(type);
this.foundPlugins.Add(Path.GetFileNameWithoutExtension(assembly.FullName), assembly.Location);
}
}

View File

@ -25,6 +25,9 @@ public class MainWindowViewModel : ViewModelBase, IViewModelBase
private bool _isReconnecting;
public ReactiveCommand<string, Unit> ClickMenu { get; }
public ReactiveCommand<Unit,Unit> OpenPlugins { get; }
private ObservableCollection<TabItemViewModel> _tabItems;
private TabItemViewModel _selectedTabItem;
public ObservableCollection<TabItemViewModel> TabItems
@ -55,6 +58,7 @@ public class MainWindowViewModel : ViewModelBase, IViewModelBase
IsReconnecting = true;
Startup.RegisterServices();
ClickMenu = ReactiveCommand.Create<string>(SelectMenu);
OpenPlugins = ReactiveCommand.Create(openPlugins);
TabItems = new ObservableCollection<TabItemViewModel>();
this.MenuItems = new List<Item>();
MenuService = (MenuService)Ioc.Default.GetService(typeof(IMenuService));
@ -115,5 +119,13 @@ public class MainWindowViewModel : ViewModelBase, IViewModelBase
}
}
}
void openPlugins()
{
if (TabItems.Count(x => x.Header == "Plugins") == 0)
TabItems.Add(new TabItemViewModel("Plugins",
new PluginListViewModel(Ioc.Default.GetService<PluginManager>())));
SelectedTabItem = TabItems.Last();
}
}

View File

@ -24,12 +24,10 @@ class PluginListViewModel : ViewModelBase, IViewModelBase
LoadAllPluginsCommand = new RelayCommand<object>(LoadAllPlugins);
UnLoadAllPluginsCommand = new RelayCommand<object>(UnLoadAllPlugins);
/*foreach (var plugin in pluginService.GetPlugins())
foreach (var plugin in pluginService.GetPlugins())
{
this.Plugins.Add(plugin.Key);
}*/
//this._pluginService = pluginService;
}
}
async void LoadPlugin(object parameter)

View File

@ -30,6 +30,9 @@
</Style>
</MenuItem.Styles>
</MenuItem>
<MenuItem Header="_Plugins" Command="{Binding OpenPlugins}">
</MenuItem>
</Menu>
<TabControl Grid.Row="1" ItemsSource="{Binding TabItems}" SelectedItem="{Binding SelectedTabItem}">
<TabControl.ItemTemplate>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.