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

master
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)
{
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"-->
<Grid HorizontalAlignment="Left" Width="400" Margin="20,20,0,20">
<Grid Height="80" VerticalAlignment="Top" Margin="0,0,0,0">
@ -149,7 +149,7 @@
</Grid>
</Grid>
<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>

View File

@ -27,7 +27,7 @@ namespace CTZLauncher
/// </summary>
public partial class MainWindow : Window
{
LauncherCore launcher;
LauncherCore launcher = null;
public MainWindow()
{
InitializeComponent();
@ -39,7 +39,7 @@ namespace CTZLauncher
{
Directory.CreateDirectory(".minecraft");
}
LauncherCore launcher = LauncherCore.Create(".minecraft");
launcher = LauncherCore.Create(".minecraft");
}
private void Window_Loaded(object sender, RoutedEventArgs e)
@ -84,20 +84,19 @@ namespace CTZLauncher
if (auth.isLogin())
{
MessageBox.Show("当前玩家已登录!");
Login.IsEnabled = true;
return;
}
if (!auth.Login())
{
MessageBox.Show("登录失败 账号不存在 或 密码错误 !");
Login.IsEnabled = true;
return;
}
else
{
ServerWindow.Visibility = System.Windows.Visibility.Visible;
return;
if (!auth.Login())
{
MessageBox.Show("登录失败 账号不存在 或 密码错误 !");
}
else
{
ServerWindow.Visibility = System.Windows.Visibility.Visible;
}
}
Login.IsEnabled = true;
}
/// <summary>