Mercurial > silverbladetech
diff Messaging/Server/UI/MainWindowViewModel.cs @ 29:9919ee227c93
msmq added
author | adminsh@apollo |
---|---|
date | Wed, 21 Mar 2012 22:09:18 +0000 |
parents | 4c0dea4760c5 |
children | 7d9de5746f18 |
line wrap: on
line diff
--- a/Messaging/Server/UI/MainWindowViewModel.cs Wed Mar 21 20:29:04 2012 +0000 +++ b/Messaging/Server/UI/MainWindowViewModel.cs Wed Mar 21 22:09:18 2012 +0000 @@ -1,6 +1,7 @@ using System.Windows.Input; using Common; using Common.Logger; +using Common.Messages; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; using System.Windows; @@ -36,16 +37,18 @@ public ICommand CloseCommand { get; set; } - public BaseEndPoint SocketEndPoint { get; set; } - public BaseEndPoint RabbitEndPoint { get; set; } - public BaseEndPoint RabbitProtoEndPoint { get; set; } + public MessageEndPoint<MsmqClientMessage, MsmqLogMessage> MsmqEndPoint { get; set; } + public MessageEndPoint<SocketClientMessage, SocketLogMessage> SocketEndPoint { get; set; } + public MessageEndPoint<RabbitClientMessage, RabbitLogMessage> RabbitEndPoint { get; set; } + public MessageEndPoint<RabbitProtoClientMessage, RabbitProtoLogMessage> RabbitProtoEndPoint { get; set; } #region Constructor public MainWindowViewModel() { - InitSocketEndPoint(Settings.SocketsPortNumber); - InitRabbitEndPoint(Settings.RabbitPortNumber, Settings.QueueName); + InitMsmqEndPoint(Settings.MsmqQueueName); + //InitSocketEndPoint(Settings.SocketsPortNumber); + InitRabbitEndPoint(Settings.RabbitPortNumber, Settings.RabbitQueueName); InitRabbitProtoEndPoint(Settings.RabbitProtoPortNumber); CloseCommand = new RelayCommand(CloseCommandExecute); @@ -53,10 +56,20 @@ #endregion + private void InitMsmqEndPoint(string queueName) + { + IListener listener = new MsmqListener(queueName); + MsmqEndPoint = new MessageEndPoint<MsmqClientMessage, MsmqLogMessage>(listener) + { + DisplayText = "Microsoft Message Queue", + ToolTip = string.Format("Listening on msmq queue ({0})", queueName) + }; + } + private void InitSocketEndPoint(int port) { IListener listener = new AsyncSocketListener(port); - SocketEndPoint = new SocketEndPoint(listener) + SocketEndPoint = new MessageEndPoint<SocketClientMessage, SocketLogMessage>(listener) { DisplayText = "Async Sockets", ToolTip = "Listening over TCP/IP on socket localhost:" + port @@ -66,7 +79,7 @@ private void InitRabbitEndPoint(int port, string queueName) { IListener listener = new RabbitQueueListener(port, queueName); - RabbitEndPoint = new RabbitEndPoint(listener) + RabbitEndPoint = new MessageEndPoint<RabbitClientMessage, RabbitLogMessage>(listener) { DisplayText = "RabbitMQ", ToolTip = "Listening..." + port @@ -76,12 +89,13 @@ private void InitRabbitProtoEndPoint(int port) { IListener listener = null; - RabbitProtoEndPoint = new RabbitProtoEndPoint(listener) + RabbitProtoEndPoint = new MessageEndPoint<RabbitProtoClientMessage, RabbitProtoLogMessage>(listener) { DisplayText = "RabbitMQ with Protobuf-net", ToolTip = "Listening...." + port }; } + private void CloseCommandExecute() { Log.Write("Closing command executed");