示例#1
0
        private void Initialize(Licensing.License license, QueueTaskManager queueTaskManager, QSetQueueItem initialRecipient, System.Messaging.Message[] messages, QSetQueueItem sourceQueueItem)
        {
            _license = license;

            InitializeComponent();

            if (messages != null && messages.Length > 0)
            {
                _mode = Mode.ExistingMessage;
            }
            else
            {
                _mode = Mode.NewMessage;
            }

            _queueTaskManager = queueTaskManager;
            _sourceQueueItem  = sourceQueueItem;

            base.Closing += new CancelEventHandler(NewMessageForm_Closing);
            numberOfCopiesComboBoxItem.ToolTipText            = "Select the number of copies to send to each recipient queue.";
            numberOfCopiesComboBoxItem.ComboBox.SelectedIndex = 0;
            numberOfCopiesComboBoxItem.ComboBox.KeyPress     += new KeyPressEventHandler(ComboBox_KeyPress);
            numberOfCopiesComboBoxItem.ComboBox.MaxLength     = 4;

            _messageViewer = new MessageViewer {
                License = license
            };
            _messageViewer.Dock = DockStyle.Fill;
            _messageViewerHostPanel.Controls.Add(_messageViewer);

            recipientsListView.Items.Clear();
            messagesListView.Items.Clear();

            if (_mode == Mode.NewMessage)
            {
                FormatterComboItem[] formatterItems = new FormatterComboItem[3];
                formatterItems[0] = new FormatterComboItem(_FORMATTER_ACTIVEX, MessageFormatterType.ActiveX);
                formatterItems[1] = new FormatterComboItem(_FORMATTER_BINARY, MessageFormatterType.Binary);
                formatterItems[2] = new FormatterComboItem(_FORMATTER_XML, MessageFormatterType.Xml);
                formatterComboBoxItem.ComboBox.DisplayMember = "Name";
                formatterComboBoxItem.ComboBox.ValueMember   = "FormatterType";
                formatterComboBoxItem.ComboBox.DataSource    = formatterItems;
                formatterComboBoxItem.ComboBox.SelectedIndex = 2;
                formatterComboBoxItem.ComboBox.DropDownStyle = ComboBoxStyle.DropDownList;

                foreach (ToolStripItem item in optionsPriorityMenuItem.DropDownItems)
                {
                    var menuItem = item as ToolStripMenuItem;
                    if (menuItem != null)
                    {
                        menuItem.Checked = false;
                    }
                }
                priorityNormalMenuItem.Checked = true;

                ConfigureMessagePriorityMenuItems();
                SelectMessagePriorityMenuItem(System.Messaging.MessagePriority.Normal);
            }
            else
            {
                if (messages.Length == 1)
                {
                    existingMessagesLabel.Text = "Message:";
                }
                else
                {
                    existingMessagesLabel.Text = "Messages:";
                }

                foreach (System.Messaging.Message message in messages)
                {
                    ListViewItem item = new ListViewItem(message.Label, (int)Resources.Images.IconType.Message);
                    item.Tag = message;
                    messagesListView.Items.Add(item);
                }

                messagesListView.Items[0].Selected = true;
            }

            //TODO when multiple messages are supplied leave all the options blank so that the existing message properties take effect
            //		but let the options be selectable so they can be overridde.  When a single message is passed into the form all
            //		of the options can be defaulted to that messages options
            sendAndKeepOpenButtonItem.Visible = _mode == Mode.NewMessage;
            formatterComboBoxItem.Visible     = _mode == Mode.NewMessage;
            optionsDropDownMenuItem.Visible   = _mode == Mode.NewMessage;
            labelLabel.Visible           = _mode == Mode.NewMessage;
            labelTextBox.Visible         = _mode == Mode.NewMessage;
            newMessagePanel.Visible      = _mode == Mode.NewMessage;
            existingMessagePanel.Visible = _mode == Mode.ExistingMessage;

            ConfigureControls();

            SetupToolTips();

            if (initialRecipient != null)
            {
                AddQueueItemToRecipientsList(initialRecipient);
            }
        }
