Esempio n. 1
0
        private void button4_Click(object sender, EventArgs e)
        {
            RecPathList recPathList = new RecPathList();
            string      disk        = "";

            foreach (int i in checkedListBox2.CheckedIndices)
            {
                disk += checkedListBox2.Items[i].ToString().Split(new char[] { ':' })[0] + ",";
            }
            recPathList.Disk          = disk.Substring(0, disk.Length - 1);
            recPathList.CapacityClear = comboBox1.Text;
            recPathList.Userfor       = "截图";
            if (RecPathClass.Update(recPathList))
            {
                MessageBox.Show("保存成功!");
            }
            else
            {
                MessageBox.Show("保存成功!");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 录像路径存储
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void videoPathSave_Click(object sender, EventArgs e)
        {
            RecPathList recPathList = new RecPathList();
            string      disk        = "";

            foreach (int i in checkedListBox1.CheckedIndices)
            {
                disk += checkedListBox1.Items[i].ToString().Split(new char[] { ':' })[0] + ",";
            }
            recPathList.Disk          = disk.Substring(0, disk.Length - 1);
            recPathList.CapacityClear = videoAutoClear.Text;
            recPathList.Userfor       = "录像";
            string errorInfo = "";

            if (RecPathClass.Update(recPathList, ref errorInfo))
            {
                MessageBox.Show("保存成功!");
            }
            else
            {
                MessageBox.Show(errorInfo);
            }
        }
Esempio n. 3
0
        private void ShowInfo(ManagementObjectSearcher wmifind)
        {
            long   gb        = 1024 * 1024 * 1024;
            string type      = "";
            string str       = "";
            string errorInfo = "";
            double freePath  = 0d;

            foreach (var mobj in wmifind.Get())
            {
                type = mobj["Description"].ToString();
                //判断是否是本机固盘
                if (type == "Local Fixed Disk")
                {
                    str      = mobj["Name"].ToString();
                    freePath = Math.Round(Convert.ToDouble(mobj["FreeSpace"]) / gb, 1);
                    str     += " 可用空间:" + freePath + "G";
                    str     += " 实际大小:" + Math.Round(Convert.ToDouble(mobj["Size"].ToString()) / gb, 1) + "G";

                    checkedListBox1.Items.Add(str);
                    checkedListBox2.Items.Add(str);
                }
            }
            DataSet ds = RecPathClass.SelectAll(ref errorInfo);

            if (ds != null)
            {
                for (int i = 0; i < ds.Tables["RecPath"].Rows.Count; i++)
                {
                    if (ds.Tables["RecPath"].Rows[i]["Usefor"].ToString() == "录像")
                    {
                        string   str1           = ds.Tables["RecPath"].Rows[i]["Disk"].ToString();
                        string[] disk           = str1.Split(new char[] { ',' });
                        string   capacityClear1 = ds.Tables["RecPath"].Rows[i]["CapacityClear"].ToString();
                        for (int j = 0; j < checkedListBox1.Items.Count; j++)
                        {
                            for (int k = 0; k < disk.Length; k++)
                            {
                                if (disk[k] == checkedListBox1.Items[j].ToString().Split(new char[] { ':' })[0])
                                {
                                    checkedListBox1.SetItemChecked(j, true);
                                }
                            }
                        }
                        videoAutoClear.Text = capacityClear1;
                    }
                    if (ds.Tables["RecPath"].Rows[i]["Usefor"].ToString() == "截图")
                    {
                        string   str1           = ds.Tables["RecPath"].Rows[i]["Disk"].ToString();
                        string[] disk           = str1.Split(new char[] { ',' });
                        string   capacityClear1 = ds.Tables["RecPath"].Rows[i]["CapacityClear"].ToString();
                        for (int j = 0; j < checkedListBox2.Items.Count; j++)
                        {
                            for (int k = 0; k < disk.Length; k++)
                            {
                                if (disk[k] == checkedListBox2.Items[j].ToString().Split(new char[] { ':' })[0])
                                {
                                    checkedListBox2.SetItemChecked(j, true);
                                }
                            }
                        }
                        comboBox1.Text = capacityClear1;
                    }
                }
            }
            else
            {
                MessageBox.Show(errorInfo + ",获取录像存储信息失败!");
            }
        }