使用c#完成一个聊天工具的学习过程 2

本文档记录了使用C#进行聊天工具开发的过程,主要涉及内容包括代码整改,采用MVC模式,详细讲解了登录服务的实现以及数据库操作类的编写,同时在model层进行了相关工作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

整改之前的代码,选择mvc模式。

 

<Window x:Class="ChatTools.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:ChatTools"
        mc:Ignorable="d"
        Title="聊天工具" Height="450" Width="700">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="127*"/>
            <ColumnDefinition Width="220*"/>
        </Grid.ColumnDefinitions>
        <Label Content="账号 :" HorizontalAlignment="Left" Margin="91,231,0,0" VerticalAlignment="Top"/>
        <Label Content="密码 :" HorizontalAlignment="Left" Margin="91,292,0,0" VerticalAlignment="Top"/>
        <Button Content="登录" HorizontalAlignment="Left" Margin="242,360,0,0" VerticalAlignment="Top" Width="197" Click="Button_Click" Height="26" Grid.ColumnSpan="2"/>
        <TextBox Name="user" Height="26" VerticalContentAlignment="Center" Margin="185,231,0,0" Width="300" Grid.ColumnSpan="2" AutomationProperties.Name="user" VerticalAlignment="Top" HorizontalAlignment="Left"/>
        <PasswordBox Name="passwd" VerticalContentAlignment="Center" HorizontalAlignment="Left" Height="26" Margin="185,292,0,0" VerticalAlignment="Top" Width="300" Grid.ColumnSpan="2" AutomationProperties.Name="passwd"/>
        <Image Height="199" Source="image/750.jpg" Grid.ColumnSpan="2" UseLayoutRounding="False" VerticalAlignment="Top" Stretch="UniformToFill" />
        <CheckBox Grid.ColumnSpan="2" Content="记住密码" HorizontalAlignment="Left" Margin="200,340,0,0" VerticalAlignment="Top"/>
        <CheckBox Content="自动登录" HorizontalAl
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值