Ejemplo n.º 1
0
        private async void main_Load(object sender, EventArgs e)
        {
            this.label1.Text = "Đang kiểm tra phiên bản ứng dụng ....";
            GetAllDiskDrives();
            HardDrive hd = hdCollection.First();

            await activeAsync(hd.SerialNo);
        }
Ejemplo n.º 2
0
        private void GetAllDiskDrives()
        {
            var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive");

            foreach (ManagementObject wmi_HD in searcher.Get())
            {
                HardDrive hd = new HardDrive();
                hd.Model         = wmi_HD["Model"].ToString();
                hd.InterfaceType = wmi_HD["InterfaceType"].ToString();
                hd.Caption       = wmi_HD["Caption"].ToString();
                hd.SerialNo      = wmi_HD.GetPropertyValue("SerialNumber").ToString().Trim();
                hdCollection.Add(hd);
            }
        }