private void downloadContent() { try { try { if (!Directory.Exists(prefObj.downloadDirectory)) { Directory.CreateDirectory(prefObj.downloadDirectory); } } catch (Exception ex) { prefObj = new preferences(); } // Choose a destination for the copied files. string destinationPath = prefObj.downloadDirectory; string filename = crawler.getFilename(sourcePath); try { FileSystem.CopyDirectory(sourcePath, destinationPath + @"\" + filename, UIOption.AllDialogs); } catch (Exception) { try { FileSystem.CopyFile(sourcePath, destinationPath + @"\" + filename, UIOption.AllDialogs); } catch (Exception ex) { lasterror = "Unable to download [exception]: " + ex.Message; //report error here } } } catch (ArgumentNullException ex) { lasterror = "Cannot download NULL content [exception]" + ex.Message; //report error here } }
/** * funcion to open * preferences form on click */ private void icon_preferences_Click(object sender, EventArgs e) { try { prefObj.Show(); } catch (Exception ex) { prefObj = new preferences(); prefObj.Show(); } }
private void settingsToolStripMenuItem_Click(object sender, EventArgs e) { preferences obj = new preferences(); obj.Show(); }
private void lStore_FormClosing(object sender, FormClosingEventArgs e) { try { if (prefObj.closeOnexit == 0) { /** * a dialog box for confirmation if you want to exit */ if (e.CloseReason == CloseReason.UserClosing) { notifICO.BalloonTipTitle = "Minimised to system tray"; notifICO.BalloonTipText = "You can access lStore from Notification panel anytime. Stay connected!"; notifICO.ShowBalloonTip(1000); notifICO.Visible = true; this.Hide(); e.Cancel = true; } } } catch (Exception ex) { prefObj = new preferences(); } }