You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
1.9 KiB
C#

using Aucma.Core.PrintTo.Config;
using Aucma.Core.PrintTo.ViewModels;
using System;
using System.Windows;
namespace Aucma.Core.PrintTo.Views
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private AppConfig appConfig = AppConfig.Instance;
public MainWindow()
{
try
{
bool loginResult = LoginInit();
if (loginResult)
{
MainWindow_Loaded();
}
else
{
this.Hide(); // 登录校验失败,关闭主窗体
LoginPageView indexPage = new LoginPageView();
indexPage.ShowDialog();
this.Close();
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
private void MainWindow_Loaded()
{
try
{
// 主窗体加载完成后执行其他逻辑
InitializeComponent();
this.DataContext = new MainWindowViewModel();
}
catch (System.Exception ex)
{
Console.WriteLine(ex.Message);
}
}
#region 登录验证
public bool LoginInit()
{
//账号名称不存在,跳转
if (string.IsNullOrWhiteSpace(appConfig.Account))
{
// this.Hide();
//this.Close();
return false;
}
else
{
// this.Account.Text = appConfig.Account;
//this.Team.Text = appConfig.TeamName;
return true;
}
}
#endregion
}
}