public AlertDetailsControlViewModel( EmulationAlert alert, AlertDetailsControlClosedEventHandler alertDetailsControlClosed) { this.Alert = alert; this.EssentialsSectionProperties = new ObservableCollection <AzureResourceProperty>(new List <AzureResourceProperty>() { new AzureResourceProperty("Subscription id", this.Alert.ResourceIdentifier.SubscriptionId), new AzureResourceProperty("Resource group", this.Alert.ResourceIdentifier.ResourceGroupName), new AzureResourceProperty("Resource type", this.Alert.ResourceIdentifier.ResourceType.ToString()), new AzureResourceProperty("Resource name", this.Alert.ResourceIdentifier.ResourceName) }); List <DisplayableAlertProperty> displayableAlertProperties = this.Alert.ContractsAlert.AlertProperties.OfType <DisplayableAlertProperty>() .Where(prop => this.supportedPropertiesTypes.Contains(prop.Type)) .OrderBy(prop => prop.Order) .ThenBy(prop => prop.PropertyName) .ToList(); this.DisplayableProperties = new ObservableCollection <DisplayableAlertProperty>(displayableAlertProperties); this.CloseControlCommand = new CommandHandler(() => { alertDetailsControlClosed.Invoke(); }); }
public AlertDetailsControlViewModel( Models.EmulationAlert alert, AlertDetailsControlClosedEventHandler alertDetailsControlClosed) { this.Alert = alert; this.EssentialsSectionProperties = new ObservableCollection <AzureResourceProperty>(new List <AzureResourceProperty>() { new AzureResourceProperty("Subscription id", this.Alert.ResourceIdentifier.SubscriptionId), new AzureResourceProperty("Resource group", this.Alert.ResourceIdentifier.ResourceGroupName), new AzureResourceProperty("Resource type", this.Alert.ResourceIdentifier.ResourceType.ToString()), new AzureResourceProperty("Resource name", this.Alert.ResourceIdentifier.ResourceName) }); this.PropertiesSectionProperties = new ObservableCollection <AlertProperty>( this.Alert.ContractsAlert.Properties .Where(prop => prop.DisplayCategory.ToString() == AlertPresentationSection.Property.ToString()).ToList()); this.AnalysisSectionProperties = new ObservableCollection <AlertProperty>( this.Alert.ContractsAlert.Properties .Where(prop => prop.DisplayCategory.ToString() == AlertPresentationSection.Analysis.ToString()).ToList()); List <AnalyticsQuery> queries = this.Alert.ContractsAlert.Properties .Where(prop => prop.DisplayCategory.ToString() == AlertPresentationSection.Chart.ToString()) .Select(chartItem => new AnalyticsQuery(chartItem.Name, chartItem.Value)).ToList(); this.AnalyticsQuerys = new ObservableCollection <AnalyticsQuery>(queries); this.CloseControlCommand = new CommandHandler(() => { alertDetailsControlClosed.Invoke(); }); }
public AlertDetailsControlViewModel( EmulationAlert alert, AlertDetailsControlClosedEventHandler alertDetailsControlClosed, IAzureResourceManagerClient armClient) { this.Alert = alert; this.EssentialsSectionProperties = new ObservableCollection <AzureResourceProperty>(new List <AzureResourceProperty>() { new AzureResourceProperty("Subscription id", this.Alert.ResourceIdentifier.SubscriptionId), new AzureResourceProperty("Resource group", this.Alert.ResourceIdentifier.ResourceGroupName), new AzureResourceProperty("Resource type", this.Alert.ResourceIdentifier.ResourceType.ToString()), new AzureResourceProperty("Resource name", this.Alert.ResourceIdentifier.ResourceName) }); this.DisplayablePropertiesTask = new ObservableTask <ObservableCollection <DisplayableAlertProperty> >( this.ComposeAlertProperties(armClient), null); this.CloseControlCommand = new CommandHandler(() => { alertDetailsControlClosed.Invoke(); }); }