/// <summary>
        /// This method causes the communication listener to close. Close is a terminal state and
        /// this method allows the communication listener to transition to this state in a
        /// graceful manner.
        /// </summary>
        /// <param name="cancellationToken">Cancellation token</param>
        /// <returns>
        /// A <see cref="T:System.Threading.Tasks.Task">Task</see> that represents outstanding operation.
        /// </returns>
        public async Task CloseAsync(CancellationToken cancellationToken)
        {
            WriteLog("Service Bus Communication Listener closing");
            IsClosing = true;
            _stopProcessingMessageTokenSource.Cancel();

            //Wait for Message processing to complete..
            await Task.WhenAny(
                // Timeout task.
                Task.Delay(CloseTimeout, cancellationToken),
                // Wait for all processing messages to finish by stealing semaphore entries.
                Task.Run(() =>
            {
                for (int i = 0; i < (MaxConcurrentCalls ?? 1); i++)
                {
                    // ReSharper disable once AccessToDisposedClosure
                    // ReSharper disable once EmptyGeneralCatchClause
                    try { ProcessingMessage.Wait(cancellationToken); }
                    catch { }
                }
            }, cancellationToken));

            ProcessingMessage.Dispose();
            await CloseImplAsync(cancellationToken);
        }
示例#2
0
        public void ChekMessageTestExitMessage()
        {
            if (!MessageQueue.Exists(@".\private$\ChekMessageTestExitMessage"))
            {
                MessageQueue.Create(@".\private$\ChekMessageTestExitMessage");
            }

            if (!MessageQueue.Exists(@".\private$\ChekMessageTestExitSendMessage"))
            {
                MessageQueue.Create(@".\private$\ChekMessageTestExitSendMessage");
            }

            if (!MessageQueue.Exists(@".\private$\ChekMessageTestExitReciveMessage"))
            {
                MessageQueue.Create(@".\private$\ChekMessageTestExitReciveMessage");
            }

            MessageQueue testQueue = new MessageQueue(@".\private$\ChekMessageTestExitMessage");

            testQueue.Formatter = new BinaryMessageFormatter();

            ExitMessage testMessage = new ExitMessage(0, 0);

            testQueue.Send(testMessage);

            Agent agent = new Agent(0, null, @".\private$\ChekMessageTestExitSendMessage", @".\private$\ChekMessageTestExitReciveMessage");

            ProcessingMessage.agentsList.Add(agent);
            agent.SetConnect();

            Assert.AreEqual(ProcessingMessage.ChekMessage(testQueue), (int)EnumTypeMessage.ExitMessage);

            MessageQueue.Delete(@".\private$\ChekMessageTestExitMessage");
        }
        private bool saveData()
        {
            procMsg = new ProcessingMessage("Saving Customer Data");
            SetButtonState(false);
            var bw = new BackgroundWorker();

            bw.DoWork             += bw_DoWork;
            bw.RunWorkerCompleted += bw_RunWorkerCompleted;
            bw.RunWorkerAsync();
            procMsg.ShowDialog(this);
            if (retValue)
            {
                MessageBox.Show(Commons.GetMessageString("CustCreationSuccess"));
                var custObject = CustomerProcedures.getCustomerDataByCustomerNumber(GlobalDataAccessor.Instance.DesktopSession, custNumber);
                if (custObject != null)
                {
                    GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer = custObject;
                    return(true);
                }
                else
                {
                    //error since the customer object could not be retrieved after save
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
 public void Start()
 {
     _consumer.OnMessageReceived += (sender, e) =>
     {
         var body = System.Text.Encoding.UTF8.GetString(e.Context.GetBody());
         try
         {
             var commandMessage = JsonConvert.DeserializeObject <CommandMessage>(body);
             var messageTypes   = _commandHandlerProvider.GetMessageTypes();
             if (!messageTypes.ContainsKey(commandMessage.CommandTypeName))
             {
                 _logger.Warn($"Command type not found: {commandMessage.CommandTypeName}, Body={body}");
                 e.Context.Ack();
                 return;
             }
             var messageType = messageTypes[commandMessage.CommandTypeName];
             var command     = (ICommand)JsonConvert.DeserializeObject(commandMessage.CommandData, messageType);
             command.MergeExtraDatas(commandMessage.ExtraDatas);
             var processingCommand = new ProcessingMessage(command, new CommandExecutingContext(_logger, e.Context), commandMessage.ExtraDatas);
             _commandProcessor.Process(processingCommand);
         }
         catch (Exception ex)
         {
             _logger.Error($"Consume command fail: {ex.Message}, Body={body}", ex);
         }
     };
     _commandProcessor.Start();
     _consumer.Start();
 }
        public void ChekMessageTaskStopProcessingMessage()
        {
            if (!MessageQueue.Exists(@".\private$\ChekMessageTaskStopProcessingMessage"))
            {
                MessageQueue.Create(@".\private$\ChekMessageTaskStopProcessingMessage");
            }

            MessageQueue testQueue = new MessageQueue(@".\private$\ChekMessageTaskStopProcessingMessage");

            testQueue.Formatter = new BinaryMessageFormatter();

            Task          task       = new Task("test", 1);
            List <Thread> listThread = new List <Thread>();

            Agent.tasksList.Add(task);
            Agent.threadDictionary.Add(1, listThread);

            TaskStopProcessingMessage testMessage = new TaskStopProcessingMessage(0, 0, 1);

            testQueue.Send(testMessage);

            Assert.AreEqual((int)EnumTypeMessage.TaskStopProcessingMessage, ProcessingMessage.ChekMessage(testQueue));
            Assert.AreEqual(0, Agent.tasksList.Count);

            MessageQueue.Delete(@".\private$\ChekMessageTaskStopProcessingMessage");
        }
示例#6
0
        public void ChekMessageTestHalloMessage()
        {
            if (!MessageQueue.Exists(@".\private$\ChekMessageTestReceiveHalloMessage"))
            {
                MessageQueue.Create(@".\private$\ChekMessageTestReceiveHalloMessage");
            }

            MessageQueue testQueue = new MessageQueue(@".\private$\ChekMessageTestReceiveHalloMessage");

            testQueue.Formatter = new BinaryMessageFormatter();

            SystemInformation info = new SystemInformation();

            HalloMessage testMessage = new HalloMessage(0, 0, info);

            testQueue.Send(testMessage);

            Thread testThread = new Thread(testChekMessageReceiveHalloMessage);

            testThread.Start();

            Assert.AreEqual(ProcessingMessage.ChekMessage(testQueue), (int)EnumTypeMessage.HelloMessage);

            MessageQueue.Delete(@".\private$\ChekMessageTestReceiveHalloMessage");
            MessageQueue.Delete(@".\private$\secondrecive1");
            MessageQueue.Delete(@".\private$\secondsend1");
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public bool Setup()
        {
            //Processing message
            var pMesg = new ProcessingMessage("* AUDIT QUERY APP SETUP *");

            pMesg.Show();

            //Initialize database connection, LDAP connection, and ShopTime
            var confRef = SecurityAccessor.Instance.EncryptConfig;

            if (confRef == null)
            {
                return(false);
            }

            this.userState = UserDesktopState.NOTLOGGEDIN;
            this.UserName  = string.Empty;

            GlobalDataAccessor.Instance.Init(
                this, confRef, "AuditQueryApp",
                auditLogEnabledChangeHandlerBase,
                auditLogMessageHandlerBase, false);

            pMesg.Close();
            pMesg.Dispose();
            return(true);
        }
 /// <summary>
 /// 入队
 /// </summary>
 /// <param name="processingMessage"></param>
 public void Enqueue(ProcessingMessage processingMessage)
 {
     if (_disposing == 1)
     {
         return;
     }
     if (processingMessage == null)
     {
         throw new ArgumentNullException(nameof(processingMessage));
     }
     if (processingMessage.Message == null)
     {
         throw new ArgumentNullException(nameof(processingMessage), $"Property \"{nameof(processingMessage.Message)}\" cann't be null.");
     }
     if (processingMessage.Message.BusinessKey != BusinessKey)
     {
         throw new InvalidOperationException($"Message's business key \"{processingMessage.Message.BusinessKey}\" is not equal with mailbox's, businessKey: {BusinessKey}, subscriber: {Subscriber}, messageId: {processingMessage.Message.Id}, messageType: {processingMessage.Message.GetMessageTypeName()}, timestamp: {processingMessage.Message.Timestamp.ToString("yyyy-MM-dd HH:mm:ss")}.");
     }
     lock (_lockObj)
     {
         processingMessage.Sequence = _nextSequence;
         if (_processingMessageDict.TryAdd(processingMessage.Sequence, processingMessage))
         {
             _nextSequence++;
             TryRun();
         }
         else
         {
             _logger.Error($"{GetType().Name} enqueue message failed, businessKey: {BusinessKey}, subscriber: {Subscriber}, messageId: {processingMessage.Message.Id}, messageType: {processingMessage.Message.GetMessageTypeName()}, messageSequence: {processingMessage.Sequence}");
         }
     }
 }
示例#9
0
        private static void RunApplication()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            try
            {
                // decrypt pawnsec information from config file
                var pMesg = new ProcessingMessage("** AUDIT QUERY APP INIT **", 4000);
                pMesg.Show();
                string key = Resources.PrivateKey;

                string dbHost     = StringUtilities.Decrypt(Settings.Default.PawnSecDBHost, key, true);
                string dbPassword = StringUtilities.Decrypt(Settings.Default.PawnSecDBPassword, key, true);
                string dbPort     = StringUtilities.Decrypt(Settings.Default.PawnSecDBPort, key, true);
                string dbSchema   = StringUtilities.Decrypt(Settings.Default.PawnSecDBSchema, key, true);
                string dbService  = StringUtilities.Decrypt(Settings.Default.PawnSecDBService, key, true);
                string dbUser     = StringUtilities.Decrypt(Settings.Default.PawnSecDBUser, key, true);

                if (!(string.IsNullOrEmpty(dbHost) || string.IsNullOrEmpty(dbPassword) || string.IsNullOrEmpty(dbPort) ||
                      string.IsNullOrEmpty(dbSchema) || string.IsNullOrEmpty(dbService) || string.IsNullOrEmpty(dbUser)))
                {
                    //Update message
                    pMesg.Message = "** AUDIT QUERY APP SECURITY INIT **";

                    // create connection with PawnSec
                    SecurityAccessor.Instance.InitializeConnection(dbHost, dbPassword, dbPort, dbSchema, dbService, dbUser);

                    // retrieve data from PawnSec
                    if (!SecurityAccessor.Instance.RetrieveSecurityData(key, ComputeAppHash(), true, PawnSecApplication.AuditQueries))
                    {
                        pMesg.Close();
                        pMesg.Dispose();
                        //TODO: Log error and report exception
                        //No security data means this machine is not allowed to access Cashlinx
                        //Fail immediately.
                    }
                    //Otherwise, the machine is now authenticated to run AuditQueries, proceed with execution
                    else
                    {
                        pMesg.Close();
                        pMesg.Dispose();
                        Application.Run(new AuditQueriesForm());
                    }
                }
                else
                {
                    pMesg.Close();
                    pMesg.Dispose();
                }
            }
            catch (Exception eX)
            {
                MessageBox.Show("Exception caught in CashlinxDesktop.Program during Application.Run: " + "\nMessage    : " + eX.Message +
                                "\nStack Trace: " + eX.StackTrace + "\nTarget Site: " + eX.TargetSite + "\nSource     : " + eX.Source +
                                "\nData       :  " + eX.Data + "\nTerminating Application!", "Application Exception", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                Application.Exit();
            }
        }
示例#10
0
        public void SendMessageArrayTest()
        {
            SystemInformation info = new SystemInformation();

            info.CountCore          = 4;
            info.PasswordsPerSecond = 100000;


            Agent agentOne   = new Agent(0, info, @".\private$\SendMessageArrayTestSend1", @".\private$\SendMessageArrayTestReceive1");
            Agent agentTwo   = new Agent(0, info, @".\private$\SendMessageArrayTestSend2", @".\private$\SendMessageArrayTestReceive2");
            Agent agentThree = new Agent(0, info, @".\private$\SendMessageArrayTestSend3", @".\private$\SendMessageArrayTestReceive3");

            if (!MessageQueue.Exists(agentOne.QueueReceiveName))
            {
                MessageQueue.Create(agentOne.QueueReceiveName);
            }

            if (!MessageQueue.Exists(agentTwo.QueueReceiveName))
            {
                MessageQueue.Create(agentTwo.QueueReceiveName);
            }

            if (!MessageQueue.Exists(agentThree.QueueReceiveName))
            {
                MessageQueue.Create(agentThree.QueueReceiveName);
            }

            agentOne.SetConnect();
            agentTwo.SetConnect();
            agentThree.SetConnect();

            Communication.Message testMessage = new Communication.Message(0, 0);
            PingMessage           pingMessage = new Communication.PingMessage(0, 0);

            Communication.Message[] arrayMessage = { testMessage, pingMessage };

            List <Agent> agentList = new List <Agent>()
            {
                agentOne, agentTwo, agentThree
            };

            ProcessingMessage.SendMessageArray(arrayMessage, agentList);

            foreach (var itemAgent in agentList)
            {
                var messageObj = itemAgent.QueueReceive.Receive();
                Communication.Message message = (Communication.Message)messageObj.Body;
                Assert.AreEqual(message.TypeMessage, (int)EnumTypeMessage.Message);

                messageObj = itemAgent.QueueReceive.Receive();
                message    = (Communication.Message)messageObj.Body;
                Assert.AreEqual(message.TypeMessage, (int)EnumTypeMessage.PingMessage);
            }

            MessageQueue.Delete(@".\private$\SendMessageArrayTestReceive1");
            MessageQueue.Delete(@".\private$\SendMessageArrayTestReceive2");
            MessageQueue.Delete(@".\private$\SendMessageArrayTestReceive3");
        }
示例#11
0
            public async Task <bool> HandleAsync(string subscriber, ProcessingMessage processingMessage, IMessageHandlerProvider messageHandlerProvider)
            {
                _queue.Enqueue(processingMessage);
                await Task.Delay(10);

                await processingMessage.CompleteAsync(new MessageExecutingResult(MessageExecutingStatus.Success, processingMessage.Message, subscriber));

                return(true);
            }
 /// <summary>
 /// This method causes the communication listener to close. Close is a terminal state and
 ///             this method allows the communication listener to transition to this state in a
 ///             graceful manner.
 /// </summary>
 /// <param name="cancellationToken">Cancellation token</param>
 /// <returns>
 /// A <see cref="T:System.Threading.Tasks.Task">Task</see> that represents outstanding operation.
 /// </returns>
 public Task CloseAsync(CancellationToken cancellationToken)
 {
     WriteLog("Service Bus Communication Listnener closing");
     _stopProcessingMessageTokenSource.Cancel();
     //Wait for Message processing to complete..
     ProcessingMessage.WaitOne();
     ProcessingMessage.Dispose();
     return(CloseImplAsync(cancellationToken));
 }
 /// <summary>
 /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
 /// </summary>
 protected virtual void Dispose(bool disposing)
 {
     if (!disposing)
     {
         return;
     }
     ProcessingMessage.Set();
     ProcessingMessage.Dispose();
     _stopProcessingMessageTokenSource.Cancel();
     _stopProcessingMessageTokenSource.Dispose();
 }
        private void InventorySummary_Load(object sender, EventArgs e)
        {
            BackgroundWorker bwLoadInventorySummary = new BackgroundWorker();

            bwLoadInventorySummary.DoWork             += new DoWorkEventHandler(bwLoadInventorySummary_DoWork);
            bwLoadInventorySummary.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwLoadInventorySummary_RunWorkerCompleted);
            bwLoadInventorySummary.RunWorkerAsync();

            ProcessingMessage = new ProcessingMessage("Loading summary...", 0);
            ProcessingMessage.ShowDialog(this);
        }
示例#15
0
        private void btnContinue_Click(object sender, EventArgs e)
        {
            if (gvAudits.SelectedRows.Count != 1)
            {
                return;
            }

            InventoryAuditVO audit = gvAudits.SelectedRows[0].Tag as InventoryAuditVO;

            if (audit == null)
            {
                return;
            }

            panelButtons.Enabled = false;
            ProcessingMessage    = new ProcessingMessage("Loading Audit Information", 0);
            ProcessingMessage.Show();
            CommonDatabaseContext dataContext = CreateCommonDatabaseContext();

            InventoryAuditProcedures.GetSummaryInfo(audit, dataContext);
            InventoryAuditProcedures.GetAdditionalAuditInfo(audit, dataContext);
            ProcessingMessage.Close();

            if (!dataContext.Result)
            {
                MessageBox.Show("Error loading CACC information");
                panelButtons.Enabled = true;
                return;
            }

            ADS.ActiveAudit = audit;

            switch (audit.Status)
            {
            case AuditStatus.ACTIVE:
                panelButtons.Enabled       = true;
                NavControlBox.IsCustom     = true;
                NavControlBox.CustomDetail = "VIEWACTIVEAUDIT";
                NavControlBox.Action       = NavBox.NavAction.SUBMIT;
                break;

            case AuditStatus.CLOSED:
                panelButtons.Enabled       = true;
                NavControlBox.IsCustom     = true;
                NavControlBox.CustomDetail = "VIEWCLOSEDAUDIT";
                NavControlBox.Action       = NavBox.NavAction.SUBMIT;
                break;

            default:
                MessageBox.Show("Status not implemented: " + audit.Status.ToString());
                panelButtons.Enabled = true;
                break;
            }
        }
示例#16
0
        private void UploadFromTrakker_Load(object sender, EventArgs e)
        {
            SetButtonStates();
            BackgroundWorker bwLoadTrakkerItems = new BackgroundWorker();

            bwLoadTrakkerItems.DoWork             += new DoWorkEventHandler(bwLoadTrakkerItems_DoWork);
            bwLoadTrakkerItems.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwLoadTrakkerItems_RunWorkerCompleted);
            bwLoadTrakkerItems.RunWorkerAsync();

            ProcessingMessage = new ProcessingMessage("Loading merchandise...", 0);
            ProcessingMessage.ShowDialog(this);
        }
        private void SelectTempIcn_Load(object sender, EventArgs e)
        {
            gvItems.Rows.Clear();

            BackgroundWorker bwLoadTempIcns = new BackgroundWorker();

            bwLoadTempIcns.DoWork             += new DoWorkEventHandler(bwLoadTempIcns_DoWork);
            bwLoadTempIcns.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwLoadTempIcns_RunWorkerCompleted);
            bwLoadTempIcns.RunWorkerAsync();

            ProcessingMessage = new ProcessingMessage("Loading temporary items...", 0);
            ProcessingMessage.ShowDialog(this);
        }
示例#18
0
 /// <summary>
 /// Will pass an incoming message to the <see cref="Receiver"/> for processing.
 /// </summary>
 /// <param name="message"></param>
 /// <param name="cancellationToken"></param>
 protected async Task ReceiveMessageAsync(Message message, CancellationToken cancellationToken)
 {
     try
     {
         ProcessingMessage.Wait(cancellationToken);
         var combined = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, StopProcessingMessageToken).Token;
         await Receiver.ReceiveMessageAsync(message, combined);
     }
     finally
     {
         ProcessingMessage.Release();
     }
 }
