Beispiel #1
0
        public async void SelectResource(SelectionChangedEventArgs args)
        {
            if (args.AddedItems.Count == 1)
            {
                LoadGraphEnabled.Value = false;
                var resource = args.AddedItems[0] as Resource;
                Metrics.Clear();
                var metrics = await _client.Metrics(resource);

                foreach (var metric in metrics)
                {
                    Metrics.Add(metric);
                }
                if (metrics.Count() > 0)
                {
                    SelectedMetric.Value = metrics.First();
                }
                else
                {
                    var m = new Metric {
                        Name = new Name {
                            LocalizedValue = "No metrics supported"
                        }
                    };
                    Metrics.Add(m);
                    SelectedMetric.Value = m;
                }
                MetricsSelectorEnabled.Value = metrics.Count() > 1;
            }
        }