Пример #1
0
        /// <summary>
        /// Deletes selected messages from a queue without prompting the user.
        /// </summary>
        private void DoDeleteSelectedMessagesFromQueue(MessageBrowser messageBrowser)
        {
            //visualize
            VisualizableProcess process = new VisualizableProcess(
                string.Format(Locale.UserMessages.RetrievingMessages, messageBrowser.SelectedItems.Count > 1 ? "s" : ""), false);

            _primaryObjects.ProcessVisualizer.ProcessStarting(process);

            try
            {
                //delete all selected messages
                while (messageBrowser.SelectedItems.Count > 0)
                {
                    messageBrowser.QSetQueueItem.QSetMessageQueue.ReceiveById(((MessageListViewItem)messageBrowser.SelectedItems[0]).Message.Id);
                    messageBrowser.SelectedItems[0].Remove();
                }
            }
            catch (Exception exc)
            {
                WindowsForms.MessageBox.Show(_primaryForms.EnvironmentForm, string.Format(Locale.UserMessages.UnableToDeleteMessage, exc.Message), Locale.ApplicationName, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
            }

            //tidyup UI
            _taskManager.MenuStateManger.SetAllMenusState();
            _primaryObjects.ProcessVisualizer.ProcessCompleted(process);
        }
Пример #2
0
        /// <summary>
        /// Handles event fired when an item in a MessageBrowser is selected
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MessageBrowser_SelectedMessageChanged(Mulholland.QSet.Application.Controls.MessageBrowser sender, SelectedMessageChangedEventArgs e)
        {
            VisualizableProcess process = new VisualizableProcess(Locale.UserMessages.DisplayingMessage);

            base.PrimaryObjects.ProcessVisualizer.ProcessStarting(process);

            PrimaryControls.DisplayQSetMessage(e.QSetQueueItem, e.Message);

            base.TaskManager.MenuStateManger.SetAllMenusState();
            base.PrimaryObjects.ProcessVisualizer.ProcessCompleted(process);
        }
Пример #3
0
 /// <summary>
 /// Handles event fired just before node is been selected within the tree view.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void _qsetTreeView_BeforeSelect(object sender, TreeViewCancelEventArgs e)
 {
     if (((QSetItemTreeNode)e.Node).QSetItem is QSetQueueItem)
     {
         _selectingItemProcess = new VisualizableProcess(Locale.UserMessages.RetrievingQueueProperties);
     }
     else
     {
         _selectingItemProcess = new VisualizableProcess();
     }
     OnBeforeQSetItemActivated(new VisualizableProcessItemAffectedEventArgs(_selectingItemProcess, ((QSetItemTreeNode)e.Node).QSetItem));
 }
Пример #4
0
        /// <summary>
        /// Performs a bulk message send.
        /// </summary>
        /// <param name="recipientQueues">Array of queues to send to.</param>
        /// <param name="message">Message to send.</param>
        /// <param name="copies">Number of copies of the message to send to each queue.</param>
        public void BulkSend(MessageQueue[] recipientQueues, Message message, int copies)
        {
            //TODO get this method to receive an array of messages, and return an object conataining all messages, queues which were not sent

            VisualizableProcess process = new VisualizableProcess(string.Format("Sending message{0}...", copies > 1 ? "s" : ""), false);

            _primaryObjects.ProcessVisualizer.ProcessStarting(process);

            try
            {
                foreach (MessageQueue queue in recipientQueues)
                {
                    try
                    {
                        for (int i = 0; i < copies; i++)
                        {
                            SendMessage(queue, message);
                        }
                    }
                    catch (Exception exc)
                    {
                        string errorMsg = string.Format("Unable to send message to {0}.", queue.QueueName);
                        if (copies > 1)
                        {
                            errorMsg += "\n\nNo further attempt will be made to send messages to this queue.";
                        }
                        errorMsg += string.Format("\n\n{0}", exc);

                        WindowsForms.MessageBox.Show(
                            _primaryForms.EnvironmentForm,
                            errorMsg,
                            Locale.ApplicationName,
                            System.Windows.Forms.MessageBoxButtons.OK,
                            System.Windows.Forms.MessageBoxIcon.Exclamation);
                    }
                }
            }
            catch (Exception exc)
            {
                WindowsForms.MessageBox.Show(
                    _primaryForms.EnvironmentForm,
                    string.Format("Encoutered an error during send:\n\n{0}", exc.Message),
                    Locale.ApplicationName,
                    System.Windows.Forms.MessageBoxButtons.OK,
                    System.Windows.Forms.MessageBoxIcon.Exclamation);
            }

            _primaryObjects.ProcessVisualizer.ProcessCompleted(process);
        }
Пример #5
0
        /// <summary>
        /// Pugres the queue contents from the QSetQueueItem.
        /// </summary>
        /// <param name="queueItem">Item which contains the quue to be purged.</param>
        public void PurgeQueueWithoutPrompt(QSetQueueItem queueItem)
        {
            QSetMessageQueue queue = queueItem.QSetMessageQueue;

            VisualizableProcess process = new VisualizableProcess(Locale.UserMessages.PurgingQueue, false);

            try
            {
                _primaryObjects.ProcessVisualizer.ProcessStarting(process);
                queue.Purge();
            }
            catch (Exception exc)
            {
                WindowsForms.MessageBox.Show(_primaryForms.EnvironmentForm, string.Format(Locale.UserMessages.UnableToPurgeQueue, exc.Message), Locale.ApplicationName, WindowsForms.MessageBoxButtons.OK, WindowsForms.MessageBoxIcon.Exclamation);
            }
            finally
            {
                _primaryObjects.ProcessVisualizer.ProcessCompleted(process);
            }
        }
Пример #6
0
        /// <summary>
        /// Aborts the current thread loading messages, if a thread is running.
        /// </summary>
        private void AttemptMessageLoadStart()
        {
            lock (this)
            {
                //abort any current load
                if (_messageLoadThread != null)
                {
                    FinishMessageLoad(true);
                }

                messagesListView.Items.Clear();

                if (_qSetQueueItem != null)
                {
                    workingPanel.Visible = true;
                }

                //create the required column headers
                messagesListView.Clear();
                foreach (string columnName in _userSettings.MessageBrowserColumnListCollection)
                {
                    messagesListView.Columns.Add(columnName, (messagesListView.Width - 10) / _userSettings.MessageBrowserColumnListCollection.Count, HorizontalAlignment.Left);
                }

                if (_qSetQueueItem != null)
                {
                    //start the worker thread
                    _startedEvent.Reset();
                    ThreadPool.QueueUserWorkItem(new WaitCallback(GetSnapShotCallBack));
                    _startedEvent.WaitOne();

                    //set up the visualisable process
                    _workingProcess = new VisualizableProcess(Locale.UserMessages.RetrievingMessages, true);
                    OnBeforeMessageListLoaded(new VisualizableProcessEventArgs(_workingProcess));
                }
            }
        }
Пример #7
0
 /// <summary>
 /// Handles event fired when a node has been selected within the tree view.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void _qsetTreeView_AfterSelect(object sender, TreeViewEventArgs e)
 {
     OnAfterQSetItemActivatedEvent(new VisualizableProcessItemAffectedEventArgs(_selectingItemProcess, ((QSetItemTreeNode)e.Node).QSetItem));
     _selectingItemProcess = null;
 }
Пример #8
0
 /// <summary>
 /// Constructs the event arguments class.
 /// </summary>
 /// <param name="process">Process which can be visualized.</param>
 /// <param name="item">Item associated with the event.</param>
 public VisualizableProcessItemAffectedEventArgs(VisualizableProcess process, QSetItemBase item)
     : base(process)
 {
     _item = item;
 }