public CountersViewModel(CategoriesViewModel categoriesViewModel) { _categoriesViewModel = categoriesViewModel; _counters = new KeyedCollectionProxy <CounterKey, CounterData>(c => c.Key); _chartItems = new ObservableCollection <ChartItemViewModel>( Enumerable.Range(0, MaxChartItems).Select(t => _emptyItem)); _counters.CollectionView.GroupDescriptions.Add(new PropertyGroupDescription("Category")); ScaleSelectedCommand = CreateCommand(ScaleSelected, () => SelectedCounters.Count > 0); SelectedCounters = new ObservableCollection <CounterData>(); SelectedCounters.CollectionChanged += (sender, args) => ScaleSelectedCommand.RaiseCanExecuteChanged(); _categories = new Dictionary <string, List <CounterData> >(); _syncContext = SynchronizationContext.Current; categoriesViewModel.Added += Add; _timer = new Timer(1000); _timer.Elapsed += (sender, args) => Tick(); _timer.AutoReset = false; _timer.Start(); }
public CountersViewModel(CategoriesViewModel categoriesViewModel) { _categoriesViewModel = categoriesViewModel; _counters = new KeyedCollectionProxy<CounterKey, CounterData>(c => c.Key); _chartItems = new ObservableCollection<ChartItemViewModel>( Enumerable.Range(0, MaxChartItems).Select(t => _emptyItem)); _counters.CollectionView.GroupDescriptions.Add(new PropertyGroupDescription("Category")); ScaleSelectedCommand = CreateCommand(ScaleSelected, () => SelectedCounters.Count > 0); SelectedCounters = new ObservableCollection<CounterData>(); SelectedCounters.CollectionChanged += (sender, args) => ScaleSelectedCommand.RaiseCanExecuteChanged(); _categories = new Dictionary<string, List<CounterData>>(); _syncContext = SynchronizationContext.Current; categoriesViewModel.Added += Add; _timer = new Timer(1000); _timer.Elapsed += (sender, args) => Tick(); _timer.AutoReset = false; _timer.Start(); }
public CategoriesViewModel() { _categories = new KeyedCollectionProxy <string, CategoryViewModel>(c => c.Name); _categories.CollectionView.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending)); AddCommand = CreateCommand(PublishAdd, () => SelectedCategory != null && SelectedCounters != null && SelectedCounters.Count > 0 && SelectedInstances != null && SelectedInstances.Count > 0); AddSearchResultsCommand = CreateCommand(PublishAddSearchResults, () => SelectedSearchResults != null && SelectedSearchResults.OfType <SearchResultItem>().Any(t => t.IsValid)); CloseCommand = CreateCommand(OnClosed); Load(); }
public CategoriesViewModel() { _categories = new KeyedCollectionProxy<string, CategoryViewModel>(c => c.Name); _categories.CollectionView.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending)); AddCommand = CreateCommand(PublishAdd, () => SelectedCategory != null && SelectedCounters != null && SelectedCounters.Count > 0 && SelectedInstances != null && SelectedInstances.Count > 0); AddSearchResultsCommand = CreateCommand(PublishAddSearchResults, () => SelectedSearchResults != null && SelectedSearchResults.OfType<SearchResultItem>().Any(t => t.IsValid)); CloseCommand = CreateCommand(OnClosed); Load(); }