/// <summary> /// Downloads to \My Documents /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDownload_Click(object sender, EventArgs e) { System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ThreadStart(delegate() { bool isSuccessful = true; SharefileCCP sharefile = new SharefileCCP(); SharefileCCP.HRESULT loginStatus = sharefile.Authenticate("citrix", "sharefile.com", username, "Apps3cur3"); if (loginStatus == SharefileCCP.HRESULT.S_OK) { List <object> items = GetUploadedFiles(); foreach (object filename in items) { //if (!sharefile.FileDownload(sharefile.GetItemId((string)filename, SharefileCCP.ITEM_TYPE.FILE), DOWNLOADS_FOLDER + (string)filename)) sharefile.FileDownload(sharefile.GetItemId(@"/" + username + @"/" + UPLOADS_FOLDER, (string)filename, SharefileCCP.ITEM_TYPE.FILE), DOWNLOADS_FOLDER + (string)filename); } MessageBox.Show(isSuccessful ? "Download successful." : "Download failed.\nPlease try again later."); } else if (loginStatus == SharefileCCP.HRESULT.E_FAIL) { FunctionalityLibrary.UserInterfaces.ErrorForm frm = new FunctionalityLibrary.UserInterfaces.ErrorForm() { Message = sharefile.FriendlyError, Technical = sharefile.TechnicalError, }; frm.ShowDialog(this); } })); thread.Start(); }
/// <summary> /// Prints the log critial exception. /// </summary> /// <param name="e">The decimal.</param> private void PrintLogCritialException(Exception e) { String technical_msg = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + " " + " Catastrophic error while creating shell extension: " + e.Message + e.StackTrace; CommonFunctionality.Instance.logger.LogItAsError(technical_msg); FunctionalityLibrary.UserInterfaces.ErrorForm form = new FunctionalityLibrary.UserInterfaces.ErrorForm(); form.Message = e.Message; form.Technical = technical_msg; form.ShowDialog(); LogError(e.Message, e); // Built into Sharpshell }