-Ftp Seite überarbeitet mit path auswahl und zurück plus weiter button. Fehlt noch logik zum speichern vom path in global variable (: um sie zu laden evtl local zwischen speichern damit nicht jedes mal eine anfrage zum server kommt. -Server Dashboard beispiel mod config hinzugefügt um ftp string zu lesen und schreiben. Plugin unterstützung fehlt hier noch plus plugin muss erstmal geschrieben werden das er es kann :P
64 lines
1.7 KiB
C#
64 lines
1.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Reactive;
|
|
using System.Reactive.Disposables;
|
|
using Avalonia;
|
|
using Avalonia.Controls;
|
|
using Avalonia.Markup.Xaml;
|
|
using Avalonia.ReactiveUI;
|
|
using KeyAuth;
|
|
using ReactiveUI;
|
|
using Valheim_Dashboard.ViewModels;
|
|
|
|
namespace Valheim_Dashboard.Views;
|
|
|
|
public partial class FtpView : ReactiveUserControl<FtpViewModel>
|
|
{
|
|
public FtpView()
|
|
{
|
|
|
|
InitializeComponent();
|
|
//DataContext = new FtpViewModel();
|
|
|
|
// Aktivierungslogik für Bindings
|
|
this.WhenActivated(disposables =>
|
|
{
|
|
// Binde den aktuellen Pfad an die TextBox
|
|
this.OneWayBind(ViewModel, vm => vm.CurrentPath, v => v.CurrentPathTextBox_.Text)
|
|
.DisposeWith(disposables);
|
|
|
|
// Konvertiere die ObservableCollection<string> zu IEnumerable<object>
|
|
this.OneWayBind(ViewModel, vm => vm.Files, v => v.FtpFileList_.ItemsSource)
|
|
.DisposeWith(disposables);
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
private void InitializeComponent()
|
|
{
|
|
AvaloniaXamlLoader.Load(this);
|
|
}
|
|
|
|
private TextBox CurrentPathTextBox_ => this.FindControl<TextBox>("CurrentPathTextBox");
|
|
private ListBox FtpFileList_ => this.FindControl<ListBox>("FtpFileList");
|
|
|
|
private void Weiter_Clicked(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
|
|
{
|
|
|
|
//Settings.SettingsSave("LizenzKey", LizenzKeyTextBox.Text);
|
|
|
|
if (this.Parent.Parent.Parent is MainWindow mainWindow)
|
|
{
|
|
if (mainWindow.DataContext is MainWindowViewModel mainWindowViewModel)
|
|
{
|
|
mainWindowViewModel.SwitchToServerDashboard();
|
|
}
|
|
}
|
|
}
|
|
} |