- methode hinzugefügt um für plugin oder ftp zu entschieden -> demnach wird dashboard oder ftpview geöffnet
- plugin zeile geeändert um user eingabe zu nutzen - ftp geändert für schnelleres testen der verbindung und nutzen der user eingabe - function erweitert bei ftp daten in globale variable zu speichern -> addvar, editvar - FTP Ordner aufrufen und zurück funktion hinzugefügt / fehler behoben
This commit is contained in:
@@ -28,7 +28,17 @@
|
||||
Height="100"
|
||||
Margin="50,0,50,0"
|
||||
Text="{Binding CurrentPath}"/>
|
||||
|
||||
|
||||
<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"
|
||||
@@ -37,9 +47,9 @@
|
||||
<ListBox x:Name="FtpFileList" ItemsSource="{Binding Files}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Button
|
||||
|
||||
CommandParameter="{Binding}"
|
||||
<Button
|
||||
Command="{Binding $parent[views:FtpView].ViewModel.FolderClickedCommand}"
|
||||
CommandParameter="{Binding }"
|
||||
Background="Transparent"
|
||||
BorderBrush="Transparent"
|
||||
HorizontalAlignment="Stretch">
|
||||
|
||||
@@ -18,8 +18,8 @@ public partial class FtpView : ReactiveUserControl<FtpViewModel>
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
//DataContext = new FtpViewModel();
|
||||
|
||||
// Aktivierungslogik für Bindings
|
||||
this.WhenActivated(disposables =>
|
||||
{
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
Content="Verifizieren"
|
||||
Width="100"
|
||||
Height="100"
|
||||
Classes="SideButton"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
|
||||
@@ -95,6 +95,7 @@
|
||||
Width="100"
|
||||
Height="100"
|
||||
IsVisible="true"
|
||||
IsEnabled="False"
|
||||
Click="Weiter_OnClick">
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Json;
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Media;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Json;
|
||||
using System.Net.Mail;
|
||||
using System.Reactive.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using Tmds.DBus.Protocol;
|
||||
using Valheim_Dashboard.ViewModels;
|
||||
|
||||
@@ -136,13 +138,22 @@ public partial class ServerSettingsView : UserControl
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
string method;
|
||||
private void Weiter_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (this.Parent.Parent.Parent is MainWindow mainWindow) {
|
||||
if (mainWindow.DataContext is MainWindowViewModel mainWindowViewModel)
|
||||
{
|
||||
|
||||
mainWindowViewModel.SwitchToFTP(ftpClient);
|
||||
if (method == "plugin")
|
||||
{
|
||||
mainWindowViewModel.SwitchToDashboard();
|
||||
}
|
||||
else
|
||||
{
|
||||
mainWindowViewModel.SwitchToFTP(ftpClient);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -189,12 +200,14 @@ public partial class ServerSettingsView : UserControl
|
||||
|
||||
try
|
||||
{
|
||||
var response = await PluginClient.GetAsync("http://amp.tbs-server.de:2456");
|
||||
var response = await PluginClient.GetAsync("http://" + plugin_ip.Text + ":" + plugin_port.Text);
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
var data = await response.Content.ReadFromJsonAsync<DataPluginJson>();
|
||||
plugin_prüfen.Background = new SolidColorBrush(Colors.Green);
|
||||
plugin_prüfen.Content = "Verbindung Erfolgreich";
|
||||
weiter.IsEnabled = true;
|
||||
method = "plugin";
|
||||
Debug.WriteLine(data.ModVersion);
|
||||
}else
|
||||
{
|
||||
@@ -208,6 +221,7 @@ public partial class ServerSettingsView : UserControl
|
||||
|
||||
plugin_prüfen.Background = new SolidColorBrush(Colors.Red);
|
||||
plugin_prüfen.Content = "Verbindung Fehlgeschlagen";
|
||||
weiter.IsEnabled = false;
|
||||
|
||||
}
|
||||
|
||||
@@ -221,24 +235,48 @@ public partial class ServerSettingsView : UserControl
|
||||
{Console.WriteLine(ftp_ip.Text + ftp_port.Text + ftp_benutzername.Text + ftp_passwort.Text);
|
||||
|
||||
//ftpClient = new FtpClient("ftp://"+ ftp_ip.Text + ":" +ftp_port.Text, ftp_benutzername.Text, ftp_passwort.Text);
|
||||
FtpViewModel._ftpClient = new FtpClient("ftp://192.168.178.34:21", "tbs_ftp", "JLI_._nTH-DyG53Se9");
|
||||
var files = await ftpClient.ListDirectoryDetailsAsync();
|
||||
|
||||
if (files != null && files.Count > 0)
|
||||
|
||||
//FtpClient ftpClient = new FtpClient("ftp://"+ ftp_ip.Text + ":" +ftp_port.Text, ftp_benutzername.Text, ftp_passwort.Text);
|
||||
FtpViewModel._ftpClient = new FtpClient("ftp://" + ftp_ip.Text + ":" + ftp_port.Text, ftp_benutzername.Text, ftp_passwort.Text);
|
||||
if (FtpViewModel._ftpClient.TestConnection())
|
||||
{
|
||||
var name = "tbs";
|
||||
ftp_prüfen.Background = new SolidColorBrush(Colors.Green);
|
||||
ftp_prüfen.Content = "Verbindung Erfolgreich1";
|
||||
Console.WriteLine(files);
|
||||
LizenzView.KeyAuthApp.webhook("aHtrWbrxrZ", "&name="+ LizenzView.lizenz_name[1] +"&data=testabc", "");
|
||||
Console.WriteLine(LizenzView.KeyAuthApp.response.message);
|
||||
|
||||
ftp_prüfen.Content = "Verbindung Erfolgreich";
|
||||
if (JsonDocument.Parse(LizenzView.KeyAuthApp.webhook("recivevar", "&name=" + LizenzView.lizenz_name[1], "")).RootElement.GetProperty("success").GetBoolean())
|
||||
{
|
||||
LizenzView.KeyAuthApp.webhook("editvar", "&varid=" + LizenzView.lizenz_name[1] + "&data=fhtjfthjtfh", "");
|
||||
}else
|
||||
{
|
||||
LizenzView.KeyAuthApp.webhook("aHtrWbrxrZ", "&name=" + LizenzView.lizenz_name[1] + "&data=teasdrz", "");
|
||||
}
|
||||
|
||||
weiter.IsEnabled = true;
|
||||
method = "ftp";
|
||||
}
|
||||
else
|
||||
{
|
||||
ftp_prüfen.Background = new SolidColorBrush(Colors.Green);
|
||||
ftp_prüfen.Content = "Verbindung Erfolgreich2";
|
||||
ftp_prüfen.Background = new SolidColorBrush(Colors.Red);
|
||||
ftp_prüfen.Content = "Verbindung Fehlgeschlagen";
|
||||
weiter.IsEnabled = false;
|
||||
}
|
||||
|
||||
//var files = await ftpClient.ListDirectoryDetailsAsync();
|
||||
|
||||
/* if (files != null && files.Count > 0)
|
||||
{
|
||||
var name = "tbs";
|
||||
ftp_prüfen.Background = new SolidColorBrush(Colors.Green);
|
||||
ftp_prüfen.Content = "Verbindung Erfolgreich1";
|
||||
Console.WriteLine(files);
|
||||
LizenzView.KeyAuthApp.webhook("aHtrWbrxrZ", "&name="+ LizenzView.lizenz_name[1] +"&data=testabc", "");
|
||||
Console.WriteLine(LizenzView.KeyAuthApp.response.message);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ftp_prüfen.Background = new SolidColorBrush(Colors.Green);
|
||||
ftp_prüfen.Content = "Verbindung Erfolgreich2";
|
||||
} */
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user