Пример #1
0
        public static async Task RunMsPublisher()
        {
            //Thread.Sleep(40000);
            if (ShowWindow)
            {
                Console.WriteLine("Checking for Certificates");
            }

            var certs = await CertRepository.GetNewCertificatesAsync();

            var batchId = DateTime.Now.ToString("yyyyMMdd-HHmm");

            if (ShowWindow)
            {
                Console.WriteLine(certs.Count() + " Found.  Batch Id = " + batchId);
            }

            if (!certs.Any())
            {
                return;
            }


            foreach (var cert in certs)
            {
                Console.WriteLine(cert.ID + " - " + cert.CertType + " - " + cert.Dojo + " = " + cert.FullName + " = " + batchId);
            }

            var app = new Application();

            app.ActiveWindow.Visible = true;


            LogData.LogLine("BATCH:  " + batchId, batchId);
            LogData.LogLine("==============================", batchId);
            LogData.LogLine($" ", batchId);
            LogData.LogLine($" ", batchId);

            foreach (vwCertificate certificate in certs)
            {
                certificate.BatchID = batchId;
                await PrintOutCertificateAsync(app, certificate);

                LogData.LogLine($"{certificate.ID}: {certificate.CertType} - {certificate.Dojo} - {certificate.FullName} - ", batchId);
            }

            LogData.LogLine($" ", batchId);
            LogData.LogLine($" ", batchId);
            LogData.LogLine("==============================", batchId);
            LogData.LogLine("TOTAL CERTS:  " + certs.Count().ToString(), batchId);

            LogData.PrintFile(batchId);

            app.Quit();

            GC.Collect();
            GC.WaitForPendingFinalizers();
            GC.Collect();
            GC.WaitForPendingFinalizers();
        }
Пример #2
0
 public void Dispose()
 {
     if (_appPub != null)
     {
         _appPub.Quit();
         _appPub = null;
         GC.Collect();
     }
 }