void OnPerfCounterPropertyChanged(object sender, PropertyChangedEventArgs args) { IsDirty = !Equals(ItemServerCounters, ItemResourceCounters); if (args.PropertyName == "CounterName") { var countersByResource = (IPerformanceCountersByResource)sender; if (countersByResource.IsNew) { { countersByResource.IsNew = false; var newPermission = CreateNewCounter(); ResourceCounters.Add(newPermission); } } else { var isEmpty = string.IsNullOrEmpty(countersByResource.CounterName); if (isEmpty) { ResourceCounters.Remove(countersByResource); } } } }
private void InitializeTos(IPerformanceCounterTo nativeCounters) { ServerCounters.Clear(); ResourceCounters.Clear(); var performanceCountersByMachines = nativeCounters.GetServerCountersTo(); foreach (var performanceCountersByMachine in performanceCountersByMachines) { RegisterPropertyChanged(performanceCountersByMachine); ServerCounters.Add(performanceCountersByMachine); } var performanceCountersByResources = nativeCounters.GetResourceCountersTo(); foreach (var performanceCountersByResource in performanceCountersByResources) { RegisterPropertyChanged(performanceCountersByResource); ResourceCounters.Add(performanceCountersByResource); } ResourceCounters.Add(CreateNewCounter()); SetItem(nativeCounters); }
private void UpdateResourceCounter(IPerformanceCounterTo perfCounterTo) { perfCounterTo.ResourceCounters = ResourceCounters.ToList().GetResourceCounters(); }
public void SetResourceCounter(ResourceCounters resourceHUD) { resourceCounters = resourceHUD; }