修改登录接口 重新调整界面布局...

master
j502647092 2015-08-02 21:16:04 +08:00
parent 6c220236ab
commit 22dabdb0bd
3 changed files with 122 additions and 124 deletions

View File

@ -10,7 +10,14 @@ namespace CTZLauncher.CTZAuth
{ {
HttpHelper http = new HttpHelper(); HttpHelper http = new HttpHelper();
string address; string address;
string port; int port;
CTZAuth(string address,int port = 25565)
{
this.address = address;
this.port = port;
}
public bool isRegister(string username) public bool isRegister(string username)
{ {
return getResult(address + ":" + port + "/isregister?username=" + username); return getResult(address + ":" + port + "/isregister?username=" + username);
@ -18,7 +25,7 @@ namespace CTZLauncher.CTZAuth
public bool Register(string username, string password) public bool Register(string username, string password)
{ {
return false; return getResult(address + ":" + port + "/register?username=" + username + "&password=" + password);
} }
public bool isLogin(string username) public bool isLogin(string username)
@ -28,7 +35,7 @@ namespace CTZLauncher.CTZAuth
public bool Login(string username, string password) public bool Login(string username, string password)
{ {
return false; return getResult(address + ":" + port + "/login?username=" + username + "&password=" + password);
} }
public bool getResult(string url) public bool getResult(string url)

View File

@ -7,13 +7,13 @@ namespace CTZLauncher.CTZAuth
{ {
interface ICTZAuth interface ICTZAuth
{ {
public abstract bool isRegister(string username); bool isRegister(string username);
public abstract bool Register(string username, string password); bool Register(string username, string password);
public abstract bool isLogin(string username); bool isLogin(string username);
public abstract bool Login(string username, string password); bool Login(string username, string password);
} }
} }

View File

@ -1,117 +1,108 @@
<Window x:Class="CTZLauncher.MainWindow" <Window x:Class="CTZLauncher.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:s="clr-namespace:System;assembly=mscorlib"
ResizeMode = "NoResize" ResizeMode = "NoResize"
MouseMove="Window_MouseMove" MouseMove="Window_MouseMove"
Title="MainWindow" Height="768" Width="1024" Background="#FF3A3A3A" AllowsTransparency="True" WindowStyle="None" Visibility="Visible" HorizontalContentAlignment="Center" HorizontalAlignment="Center" Icon="ico.ico" VerticalAlignment="Center" VerticalContentAlignment="Center" WindowStartupLocation="CenterScreen" Initialized="Window_Initialized" Loaded="Window_Loaded" FontFamily="Microsoft YaHei"> Title="MainWindow" Height="600" Width="800" Background="#FF3A3A3A" AllowsTransparency="True" WindowStyle="None" Visibility="Visible" HorizontalContentAlignment="Center" HorizontalAlignment="Center" Icon="ico.ico" VerticalAlignment="Center" VerticalContentAlignment="Center" WindowStartupLocation="CenterScreen" Initialized="Window_Initialized" Loaded="Window_Loaded" FontFamily="Microsoft YaHei">
<Window.Resources> <Window.Resources>
<!-- s:Double表示了变量类型 x:key表示了变量名 --> <!-- s:Double表示了变量类型 x:key表示了变量名 -->
<s:Double x:Key="m_nFontSize"> <s:Double x:Key="m_nFontSize">
32 32
</s:Double> </s:Double>
<!-- <!--
<ControlTemplate x:Key="CornerButton" TargetType="{x:Type Button}"> <ControlTemplate x:Key="CornerButton" TargetType="{x:Type Button}">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" CornerRadius="10" Background="{TemplateBinding Background}"> <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" CornerRadius="10" Background="{TemplateBinding Background}">
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" /> <ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border> </Border>
</ControlTemplate> </ControlTemplate>
<ControlTemplate x:Key="CornerTextBox" TargetType="{x:Type TextBox}"> <ControlTemplate x:Key="CornerTextBox" TargetType="{x:Type TextBox}">
<Border BorderBrush="#FFA1A1A1" BorderThickness="3" CornerRadius="10" Background="#FFA1A1A1"> <Border BorderBrush="#FFA1A1A1" BorderThickness="3" CornerRadius="10" Background="#FFA1A1A1">
<ScrollViewer x:Name="PART_ContentHost" VerticalAlignment="Center" Background="#FFA1A1A1"/> <ScrollViewer x:Name="PART_ContentHost" VerticalAlignment="Center" Background="#FFA1A1A1"/>
</Border> </Border>
</ControlTemplate> </ControlTemplate>
--> -->
<ControlTemplate x:Key="CornerButton" TargetType="{x:Type Button}"> <ControlTemplate x:Key="CornerButton" TargetType="{x:Type Button}">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" CornerRadius="0" Background="{TemplateBinding Background}"> <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" CornerRadius="0" Background="{TemplateBinding Background}">
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" /> <ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border> </Border>
</ControlTemplate> </ControlTemplate>
<ControlTemplate x:Key="CornerTextBox" TargetType="{x:Type TextBox}"> <ControlTemplate x:Key="CornerTextBox" TargetType="{x:Type TextBox}">
<Border BorderBrush="#FFA1A1A1" BorderThickness="3" CornerRadius="0" Background="#FFA1A1A1"> <Border BorderBrush="#FF3299CC" BorderThickness="1" CornerRadius="0" Background="#FF3299CC">
<ScrollViewer x:Name="PART_ContentHost" VerticalAlignment="Center" Background="#FFA1A1A1"/> <ScrollViewer x:Name="PART_ContentHost" Background="White"/>
</Border> </Border>
</ControlTemplate> </ControlTemplate>
</Window.Resources> </Window.Resources>
<Grid Name="outline" Background="#FF3299CC" Height="768" Width="1024" VerticalAlignment="Top" MouseLeftButtonDown="outline_MouseLeftButtonDown"> <Grid Name="outline" Background="#FF3299CC" Height="600" Width="800" VerticalAlignment="Top" MouseLeftButtonDown="outline_MouseLeftButtonDown">
<Grid Margin="20,0" Background="#FF3299CC" Height="60" VerticalAlignment="Top" > <Grid Margin="20,0" Background="#FF3299CC" Height="60" VerticalAlignment="Top" >
<Label x:Name="barl1" Content="论坛" HorizontalAlignment="Left" Margin="15,15,0,0" VerticalAlignment="Top" Width="100" Height="30" FontSize="15" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White" MouseDown="barclick_MouseDown"/> <Label x:Name="barl1" Content="论坛" HorizontalAlignment="Left" Margin="245,15,0,0" VerticalAlignment="Top" Width="100" Height="30" FontSize="15" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White" MouseDown="barclick_MouseDown"/>
<Label x:Name="barl2" Content="资源下载" HorizontalAlignment="Left" Margin="120,15,0,0" VerticalAlignment="Top" Width="100" Height="30" FontSize="15" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White" MouseDown="barclick_MouseDown"/> <Label x:Name="barl2" Content="资源下载" HorizontalAlignment="Left" Margin="350,15,0,0" VerticalAlignment="Top" Width="100" Height="30" FontSize="15" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White" MouseDown="barclick_MouseDown"/>
<Label x:Name="barl3" Content="新手指南" HorizontalAlignment="Left" Margin="220,15,0,0" VerticalAlignment="Top" Width="100" Height="30" FontSize="15" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White" MouseDown="barclick_MouseDown"/> <Label x:Name="barl3" Content="新手指南" HorizontalAlignment="Left" Margin="455,15,0,0" VerticalAlignment="Top" Width="100" Height="30" FontSize="15" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White" MouseDown="barclick_MouseDown"/>
<Label x:Name="barl4" Content="赞助我们" HorizontalAlignment="Left" Margin="325,15,0,0" VerticalAlignment="Top" Width="100" Height="30" FontSize="15" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White" MouseDown="barclick_MouseDown"/> <Label x:Name="barl4" Content="赞助我们" HorizontalAlignment="Left" Margin="560,15,0,0" VerticalAlignment="Top" Width="100" Height="30" FontSize="15" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White" MouseDown="barclick_MouseDown"/>
<Label x:Name="barr4" Content="主导航" HorizontalAlignment="Right" Margin="0,15,15,0" VerticalAlignment="Top" Width="100" Height="30" FontSize="15" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White" MouseDown="barclick_MouseDown"/> <Image HorizontalAlignment="Left" Height="50" Margin="15,5,0,0" VerticalAlignment="Top" Width="50" Source="ico.ico" RenderTransformOrigin="0.56,0.24"/>
<Label x:Name="barr3" Content="主导航" HorizontalAlignment="Right" Margin="0,15,120,0" VerticalAlignment="Top" Width="100" Height="30" FontSize="15" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White" MouseDown="barclick_MouseDown"/> <Label Content="魔方" HorizontalAlignment="Left" Height="50" Margin="90,5,0,0" VerticalAlignment="Top" Width="74" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontFamily="STXingkai" Foreground="White" FontSize="35" />
<Label x:Name="barr2" Content="主导航" HorizontalAlignment="Right" Margin="0,15,220,0" VerticalAlignment="Top" Width="100" Height="30" FontSize="15" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White" MouseDown="barclick_MouseDown"/> </Grid>
<Label x:Name="barr1" Content="主导航" HorizontalAlignment="Right" Margin="0,15,325,0" VerticalAlignment="Top" Width="100" Height="30" FontSize="15" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White" MouseDown="barclick_MouseDown"/> <Grid Margin="20,60,20,20" Background="White">
<Image HorizontalAlignment="Left" Height="50" Margin="430,5,0,0" VerticalAlignment="Top" Width="50" Source="ico.ico" RenderTransformOrigin="0.56,0.24"/> <Grid Height="269" VerticalAlignment="Top">
<Label Content="魔方" HorizontalAlignment="Left" Height="50" Margin="480,5,0,0" VerticalAlignment="Top" Width="74" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontFamily="STXingkai" Foreground="White" FontSize="35" /> <Grid Margin="20,20,0,0" HorizontalAlignment="Left" Width="400" >
</Grid> <Image />
<Grid Margin="20,60,20,20" Background="White"> </Grid>
<Grid Margin="0,0,0,300"> <Grid Margin="0,20,20,0" HorizontalAlignment="Right" Width="300">
<Grid Margin="30,20,0,20" HorizontalAlignment="Left" Width="550" > <Grid>
<Image Source="image/gg.jpg" /> <Grid Margin="10,10,10,0" Height="174" VerticalAlignment="Top">
<Border BorderBrush="Black" BorderThickness="2" CornerRadius="5"/> <Label Content="————— XX XX 帐 号 —————" VerticalAlignment="Top" Margin="10,0" HorizontalContentAlignment="Center" FontSize="15"/>
</Grid> <TextBox Name="username" Template="{StaticResource CornerTextBox}" Height="34" TextWrapping="Wrap" Text="" VerticalAlignment="Top" HorizontalContentAlignment="Center" FontFamily="微软雅黑" FontSize="20" Margin="30,30,30,0" />
<Grid Margin="0,20,30,20" HorizontalAlignment="Right" Width="350"> <Label Content="————— XX XX 密 码 —————" VerticalAlignment="Top" Margin="10,69,10,0" HorizontalContentAlignment="Center" FontSize="15"/>
<Border BorderBrush="Black" BorderThickness="2" CornerRadius="5"/> <TextBox Name="password" Template="{StaticResource CornerTextBox}" TextWrapping="Wrap" HorizontalContentAlignment="Center" FontFamily="微软雅黑" FontSize="20" Margin="30,104,30,0" Height="34" VerticalAlignment="Top" />
<Grid> <Button Margin="217,106,33,0" Template="{StaticResource CornerButton}" Height="30" Content="?" VerticalAlignment="Top" />
<Grid Margin="30,20,30,0" Height="200" VerticalAlignment="Top"> </Grid>
<Label Content="————— XX XX 帐 号 —————" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,0" HorizontalContentAlignment="Center" FontSize="15"/> <Grid Margin="10,0,10,10" Height="50" VerticalAlignment="Bottom">
<TextBox Name="username" Template="{StaticResource CornerTextBox}" Height="34" Width="220" TextWrapping="Wrap" Text="" VerticalAlignment="Center" HorizontalAlignment="Center" HorizontalContentAlignment="Center" FontFamily="微软雅黑" Foreground="White" FontSize="20" Margin="33,40,33,126" /> <Button Name="Login" Margin="30,10,160,10" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Content="登录" Click="Login_Click"/>
<Label Content="————— XX XX 密 码 —————" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,80" HorizontalContentAlignment="Center" FontSize="15"/> <Button Name="register" Margin="160,10,30,10" Template="{StaticResource CornerButton}" BorderBrush="#FF3299CC" Content="注册" Click="register_Click" />
<TextBox Name="password" Template="{StaticResource CornerTextBox}" Height="34" Width="220" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Center" HorizontalContentAlignment="Center" FontFamily="微软雅黑" Foreground="White" FontSize="20" Margin="33,110,33,56" /> </Grid>
<Button Margin="222,112,38,58" Template="{StaticResource CornerButton}" Height="30" Width="30" HorizontalAlignment="Center" Content="?" /> </Grid>
</Grid> </Grid>
<Grid Margin="30,20,30,30" Height="100" VerticalAlignment="Bottom"> </Grid>
<Button Margin="12,24,167,35" Template="{StaticResource CornerButton}" Width="111" HorizontalAlignment="Center" Content="登录" Click="Login_Click" Background="Green" /> <Grid Height="246" VerticalAlignment="Bottom">
<Button Name="register" Margin="167,24,12,35" Template="{StaticResource CornerButton}" Width="111" HorizontalAlignment="Center" Content="注册" Background="Green" Click="register_Click" /> <Grid Margin="20,20,0,20" HorizontalAlignment="Left" Width="391" >
</Grid> <TabControl Background="White" BorderThickness="0">
</Grid> <TabItem Header="动态" Background="White" BorderThickness="0" Margin="0" Height="30" FontSize="20" >
</Grid> <ListBox BorderThickness="0" FontSize="20">
</Grid> <ListBoxItem Content="动态" Height="30" />
<Grid Margin="0,400,0,0"> <ListBoxItem Content="动态" Height="30" />
<Grid Margin="30,20,0,20" HorizontalAlignment="Left" Width="550" > <ListBoxItem Content="动态" Height="30" />
<TabControl Background="White" BorderThickness="0"> <ListBoxItem Content="动态" Height="30" />
<TabItem Header="动态" Background="White" BorderThickness="0" Margin="0" Height="30" FontSize="20" > <ListBoxItem Content="动态" Height="30" />
<ListBox BorderThickness="0"> <ListBoxItem Content="动态" Height="30" />
<ListBoxItem Content="动态" Height="30" FontSize="25"/> </ListBox>
<ListBoxItem Content="动态" Height="30" FontSize="25"/> </TabItem>
<ListBoxItem Content="动态" Height="30" FontSize="25"/> <TabItem Header="新闻" Background="White" BorderThickness="0" Margin="0" Height="30" FontSize="20" >
<ListBoxItem Content="动态" Height="30" FontSize="25"/> <ListBox BorderThickness="0" FontSize="20">
<ListBoxItem Content="动态" Height="30" FontSize="25"/> <ListBoxItem Content="新闻" Height="30" />
<ListBoxItem Content="动态" Height="30" FontSize="25"/> <ListBoxItem Content="新闻" Height="30" />
</ListBox> <ListBoxItem Content="新闻" Height="30" />
</TabItem> <ListBoxItem Content="新闻" Height="30" />
<TabItem Header="新闻" Background="White" BorderThickness="0" Margin="0" Height="30" FontSize="20" > <ListBoxItem Content="新闻" Height="30" />
<ListBox BorderThickness="0"> </ListBox>
<ListBoxItem Content="新闻" Height="30" FontSize="25"/> </TabItem>
<ListBoxItem Content="新闻" Height="30" FontSize="25"/> <TabItem Header="公告" Background="White" BorderThickness="0" Margin="0" Height="30" FontSize="20" />
<ListBoxItem Content="新闻" Height="30" FontSize="25"/> <TabItem Header="活动" Background="White" BorderThickness="0" Margin="0" Height="30" FontSize="20" />
<ListBoxItem Content="新闻" Height="30" FontSize="25"/> </TabControl>
<ListBoxItem Content="新闻" Height="30" FontSize="25"/> </Grid>
</ListBox> <Grid Margin="0,20,20,20" HorizontalAlignment="Right" Width="300" Grid.ShowGridLines="True">
</TabItem> <Label Margin="10,15,0,0" Content="最大内存" VerticalAlignment="Top" Height="30" FontSize="17" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="Black" HorizontalAlignment="Left" Width="100"/>
<TabItem Header="公告" Background="White" BorderThickness="0" Margin="0" Height="30" FontSize="20" /> <TextBox Name="maxmem" Template="{StaticResource CornerTextBox}" Text="" Height="30" Width="174" TextWrapping="Wrap" Margin="0,15,10,161" FontSize="20" TextChanged="maxmem_TextChanged" HorizontalAlignment="Right" />
<TabItem Header="活动" Background="White" BorderThickness="0" Margin="0" Height="30" FontSize="20" /> <ComboBox Name="javacombo" Height="30" Width="174" FontSize="15" Margin="0,50,10,0" VerticalAlignment="Top" HorizontalAlignment="Right"/>
</TabControl> <Label Margin="10,50,0,126" Content="JAVA版本" FontSize="17" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="Black" HorizontalAlignment="Left" Width="100"/>
</Grid> <ComboBox Name="gamecombo" Height="30" Width="174" FontSize="15" Margin="0,85,10,0" VerticalAlignment="Top" HorizontalAlignment="Right"/>
<Grid Margin="0,20,30,20" HorizontalAlignment="Right" Width="350" Grid.ShowGridLines="True"> <Label Margin="10,85,0,91" Content="游戏版本" FontSize="17" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="Black" HorizontalAlignment="Left" Width="100"/>
<Border BorderBrush="Black" BorderThickness="2" CornerRadius="5"> <Button Name="StartGame" BorderBrush="#FF3299CC" Content="启动游戏" Template="{StaticResource CornerButton}" HorizontalAlignment="Right" Margin="0,0,10,10" Width="100" Height="46" VerticalAlignment="Bottom" FontSize="16" Click="StartGame_Click"/>
</Border> <Button x:Name="SelServer" BorderBrush="#FF3299CC" Content="选择服务器" Template="{StaticResource CornerButton}" Margin="34,0,0,16" Height="40" Width="100" FontSize="13" Click="StartGame_Click" VerticalAlignment="Bottom" HorizontalAlignment="Left"/>
<Label Margin="0,30,240,0" Content="最大内存" HorizontalAlignment="Right" VerticalAlignment="Top" Width="100" Height="30" FontSize="17" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="Black"/> </Grid>
<TextBox Name="maxmem" Template="{StaticResource CornerTextBox}" Text="" Height="30" Width="200" TextWrapping="Wrap" Margin="120,30,30,188" FontSize="20" TextChanged="maxmem_TextChanged" /> </Grid>
<ComboBox Name="javacombo" Height="30" Width="200" FontSize="15" Margin="120,65,30,0" VerticalAlignment="Top"/> </Grid>
<Label Margin="0,65,240,0" Content="JAVA版本" HorizontalAlignment="Right" VerticalAlignment="Top" Width="100" Height="30" FontSize="17" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="Black"/> <Button Template="{StaticResource CornerButton}" Width="30" HorizontalAlignment="Right" Content="r" Background="#FFE05A5A" Height="30" VerticalAlignment="Top" FontFamily="Webdings" Click="close_Click" Margin="0,0,0,0" />
<ComboBox Name="gamecombo" Height="30" Width="200" FontSize="15" Margin="120,100,30,0" VerticalAlignment="Top"/> </Grid>
<Label Margin="0,100,240,0" Content="游戏版本" HorizontalAlignment="Right" VerticalAlignment="Top" Width="100" Height="30" FontSize="17" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="Black"/> </Window>
<Button Name="StartGame" Content="启动游戏" Template="{StaticResource CornerButton}" Background="Gray" HorizontalAlignment="Right" Margin="0,0,30,30" Width="120" Height="70" VerticalAlignment="Bottom" FontSize="20" Click="StartGame_Click"/>
<Button x:Name="SelServer" Content="选择服务器" Template="{StaticResource CornerButton}" Background="Gray" Margin="30,0,200,50" Height="50" Width="100" FontSize="15" Click="StartGame_Click" VerticalAlignment="Bottom"/>
</Grid>
</Grid>
</Grid>
<Button Template="{StaticResource CornerButton}" Width="30" HorizontalAlignment="Right" Content="r" Background="#FFE05A5A" Height="30" VerticalAlignment="Top" FontFamily="Webdings" Click="close_Click" />
</Grid>
</Window>