private void Window_Loaded(object sender, RoutedEventArgs e) { _session.Start(); var streamers = _session.StreamerCollection.Values; var profileViewModels = new WatcherDataViewModel[streamers.Length]; for (var i = 0; i < streamers.Length; i++) { var streamer = streamers[i]; var valueType = GetValueType(streamers[i]); var stackPanel = StackPanel.AddGroupStackPanel($"{streamer.GetType().Name}<{valueType.Name}>", null); var inputSpeedTextBlock = new TextBlock { Text = "0/s" }; var processingSpeedTextBlock = new TextBlock { Text = "0/s" }; var totalCountTextBlock = new TextBlock { Text = "0/0" }; stackPanel.AddLabeledRow("Input Speed", inputSpeedTextBlock); stackPanel.AddLabeledRow("Processing Speed", processingSpeedTextBlock); stackPanel.AddLabeledRow("Processed/Input Count", totalCountTextBlock); profileViewModels[i] = new WatcherDataViewModel(streamer, inputSpeedTextBlock, processingSpeedTextBlock, totalCountTextBlock); } _startTimestamp = DateTimeUtils.CurrentTimeMillis; foreach (var profileViewModel in profileViewModels) { profileViewModel.AttachWatcher(); } _profileViewModels = profileViewModels; _timer = new Timer(Timer_OnTick, null, 1000, 1000); }
internal ConfigViewModel(string type, string groupDesc, StackPanel container, IEnumerable selections) { Container = container; var consumerGroupPanel = Container.AddGroupStackPanel(type, groupDesc); ComboBox = new ComboBox { ItemsSource = selections, Tag = this }; consumerGroupPanel.AddLabeledRow(type, ComboBox); ParamPanel = new ParameterPanel { CanCollapse = false, Tag = this }; Container.Children.Add(ParamPanel); }