Files
xuyueandClaude Opus 5.5 65a1b3a81e
CI/CD / test (push) Canceled after 0s
CI/CD / deploy (push) Canceled after 0s
项目 8 智慧校园管理平台:5 个任务的示例、自绘素材、WisdomCampus 数据库
- 示例 p8-t1…t5(代码逐个累加):主界面、校园环境界面、环境采集与分析(路灯手动 / 自动控制、
  LED 推送、自动推送火情、7 天温度图表)、校园安防(入侵提示、摄像机方向、拍照入库)、历史图片
  (按日期查询、左右切换),各有评分规则
- 按书补全参考工程里空着的"推送LED信息""自动控制",给"自动推送火情"绑定 CheckedChanged
  (书上第 23 步写成了 ch_autoLamp);任务 5 每次查询前清空 Keys
- 素材:项目 8 的 20 多张图片全部自绘,名字和尺寸与教材一致(project8.py 生成 SVG,
  build-gallery.sh 渲染成 PNG;源文件移到 svg/)
- 数据库 WisdomCampus 按教材的表结构建(EnvironmentData、SecurityData、Users),预置 7 天环境数据
- 测试:参考答案全部通过;没绑定"自动推送火情"、开灯换错背景图片时报出对应原因
- 文档:教材 8 个项目全部有示例,共 23 个

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 15:15:00 +08:00

130 lines
3.2 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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 DeviceCtrlLibrary;
using 智慧校园.SQLHelpers;
namespace 智慧校园
{
public partial class SecurityCameraData : Form
{
public SecurityCameraData()
{
InitializeComponent();
}
//存放报警信息的集合
Dictionary<string, Image> ImgDictionary = new Dictionary<string, Image>();
//图片下标
int index = -1;
Image img;
//KEY的列表(报警时间为KEY)
List<string> Keys = new List<string>();
private void SecurityCameraData_Load(object sender, EventArgs e)
{
try
{
//设置父容器
pic_up.Parent = pic_camera;
pic_down.Parent = pic_camera;
//设置加载坐标
pic_up.Location = new Point(20, 0);
pic_down.Location = new Point(560, 0);
GetData();
}
catch
{
}
}
//更新数据
private void GetData()
{
try
{
DateTime startdt = dateTimePicker1.Value;
DateTime enddt = dateTimePicker2.Value;
ImgDictionary = SQLBLL.GetSecurityData(startdt, enddt);
index = -1;
Keys.Clear();
if (ImgDictionary.Count != 0)
lb_noData.Visible = false;
else
{
lb_noData.Visible = true;
return;
}
foreach (string key in ImgDictionary.Keys)
{
Keys.Add(key);
}
ImageChanged();
}
catch
{
}
}
//切换图片
private void ImageChanged(char UpOrDown = '+')
{
try
{
if (ImgDictionary.Count == 0)
return;
if (UpOrDown == '+')
index++;
else if (UpOrDown == '-')
index--;
if (index == ImgDictionary.Count)
index = 0;
if (index == -1)
index = ImgDictionary.Count - 1;
ImgDictionary.TryGetValue(Keys[index], out img);
pic_camera.Image = img;
lb_time.Text = Keys[index];
}
catch
{
}
}
private void btn_get_Click(object sender, EventArgs e)
{
try
{
GetData();
}
catch
{
}
}
private void pictureBox1_Click(object sender, EventArgs e)
{
this.Close();
}
private void pic_up_Click(object sender, EventArgs e)
{
ImageChanged('-');
}
private void pic_down_Click(object sender, EventArgs e)
{
ImageChanged();
}
}
}