89
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1 using System;
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
2 using System.Threading.Tasks;
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
3 using System.Windows;
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
4 using System.Windows.Media.Animation;
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
5 using System.Windows.Threading;
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
6 using Burrow;
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
7 using Burrow.Extras;
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
8 using Client.Controls;
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
9 using Client.Messages;
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
10
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
11 namespace Client
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
12 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
13 public partial class MainWindow
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
14 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
15 private const string QUEUE_CONNECTION_STRING = "host=localhost;username=guest;password=guest";
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
16 private readonly ITunnel tunnel;
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
17 private readonly Subscription subscriptionOrder;
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
18 private readonly Subscription subscriptionPayment;
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
19 private readonly Subscription subscriptionDelivery;
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
20 private readonly Subscription subscriptionError;
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
21 private readonly Guid orderId;
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
22 private const string ORDER_ROUTING_KEY = "Order";
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
23 private const string PAYMENT_ROUTING_KEY = "Payment";
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
24 private const string DELIVERY_ROUTING_KEY = "Delivery";
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
25 private const string ORDER_STORYBOARD_KEY = "OrderStoryboard";
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
26 private const string PAYMENT_STORYBOARD_KEY = "PaymentStoryboard";
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
27 private const string DELIVERY_STORYBOARD_KEY = "DeliveryStoryboard";
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
28 private const string FADEINGIFT_STORYBOARD_KEY = "FadeInGiftStoryboard";
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
29 private readonly Storyboard orderStoryboard;
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
30 private readonly Storyboard paymentStoryboard;
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
31 private readonly Storyboard deliveryStoryboard;
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
32 private readonly Storyboard fadeInGiftStoryboard;
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
33
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
34 public MainWindow()
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
35 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
36 InitializeComponent();
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
37
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
38 // set up rabbitmq tunnel
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
39 tunnel = RabbitTunnel.Factory.Create(QUEUE_CONNECTION_STRING);
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
40 tunnel.SetSerializer(new JsonSerializer());
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
41
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
42 // set up a subscription to each message type
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
43 subscriptionOrder = tunnel.SubscribeAsync<OrderMessage>("Workflow",
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
44 (message, args) => Dispatcher.BeginInvoke(new Action(() => OnOrderReceived(message, args))));
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
45
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
46 subscriptionPayment = tunnel.SubscribeAsync<PaymentMessage>("Workflow",
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
47 (message, args) => Dispatcher.BeginInvoke(new Action(() => OnPaymentReceived(message, args))));
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
48
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
49 subscriptionDelivery = tunnel.SubscribeAsync<DeliveryMessage>("Workflow",
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
50 (message, args) => Dispatcher.BeginInvoke(new Action(() => OnDeliveryReceived(message, args))));
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
51
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
52 //subscriptionError = tunnel.SubscribeAsync<?????>("Workflow",
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
53 // (message, args) => Dispatcher.BeginInvoke(new Action(() => OnErrorReceived(message, args))));
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
54
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
55 // make sure all storyboards are available
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
56 orderStoryboard = (Storyboard)this.TryFindResource(ORDER_STORYBOARD_KEY);
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
57 paymentStoryboard = (Storyboard)this.TryFindResource(PAYMENT_STORYBOARD_KEY);
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
58 deliveryStoryboard = (Storyboard)this.TryFindResource(DELIVERY_STORYBOARD_KEY);
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
59 fadeInGiftStoryboard = (Storyboard)this.TryFindResource(FADEINGIFT_STORYBOARD_KEY);
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
60 if (orderStoryboard == null) throw new ResourceReferenceKeyNotFoundException("Cannot find OrderStoryboard resource", ORDER_STORYBOARD_KEY);
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
61 if (paymentStoryboard == null) throw new ResourceReferenceKeyNotFoundException("Cannot find PaymentStoryboard resource", PAYMENT_STORYBOARD_KEY);
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
62 if (deliveryStoryboard == null) throw new ResourceReferenceKeyNotFoundException("Cannot find DeliveryStoryboard resource", DELIVERY_STORYBOARD_KEY);
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
63 if (fadeInGiftStoryboard == null) throw new ResourceReferenceKeyNotFoundException("Cannot find FadeInGiftStoryboard resource", FADEINGIFT_STORYBOARD_KEY);
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
64
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
65 // create an orderid for the workflow
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
66 orderId = Guid.NewGuid();
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
67 }
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
68
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
69 private void NotifyUI(UIMessage ctrl, MessageType messageType, string text)
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
70 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
71 Dispatcher.BeginInvoke(new Action(() =>
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
72 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
73 ctrl.MessageType = messageType;
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
74 ctrl.Text = text;
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
75 ctrl.Show();
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
76 }));
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
77 }
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
78
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
79 #region EventHandlers
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
80
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
81 private void btnSubmit_Click(object sender, RoutedEventArgs e)
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
82 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
83 try
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
84 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
85 orderStoryboard.Begin();
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
86 NotifyUI(NotificationRight, MessageType.Success, "Order submitted");
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
87 }
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
88 catch (Exception ex)
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
89 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
90 NotifyUI(NotificationRight, MessageType.Error, ex.Message);
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
91 }
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
92 }
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
93
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
94 private void OnOrderStoryboardCompleted(object sender, EventArgs e)
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
95 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
96 try
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
97 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
98 tunnel.Publish(new OrderMessage
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
99 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
100 OrderId = orderId,
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
101 OrderDate = DateTime.Now,
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
102 ProductCode = "ABCDE",
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
103 Quantity = 10,
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
104 UnitPrice = 9.99m
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
105 }, ORDER_ROUTING_KEY);
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
106
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
107 NotifyUI(NotificationLeft, MessageType.Success, "Order published");
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
108 }
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
109 catch (Exception ex)
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
110 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
111 NotifyUI(NotificationRight, MessageType.Error, ex.Message);
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
112 }
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
113 }
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
114
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
115 private void OnOrderReceived(OrderMessage order, MessageDeliverEventArgs args)
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
116 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
117 try
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
118 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
119 NotifyUI(NotificationRight, MessageType.Success, "Order received");
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
120 paymentStoryboard.Begin();
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
121 }
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
122 catch (Exception ex)
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
123 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
124 NotifyUI(NotificationRight, MessageType.Error, ex.Message);
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
125 }
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
126 finally
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
127 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
128 if (subscriptionOrder != null) subscriptionOrder.Ack(args.DeliveryTag);
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
129 }
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
130 }
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
131
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
132 private void OnPaymentStoryboardCompleted(object sender, EventArgs e)
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
133 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
134 try
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
135 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
136 tunnel.Publish(new PaymentMessage()
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
137 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
138 OrderId = orderId,
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
139 IsConfirmed = true
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
140 }, PAYMENT_ROUTING_KEY);
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
141
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
142 NotifyUI(NotificationLeft, MessageType.Success, "Payment published");
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
143 }
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
144 catch (Exception ex)
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
145 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
146 NotifyUI(NotificationRight, MessageType.Error, ex.Message);
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
147 }
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
148 }
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
149
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
150 private void OnPaymentReceived(PaymentMessage payment, MessageDeliverEventArgs args)
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
151 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
152 try
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
153 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
154 NotifyUI(NotificationRight, MessageType.Success, "Payment received");
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
155 deliveryStoryboard.Begin();
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
156 }
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
157 catch (Exception ex)
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
158 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
159 NotifyUI(NotificationRight, MessageType.Error, ex.Message);
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
160 }
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
161 finally
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
162 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
163 if (subscriptionPayment != null) subscriptionPayment.Ack(args.DeliveryTag);
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
164 }
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
165 }
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
166
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
167 private void OnDeliveryStoryboardCompleted(object sender, EventArgs e)
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
168 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
169 try
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
170 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
171 tunnel.Publish(new DeliveryMessage()
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
172 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
173 OrderId = orderId,
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
174 Address = "123 Some Street, Somewhere"
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
175 }, DELIVERY_ROUTING_KEY);
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
176
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
177 NotifyUI(NotificationLeft, MessageType.Success, "Delivery published");
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
178 }
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
179 catch (Exception ex)
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
180 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
181 NotifyUI(NotificationRight, MessageType.Error, ex.Message);
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
182 }
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
183 }
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
184
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
185 private void OnDeliveryReceived(DeliveryMessage delivery, MessageDeliverEventArgs args)
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
186 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
187 try
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
188 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
189 NotifyUI(NotificationRight, MessageType.Success, "Delivery received");
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
190 fadeInGiftStoryboard.Begin();
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
191 }
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
192 catch (Exception ex)
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
193 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
194 NotifyUI(NotificationRight, MessageType.Error, ex.Message);
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
195 }
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
196 finally
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
197 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
198 if (subscriptionDelivery != null) subscriptionDelivery.Ack(args.DeliveryTag);
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
199 }
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
200 }
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
201
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
202 #endregion
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
203
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
204 private void Window_Closed(object sender, EventArgs e)
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
205 {
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
206 Application.Current.Shutdown();
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
207 }
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
208 }
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
209 } |