Verbinden: Passwort merken, Felder nebeneinander, Link-Status-Punkt (#42, #31, #54)
Build / build (push) Canceled after 0s

- 'Passwort merken' (aus = gespeichertes Passwort wird geloescht), Fehler beim Speichern
  in der Anmeldeinformationsverwaltung wird angezeigt (Mac v1.11.4)
- Benutzername/Passwort nebeneinander, damit 'Verbindung testen' ohne Scrollen sichtbar ist
- Schnittstellenliste mit Punkt gruen/grau fuer den Link-Status (Mac v1.3.0)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 5.5 committed 2026-10-16 06:22:28 +02:00
1 parent bd65ffbc3c
commit de86a29fab
7 files changed
+67 -15

No files matched your search

@@ -19,7 +19,8 @@ internal static class WindowsCredentialStore
private const uint CredPersistLocalMachine = 2;
private const int ErrorNotFound = 1168;
public static void Save(string savedRouterId, string username, string password)
/// <summary>Gibt false zurück, wenn Windows das Passwort nicht speichern konnte — der Aufrufer zeigt das an.</summary>
public static bool Save(string savedRouterId, string username, string password)
{
var passwordBytes = Encoding.Unicode.GetBytes(password);
var blob = Marshal.AllocHGlobal(Math.Max(passwordBytes.Length, 1));
@@ -40,7 +41,7 @@ internal static class WindowsCredentialStore
UserName = username,
};
CredWrite(ref credential, 0);
return CredWrite(ref credential, 0);
}
finally
{
@@ -47,6 +47,9 @@ public partial class ConnectionStepViewModel : WizardStepViewModelBase
[ObservableProperty]
private bool _useEncryption;
[ObservableProperty]
private bool _rememberPassword = true;
[ObservableProperty]
private bool _isTesting;
@@ -88,7 +91,9 @@ public partial class ConnectionStepViewModel : WizardStepViewModelBase
{
Host = entry.Host;
Username = entry.Username;
Password = WindowsCredentialStore.TryRead(entry.Id) ?? string.Empty;
var storedPassword = WindowsCredentialStore.TryRead(entry.Id);
Password = storedPassword ?? string.Empty;
RememberPassword = storedPassword is not null;
}
/// <summary>Ein-Klick-Verbinden für die Sidebar-Kurzauswahl — übernimmt die Zugangsdaten und verbindet direkt, ohne den Umweg über die Formularfelder.</summary>
@@ -128,6 +133,7 @@ public partial class ConnectionStepViewModel : WizardStepViewModelBase
_session.Client = await RouterOsClientFactory.ConnectAsync(credentials);
_session.Credentials = credentials;
_session.RememberPassword = RememberPassword;
IsConnected = true;
StatusIsError = false;
@@ -30,6 +30,10 @@ public partial class DeviceOverviewStepViewModel : WizardStepViewModelBase
[ObservableProperty]
private string? _errorMessage;
/// <summary>Nicht blockierend: Windows konnte das Passwort nicht im Anmeldeinformationsspeicher ablegen.</summary>
[ObservableProperty]
private string? _credentialWarning;
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(CanGoNext))]
[NotifyPropertyChangedFor(nameof(Interfaces))]
@@ -102,6 +106,15 @@ public partial class DeviceOverviewStepViewModel : WizardStepViewModelBase
var saved = _savedRoutersStore.RecordConnection(
credentials.Host, credentials.Username, device.BoardModel, device.SerialNumber, DateTimeOffset.Now);
WindowsCredentialStore.Save(saved.Id, credentials.Username, credentials.Password);
CredentialWarning = null;
if (!_session.RememberPassword)
{
WindowsCredentialStore.Delete(saved.Id);
}
else if (!WindowsCredentialStore.Save(saved.Id, credentials.Username, credentials.Password))
{
CredentialWarning = "Das Passwort konnte nicht in der Windows-Anmeldeinformationsverwaltung gespeichert werden. Du musst es beim nächsten Verbinden erneut eingeben.";
}
}
}
@@ -3,7 +3,7 @@ using MikrotikInstaller.Core.Devices;
namespace MikrotikInstaller.App.ViewModels.Steps;
/// <summary>Aufbereitete Anzeige einer Schnittstelle für die Geräte-Übersicht (laientaugliche Texte statt Enum-Werte).</summary>
public sealed record InterfaceDisplayItem(string Name, string KindLabel, string StatusLabel, bool IsProblem)
public sealed record InterfaceDisplayItem(string Name, string KindLabel, string StatusLabel, bool IsProblem, bool HasLink)
{
public static InterfaceDisplayItem From(InterfaceInfo info)
{
@@ -18,6 +18,6 @@ public sealed record InterfaceDisplayItem(string Name, string KindLabel, string
var statusLabel = info.IsDisabled ? "Deaktiviert" : info.IsRunning ? "Aktiv" : "Inaktiv";
return new InterfaceDisplayItem(info.Name, kindLabel, statusLabel, IsProblem: info.IsDisabled);
return new InterfaceDisplayItem(info.Name, kindLabel, statusLabel, IsProblem: info.IsDisabled, HasLink: info.IsRunning && !info.IsDisabled);
}
}
@@ -18,6 +18,9 @@ public sealed class WizardSession
/// Geräte-Erkennungs-Schritt, sobald dort Modell/Seriennummer bekannt sind.</summary>
public RouterOsCredentials? Credentials { get; set; }
/// <summary>"Passwort merken" aus dem Verbindungs-Schritt: aus = ein früher gespeichertes Passwort wird gelöscht.</summary>
public bool RememberPassword { get; set; } = true;
public RouterDevice? Device { get; set; }
/// <summary>
@@ -1,4 +1,4 @@
<UserControl x:Class="MikrotikInstaller.App.Views.Steps.ConnectionStepView"
<UserControl x:Class="MikrotikInstaller.App.Views.Steps.ConnectionStepView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
@@ -17,14 +17,25 @@
<ui:TextBox Text="{Binding Host, UpdateSourceTrigger=PropertyChanged}"
PlaceholderText="z. B. 192.168.88.1" Margin="0,0,0,16" />
<TextBlock Text="Benutzername" Margin="0,0,0,4" />
<ui:TextBox Text="{Binding Username, UpdateSourceTrigger=PropertyChanged}"
PlaceholderText="admin" Margin="0,0,0,16" />
<TextBlock Text="Passwort" Margin="0,0,0,4" />
<ui:PasswordBox Password="{Binding Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="0,0,0,16" />
<!-- Nebeneinander statt untereinander, damit "Verbindung testen" im Standardfenster ohne Scrollen erreichbar bleibt (Issue #31). -->
<Grid Margin="0,0,0,16">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="16" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0">
<TextBlock Text="Benutzername" Margin="0,0,0,4" />
<ui:TextBox Text="{Binding Username, UpdateSourceTrigger=PropertyChanged}" PlaceholderText="admin" />
</StackPanel>
<StackPanel Grid.Column="2">
<TextBlock Text="Passwort" Margin="0,0,0,4" />
<ui:PasswordBox Password="{Binding Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</StackPanel>
</Grid>
<StackPanel Orientation="Horizontal" Margin="0,0,0,20">
<CheckBox Content="Passwort merken" IsChecked="{Binding RememberPassword}" Margin="0,0,24,0" />
<CheckBox Content="Verschlüsselte Verbindung verwenden" IsChecked="{Binding UseEncryption}" />
<controls:InfoHint Text="Verschlüsselt die Verbindung zu deinem Router. Nur aktivieren, wenn du das auf dem Gerät bereits eingerichtet hast – sonst schlägt die Verbindung fehl. Im Zweifel einfach ausgeschaltet lassen." />
</StackPanel>
@@ -1,4 +1,4 @@
<UserControl x:Class="MikrotikInstaller.App.Views.Steps.DeviceOverviewStepView"
<UserControl x:Class="MikrotikInstaller.App.Views.Steps.DeviceOverviewStepView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
@@ -21,6 +21,9 @@
Command="{Binding RetryCommand}" />
</StackPanel>
<TextBlock Text="{Binding CredentialWarning}" TextWrapping="Wrap" Foreground="{StaticResource MikrotikWarningBrush}" Margin="0,0,0,12"
Visibility="{Binding CredentialWarning, Converter={StaticResource StringToVisibilityConverter}}" />
<StackPanel Visibility="{Binding Device, Converter={StaticResource NullToVisibilityConverter}}">
<ui:CardExpander IsExpanded="True" Margin="0,0,0,16">
<ui:CardExpander.Icon>
@@ -64,7 +67,22 @@
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding Name}" />
<StackPanel Grid.Column="0" Orientation="Horizontal">
<!-- Link-Status als Punkt: grün = Link, grau = kein Link (Mac v1.3.0). -->
<Ellipse Width="8" Height="8" Margin="0,0,8,0" VerticalAlignment="Center">
<Ellipse.Style>
<Style TargetType="Ellipse">
<Setter Property="Fill" Value="{DynamicResource ControlStrongFillColorDisabledBrush}" />
<Style.Triggers>
<DataTrigger Binding="{Binding HasLink}" Value="True">
<Setter Property="Fill" Value="{StaticResource MikrotikAccentBrush}" />
</DataTrigger>
</Style.Triggers>
</Style>
</Ellipse.Style>
</Ellipse>
<TextBlock Text="{Binding Name}" VerticalAlignment="Center" />
</StackPanel>
<TextBlock Grid.Column="1" Text="{Binding KindLabel}" Opacity="0.6" Margin="0,0,16,0" />
<TextBlock Grid.Column="2" Text="{Binding StatusLabel}">
<TextBlock.Style>