/// <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); }
/// <summary> /// Removes the MessageBrowser at the specified index. /// </summary> /// <param name="index">Index to remove at.</param> public void RemoveAt(int index) { MessageBrowser messageBrowser = null; lock (this) { messageBrowser = (MessageBrowser)base.BaseGet(index); base.BaseRemoveAt(index); } if (messageBrowser != null) { OnItemRemoved(new MessageBrowserCollection.ItemMovedEventArgs(messageBrowser)); } }
/// <summary> /// Adds a MessageBrowser to the collection. /// </summary> /// <param name="messageBrowser">MessageBrowser to add.</param> /// <exception cref="System.ArgumentNullException">Thrown if any arguments are set to null.</exception> public void Add(string key, MessageBrowser messageBrowser) { if (key == null) { throw new ArgumentNullException("key"); } if (messageBrowser == null) { throw new ArgumentNullException("messageBrowser"); } if (this.Exists(key)) { throw new ArgumentOutOfRangeException("key", "Key already exists in collection."); } base.BaseAdd(key, messageBrowser); OnItemAdded(new MessageBrowserCollection.ItemMovedEventArgs(messageBrowser)); }
/// <summary> /// Handles an exception whilst a message browser is loading messages. /// </summary> /// <param name="sender"></param> /// <param name="a"></param> private void MessageBrowser_MessageLoadException(MessageBrowser sender, MessageLoadExceptionEventArgs e) { base.PrimaryObjects.ProcessVisualizer.SeizeCursor(Cursors.Arrow); MessageBox.Show(e.Exception.Message, Locale.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Warning); base.PrimaryObjects.ProcessVisualizer.ReleaseCursor(); }
/// <summary> /// Constructs the object with the minum requirements. /// </summary> /// <param name="item">Item that was added or removed.</param> public ItemMovedEventArgs(MessageBrowser item) { _item = item; }
/// <summary> /// Adds a MessageBrowser to the collection. /// </summary> /// <param name="messageBrowser">MessageBrowser to add.</param> /// <exception cref="System.ArgumentNullException">Thrown if any arguments are set to null.</exception> public void Add(string key, MessageBrowser messageBrowser) { if (key == null) throw new ArgumentNullException("key"); if (messageBrowser == null) throw new ArgumentNullException("messageBrowser"); if (this.Exists(key)) throw new ArgumentOutOfRangeException("key", "Key already exists in collection."); base.BaseAdd(key, messageBrowser); OnItemAdded(new MessageBrowserCollection.ItemMovedEventArgs(messageBrowser)); }
/// <summary> /// Constructs the object with the minum requirements. /// </summary> /// <param name="item">Item that was added or removed.</param> public ItemMovedEventArgs(MessageBrowser item) { _item = item; }
/// <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); }
/// <summary> /// Loads anew MessageBrowser, and displays in the main document window. /// </summary> /// <param name="qsetQueueItem">QSetQueueItem to display.</param> /// <returns>The added DockControl hosting the MessageBrowser if successful, else false.</returns> private DockControl LoadNewMessageBrowser(QSetQueueItem qsetQueueItem) { DockControl newDockControl = null; //set up a new message browser, and create adock for it MessageBrowser messageBrowser = new MessageBrowser(); messageBrowser.UserSettings = _primaryObjects.UserSettings; _primaryControls.MessageBrowserCollection.Add(qsetQueueItem.ID.ToString(), messageBrowser); newDockControl = new TabbedDocument(_primaryControls.DocumentContainer.Manager, messageBrowser, qsetQueueItem.Name); newDockControl.Open(); messageBrowser.ImageList = _primaryControls.Images.Icon16ImageList; //pass the qsetitem to the message browser to load the queue try { messageBrowser.QSetQueueItem = qsetQueueItem; newDockControl.Activate(); } catch (Exception exc) { _primaryObjects.ProcessVisualizer.SeizeCursor(Cursors.Arrow); MessageBox.Show(exc.Message, Locale.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Warning); _primaryObjects.ProcessVisualizer.ReleaseCursor(); newDockControl.Close(); newDockControl = null; } return newDockControl; }