public async Task <int> ProcessMessagesAsync()
        {
            if (_asyncActions != null & _asyncActions.Count > 0)
            {
                var theQueue = await(new QueueClient(_queueName, _storageAccount)).GetQueueAsync();

                await theQueue.FetchAttributesAsync();

                var msgCount = theQueue.ApproximateMessageCount;

                if (msgCount > 0)
                {
                    var idx = 0;

                    while (idx <= msgCount - 1)
                    {
                        var msg = await theQueue.GetMessageAsync();

                        if (msg != null)
                        {
                            ServicesContainer.Get <IWaitingPanel>().Wait(ResStrConst.ProcessItem("Message"), msg.Id);

                            if (await ProcessBlobMsgAsync(msg))
                            {
                                await theQueue.DeleteMessageAsync(msg);

                                idx += 1;
                            }
                            else
                            {
                                break;
                            }
                        }
                        else
                        {
                            break;
                        }
                    }

                    SPC.ServicesContainer.Get <IAlert>().Alert($"Processed {msgCount} messages.");

                    return(idx);
                }
                else
                {
                    SPC.ServicesContainer.Get <IAlert>().Alert("No message to process!!!".Translate());
                }
            }
            else
            {
                SPC.ServicesContainer.Get <IAlert>().Alert("No processing actions defined".Translate());
            }

            // End If

            return(0);
        }
Exemple #2
0
 public void OpenDocument(string pURL, Dictionary <string, string> options)
 {
     if (System.IO.File.Exists(pURL))
     {
     }
     else if (System.IO.Directory.Exists(pURL))
     {
         Process_Start(pURL);
     }
     else
     {
         SPC.ServicesContainer.Get <IAlert>().Alert(ResStrConst.DoesNotExists(pURL, "Open"));
     }
 }