示例#19
0
        private void ProcessRequest(ProcessingMessage procReq)
        {
            var tool = ToolsManifest.GetTool(procReq.ToolName);
            if (tool == null)
                throw new ArgumentException(procReq.ToolName + " does not exist.", "procReq");

            var file = _dataSource.GetFileFromUri(procReq.FileUri);
            var output = tool.ProcessFile(file, procReq.FileContentType);
            var outputUri = _dataSource.AddOutput(procReq.ToolName, output.ContentType, output.Content);

            var procCompl = new ProcessingMessage(outputUri, output.ContentType, procReq.ToolName);
            _dataSource.EnqueueProcessingCompletion(procCompl);
        }
        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        protected virtual void Dispose(bool disposing)
        {
            if (!disposing)
            {
                return;
            }

            _stopProcessingMessageTokenSource.Cancel();
            _stopProcessingMessageTokenSource.Dispose();

            ProcessingMessage.Release(MaxConcurrentCalls ?? 1);
            ProcessingMessage.Dispose();
        }
        //activates the search
        private void customButtonFind_Click(object sender, EventArgs e)
        {
            //Proceed to search results form only if the form is validated
            //if (formValidate())
            //{
            //isFormValid = true;
            //load up CashlinxDesktopSession.Instance.InquirySelectionCriteria
            AddShopsToSessionVar();
            AddCriteriaToSessionVar();
            //Validate()?
            procMsg = new ProcessingMessage("Loading Customer Search Results");
            BackgroundWorker bw = new BackgroundWorker();

            bw.DoWork             += new DoWorkEventHandler(bw_DoWork);
            bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
            bw.RunWorkerAsync();
            procMsg.ShowDialog(this);
            //if (_errorMessage.Length > 0)
            //{
            //    errorLabel.Text = _errorMessage;
            //    errorLabel.Visible = true;
            //    return;
            //}
            //}
            //else
            //{
            //    if (errorLabel.Text.Length > 0)
            //        MessageBox.Show(Commons.GetMessageString("FormErrorSubmitAgain"));
            //}

            //for now - build SQL
            //string sql = SelectClause() + FromClause() + WhereClause() + Sort();
            ////if > row - show results screen - else show individual?
            //LoanInquiryResults inquiryResults = new LoanInquiryResults();
            //if (this.radioButtonCustomerSearch.Checked)
            //{
            //    inquiryResults.labelInquiryType.Text = InquiryDataTypes.Customer.ToString() + InquiryConst.RESULTLABEL;
            //}
            //else if (this.radioButtonItemSearch.Checked)
            //{
            //    inquiryResults.labelInquiryType.Text = InquiryDataTypes.Item.ToString() + InquiryConst.RESULTLABEL;
            //}
            //else
            //{
            //    inquiryResults.labelInquiryType.Text = InquiryDataTypes.Loan.ToString() + InquiryConst.RESULTLABEL;
            //}
            //inquiryResults.listCriteria = this.listCriteria;

            //inquiryResults.Show();
        }
