This repository has been archived on 2025-01-01. You can view files and clone it, but cannot push or open issues or pull requests.
ShiftOS_TheReturn/ShiftOS.WinForms/UniteSignupDialog.cs

77 lines
1.7 KiB
C#
Raw Normal View History

2017-04-30 18:50:54 -04:00
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ShiftOS.Engine;
2017-04-30 19:26:00 -04:00
using Newtonsoft.Json;
using System.Net;
2017-05-21 08:21:41 -04:00
using ShiftOS.Objects;
2017-04-30 18:50:54 -04:00
namespace ShiftOS.WinForms
{
public partial class UniteSignupDialog : UserControl, IShiftOSWindow
{
public class SignupCredentials
{
public string SystemName { get; set; }
public string RootPassword { get; set; }
}
public UniteSignupDialog(Action<SignupCredentials> callback)
2017-04-30 18:50:54 -04:00
{
InitializeComponent();
Callback = callback;
}
private Action<SignupCredentials> Callback { get; set; }
2017-04-30 18:50:54 -04:00
public void OnLoad()
{
this.ParentForm.AcceptButton = btnlogin;
}
public void OnSkinLoad()
{
}
public bool OnUnload()
{
return true;
}
public void OnUpgrade()
{
}
2017-04-30 19:26:00 -04:00
private void btnlogin_Click(object sender, EventArgs e)
{
string sys = txtsys.Text;
string root = txtroot.Text;
2017-04-30 19:26:00 -04:00
if (string.IsNullOrWhiteSpace(sys))
2017-04-30 19:26:00 -04:00
{
Infobox.Show("{TITLE_EMPTY_SYSNAME}", "{MSG_EMPTY_SYSNAME}");
2017-04-30 19:26:00 -04:00
return;
}
if(sys.Length < 5)
2017-04-30 19:26:00 -04:00
{
Infobox.Show("{TITLE_VALIDATION_ERROR}", "{MSG_VALIDATION_ERROR_SYSNAME_LENGTH}");
2017-04-30 19:26:00 -04:00
return;
}
Callback?.Invoke(new SignupCredentials
2017-04-30 19:26:00 -04:00
{
SystemName = sys,
RootPassword = root
});
2017-04-30 19:26:00 -04:00
}
2017-04-30 18:50:54 -04:00
}
}