OOP:面向对象编程 S2S1:语法基础++++++逻辑思维S2:面向对象思维+创新思维++++项目驱动Y2:框架++++源码++++++对整个真正的项目,全局的把控1.封装:类(属性++方法) 私有字段封装成共有的属性2.泛型集合++++++重点3.xml解析技术4.IO流 +++++++--------------------------------------------------------------预习检查:1. .NET 框架的两个主要组件是什么? 解析: 2.任何人 在任何地方 使用任何终端设备 服务3.前惠普ceo 卡莉·菲奥莉娜 艰难的抉择hp 康柏合并李纳斯 写的linux Unix MinuxGhost 安装版FCL(Framework Class Library 框架类型)4.CLR=========CLS(Common Language Specfication 公共语言规范)+CTS(Common Type System 通用类型系统) 基本框架类::线程类 5.WF:Work Flow :工作流 WCF:底层通信 HTTp Ftp WPF:更酷炫 Linq:是一种类似于数据的能获取数据的语言 from c in db.xxxx 6.类库一堆类的集合 10个 dll神器:Reflector7.类图作用:清晰的反馈出类结构 :字段 属性 方法using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;namespace WindowsFormsapplication4{ public partial class denglu : Form { public denglu() { InitializeComponent(); } public LoginInfo[] persons = new LoginInfo[10]; public void LoadData() { persons[0] = new LoginInfo(); persons[0].Name = "李小龙"; persons[0].PassWord = "1"; persons[0].Email = "lxl"; persons[0].Id = "001"; persons[1] = new LoginInfo(); persons[1].Name = "李小龙2"; persons[1].Password = "2"; persons[1].Email = "lxl2"; persons[1].Id = "002"; persons[2] = new LoginInfo(); persons[2].Name = "巩俐"; persons[2].Password = "3"; persons[2].Email = "gl"; persons[2].Id = "003"; } PRivate void label3_Click(object sender, EventArgs e) { zhuce frm = new zhuce(); frm.mylogin = this; frm.Show(); this.Visible = false; } private void button1_Click(object sender, EventArgs e) { //if(textBox1.Text.Trim().Equals(null)||textBox2.Text.Trim().Equals(null)){ // MessageBox.Show("用户名或密码不能为空", "提示"); //} //LoadData(); //01.用户会输入用户名和密码 string email = textBox1.Text; string pwd = textBox2.Text; //02.将用户输入内容与数组中的每一项对比,如果有匹配项目,登陆成功 bool flag = false;//登陆状态,默认为失败 foreach (LoginInfo item in persons) { if (item != null) { //参与比较 if (email.Equals(item.Email) && pwd.Equals(item.Password)) /// if (email == item.Email && pwd == item.Password) { //证明用户输入的信息均正确,登陆成功 flag = true; zhujiemian frm = new zhujiemian(); frm.name = email; frm.textBox1.Text = "欢迎," + item.Name; frm.Show(); break; } } else if(email.Equals("") && pwd.Equals("")){ MessageBox.Show("用户名或密码不能为空","提示"); } } if (!flag) { MessageBox.Show("用户名或者密码错误!"); } //03.写一个方法来给数组中前三项赋值 } private void Form1_Load(object sender, EventArgs e) { LoadData(); } }}using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;using System.Data.SqlClient;namespace WindowsFormsApplication4{ public partial class zhuce : Form { public zhuce() { InitializeComponent(); } public denglu mylogin; private void button1_Click(object sender, EventArgs e) { //01.非空验证自己判定下 //02.先构造出一个LoginInfo对象 然后将LoginInfo对象添加到persons数组中 LoginInfo info = new LoginInfo(); info.Name = textBox1.Text; info.Email = textBox3.Text; info.Password = textBox4.Text; info.Id = textBox2.Text; //就是将info天际到数组中 //数组有10个位置,要把info扔到什么位置 for (int i = 0; i < mylogin.persons.Length; i++) { if (mylogin.persons[i] == null) { mylogin.persons[i] = info; MessageBox.Show("注册成功"); mylogin.Visible = true; this.Close(); break; } } } private void button2_Click(object sender, EventArgs e) { this.Close(); } }}using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;namespace WindowsFormsApplication4{ public partial class zhujiemian : Form { public string name; public zhujiemian() { InitializeComponent(); } private void pictureBox1_Click(object sender, EventArgs e) { Application.Exit(); } private void textBox1_TextChanged(object sender, EventArgs e) { this.Text = name; } private void Form3_Load(object sender, EventArgs e) { } }}using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace WindowsFormsApplication4{ public class LoginInfo { //private string _email; //private string _id; //private string _name; //private string _password; //public string Email //{ // get // { // throw new System.NotImplementedException(); // } // set // { // } //} //public string Id //{ // get // { // throw new System.NotImplementedException(); // } // set // { // } //} //public string Name //{ // get // { // throw new System.NotImplementedException(); // } // set // { // } //} //public string Password //{ // get // { // throw new System.NotImplementedException(); // } // set // { // } //} public string Name { get; set; } public string Id { get; set; } public string Email { get; set; } public string Password { get; set; } }}
新闻热点
疑难解答