示例#2
0
		private void Initialize(Licensing.License license, QueueTaskManager queueTaskManager, QSetQueueItem initialRecipient, System.Messaging.Message[] messages, QSetQueueItem sourceQueueItem)
		{		
			_license = license;

			InitializeComponent();

			if (messages != null && messages.Length > 0)
				_mode = Mode.ExistingMessage;
			else
				_mode = Mode.NewMessage;

			_queueTaskManager = queueTaskManager;
			_sourceQueueItem = sourceQueueItem;
			
			base.Closing += new CancelEventHandler(NewMessageForm_Closing);
			numberOfCopiesComboBoxItem.ToolTipText = "Select the number of copies to send to each recipient queue.";
			numberOfCopiesComboBoxItem.ComboBox.SelectedIndex = 0;
			numberOfCopiesComboBoxItem.ComboBox.KeyPress += new KeyPressEventHandler(ComboBox_KeyPress);
			numberOfCopiesComboBoxItem.ComboBox.MaxLength = 4;

			_messageViewer = new MessageViewer(license);
			_messageViewer.Dock = DockStyle.Fill;
			_messageViewerHostPanel.Controls.Add(_messageViewer);

			recipientsListView.Items.Clear();
			messagesListView.Items.Clear();

			if (_mode == Mode.NewMessage)
			{
				FormatterComboItem[] formatterItems = new FormatterComboItem[3]; 
				formatterItems[0] = new FormatterComboItem(_FORMATTER_ACTIVEX, MessageFormatterType.ActiveX);
				formatterItems[1] = new FormatterComboItem(_FORMATTER_BINARY, MessageFormatterType.Binary);
				formatterItems[2] = new FormatterComboItem(_FORMATTER_XML, MessageFormatterType.Xml);
				formatterComboBoxItem.ComboBox.DisplayMember = "Name";
				formatterComboBoxItem.ComboBox.ValueMember = "FormatterType";
				formatterComboBoxItem.ComboBox.DataSource = formatterItems;			
				formatterComboBoxItem.ComboBox.SelectedIndex = 2;
				formatterComboBoxItem.ComboBox.DropDownStyle = ComboBoxStyle.DropDownList;

				foreach (MenuItemBase item in optionsPriorityMenuItem.Items)
					item.Checked = false;
				priorityNormalMenuItem.Checked = true;

				ConfigureMessagePriorityMenuItems();
				SelectMessagePriorityMenuItem(System.Messaging.MessagePriority.Normal);
			}
			else
			{
				if (messages.Length == 1)
					existingMessagesLabel.Text = "Message:";
				else
					existingMessagesLabel.Text = "Messages:";

				foreach (System.Messaging.Message message in messages)
				{
					ListViewItem item = new ListViewItem(message.Label, (int)Resources.Images.IconType.Message);
					item.Tag = message;
					messagesListView.Items.Add(item);
				}
				
				messagesListView.Items[0].Selected = true;				
			}

			//TODO when multiple messages are supplied leave all the options blank so that the existing message properties take effect
			//		but let the options be selectable so they can be overridde.  When a single message is passed into the form all
			//		of the options can be defaulted to that messages options
			sendAndKeepOpenButtonItem.Visible = _mode == Mode.NewMessage;
			formatterComboBoxItem.Visible = _mode == Mode.NewMessage;
			optionsDropDownMenuItem.Visible = _mode == Mode.NewMessage;
			labelLabel.Visible = _mode == Mode.NewMessage;
			labelTextBox.Visible =  _mode == Mode.NewMessage;			
			newMessagePanel.Visible = _mode == Mode.NewMessage;
			existingMessagePanel.Visible = _mode == Mode.ExistingMessage;

			ConfigureControls();

			SetupToolTips();

			if (initialRecipient != null)
				AddQueueItemToRecipientsList(initialRecipient);
		}