Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public partial class FrmMain : Form
- {
- private BatchProcessor batchProcessor;
- private BatchManager batchManager;
- public FrmMain()
- {
- InitializeComponent();
- }
- private void BatchPolling()
- {
- // ...
- }
- private void UpdateUI()
- {
- // ... Do custom stuff here ...
- }
- private void FrmMain_Load(object sender, EventArgs e)
- {
- try
- {
- batchProcessor = new BatchProcessor();
- batchManager = new BatchManager(batchProcessor.CustomModuleId);
- batchManager.LoginToRuntimeSession();
- timerBatchPolling.Enabled = true;
- }
- catch (Exception exception)
- {
- throw exception;
- }
- }
- private void FrmMain_FormClosed(object sender, FormClosedEventArgs e)
- {
- timerBatchPolling.Enabled = false;
- try
- {
- // ...
- }
- catch (Exception exception)
- {
- throw exception;
- }
- }
- private void timerBatchPolling_Tick(object sender, EventArgs e)
- {
- BatchPolling();
- UpdateUI();
- }
- }
- internal class BatchProcessor
- {
- private const string CUSTOM_MODULE_ID = "StampOnScanProcess";
- private const string BATCH = "Batch";
- private const string DOCUMENTS = "Documents";
- private const string DOCUMENT = "Document";
- private const string PDF_GENERATION_FILE_NAME = "PDFGenerationFileName";
- public string CustomModuleId { get { return CUSTOM_MODULE_ID; } }
- public void Process(IBatch batch)
- {
- IACDataElement rootElement = batch.ExtractRuntimeACDataElement(0);
- IACDataElement batchElement = rootElement.FindChildElementByName(BATCH);
- IACDataElementCollection currentDocuments = batchElement.FindChildElementByName(DOCUMENTS).FindChildElementsByName(DOCUMENT);
- for (int i = 0; i < currentDocuments.Count; i++)
- {
- int currentPageIndex = i + 1;
- IACDataElement currentDocument = currentDocuments[currentPageIndex];
- string documentFilePath = currentDocument[PDF_GENERATION_FILE_NAME];
- // !!! Manipulate the PDF file here !!!
- }
- }
- }
- internal class BatchManager
- {
- private Login currentSession;
- public BatchManager(string customModuleId)
- {
- // ...
- }
- public void LoginToRuntimeSession()
- {
- if (currentSession == null)
- {
- currentSession = new Login();
- string applicationName = Application.ExecutablePath;
- // strPathName = Right(strPathName, 12);
- // strPathName = Left(strPathName, 8);
- currentSession.Login();
- currentSession.ApplicationName = applicationName;
- }
- // currentSession.ValidateUser(/* UniqueID */);
- IRuntimeSession runtimeSession = null; // DirectCast(currentSession.RuntimeSession, RuntimeSession);
- runtimeSession.BatchAvailable += RuntimeSession_BatchAvailable;
- }
- private void RuntimeSession_BatchAvailable()
- {
- // ...
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement