public ScheduledSync(Device device, int minutes) { this.Device = device; this.Minutes = minutes; timer = new Timer(); timer.Interval = minutes * 1000; timer.Tick += new EventHandler(timer_Tick); timer.Enabled = true; }
public void Dispose() { timer.Enabled = false; timer.Stop(); timer.Dispose(); timer = null; this.Device = null; this.Minutes = -1; }
private void button6_Click(object sender, EventArgs e) { SelectDriveForm sdf = new SelectDriveForm(); if (sdf.ShowDialog() == DialogResult.OK) { // check if a removable drive System.IO.DriveInfo di = sdf.SelectedDrive; if (di.DriveType != System.IO.DriveType.Removable) { if (di.DriveType == System.IO.DriveType.Ram) { MessageBox.Show("You have selected a RAM drive. This is not allowed."); return; } else if (di.DriveType == System.IO.DriveType.NoRootDirectory) { MessageBox.Show("The Selected drive doesn't have a root Directory!"); return; } DialogResult r = MessageBox.Show("Warning: The drive you have selected isn't a removable drive.\nContinue?", "OH NOES!", MessageBoxButtons.YesNo); if (r == System.Windows.Forms.DialogResult.No) return; } // generate Drive info IITPlaylist device = GetPlaylistNameForm.InputBox(); Device newDevice = new Device(device, di); listBox1.Items.Add(newDevice.Name.ToUpper() + " (" + newDevice.iTunesPlaylist.Name + ")"); ManagedDrives.Add(newDevice); //MessageBox.Show("To put songs on your device, drag them onto the playlist, \n" + "Then press 'sync'"); } }