public MonitorViewModel(IEventAggregator events, VLCVideoViewModel videoViewModel, ImageViewModel imageViewModel, BrowserViewModel browserViewModel) { this._events = events; this._video = videoViewModel; this._image = imageViewModel; this._browser = browserViewModel; }
void IHandle <MonitorShowMediaEvent> .Handle(MonitorShowMediaEvent evt) { _logger.Info("{0} : receveid MonitorShowMediaEvent : {1} {2}", _channel, evt.Media.Type, evt.Media.LocalFile); try { Uri source = null; //IScreen screen = null; AbstractMonitorViewModel @abstract = null; switch (evt.Media.Type) { case Media.MediaTypeEnum.VIDEO: @abstract = _video; source = new Uri(evt.Media.LocalFile); //Execute.PostToUIThread(() => _video.Source = source); //; // _video.Source = source; //this.ActivateItem(_video); break; case Media.MediaTypeEnum.IMAGE: @abstract = _image; source = new Uri(evt.Media.LocalFile); //_image.Source = source; //this.ActivateItem(_image); break; } @abstract.Source = source; @abstract.Play(); this.ActivateItem(@abstract); _media = evt.Media; _currentMediaShowDateTiem = DateTime.Now; } catch (Exception e) { _logger.Error(e, "error occurred"); this._events.Publish(new MonitorShowMediaErrorEvent(evt.Media), _channel); } }