wakka/MainWindow.xaml.cs
2025-05-12 02:41:58 -05:00

42 lines
1.3 KiB
C#

using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
namespace wakka
{
/// <summary>
/// An empty window that can be used on its own or navigated to within a Frame.
/// </summary>
///
public sealed partial class MainWindow : Window
{
private static SshConnection Ssh { get; set; } = new SshConnection();
public Frame RootFrame;
public MainWindow()
{
this.InitializeComponent();
RootFrame = rootFrame;
Ssh.DeleteSshKey();
if (Ssh.KeyExists() & (string)App.LocalSettingsData.Values["username"] != null)
{
try
{
Ssh.InitializeConnection((string)App.LocalSettingsData.Values["username"]);
RootFrame.Content = new NavigationPage();
}
catch (Renci.SshNet.Common.SshAuthenticationException)
{
RootFrame.Content = new StartupSshPage();
}
}
else
{
RootFrame.Content = new StartupSshPage();
}
}
}
}