annotate Messaging/Client/MainWindow.xaml.cs @ 28:4c0dea4760c5

RabbitMq working
author adminsh@apollo
date Wed, 21 Mar 2012 20:29:04 +0000
parents 045dac571339
children 9919ee227c93
rev   line source
26
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
1 using System;
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
2 using System.Collections.Generic;
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
3 using System.Text;
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
4 using System.Windows;
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
5 using System.Windows.Controls;
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
6 using System.Windows.Data;
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
7 using System.Windows.Documents;
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
8 using System.Windows.Input;
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
9 using System.Windows.Media;
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
10 using System.Windows.Media.Imaging;
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
11 using System.Windows.Navigation;
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
12 using System.Windows.Shapes;
28
4c0dea4760c5 RabbitMq working
adminsh@apollo
parents: 26
diff changeset
13 using Common;
4c0dea4760c5 RabbitMq working
adminsh@apollo
parents: 26
diff changeset
14 using RabbitMQ.Client;
26
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
15
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
16 namespace Client
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
17 {
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
18 /// <summary>
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
19 /// Interaction logic for MainWindow.xaml
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
20 /// </summary>
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
21 public partial class MainWindow : Window
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
22 {
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
23 public MainWindow()
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
24 {
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
25 InitializeComponent();
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
26 }
28
4c0dea4760c5 RabbitMq working
adminsh@apollo
parents: 26
diff changeset
27
4c0dea4760c5 RabbitMq working
adminsh@apollo
parents: 26
diff changeset
28 private void BtnRabbitClick(object sender, RoutedEventArgs e)
4c0dea4760c5 RabbitMq working
adminsh@apollo
parents: 26
diff changeset
29 {
4c0dea4760c5 RabbitMq working
adminsh@apollo
parents: 26
diff changeset
30 Task
4c0dea4760c5 RabbitMq working
adminsh@apollo
parents: 26
diff changeset
31 var cf = new ConnectionFactory {Address = "localhost:" + Settings.RabbitPortNumber};
4c0dea4760c5 RabbitMq working
adminsh@apollo
parents: 26
diff changeset
32
4c0dea4760c5 RabbitMq working
adminsh@apollo
parents: 26
diff changeset
33 using (var conn = cf.CreateConnection())
4c0dea4760c5 RabbitMq working
adminsh@apollo
parents: 26
diff changeset
34 using (var channel = conn.CreateModel())
4c0dea4760c5 RabbitMq working
adminsh@apollo
parents: 26
diff changeset
35 {
4c0dea4760c5 RabbitMq working
adminsh@apollo
parents: 26
diff changeset
36 for (var i = 0; i < 10000; i++)
4c0dea4760c5 RabbitMq working
adminsh@apollo
parents: 26
diff changeset
37 {
4c0dea4760c5 RabbitMq working
adminsh@apollo
parents: 26
diff changeset
38 channel.BasicPublish("amq.direct", Settings.QueueName, null,
4c0dea4760c5 RabbitMq working
adminsh@apollo
parents: 26
diff changeset
39 Encoding.UTF8.GetBytes("hello from the client!"));
4c0dea4760c5 RabbitMq working
adminsh@apollo
parents: 26
diff changeset
40 }
4c0dea4760c5 RabbitMq working
adminsh@apollo
parents: 26
diff changeset
41 }
4c0dea4760c5 RabbitMq working
adminsh@apollo
parents: 26
diff changeset
42 }
26
045dac571339 Working on data binding to a user control
adminsh@apollo
parents:
diff changeset
43 }
28
4c0dea4760c5 RabbitMq working
adminsh@apollo
parents: 26
diff changeset
44 }