comparison Messaging/Server/UI/MainWindowViewModel.cs @ 28:4c0dea4760c5

RabbitMq working
author adminsh@apollo
date Wed, 21 Mar 2012 20:29:04 +0000
parents 96fdf58e05b4
children 9919ee227c93
comparison
equal deleted inserted replaced
27:96fdf58e05b4 28:4c0dea4760c5
1 using System; 1 using System.Windows.Input;
2 using System.Windows.Input;
3 using Common; 2 using Common;
4 using Common.Logger; 3 using Common.Logger;
5 using Common.Messages;
6 using GalaSoft.MvvmLight; 4 using GalaSoft.MvvmLight;
7 using GalaSoft.MvvmLight.Command; 5 using GalaSoft.MvvmLight.Command;
8 using System.Windows; 6 using System.Windows;
9 using GalaSoft.MvvmLight.Messaging;
10 using Server.EndPoints; 7 using Server.EndPoints;
11 using Server.Interfaces; 8 using Server.Interfaces;
12 using Server.Listeners; 9 using Server.Listeners;
13 10
14 namespace Server.UI 11 namespace Server.UI
46 #region Constructor 43 #region Constructor
47 44
48 public MainWindowViewModel() 45 public MainWindowViewModel()
49 { 46 {
50 InitSocketEndPoint(Settings.SocketsPortNumber); 47 InitSocketEndPoint(Settings.SocketsPortNumber);
51 InitRabbitEndPoint(Settings.RabbitPortNumber); 48 InitRabbitEndPoint(Settings.RabbitPortNumber, Settings.QueueName);
52 InitRabbitProtoEndPoint(Settings.RabbitProtoPortNumber); 49 InitRabbitProtoEndPoint(Settings.RabbitProtoPortNumber);
53 50
54 CloseCommand = new RelayCommand(CloseCommandExecute); 51 CloseCommand = new RelayCommand(CloseCommandExecute);
52 }
55 53
56 } 54 #endregion
57 55
58 private void InitSocketEndPoint(int port) 56 private void InitSocketEndPoint(int port)
59 { 57 {
60 IListener listener = new AsyncSocketListener(port); 58 IListener listener = new AsyncSocketListener(port);
61 SocketEndPoint = new SocketEndPoint(listener) 59 SocketEndPoint = new SocketEndPoint(listener)
63 DisplayText = "Async Sockets", 61 DisplayText = "Async Sockets",
64 ToolTip = "Listening over TCP/IP on socket localhost:" + port 62 ToolTip = "Listening over TCP/IP on socket localhost:" + port
65 }; 63 };
66 } 64 }
67 65
68 private void InitRabbitEndPoint(int port) 66 private void InitRabbitEndPoint(int port, string queueName)
69 { 67 {
70 IListener listener = new RabbitQueueListener(port); 68 IListener listener = new RabbitQueueListener(port, queueName);
71 RabbitEndPoint = new RabbitEndPoint(listener) 69 RabbitEndPoint = new RabbitEndPoint(listener)
72 { 70 {
73 DisplayText = "RabbitMQ", 71 DisplayText = "RabbitMQ",
74 ToolTip = "Listening..." + port 72 ToolTip = "Listening..." + port
75 }; 73 };
87 private void CloseCommandExecute() 85 private void CloseCommandExecute()
88 { 86 {
89 Log.Write("Closing command executed"); 87 Log.Write("Closing command executed");
90 Application.Current.Shutdown(); 88 Application.Current.Shutdown();
91 } 89 }
92
93 #endregion
94 } 90 }
95 } 91 }