public async void LoadSubscriptions(string id) { Busy = true; BusyContent = "Loading subscriptions"; Id = id; List <SpisSubscriptionObject> subscriptions = new List <SpisSubscriptionObject>(); List <IdentityDescriptionObject> acl = new List <IdentityDescriptionObject>(); SubscriptionList = new ObservableCollection <SpisSubscriptionObject>(); AclList = new ObservableCollection <IdentityDescriptionObject>(); await Task.Factory.StartNew(() => { var SpisService = new SpisService(); subscriptions = SpisService.GetSubscriptions(Id); acl = SpisService.GetAcl(Id); }); foreach (var i in acl) { AclList.Add(i); } foreach (var i in subscriptions) { SubscriptionList.Add(i); } Busy = false; }
public async void ExecuteDeleteSubscriptionCommand(object parameter) { Busy = true; BusyContent = "Deleting subscription"; try { await Task.Factory.StartNew(() => { var SpisService = new SpisService(); SpisService.RemoveSubscription(Id, new List <SpisSubscriptionObject> { SelectedSubscription }); }); SubscriptionList.Remove(SelectedSubscription); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { Busy = false; } }
public async void ExecutePublishMessageCommand(object parameter) { Busy = true; BusyContent = "Publishing PCM"; await Task.Factory.StartNew(() => { try { var service = new SpisService(); var result = service.PublishMessage(SelectedMessage.MessageID, "PCM", SelectedMessage.Message); MessageBox.Show(result); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { Busy = false; } }); Busy = false; }
public async void ExecuteAddSubscriptionCommand(object parameter) { Busy = true; BusyContent = "Adding subscription"; try { var subscription = new SpisSubscriptionObject { AmssEndpointURL = new Uri(AmssUrl), MbEndpointURL = new Uri(MbUrl), IdentityId = SelectedAcl.IdentityId, IdentityName = SelectedAcl.IdentityName }; await Task.Factory.StartNew(() => { var SpisService = new SpisService(); SpisService.AddSubscription(Id, new List <SpisSubscriptionObject> { subscription }); }); SubscriptionList.Add(subscription); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { Busy = false; } }
public async void ExecuteDeleteMessageCommand(object parameter) { if (MessageBox.Show("Are you sure that you want to delete message?", "Delete message", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No) { return; } Busy = true; BusyContent = "Deleting message"; await Task.Factory.StartNew(() => { try { var spisService = new SpisService(); var result = spisService.DeleteMessage(SelectedMessage.MessageID); MessageBox.Show(result); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { Busy = false; } }); ExecuteLoadPublishedMessagesCommand(null); }
private void _notificationTimer_Elapsed(object sender, ElapsedEventArgs e) { var visService = new VisService(); var spisService = new SpisService(); List <Notification> notifications = new List <Notification>(); var visNotifications = visService.GetNotifications(); if (visNotifications != null) { notifications.AddRange(visNotifications); } var spisNotifications = spisService.GetNotifications(); if (spisNotifications != null) { notifications.AddRange(spisNotifications); } if (notifications != null) { foreach (var notification in notifications) { Instance_NewNotification(sender, notification); } } }
public async void LoadAcl(string id) { Busy = true; BusyContent = "Loading ACL"; Id = id; List <Organization> orgs = new List <Organization>(); List <IdentityDescriptionObject> acl = new List <IdentityDescriptionObject>(); AllIdentities = new ObservableCollection <Organization>(); AclList = new ObservableCollection <IdentityDescriptionObject>(); await Task.Factory.StartNew(() => { var SpisService = new SpisService(); acl = SpisService.GetAcl(Id); orgs = SpisService.FindIdentties(); }); foreach (var i in acl) { AclList.Add(i); } foreach (var org in orgs) { if (acl.FirstOrDefault(x => x.IdentityId == org.Mrn) == null) { AllIdentities.Add(org); } } Busy = false; }
public async void ExecuteDeleteAclCommand(object parameter) { Busy = true; BusyContent = "Deleting ACL"; try { await Task.Factory.StartNew(() => { var SpisService = new SpisService(); SpisService.RemoveAuthorization(Id, new List <IdentityDescriptionObject> { SelectedAcl }); }); AclList.Remove(SelectedAcl); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { Busy = false; } }
public async void ExecuteAddAclCommand(object parameter) { Busy = true; BusyContent = "Adding ACL"; try { var identity = new IdentityDescriptionObject(SelectedIdentity.Mrn, SelectedIdentity.Name); await Task.Factory.StartNew(() => { var SpisService = new SpisService(); SpisService.AuthorizeIdentities(Id, new List <IdentityDescriptionObject> { identity }); }); AclList.Add(identity); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { Busy = false; } }
public async void ExecuteLoadPublishedMessagesCommand(object parameter) { Busy = true; BusyContent = "Loading published PCM from SPIS"; await Task.Factory.StartNew(() => { var service = new SpisService(); Messages = new ObservableCollection <PublishedMessageContract>(service.GetPublishedMessages()); }); Busy = false; }
private async void ExecuteGetPCMMessagesCommand(object obj) { DateTime?from = null; DateTime?to = null; DateTime temp; if (!string.IsNullOrEmpty(FromTime)) { if (DateTime.TryParse(FromTime, out temp)) { from = temp; } else { MessageBox.Show("Invalid from time"); return; } } if (!string.IsNullOrEmpty(ToTime)) { if (DateTime.TryParse(ToTime, out temp)) { to = temp; } else { MessageBox.Show("Invalid to time"); return; } } if (from != null) { Messages = new ObservableCollection <Message>(); } var service = new SpisService(); MessageEnvelope result = null; Busy = true; BusyContent = "Loading messages from SPIS"; await Task.Factory.StartNew(() => { try { result = service.GetMessages(Id, LimitQuery, from, to); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { Busy = false; } }); if (result == null) { return; } RemainingMessages = result.RemainingNumberOfMessages ?? 0; if (result.Messages != null) { foreach (var message in result.Messages) { if (message != null && message.StmMessage != null && message.StmMessage.Message != null) { message.StmMessage.Message = XmlUtil.FormatXml(message.StmMessage.Message); } Messages.Add(message); } } }