public static void StartAppEngine(RichTextBox richTextBox)
        {
            // assign the richTextBox global to point to the one on the main form
            mainformRichTextBox = richTextBox;

            try
            {
                // startup the OWIN webserver on the port specified in App.config
                // http://+ means that any host name is valid (ipaddress, localhost, MachineName etc)
                string url = "http://+:" + AppCommon.GetAppEnginePort().ToString();
                WebApp.Start <Startup>(url);
                Log("Starting TruckTrackWeb App Engine", EventLogEntryType.Information);
                Log("App Engine API URL " + BuildUrl(GetAppEngineUrl(), "", GetAppEnginePort()) + " . ", EventLogEntryType.Information);
                Log("Remote server URL " + AppCommon.GetRemoteWebApiUrl() + " . ", EventLogEntryType.Information);
                Log("Saving files to " + GetFileSaveDirectory() + " . ", EventLogEntryType.Information);
                // purge old files older than the specified number of hours if purge enabled
                int countOfPurgedFiles = 0;
                if (AppCommon.IsPurgeOldFilesEnabled())
                {
                    countOfPurgedFiles = AppCommon.PurgeOldFiles(GetFileSaveDirectory(), AppCommon.GetPurgeAgeHours());
                    if (countOfPurgedFiles > 0)
                    {
                        AppCommon.Log("Purged " + countOfPurgedFiles.ToString() + " files from " + GetFileSaveDirectory() + " .", EventLogEntryType.Information);
                    }
                }
            }
            catch (Exception e)
            {
                string message = AppendInnerExceptionMessages("Could not start the App Engine - " + e.Message, e);
                Log(message, EventLogEntryType.Error);
                Log("App Engine stopped.", EventLogEntryType.Error);
            }
        } // StartAppEngine()
 public IHttpActionResult PalletsIndexPrinterFriendly()
 {
     try
     {
         // create report object, Url is the public location where it can be viewed with a browser
         Report report = new Report();
         report.Name       = "PalletsIndexPrinterFriendly";
         report.Filename   = "PalletsIndexPrinterFriendly";
         report.SaveFormat = WdSaveFormat.wdFormatPDF;
         report.Extension  = AppCommon.GetExtensionFromWdSaveFormat(report.SaveFormat);
         report.Url        = AppCommon.BuildUrl(AppCommon.GetAppEngineUrl(), report.Filename + "." + AppCommon.GetExtensionFromWdSaveFormat(report.SaveFormat), AppCommon.GetAppEnginePort());
         // generate the report
         ReportManager.GenerateReport(report);
         // return the report properties
         return(Ok(report));
     }
     catch (Exception e)
     {
         string message = AppCommon.AppendInnerExceptionMessages("ReportsController.PalletsIndexPrinterFriendly = " + e.Message, e);
         AppCommon.Log(message, EventLogEntryType.Error);
         throw new Exception(message);
     }
 } // PalletsIndexPrinterFriendly()