示例#22
0
        /// <summary>
        ///
        /// </summary>
        public VoidLoanForm(bool hasResource)
        {
            this.validTicketNumber = false;
            this.validStoreNumber  = false;
            this.LoanChainData     = null;
            this.Loans             = new Dictionary <string, List <LoanVoidDetails> >();
            this.processMsg        = new ProcessingMessage("Retrieving Loan Chain")
            {
                Visible = false
            };

            this.forceOverride = !hasResource; // if user doesn't have resource force the override

            InitializeComponent();
        }
示例#23
0
        private bool saveData()
        {
            procMsg = new ProcessingMessage("Saving Vendor Data");
            SetButtonState(false);
            BackgroundWorker bw = new BackgroundWorker();

            bw.DoWork             += new DoWorkEventHandler(bw_DoWork);
            bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
            bw.RunWorkerAsync();
            procMsg.ShowDialog(this);
            if (retValue)
            {
                return(true);
            }
            return(false);
        }
示例#24
0
 private void Print_PfiChargeOffList_Load(object sender, EventArgs e)
 {
     if (_Records.Count > 0)
     {
         ProcessingMessage myForm = new ProcessingMessage("Please wait while we generate report.");
         myForm.Show();
         PrintQueue();
         myForm.Close();
         myForm.Dispose();
         MessageBox.Show("Printing Complete", "PFI Charge Off Report", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         MessageBox.Show("No records available to print", "PFI Charge Off Report", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     Close();
 }
示例#25
0
 private void Print_AssignPhysicalLocation_Load(object sender, EventArgs e)
 {
     if (_Records.Count > 0)
     {
         ProcessingMessage myForm = new ProcessingMessage("Please wait while we generate report.");
         myForm.Show();
         PrintQueue();
         myForm.Close();
         myForm.Dispose();
         MessageBox.Show("Printing Complete", "Merchandise Location Assignment", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         MessageBox.Show("No records available to print", "Merchandise Location Assignment", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     Close();
 }
        public void ChekMessageTestEmptyMessage()
        {
            if (!MessageQueue.Exists(@".\private$\ChekMessageTestEmptyMessage"))
            {
                MessageQueue.Create(@".\private$\ChekMessageTestEmptyMessage");
            }

            MessageQueue testQueue = new MessageQueue(@".\private$\ChekMessageTestEmptyMessage");

            testQueue.Formatter = new BinaryMessageFormatter();

            Communication.Message testMessage = new Communication.Message(0, 0);
            testQueue.Send(testMessage);

            Assert.AreEqual(ProcessingMessage.ChekMessage(testQueue), (int)EnumTypeMessage.Message);

            MessageQueue.Delete(@".\private$\ChekMessageTestEmptyMessage");
        }
示例#27
0
        /// <summary>
        /// Will pass an incoming message to the <see cref="Receiver"/> for processing.
        /// </summary>
        /// <param name="messageSession">Contains the MessageSession when sessions are enabled.</param>
        /// <param name="message"></param>
        protected async Task ReceiveMessageAsync(BrokeredMessage message, MessageSession messageSession)
        {
            try
            {
                ProcessingMessage.Reset();
                await Receiver.ReceiveMessageAsync(message, messageSession, StopProcessingMessageToken);

                if (Receiver.AutoComplete)
                {
                    await message.CompleteAsync();
                }
            }
            finally
            {
                message.Dispose();
                ProcessingMessage.Set();
            }
        }
        public void ChekMessageMessageNotExist()
        {
            if (!MessageQueue.Exists(@".\private$\ChekMessageMessageNotExist"))
            {
                MessageQueue.Create(@".\private$\ChekMessageMessageNotExist");
            }

            MessageQueue testQueue = new MessageQueue(@".\private$\ChekMessageMessageNotExist");

            testQueue.Formatter = new BinaryMessageFormatter();

            int message = 15;

            testQueue.Send(message);

            Assert.AreEqual(-1, ProcessingMessage.ChekMessage(testQueue));

            MessageQueue.Delete(@".\private$\ChekMessageMessageNotExist");
        }
示例#29
0
        private void btnContinue_Click(object sender, EventArgs e)
        {
            StringBuilder comments = new StringBuilder();

            comments.Append(commentsTextbox.Text);
            ADS.InventoryQuestionsAdditionalComments = comments;
            Reports.CallAuditReport callReport = new Reports.CallAuditReport();
            callReport.SetInventorySummaryCACCData();
            callReport.GetPreAuditReport(true, false);
            btnContinue.Enabled = false;
            BackgroundWorker bwPostAudit = new BackgroundWorker();

            bwPostAudit.DoWork             += new DoWorkEventHandler(bwPostAudit_DoWork);
            bwPostAudit.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwPostAudit_RunWorkerCompleted);
            bwPostAudit.RunWorkerAsync();

            ProcessingMessage = new ProcessingMessage("Posting audit...", 0);
            ProcessingMessage.ShowDialog(this);
        }
示例#30
0
        private void ResolveAssemblylocations(List <string> codeModules, CompilerParameters options, ErrorContext errorContext, AppDomain compilationTempAppDomain)
        {
            AssemblyLocationResolver assemblyLocationResolver = AssemblyLocationResolver.CreateResolver(compilationTempAppDomain);

            for (int num = codeModules.Count - 1; num >= 0; num--)
            {
                try
                {
                    options.ReferencedAssemblies.Add(assemblyLocationResolver.LoadAssemblyAndResolveLocation(codeModules[num]));
                }
                catch (Exception ex)
                {
                    ProcessingMessage processingMessage = errorContext.Register(ProcessingErrorCode.rsErrorLoadingCodeModule, Severity.Error, this.m_expressionHostAssemblyHolder.ObjectType, null, null, codeModules[num], ex.Message);
                    if (Global.Tracer.TraceError && processingMessage != null)
                    {
                        Global.Tracer.Trace(TraceLevel.Error, processingMessage.Message + Environment.NewLine + ex.ToString());
                    }
                }
            }
        }
        public void ChekMessageTestReceiveTaskMessage()
        {
            if (!MessageQueue.Exists(@".\private$\ChekMessageTestReceiveTaskMessage"))
            {
                MessageQueue.Create(@".\private$\ChekMessageTestReceiveTaskMessage");
            }

            MessageQueue testQueue = new MessageQueue(@".\private$\ChekMessageTestReceiveTaskMessage");

            testQueue.Formatter = new BinaryMessageFormatter();
            Task task = new Task("", 0);

            TaskMessage testMessage = new TaskMessage(0, 0, task, "a", "b");

            testQueue.Send(testMessage);

            Assert.AreEqual(ProcessingMessage.ChekMessage(testQueue), (int)EnumTypeMessage.TaskMessage);

            MessageQueue.Delete(@".\private$\ChekMessageTestReceiveTaskMessage");
        }