- ServerDashbord Hinzugefügt
-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
This commit is contained in:
@@ -2,62 +2,83 @@
|
||||
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:local="clr-namespace:Valheim_Dashboard"
|
||||
xmlns:vm="clr-namespace:Valheim_Dashboard.ViewModels"
|
||||
xmlns:views="clr-namespace:Valheim_Dashboard.Views"
|
||||
mc:Ignorable="d"
|
||||
x:Name="root"
|
||||
x:Class="Valheim_Dashboard.Views.FtpView"
|
||||
x:DataType="vm:FtpViewModel"
|
||||
>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- TextBox für den aktuellen FTP-Pfad -->
|
||||
<TextBox x:Name="CurrentPathTextBox"
|
||||
Grid.Row="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
IsEnabled="False"
|
||||
Height="100"
|
||||
Margin="50,0,50,0"
|
||||
Text="{Binding CurrentPath}"/>
|
||||
x:Class="Valheim_Dashboard.Views.FtpView"
|
||||
x:DataType="vm:FtpViewModel">
|
||||
|
||||
<Button
|
||||
x:Name="CurrentPathBack"
|
||||
Grid.Row="0"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left"
|
||||
Content="Zurück"
|
||||
IsVisible="{Binding CanGoBack}"
|
||||
Command="{Binding $parent[views:FtpView].ViewModel.FolderBackClickedCommand}"
|
||||
/>
|
||||
|
||||
<!-- ScrollViewer mit ListBox -->
|
||||
<ScrollViewer x:Name="ftp_ScrollVie2"
|
||||
Grid.Row="1"
|
||||
Background="Brown"
|
||||
Margin="50,0,50,50">
|
||||
<ListBox x:Name="FtpFileList" ItemsSource="{Binding Files}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Button
|
||||
Command="{Binding $parent[views:FtpView].ViewModel.FolderClickedCommand}"
|
||||
CommandParameter="{Binding }"
|
||||
Background="Transparent"
|
||||
BorderBrush="Transparent"
|
||||
HorizontalAlignment="Stretch">
|
||||
<TextBlock Text="{Binding Name}" Foreground="Green" />
|
||||
</Button>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
<!-- Äußerer Border für Padding -->
|
||||
<Border Padding="20">
|
||||
<Grid RowDefinitions="Auto,*,Auto">
|
||||
|
||||
<!-- Header mit Zurück-Button + Pfad -->
|
||||
<Grid Grid.Row="0" ColumnDefinitions="Auto,*" Margin="0,0,0,20">
|
||||
|
||||
<Button x:Name="CurrentPathBack"
|
||||
Grid.Column="0"
|
||||
Content="←"
|
||||
FontSize="36"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Width="100" Height="100"
|
||||
IsVisible="{Binding CanGoBack}"
|
||||
Command="{Binding $parent[views:FtpView].ViewModel.FolderBackClickedCommand}"/>
|
||||
|
||||
<TextBox x:Name="CurrentPathTextBox"
|
||||
Grid.Column="1"
|
||||
Text="{Binding CurrentPath}"
|
||||
FontSize="28"
|
||||
IsReadOnly="True"
|
||||
VerticalContentAlignment="Center"
|
||||
HorizontalContentAlignment="Left"
|
||||
Height="100"
|
||||
BorderThickness="2"
|
||||
BorderBrush="Gray"
|
||||
CornerRadius="8"
|
||||
Padding="20,0"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Dateiliste -->
|
||||
<ScrollViewer Grid.Row="1" Margin="0,0,0,20">
|
||||
<ListBox x:Name="FtpFileList"
|
||||
ItemsSource="{Binding Files}"
|
||||
BorderThickness="0">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Button Command="{Binding $parent[views:FtpView].ViewModel.FolderClickedCommand}"
|
||||
CommandParameter="{Binding}"
|
||||
Background="Transparent"
|
||||
BorderBrush="Transparent"
|
||||
HorizontalAlignment="Stretch"
|
||||
Height="100"
|
||||
Padding="20">
|
||||
<TextBlock Text="{Binding Name}"
|
||||
FontSize="28"
|
||||
VerticalAlignment="Center"/>
|
||||
</Button>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</ScrollViewer>
|
||||
|
||||
<!-- Weiter-Button unten -->
|
||||
<Button Grid.Row="2"
|
||||
x:Name="weiter"
|
||||
Content="Weiter"
|
||||
FontSize="28"
|
||||
FontWeight="Bold"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Width="200" Height="100"
|
||||
VerticalContentAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
CornerRadius="12"
|
||||
Background="#3B82F6"
|
||||
Foreground="White"
|
||||
Margin="0,0,0,10"
|
||||
IsEnabled="True"
|
||||
Click="Weiter_Clicked"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</UserControl>
|
||||
|
||||
@@ -47,4 +47,18 @@ public partial class FtpView : ReactiveUserControl<FtpViewModel>
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Avalonia.Controls;
|
||||
using Valheim_Dashboard.ViewModels;
|
||||
|
||||
namespace Valheim_Dashboard.Views;
|
||||
|
||||
@@ -7,5 +8,16 @@ public partial class MainWindow : Window
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
var locator = new ViewModelLocator();
|
||||
var mainVm = new MainWindowViewModel(locator);
|
||||
DataContext = mainVm;
|
||||
|
||||
// MainWindow ins ServerDashboardViewModel setzen
|
||||
if (locator.ServerDashboardViewModel is ServerDashboardViewModel dashboardVm)
|
||||
{
|
||||
dashboardVm.SetMainWindow(this); // <-- hier 'this' ist MainWindow
|
||||
}
|
||||
|
||||
this.DataContext = mainVm;
|
||||
}
|
||||
}
|
||||
69
Valheim Dashboard/Views/ServerDashboard.axaml
Normal file
69
Valheim Dashboard/Views/ServerDashboard.axaml
Normal file
@@ -0,0 +1,69 @@
|
||||
<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:Valheim_Dashboard.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="1280" d:DesignHeight="800"
|
||||
x:Class="Valheim_Dashboard.Views.ServerDashboardView"
|
||||
x:DataType="vm:ServerDashboardViewModel">
|
||||
|
||||
|
||||
<Grid ColumnDefinitions="2*,3*">
|
||||
<!-- Linke Spalte -->
|
||||
<StackPanel Margin="20" Spacing="20">
|
||||
<!-- BepInEx Status -->
|
||||
<Border BorderBrush="Gray" BorderThickness="2" CornerRadius="12" Padding="20">
|
||||
<StackPanel Spacing="10" Height="150">
|
||||
<TextBlock Text="BepInEx Status" FontSize="28" FontWeight="Bold"/>
|
||||
<TextBlock Text="{Binding BepInExStatus}" FontSize="20"/>
|
||||
<Button Content="Installieren"
|
||||
Command="{Binding InstallBepInExCommand}"
|
||||
IsVisible="{Binding ShowInstallButton}"
|
||||
Height="80"/>
|
||||
<Button Content="Update"
|
||||
Command="{Binding UpdateBepInExCommand}"
|
||||
IsVisible="{Binding ShowUpdateButton}"
|
||||
Height="80"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- Mods Liste -->
|
||||
<Border BorderBrush="Gray" BorderThickness="2" CornerRadius="12" Padding="20">
|
||||
<StackPanel Height="450">
|
||||
<TextBlock Text="Mods" FontSize="28" FontWeight="Bold"/>
|
||||
<ListBox ItemsSource="{Binding Mods}" SelectedItem="{Binding SelectedMod}" Height="380">
|
||||
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Name}" FontWeight="Bold" Margin="0,0,5,0"/>
|
||||
<TextBlock Text="{Binding Version}" Foreground="Gray"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
|
||||
</ListBox>
|
||||
<Grid>
|
||||
|
||||
<Button Content="Mod hochladen" Command="{Binding UploadModCommand}" Height="80" HorizontalAlignment="Left"/>
|
||||
<Button Content="Aus Store installieren" Command="{Binding InstallFromStoreCommand}" Height="80" HorizontalAlignment="Right"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Rechte Spalte (Config Editor) -->
|
||||
<StackPanel Grid.Column="1" Margin="20" Spacing="20">
|
||||
<TextBlock Text="{Binding SelectedMod.Name}" FontSize="28" FontWeight="Bold"/>
|
||||
<TextBox Text="{Binding SelectedModConfig}" AcceptsReturn="True" FontSize="20" Height="550"/>
|
||||
<Grid>
|
||||
<Button Content="Speichern" Command="{Binding SaveConfigCommand}" Height="80" HorizontalAlignment="Left"/>
|
||||
<Button Content="Mod entfernen" Command="{Binding RemoveModCommand}" Height="80" Background="Red" HorizontalAlignment="Right"/>
|
||||
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
|
||||
</UserControl>
|
||||
14
Valheim Dashboard/Views/ServerDashboard.axaml.cs
Normal file
14
Valheim Dashboard/Views/ServerDashboard.axaml.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Valheim_Dashboard.ViewModels;
|
||||
|
||||
namespace Valheim_Dashboard.Views;
|
||||
|
||||
public partial class ServerDashboardView : UserControl
|
||||
{
|
||||
public ServerDashboardView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user