Exemple #1
0
        private EnvironmentState GetEnvironmentState()
        {
            var qSetExplorerActiveItem = _primaryControls.GetQSetExplorerActiveItem();

            //ascertain the state of the environment
            EnvironmentState environmentState = new EnvironmentState();

            environmentState.IsQSetOpen       = _primaryControls.IsQSetExplorerOpen;
            environmentState.IsQSetDirty      = environmentState.IsQSetOpen && _primaryControls.IsQSetExplorerDirty;
            environmentState.IsQSetItemActive = (environmentState.IsQSetOpen && qSetExplorerActiveItem != null);
            if (environmentState.IsQSetItemActive)
            {
                environmentState.IsQSetActiveItemQueue      = qSetExplorerActiveItem is QSetQueueItem;
                environmentState.IsQSetActiveItemFolder     = qSetExplorerActiveItem is QSetFolderItem;
                environmentState.IsQSetActiveItemMachine    = qSetExplorerActiveItem is QSetMachineItem;
                environmentState.IsQSetActiveItemQSet       = qSetExplorerActiveItem is QSetModel;
                environmentState.IsQSetActiveItemQueue      = qSetExplorerActiveItem is QSetQueueItem;
                environmentState.IsQSetActiveItemWebService = qSetExplorerActiveItem is QSetWebServiceItem;

                if (qSetExplorerActiveItem.ParentItem != null)
                {
                    environmentState.IsQSetParentItemMachine = qSetExplorerActiveItem.ParentItem is QSetMachineItem;
                    environmentState.IsQSetParentItemQSet    = qSetExplorerActiveItem.ParentItem is QSetModel;
                }
            }

            environmentState.IsMessageBrowserActive = _primaryControls.HasActiveMessageBrowser();

            if (environmentState.IsMessageBrowserActive)
            {
                environmentState.ActiveMessageBrowserSelectedMessageCount = _primaryControls.GetActiveMessageBrowser().SelectedItems.Count;

                environmentState.IsMessageBrowserQueueChildOfActiveQSetItem =
                    environmentState.IsQSetActiveItemFolder
                    &&
                    ((QSetFolderItem)_primaryControls.GetQSetExplorerActiveItem())
                    .ChildItems
                    .Exists((_primaryControls.GetActiveMessageBrowser()).QSetQueueItem.Name);
            }

            return(environmentState);
        }
Exemple #2
0
        /// <summary>
        /// Adds a new web service client to the Q Set.
        /// </summary>
        public void AddNewWebServiceClient()
        {
            //ensure the q set is selected at a valid position
            if (_primaryControls.GetQSetExplorerSet() == null)
            {
                _taskManager.CreateNewQSet();
            }
            if (_primaryControls.GetQSetExplorerActiveItem() == null ||
                !(_primaryControls.GetQSetExplorerActiveItem() is QSetFolderItem) ||
                _primaryControls.GetQSetExplorerActiveItem() is QSetMachineItem)
            {
                _primaryControls.SetQSetExplorerActiveItem(_primaryControls.GetQSetExplorerSet());
            }

            QSetFolderItem parentItem = _primaryControls.GetQSetExplorerActiveItem() as QSetFolderItem;

            if (parentItem != null)
            {
                QSetWebServiceItem webServiceItem = new QSetWebServiceItem(_taskManager.GetNextAvailableNewItemName("New Web Service Client", parentItem.ChildItems));
                parentItem.ChildItems.Add(webServiceItem);
                LoadNewWebServiceClientControl(webServiceItem);
            }
        }
Exemple #3
0
        /// <summary>
        /// Attempts to delete a MSMQ message queue.
        /// </summary>
        public void DeleteActiveQueue()
        {
            if (_primaryControls.GetQSetExplorerActiveItem() != null)
            {
                QSetQueueItem queueItem = _primaryControls.GetQSetExplorerActiveItem() as QSetQueueItem;
                if (queueItem != null)
                {
                    //confirm the delete
                    if (WindowsForms.MessageBox.Show(_primaryForms.EnvironmentForm,
                                                     string.Format(Locale.UserMessages.ConfirmQueueDelete, queueItem.Name),
                                                     Locale.ApplicationName,
                                                     WindowsForms.MessageBoxButtons.YesNoCancel,
                                                     WindowsForms.MessageBoxIcon.Question,
                                                     WindowsForms.MessageBoxDefaultButton.Button3) == WindowsForms.DialogResult.Yes)
                    {
                        try
                        {
                            MessageQueue.Delete(queueItem.Name);

                            if (queueItem.ParentItem != null)
                            {
                                queueItem.ParentItem.ChildItems.Remove(queueItem.Name);
                            }
                        }
                        catch (Exception exc)
                        {
                            WindowsForms.MessageBox.Show(
                                _primaryForms.EnvironmentForm,
                                string.Format(Locale.UserMessages.UnableToDeleteQueue, exc.Message),
                                Locale.ApplicationName,
                                System.Windows.Forms.MessageBoxButtons.OK,
                                System.Windows.Forms.MessageBoxIcon.Exclamation);
                        }
                    }
                }
            }
        }
Exemple #4
0
        /// <summary>
        /// Adds the currently active queue to the Q Set.
        /// </summary>
        public void AddActiveQueueToQSet()
        {
            if (_primaryControls.GetQSetExplorerSet() != null)
            {
                if (_primaryControls.GetQSetExplorerActiveItem() == null)
                {
                    _primaryControls.SetQSetExplorerActiveItem(_primaryControls.GetQSetExplorerSet());
                }

                if (_primaryControls.HasActiveDocument)
                {
                    MessageBrowser messageBrowser = _primaryControls.GetActiveMessageBrowser();
                    if (messageBrowser != null)
                    {
                        QSetFolderItem folderItem = _primaryControls.GetQSetExplorerActiveItem() as QSetFolderItem;
                        if (folderItem != null)
                        {
                            if (!folderItem.ChildItems.Exists(messageBrowser.QSetQueueItem.Name))
                            {
                                folderItem.ChildItems.Add(messageBrowser.QSetQueueItem);
                            }
                        }
                        else
                        {
                            MessageBox.Show(_primaryForms.EnvironmentForm, "Cannot add the queue at this point.  Select a valid folder, or the top level Queue Set to add the queue.", Locale.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
            }
        }