Пример #1
0
 public static void SavePublishHistory(string publishDestinationUrl, PublishResponse response)
 {
     string timestamp = DateTime.Now.ToString("yyyy-MM-ddThh:mm:ssZ");
     using(FileStream fs = new FileStream(".history", FileMode.Append))
         using(StreamWriter writer = new StreamWriter(fs))
             foreach(DocPublishResult result in response.document_results)
                     writer.WriteLine(String.Format("{0} {1} {2}", publishDestinationUrl,
                                                result.doc_ID, timestamp));
 }
    private void buildAndShowNotification(PublishResponse response)
    {
        StringBuilder sb = new StringBuilder();
        bool success =  response.OK;
        if(!response.OK)
                sb.AppendLine("General response error: " + response.error);
        foreach(DocPublishResult docResult in response.document_results)
        {
            if(!docResult.OK)
            {
                success = false;
                sb.AppendLine("Doc error: " + docResult.error);
            }
        }
        if(success)
        {
            PublishGUI.Helper.SavePublishHistory(this.ServerInfoWidget.NodeUrl, response);
            sb.AppendLine("Documents were successfully published!");
            sb.AppendLine("To view the docs online, or for further information from the responses,"
                         +"you may go to History -> Show All in the main menu.");
        }
        else
            sb.AppendLine("One or more errors occurred while publishing your documents. See above for detailed error report.");

        PublishGUI.Helper.CreateNotficationWindow(sb.ToString());
    }