/// <summary>
/// Notification configuration window load event
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void NcWindow_Loaded(object sender, RoutedEventArgs e)
{
try
{
AmazonAutoScalingConfig config = new AmazonAutoScalingConfig();
config.ServiceURL = ((ViewModel)this.DataContext).Region.Url;
AmazonAutoScalingClient client = new AmazonAutoScalingClient(config);
DescribeAutoScalingNotificationTypesRequest dasntreq = new DescribeAutoScalingNotificationTypesRequest();
DescribeAutoScalingNotificationTypesResponse dasntresp = client.DescribeAutoScalingNotificationTypes(dasntreq);
foreach (string asnt in dasntresp.DescribeAutoScalingNotificationTypesResult.AutoScalingNotificationTypes)
{
this.notificationTypes.Add(asnt);
}
AmazonSimpleNotificationServiceConfig snsconfig = new AmazonSimpleNotificationServiceConfig();
config.ServiceURL = ((ViewModel)this.DataContext).Region.Url;
AmazonSimpleNotificationServiceClient snsclient = new AmazonSimpleNotificationServiceClient(snsconfig);
ListTopicsRequest ltrequest = new ListTopicsRequest();
ListTopicsResponse ltresp = snsclient.ListTopics(ltrequest);
foreach (Topic topic in ltresp.ListTopicsResult.Topics)
{
this.snstopics.Add(topic.TopicArn);
}
rlbNcTypes.ItemsSource = this.notificationTypes;
cboTopics.ItemsSource = this.snstopics;
}
catch
{
MessageBox.Show(Window.GetWindow(this), "Error occured while loading the notification configuration options.", "Error", MessageBoxButton.OK);
this.Close();
}
}