I am creating a utility that changes settings for a LED Light using a SD Card. Now, I have it working perfectly fine on Windows 8 (I used Windows 8 to make it), but when I test it on Windows 7 the label doesn't change to "SD Card Not Inserted" when the card is removed during run-time.
I have used a dispatchTimer to check if the card is removed/inserted and if it is then the Label reads "SD Card is Available" and if it isn't then it should read "SD Card Not Available". Does anyone know how to work this? Maybe it is something to do with the Array that I have used:
private void dispatcherTimer_Tick(object sender, EventArgs e) { string[] drives = Environment.GetLogicalDrives(); foreach (string drive in drives) { try { DriveInfo di = new DriveInfo(drive); if (di.VolumeLabel.Contains("STAR-LIGHT")) { var bc = new BrushConverter(); sdAvailability.Foreground = (Brush)bc.ConvertFrom("#FF83A680"); updateBtn.IsEnabled = true; sdAvailability.Content = "SD Card is Available"; } } catch { } try { DriveInfo di = new DriveInfo(drive); if (di.VolumeLabel != "STAR-LIGHT") { var bc = new BrushConverter(); sdavailability.foreground = (brush)bc.convertfrom("#ffa45f5f"); sdavailability.content = "sd card not available"; updatebtn.isenabled = false; } } catch { } } }
Could anyone please help me out, if you need any more information please ask.
Thanks in advance.
Lee.