chore: 首次簽入 Thinkyu ASP.NET 專案
- 加入 Visual Studio / ASP.NET .gitignore - 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using 報到系統客戶端.Services;
|
||||
|
||||
namespace 報到系統客戶端
|
||||
{
|
||||
public partial class LoginForm : Form
|
||||
{
|
||||
public LoginForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
lbApiUrlBase.Text = string.Format("主機:{0}", ApiService.Instance.BaseUrl);
|
||||
lbVersion.Text = ClientSession.Version;
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Application.Exit();
|
||||
}
|
||||
|
||||
private async void btnLogin_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
btnLogin.Enabled = false;
|
||||
btnCancel.Enabled = false;
|
||||
btnLogin.Text = "登入中";
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
Application.DoEvents();
|
||||
|
||||
if (cbOffline.Checked)
|
||||
{
|
||||
var loginResult = ClientSession.LoginOffline(txtUserID.Text);
|
||||
|
||||
if (loginResult.Item1)
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(loginResult.Item2, "登入錯誤");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var loginResult = await ClientSession.LoginAsync(txtUserID.Text, txtPassword.Text);
|
||||
|
||||
if (loginResult.Item1)
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(loginResult.Item2, "登入錯誤");
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
Cursor.Current = Cursors.Default;
|
||||
btnLogin.Enabled = true;
|
||||
btnCancel.Enabled = true;
|
||||
btnLogin.Text = "登入";
|
||||
}
|
||||
}
|
||||
|
||||
private void LoginForm_Activated(object sender, EventArgs e)
|
||||
{
|
||||
txtUserID.Focus();
|
||||
}
|
||||
|
||||
private void cbOffline_CheckStateChanged(object sender, EventArgs e)
|
||||
{
|
||||
txtPassword.Enabled = !cbOffline.Checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user