/// <summary> /// Initializes a new instance of the <see cref="DatasetViewModel"/> class. /// </summary> /// <param name="dataset">The dataset for which to create the view model.</param> public DatasetViewModel(Dataset dataset) { this.dataset = dataset; this.internalSessionViewModels = new ObservableCollection <SessionViewModel>(); this.sessionViewModels = new ReadOnlyObservableCollection <SessionViewModel>(this.internalSessionViewModels); foreach (var item in this.dataset.Sessions) { this.internalSessionViewModels.Add(new SessionViewModel(this, item)); } this.currentSessionViewModel = this.internalSessionViewModels.FirstOrDefault(); }
/// <summary> /// Initializes a new instance of the <see cref="PartitionViewModel"/> class. /// </summary> /// <param name="sessionViewModel">The view model of the session to which this partition belongs.</param> /// <param name="partition">The partition for which to create the view model.</param> public PartitionViewModel(SessionViewModel sessionViewModel, IPartition partition) { this.partition = partition; this.sessionViewModel = sessionViewModel; this.sessionViewModel.DatasetViewModel.PropertyChanged += this.DatasetViewModel_PropertyChanged; this.streamsById = new Dictionary <int, IStreamTreeNode>(); this.StreamTreeRoot = new StreamTreeNode(this); foreach (var stream in this.partition.AvailableStreams) { this.streamsById[stream.Id] = this.StreamTreeRoot.AddPath(stream); } // Check if this is a live partition (i.e. it still has a writer attached) this.UpdateLiveStatus(); if (this.IsLivePartition) { this.liveMessageCallback = new LiveMessageReceivedDelegate(this.OnMessageWritten); this.newMetadataCallback = new UpdateStreamMetadataDelegate(this.UpdateStreamMetadata); this.MonitorLivePartition(); } }
/// <summary> /// Initializes a new instance of the <see cref="DatasetViewModel"/> class. /// </summary> /// <param name="dataset">The dataset for which to create the view model.</param> public DatasetViewModel(Dataset dataset) { this.PropertyChanged += this.OnPropertyChanged; this.dataset = dataset; this.internalSessionViewModels = new ObservableCollection <SessionViewModel>(); this.sessionViewModels = new ReadOnlyObservableCollection <SessionViewModel>(this.internalSessionViewModels); foreach (var item in this.dataset.Sessions) { this.internalSessionViewModels.Add(new SessionViewModel(this, item)); } this.currentSessionViewModel = this.internalSessionViewModels.FirstOrDefault(); if (this.currentSessionViewModel != null && this.dataset.Sessions.Count == 1) { this.currentSessionViewModel.IsTreeNodeExpanded = true; } this.IsTreeNodeExpanded = true; }