菜单
  

    {
    MessageBox.Show(this, ex.Message);
    }
    mySniffSocket.PacketArrival +=
    new SniffSocket.PacketArrivedEventHandler(DataArrival);//绑定事件处理方法
    LoadSettings();
    if (IsAdmin == false)
    {
    btnStart.Visible = false;
    btnClear.Visible = false;
    btnClose.Visible = false;
    cmbIpList.Enabled = false;
    }
    StartScocket();
    }
    private void LoadSettings()
    {
    SqlDataReader dr;
    dr = MyData.MySQL.GetData("select * from [Settings]");
    if (dr.HasRows)
    {
    if (dr.Read())
    {
    warnCheckInterval = Convert.ToUInt32(dr["warnCheckInterval"]);
    warnByteSize = Convert.ToUInt32(dr["warnByteSize"]);
    saveDataInterval = Convert.ToUInt32(dr["saveDataInterval"]);
    paidMoney = Convert.ToDouble(dr["paidMoney"]);
    }
    }
    else
    {
    string sql = "INSERT INTO [Settings]([WarnCheckInterval],[WarnByteSize],[SaveDataInterval],[PaidMoney])Values('"
    + warnCheckInterval + "','" + warnByteSize + "','" + saveDataInterval + "','" + paidMoney + "')";
    MyData.MySQL.updata(sql);
    }
    MyData.MySQL.CloseSQL();
    }
    private void btnStart_Click(object sender, EventArgs e)
    {
    StartScocket();
    }
    private void StartScocket()
    {
    if (mySniffSocket.KeepRunning == false)
    {
    mySniffSocket.KeepRunning = true;
    try
    {
    mySniffSocket.Run();//开始监听
    }
    catch (SocketException)//如果监听出现异常,将重新创建和绑定连接
    {
    mySniffSocket.CreateAndBindSocket(cmbIpList.Text);
    mySniffSocket.Run();
    }
    btnStart.Text = "暂停";
    }
    else
    {
    mySniffSocket.KeepRunning = false;
    btnStart.Text = "恢复";
    }
    }
    private void btnClose_Click(object sender, EventArgs e)
    {
    mySniffSocket.KeepRunning = false;
    btnStart.Text = "开始";
    Thread.Sleep(10);//需要引用System.Threading
    mySniffSocket.ShutDown(); //禁止Socket上的发送和接收
    }
    private void btnClear_Click(object sender, EventArgs e)
    {
    lvSniffInfo.Items.Clear();
    txtPacketInfo.Text = "";
    }
    private void lvSniffInfo_SelectedIndexChanged(object sender, EventArgs e)
    {
    if (lvSniffInfo.SelectedItems.Count != 0)
    {
    foreach (ListViewItem item in lvSniffInfo.SelectedItems) {                    
    txtPacketInfo.Text = item.SubItems[6].Text;
    }
    }
    }
    private void menuItemSettings_Click(object sender, EventArgs e)
    {
    if (IsAdmin == false)
    {
    MessageBox.Show("您不是管理员,不能进入系统设置!", "提  示", MessageBoxButtons.OK, MessageBoxIcon.Information);
    }
    else
    {
    SettingForm F1 = new SettingForm(this);
    F1.Show();
    }
    }
    private void menuItemExit_Click(object sender, EventArgs e)
    {
    mySniffSocket.KeepRunning = false;
    Thread.Sleep(5);//需要引用System.Threading
    mySniffSocket.ShutDown(); //禁止Socket上的发送和接收
    Application.Exit();
    }
    private void menuItemAbout_Click(object sender, EventArgs e)
    {
    About_Sniffer F1 = new About_Sniffer();
    F1.Show();
    }
    private void menuItem3_Click(object sender, EventArgs e)
    {
    FlowManage F1 = new FlowManage(this);
    F1.Show();
    }
    private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
    {
    if (isbegin == true)
    {
    SaveData(false);
    }
    }
    private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
  1. 上一篇:C#汽车销售系统财务管理和销售管理设计
  2. 下一篇:基于AS3的休闲英雄联盟游戏设计+文献综述
  1. jsp+sqlserver高校二手商品交...

  2. 基于Kinect的手势跟踪与识别算法设计

  3. 医院查询与挂号系统设计与实现

  4. java+mysql酒店管理系统设计与实现

  5. jsp公交刷卡数据统计系统图表的设计与实现

  6. php+mysql高校迎新系统的开发与应用

  7. jsp+mysql学生选课信息系统设计与实现

  8. 杂拟谷盗体内共生菌沃尔...

  9. 当代大学生慈善意识研究+文献综述

  10. 电站锅炉暖风器设计任务书

  11. 乳业同业并购式全产业链...

  12. 十二层带中心支撑钢结构...

  13. 中考体育项目与体育教学合理结合的研究

  14. 大众媒体对公共政策制定的影响

  15. 酸性水汽提装置总汽提塔设计+CAD图纸

  16. java+mysql车辆管理系统的设计+源代码

  17. 河岸冲刷和泥沙淤积的监测国内外研究现状

  

About

751论文网手机版...

主页:http://www.751com.cn

关闭返回