/// <summary>
		/// Starts the visualization of a process.
		/// </summary>
		/// <param name="process">Process to be visualized.</param>
		public void ProcessStarting(VisualizableProcess process)
		{			
			if (process == null) throw new ArgumentNullException("process");

			_processesDictionary.Add(process.Guid, process);						
			VisualizeProcesses();
		}
		/// <summary>
		/// Ends the visualization of a process.
		/// </summary>
		/// <param name="process">Process which has ended.</param>
		public void ProcessCompleted(VisualizableProcess process)
		{
			if (process == null) throw new ArgumentNullException("process");

			_processesDictionary.Remove(process.Guid);
			VisualizeProcesses();
		}
Beispiel #3
0
        /// <summary>
        /// Ends the visualization of a process.
        /// </summary>
        /// <param name="process">Process which has ended.</param>
        public void ProcessCompleted(VisualizableProcess process)
        {
            if (process == null)
            {
                throw new ArgumentNullException("process");
            }

            _processesDictionary.Remove(process.Guid);
            VisualizeProcesses();
        }
Beispiel #4
0
        /// <summary>
        /// Starts the visualization of a process.
        /// </summary>
        /// <param name="process">Process to be visualized.</param>
        public void ProcessStarting(VisualizableProcess process)
        {
            if (process == null)
            {
                throw new ArgumentNullException("process");
            }

            _processesDictionary.Add(process.Guid, process);
            VisualizeProcesses();
        }
Beispiel #5
0
        /// <summary>
        /// Sets up the mouse cursor and status bar, according to what is current running.
        /// </summary>
        private void VisualizeProcesses()
        {
            //ascertain which cursor to display, an arrow, an arrow & hourglass, or hourglass, or an overridden (seized) cursor
            Cursor newCursor = Cursors.Arrow;

            if (_seizedCursor == null)
            {
                if (_processesDictionary.Count > 0)
                {
                    newCursor = Cursors.AppStarting;
                    foreach (DictionaryEntry entry in _processesDictionary)
                    {
                        VisualizableProcess process = entry.Value as VisualizableProcess;
                        if (process != null && process.AllowUserInteraction == false)
                        {
                            newCursor = Cursors.WaitCursor;
                        }
                    }
                }
            }
            else
            {
                //cursor has been overridden
                newCursor = _seizedCursor;
            }

            Action hack = () =>
            {
                //display the cursor
                _owner.Cursor = newCursor;

                //set the staus bar
                if (_statusBarPanel != null)
                {
                    //ascertain the new text
                    string newText = _awaitingText == null ? "" : _awaitingText;
                    System.Collections.IDictionaryEnumerator de = _processesDictionary.GetEnumerator();
                    if (de.MoveNext())
                    {
                        VisualizableProcess oldestProcess = de.Value as VisualizableProcess;
                        if (oldestProcess != null)
                        {
                            newText = oldestProcess.Description;
                        }
                    }
                    _statusBarPanel.Text = newText;
                }
            };

            if (_owner.Visible)
            {
                _owner.Invoke(hack);
            }
        }
		/// <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.MessageViewer.DisplayMessage(e.QSetQueueItem, e.Message);		
			
			base.TaskManager.MenuStateManger.SetAllMenusState();				
			base.PrimaryObjects.ProcessVisualizer.ProcessCompleted(process);			
		}
Beispiel #7
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();
                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);			

				//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));	
			}
		}
Beispiel #8
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;
		}
Beispiel #9
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));	
		}
		/// <summary>
		/// Constructs the object.
		/// </summary>
		/// <param name="process">Process which can be visualized.</param>
		public VisualizableProcessEventArgs(VisualizableProcess process)
		{
			_process = process;
		}
Beispiel #11
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);
		}
Beispiel #12
0
		/// <summary>
		/// Pugres the queue contents from the QSetQueueItem.
		/// </summary>
		/// <param name="queueItem">Item which contains the quue to be purged.</param>
		public void PurgeQueue(QSetQueueItem queueItem)
		{
			QSetMessageQueue queue = queueItem.QSetMessageQueue;

			string confirmationMessage = string.Format(Locale.UserMessages.ConfirmQueuePurge, string.Format(@"{0}\{1}", queue.MachineName, queue.QueueName));					

			if (WindowsForms.MessageBox.Show(_primaryForms.EnvironmentForm, confirmationMessage, Locale.ApplicationName, WindowsForms.MessageBoxButtons.YesNoCancel, WindowsForms.MessageBoxIcon.Question, WindowsForms.MessageBoxDefaultButton.Button3) == WindowsForms.DialogResult.Yes)
			{
				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);							
				}										
			}
		}
Beispiel #13
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);

		}
Beispiel #14
0
 /// <summary>
 /// Constructs the object.
 /// </summary>
 /// <param name="process">Process which can be visualized.</param>
 public VisualizableProcessEventArgs(VisualizableProcess process)
 {
     _process = process;
 }
Beispiel #15
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;
		}