public async Task <ObservableCollection <AppPoolsViewModel> > GetAppPools(string key) { var activeApplicationPools = new ObservableCollection <AppPoolsViewModel>(); var appPools = await _webservice.GetServerOtherParamsAsync("App Pools", key); var value = appPools.Value; var deserializeAll = Newtonsoft.Json.JsonConvert.DeserializeObject <List <ApplicationPoolsValue> >(value); var color = Color.FromRgb(99, 255, 74); try { var configuration = _webservice.GetAppPoolsConfig(key); var deserializeConf = Newtonsoft.Json.JsonConvert.DeserializeObject <List <CheckedAppPools> >(configuration); foreach (var d in deserializeAll) { foreach (var c in deserializeConf) { if (d.Name == c.Name) { var appPool = new AppPoolsViewModel(d.Name, d.State, d.User, color); var state = AppPoolsValidator.validate(d); if (state == AppPoolsValidator.outcome.NotOK) { color = Color.FromRgb(192, 0, 2); appPool.Icon = new System.Windows.Media.Imaging.BitmapImage(new Uri("C:\\Users\\zuziaa\\Desktop\\staf\\nexpertis\\NX_ServerMonitor\\NxServerMonitor\\assets\\status-icon-error.png")); } else { color = Color.FromRgb(99, 255, 74); appPool.Icon = new System.Windows.Media.Imaging.BitmapImage(new Uri("C:\\Users\\zuziaa\\Desktop\\staf\\nexpertis\\NX_ServerMonitor\\NxServerMonitor\\assets\\status-icon-ok.png")); } activeApplicationPools.Add(appPool); } } } } catch { } return(activeApplicationPools); }
public async Task <ObservableCollection <AppPoolsViewModel> > GetAppPools(string key) { var activeApplicationPools = new ObservableCollection <AppPoolsViewModel>(); var appPools = await _webservice.GetServerOtherParamsAsync("App Pools", key); var value = appPools.Value; var deserializeAll = Newtonsoft.Json.JsonConvert.DeserializeObject <List <ApplicationPoolsValue> >(value); Color color = Color.FromRgb(99, 255, 74); try { var configuration = _webservice.GetAppPoolsConfig(key); var deserializeConf = Newtonsoft.Json.JsonConvert.DeserializeObject <List <CheckedPools> >(configuration); foreach (var d in deserializeAll) { foreach (var c in deserializeConf) { if (d.Name == c.Name) { if (d.State == "Stopped") { color = Color.FromRgb(192, 0, 2); } else { color = Color.FromRgb(99, 255, 74); } var appPool = new AppPoolsViewModel(d.Name, d.State, d.User, color); activeApplicationPools.Add(appPool); } } } } catch { } return(activeApplicationPools); }