1
0
mirror of https://e.coding.net/circlecloud/CTZLauncher.git synced 2025-11-24 21:36:06 +00:00

修复登录检测 修改登录流程...

This commit is contained in:
j502647092
2015-08-05 20:39:00 +08:00
parent b7af6c9b70
commit 5796c2c3a1
3 changed files with 14 additions and 15 deletions

View File

@@ -68,7 +68,7 @@ namespace KMCCC.Authentication
public bool getResult(string url) public bool getResult(string url)
{ {
return http.Send(HttpMethod.GET, url) == "true" ? true : false; return http.Send(HttpMethod.GET, url).Contains("true") ? true : false;
} }
} }
} }

View File

@@ -110,7 +110,7 @@
<Grid Margin="20,60,20,20" Background="White" x:Name="ServerWindow"> <Grid Margin="20,60,20,20" Background="White" x:Name="ServerWindow" Visibility="Hidden">
<!--Visibility="Hidden"--> <!--Visibility="Hidden"-->
<Grid HorizontalAlignment="Left" Width="400" Margin="20,20,0,20"> <Grid HorizontalAlignment="Left" Width="400" Margin="20,20,0,20">
<Grid Height="80" VerticalAlignment="Top" Margin="0,0,0,0"> <Grid Height="80" VerticalAlignment="Top" Margin="0,0,0,0">
@@ -149,7 +149,7 @@
</Grid> </Grid>
</Grid> </Grid>
<Grid HorizontalAlignment="Right" Width="300" ShowGridLines="True" Height="206" VerticalAlignment="Bottom"> <Grid HorizontalAlignment="Right" Width="300" ShowGridLines="True" Height="206" VerticalAlignment="Bottom">
<Button x:Name="StartGame" BorderBrush="#FF3299CC" Content="启动游戏" Template="{StaticResource CornerButton}" Margin="10,0,10,10" Height="64" VerticalAlignment="Bottom" FontSize="16" Click="StartGame_Click" IsEnabled="False"/> <Button x:Name="StartGame" BorderBrush="#FF3299CC" Content="启动游戏" Template="{StaticResource CornerButton}" Margin="10,0,10,10" Height="64" VerticalAlignment="Bottom" FontSize="16" Click="StartGame_Click"/>
</Grid> </Grid>
</Grid> </Grid>
</Grid> </Grid>

View File

@@ -27,7 +27,7 @@ namespace CTZLauncher
/// </summary> /// </summary>
public partial class MainWindow : Window public partial class MainWindow : Window
{ {
LauncherCore launcher; LauncherCore launcher = null;
public MainWindow() public MainWindow()
{ {
InitializeComponent(); InitializeComponent();
@@ -39,7 +39,7 @@ namespace CTZLauncher
{ {
Directory.CreateDirectory(".minecraft"); Directory.CreateDirectory(".minecraft");
} }
LauncherCore launcher = LauncherCore.Create(".minecraft"); launcher = LauncherCore.Create(".minecraft");
} }
private void Window_Loaded(object sender, RoutedEventArgs e) private void Window_Loaded(object sender, RoutedEventArgs e)
@@ -84,21 +84,20 @@ namespace CTZLauncher
if (auth.isLogin()) if (auth.isLogin())
{ {
MessageBox.Show("当前玩家已登录!"); MessageBox.Show("当前玩家已登录!");
Login.IsEnabled = true;
return;
} }
else
{
if (!auth.Login()) if (!auth.Login())
{ {
MessageBox.Show("登录失败 账号不存在 或 密码错误 !"); MessageBox.Show("登录失败 账号不存在 或 密码错误 !");
Login.IsEnabled = true;
return;
} }
else else
{ {
ServerWindow.Visibility = System.Windows.Visibility.Visible; ServerWindow.Visibility = System.Windows.Visibility.Visible;
return;
} }
} }
Login.IsEnabled = true;
}
/// <summary> /// <summary>
/// 模仿C#的Application.Doevent函数。可以适当添加try catch 模块 /// 模仿C#的Application.Doevent函数。可以适当添加try catch 模块