Mercurial > silverbladetech
comparison Messaging/Server/Listeners/MsmqListener.cs @ 31:7d9de5746f18
Working version
author | adminsh@apollo |
---|---|
date | Thu, 22 Mar 2012 08:09:41 +0000 |
parents | 9919ee227c93 |
children |
comparison
equal
deleted
inserted
replaced
30:8d574f2d4174 | 31:7d9de5746f18 |
---|---|
1 using System; | 1 using System; |
2 using System.Messaging; | 2 using System.Messaging; |
3 using Common.Messages; | 3 using Common.Messages; |
4 using GalaSoft.MvvmLight.Messaging; | 4 using GalaSoft.MvvmLight.Messaging; |
5 using Server.Interfaces; | |
6 | 5 |
7 namespace Server.Listeners | 6 namespace Server.Listeners |
8 { | 7 { |
9 public class MsmqListener : IListener | 8 public class MsmqListener : IListener |
10 { | 9 { |
23 | 22 |
24 public void Start() | 23 public void Start() |
25 { | 24 { |
26 if (IsListening) return; | 25 if (IsListening) return; |
27 | 26 |
28 Messenger.Default.Send(new MsmqLogMessage() { Body = "Opening listener..." }); | 27 Messenger.Default.Send(new MsmqLogMessage() { Body = "Opening listener" }); |
29 IsListening = true; | 28 IsListening = true; |
30 while (IsListening) | 29 while (IsListening) |
31 { | 30 { |
32 try | 31 try |
33 { | 32 { |
46 } | 45 } |
47 | 46 |
48 public void Stop() | 47 public void Stop() |
49 { | 48 { |
50 if (!IsListening) return; | 49 if (!IsListening) return; |
51 Messenger.Default.Send(new MsmqLogMessage() { Body = "Closing listener..." }); | |
52 _mq.Close(); | 50 _mq.Close(); |
53 IsListening = false; | 51 IsListening = false; |
54 Messenger.Default.Send(new MsmqLogMessage() { Body = "Closed." }); | 52 Messenger.Default.Send(new MsmqLogMessage() { Body = "Listener closed." }); |
55 } | 53 } |
56 } | 54 } |
57 } | 55 } |