Files
ayanova7/source/Plugins/AyaNova.Plugin.V8/Auth.cs
2020-05-11 21:19:58 +00:00

78 lines
2.0 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace AyaNova.PlugIn.V8
{
public partial class Auth : Form
{
public Auth()
{
InitializeComponent();
}
private async void btnTest_Click(object sender, EventArgs e)
{
var result = await util.TestUrlAsync(edServerUrl.Text);
if (result == "OK")
{
MessageBox.Show("Server URL is GOOD!");
}
else
{
MessageBox.Show("Server could not be reached at that URL\n" + result);
}
}
private async void btnOk_Click(object sender, EventArgs e)
{
if (!util.Initialized)
{
var result = await util.TestUrlAsync(edServerUrl.Text);
if (result != "OK")
{
MessageBox.Show("Server could not be reached at that URL\n" + result);
return;
}
}
var res = await util.AuthenticateAsync(edUserName.Text,edPassword.Text);
if (!res)
{
MessageBox.Show("Login failed");
return;
}
this.DialogResult = DialogResult.OK;
this.Close();
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.Close();
}
private void Auth_Load(object sender, EventArgs e)
{
lblPreRelease.Text = util.PRE_RELEASE_VERSION_STRING;
#if (DEBUG)
edServerUrl.Text = "192.168.1.56:7575";
edUserName.Text = "manager";
edPassword.Text = "l3tm3in";
#endif
}
private void label2_Click(object sender, EventArgs e)
{
}
}
}