public CommunicationViewModel( IProcess process, PacketListViewModel packetList, PacketDetailsViewModel packetDetails, IBus bus) : base(bus) { Contract.Requires <ArgumentNullException>(process != null); Contract.Requires <ArgumentNullException>(packetList != null); Contract.Requires <ArgumentNullException>(packetDetails != null); Contract.Requires <ArgumentNullException>(bus != null); this.process = process; this.packetList = packetList; this.packetDetails = packetDetails; Func <string> getTitle = () => "Communication: " + (this.process.Player != null ? this.process.Player.Name : this.process.DisplayName); this.Title = getTitle(); PropertyChangedEventManager.AddHandler( this.process, (sender, args) => this.Title = getTitle(), string.Empty); PropertyChangedEventManager.AddHandler( this.packetList, (sender, args) => this.packetDetails.Packet = this.packetList.SelectedPacket, "SelectedPacket"); this.Bus.Subscribe(this.packetList); }
public PacketDetailsDocumentItemViewModel(IAutoFactory <PacketDetailsViewModel> packetDetailsVMFactory, IBus bus) : base(bus) { Contract.Requires <ArgumentNullException>(packetDetailsVMFactory != null); Contract.Requires <ArgumentNullException>(bus != null); this.packetDetails = packetDetailsVMFactory.Create(); this.Title = "Packet Details"; }