1.计划时间
一周左右
2.需求分析
作为一个排球教练的助手,我需要统计本队每名球员在球场各个技术动作的发挥情况,每个队员的技术习惯,以便教练员即时指导比赛,并作为以后球员训练的依据
3.生成设计文档
输入比赛时队员的名字,然后分析他们个人的技术动作,得分情况,然后保存记事本的格式,发送给教练
4.设计复审
和伙伴谈论,分析了一下,还是可以完成的
5.代码规范
Visual Studio 2010
6.具体设计
点击确定按钮,出现下一个页面
点击确定后保存结果
7.具体编码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Management;
using System.IO;
namespace 排球
{
public partial class ZhuShou : Form
{
public ZhuShou()
{
InitializeComponent();
}
private void btnOK_Click(object sender, EventArgs e)
{
string ZhuGong111 = txtZhuGong1.Text;
string ZhuGong222 = txtZhuGong2.Text;
string FuGong111 = txtFuGong1.Text;
string FuGong222 = txtFuGong2.Text;
string JieYing111 = txtJieYing.Text;
string ErChuan111 = txtErChuan.Text;
string ZiYouRen111 = txtZiYouRen.Text;
if (string.IsNullOrEmpty(ZhuGong111)) { MessageBox.Show("请输入本场比赛的主攻手一"); }
else if (string.IsNullOrEmpty(FuGong111)) { MessageBox.Show("请输入本场比赛的副攻手一"); }
else if (string.IsNullOrEmpty(ZhuGong222)) { MessageBox.Show("请输入本场比赛的主攻手二"); }
else if (string.IsNullOrEmpty(FuGong222)) { MessageBox.Show("请输入本场比赛的副攻手二"); }
else if (string.IsNullOrEmpty(JieYing111)) { MessageBox.Show("请输入本场比赛的接应"); }
else if (string.IsNullOrEmpty(ErChuan111)) { MessageBox.Show("请输入本场比赛的二传"); }
else if (string.IsNullOrEmpty(ZiYouRen111)) { MessageBox.Show("请输入本场比赛的自由人"); }
else
{
groupBox1.Visible = false;
groupBox2.Visible = true;
linkZhuGong1.Text = ZhuGong1.Text + txtZhuGong1.Text;
linkFuGong1.Text=FuGong1.Text+txtFuGong1.Text;
linkZhuGong2.Text = ZhuGong2.Text + txtZhuGong2.Text;
linkFuGong2.Text = FuGong2.Text + txtFuGong2.Text;
linkJieYing.Text = JieYing.Text + txtJieYing.Text;
linkErChuan.Text = ErChuan.Text + txtErChuan.Text;
linkZiYouRen.Text = ZiYouRen.Text + txtZiYouRen.Text;
}
}
private void ZhuShou_Load(object sender, EventArgs e)
{
groupBox1.Visible = true;
groupBox2.Visible = false;
}
int i = 0;
private void button1_Click(object sender, EventArgs e)
{
i++;
txtFen.AppendText (lblName.Text + button1.Text + " " + i);
}
int FQ = 0;
private void btnFaQiu_Click(object sender, EventArgs e)
{
FQ++;
txtFen.AppendText(lblName.Text+btnFaQiu.Text+" "+FQ);
}
int KQ=0;
private void btnKouQiu_Click(object sender, EventArgs e)
{
KQ++;
txtFen.AppendText(lblName.Text + btnKouQiu.Text + " " + KQ);
}
int CW=0;
private void btnChouWang_Click(object sender, EventArgs e)
{
CW++;
txtFen.AppendText(lblName.Text + btnChouWang.Text + " " + CW);
}
int DQ = 0;
private void btnDiaoQiu_Click(object sender, EventArgs e)
{
DQ++;
txtFen.AppendText(lblName.Text + btnDiaoQiu.Text + " " + DQ);
}
int LWCJ = 0;
private void btnLWChuJie_Click(object sender, EventArgs e)
{
LWCJ++;
txtFen.AppendText(lblName.Text + btnLWChuJie.Text + " " + LWCJ);
}
int FQSW = 0;
private void btnFaQiuShiWu_Click(object sender, EventArgs e)
{
FQSW++;
txtFen.AppendText(lblName.Text + btnFaQiuShiWu.Text + " " + FQSW);
}
int KQCJ = 0;
private void btnKouQiuChuJie_Click(object sender, EventArgs e)
{
KQCJ++;
txtFen.AppendText(lblName.Text + btnKouQiuChuJie.Text + " " + KQCJ);
}
private void lastOK_Click(object sender, EventArgs e)
{
//创建一个文件流,用以写入或者创建一个StreamWriter
FileStream fs = new FileStream("C:\file.txt", FileMode.OpenOrCreate, FileAccess.Write);
StreamWriter m_streamWriter = new StreamWriter(fs);
m_streamWriter.Flush(); // 使用StreamWriter来往文件中写入内容
m_streamWriter.BaseStream.Seek(0, SeekOrigin.Begin);
// 把richTextBox1中的内容写入文件
m_streamWriter.Write(txtFen.Text);
//关闭此文件 m_streamWriter.Flush ( ) ;
m_streamWriter.Close();
MessageBox.Show("发送成功!");
groupBox2.Visible = false;
groupBox1.Visible = true;
}
private void linkZhuGong1_LinkClicked_1(object sender, LinkLabelLinkClickedEventArgs e)
{
lblName.Text = linkZhuGong1.Text;
}
private void linkFuGong1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
lblName.Text = linkFuGong1.Text;
}
private void linkZhuGong2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
lblName.Text = linkZhuGong2.Text;
}
private void linkFuGong2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
lblName.Text = linkFuGong2.Text;
}
private void linkJieYing_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
lblName.Text = linkJieYing.Text;
}
private void linkErChuan_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
lblName.Text = linkErChuan.Text;
}
private void linkZiYouRen_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
lblName.Text = linkZiYouRen.Text;
}
8.代码复审
经过代码编辑之后功能已实现
9.测试
当文本框未输入值,就会弹出对话框
选中队员之后,点击队员得分原因,点击确定
保存成功
以记事本的格式保存
10.测试报告
已实现,无错误
11.计算工作量
时间刚好
12.事后总结
编程语法不熟悉,逻辑思维差,掌握的东西少,欠练习,发现一个人完成一个项目,思路少,结对编程是个不错的方法,,还有一个问题就是,如果先选择排球技术,未选中队员,不能返回到上一步来重新选择队员在选择技术