Example #1
0
        /// <summary>
        /// A fully featured upload-event handler
        /// </summary>
        protected virtual UploadHandlerReturnVal UploadHandler(TraceListenerUploadableBase Sender, string LogTitle,
                                                               string LogDetails, string UploadToWithoutPageNumber, List <LogEntry> LinksToLog, bool OpenInBrowser,
                                                               bool AddToWatchlist, string Username, string LogHeader, string EditSummary,
                                                               string LogSummaryEditSummary, WikiFunctions.Plugin.IAutoWikiBrowser AWB,
                                                               UsernamePassword LoginDetails)
        {
            UploadHandlerReturnVal retval = new UploadHandlerReturnVal();

            retval.Success = false;

            if (StartingUpload(Sender))
            {
                string pageName = UploadToWithoutPageNumber + " " + Sender.TraceStatus.PageNumber.ToString();
                UploadingPleaseWaitForm waitForm = new UploadingPleaseWaitForm();
                LogUploader             uploader = new LogUploader();

                waitForm.Show();

                try
                {
                    uploader.LogIn(LoginDetails);
                    Application.DoEvents();

                    retval.PageRetVals = uploader.LogIt(Sender.TraceStatus.LogUpload, LogTitle, LogDetails, pageName, LinksToLog,
                                                        Sender.TraceStatus.PageNumber, Sender.TraceStatus.StartDate, OpenInBrowser,
                                                        AddToWatchlist, Username, "{{log|name=" + UploadToWithoutPageNumber + "|page=" +
                                                        Sender.TraceStatus.PageNumber.ToString() + "}}" + System.Environment.NewLine + LogHeader,
                                                        false, EditSummary, LogSummaryEditSummary, ApplicationName, true, AWB);

                    retval.Success = true;
                }
                catch (Exception ex)
                {
                    ErrorHandler.Handle(ex);

                    retval.Success = false;
                }
                finally
                {
                    if (retval.Success)
                    {
                        Sender.WriteCommentAndNewLine("Log uploaded to " + pageName);
                    }
                    else
                    {
                        Sender.WriteCommentAndNewLine(
                            "LOG UPLOADING FAILED. Please manually upload this section to " + pageName);
                    }
                }

                waitForm.Dispose();
                FinishedUpload();
            }
            return(retval);
        }
        /// <summary>
        /// A fully featured upload-event handler
        /// </summary>
        protected virtual UploadHandlerReturnVal UploadHandler(TraceListenerUploadableBase sender, string logTitle,
                                                               string logDetails, string uploadToWithoutPageNumber, List <LogEntry> linksToLog, bool openInBrowser,
                                                               bool addToWatchlist, string username, string logHeader, string editSummary,
                                                               string logSummaryEditSummary, Plugin.IAutoWikiBrowser awb,
                                                               UsernamePassword loginDetails)
        {
            UploadHandlerReturnVal retval = new UploadHandlerReturnVal {
                Success = false
            };

            if (StartingUpload(sender))
            {
                string pageName = uploadToWithoutPageNumber + " " + sender.TraceStatus.PageNumber;
                UploadingPleaseWaitForm waitForm = new UploadingPleaseWaitForm();
                LogUploader             uploader = new LogUploader(awb.TheSession.Editor);

                waitForm.Show();

                try
                {
                    uploader.LogIn(loginDetails);
                    Application.DoEvents();

                    retval.PageRetVals = uploader.LogIt(sender.TraceStatus.LogUpload, logTitle, logDetails, pageName, linksToLog,
                                                        sender.TraceStatus.PageNumber, sender.TraceStatus.StartDate, openInBrowser,
                                                        addToWatchlist, username, "{{log|name=" + uploadToWithoutPageNumber + "|page=" +
                                                        sender.TraceStatus.PageNumber + "}}" + Environment.NewLine + logHeader,
                                                        false, editSummary, logSummaryEditSummary, ApplicationName, true, awb);

                    retval.Success = true;
                }
                catch (Exception ex)
                {
                    ErrorHandler.Handle(ex);

                    retval.Success = false;
                }
                finally
                {
                    if (retval.Success)
                    {
                        sender.WriteCommentAndNewLine("Log uploaded to " + pageName);
                    }
                    else
                    {
                        sender.WriteCommentAndNewLine(
                            "LOG UPLOADING FAILED. Please manually upload this section to " + pageName);
                    }
                }

                waitForm.Dispose();
                FinishedUpload();
            }
            return(retval);
        }