/// <summary> /// Some error handling around the file upload method. Used for handling files from the context menu. /// </summary> /// <param name="file">The file to upload.</param> public void HandleUpload(string file) { if (!loggedIn) { MessageBox.Show("Please log in before uploading documents", "Upload Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { DocListNotifyIcon.ShowBalloonTip(BALLOON_TIMER, "Uploading", "Uploading " + file, ToolTipIcon.Info); lastToolTipWasUpload = false; UploadFile(file); DocListNotifyIcon.ShowBalloonTip(BALLOON_TIMER, "Upload Success", "Successfully uploaded " + file, ToolTipIcon.Info); lastToolTipWasUpload = true; optionsForm.UpdateDocList(); } catch (ArgumentException) { DocListNotifyIcon.ShowBalloonTip(BALLOON_TIMER, "Upload Error", "Error: unable to upload the file: '" + file + "'. It is not one of the valid types.", ToolTipIcon.Error); lastToolTipWasUpload = false; } catch (Exception ex) { DocListNotifyIcon.ShowBalloonTip(BALLOON_TIMER, "Upload Error", "Error: unable to upload the file: '" + file + "'. " + ex.Message, ToolTipIcon.Error); lastToolTipWasUpload = false; } }
/// <summary> /// Called when the OptionsForm is minimized/hidden. /// </summary> public void HandleMinimize() { if (firstMinimize) { DocListNotifyIcon.ShowBalloonTip(BALLOON_TIMER, "DocList Uploader", "Uploader now running in the system tray.", ToolTipIcon.Info); lastToolTipWasUpload = false; firstMinimize = false; } }