i trying to create auto copy application, once the USB Flashdisk plug in and then the service start copying.. I already done it with Windows Form application, and it work fine. When the service start copying, it pop out the copying dialog box.
BUT, when i implement Microsoft.VIsualBasic.FIlesystem in Windows Service application, it won't show the copying dialog box, it just COPY without any notification
here is my code
private void BackupWithVisual()
{
sourceDir = "D:\\images";
DriveInfo[] ListDrives = DriveInfo.GetDrives();
foreach (DriveInfo Drive in ListDrives)
{
if (Drive.DriveType == DriveType.Removable)
{
USBLocation = Drive.RootDirectory.ToString() + "Backup\\" + DateTime.Now.ToString("MMMM") + "\\" + DateTime.Now.ToString("ddMMyy");
}
}
eventLog1.WriteEntry(USBLocation);
Directory.CreateDirectory(sourceDir);
if (!System.IO.Directory.Exists(USBLocation))
{
System.IO.Directory.CreateDirectory(USBLocation);
}
FileSystem.CopyDirectory(sourceDir, USBLocation, UIOption.AllDialogs, UICancelOption.DoNothing);
}
in my last line of my code is where i use to do a copy with windows dialogbox just like we do CTRL + C then CTRL + V, in windows form application, it works very fine! but in windows service, the dialog box doesn't show, it just copy in the background, i already set my service to allow to interact with desktop. Is there something i missed?