form1.cs

来自「MSMQ之使用範例程式」· CS 代码 · 共 41 行

CS
41
字号
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace MSMQ.App
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Book book = new Book();
            book.BookId = int.Parse(textBox2.Text.ToString());
            book.BookName = textBox3.Text;
            book.BookAuthor = textBox4.Text;
            book.BookPrice = double.Parse(textBox5.Text.ToString());
            if (MsgQueue.SendMessage(book))
            {
                MessageBox.Show("成功发送消息到队列");
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MsgQueue.Createqueue(textBox1.Text.Trim().ToString());
        }

        private void button3_Click(object sender, EventArgs e)
        {
            this.textBox6.Text += MsgQueue.ReceiveMessage();
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?