private void onPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {
            case nameof(SelectedStreamType):
                IsShowStreamType = false;
                if (DisplayModel.StreamInfoArray != null && !_streamRefreshing)
                {
                    StreamInfo si = DisplayModel.StreamInfoArray.FirstOrDefault <StreamInfo>(s => { return(s.Name.Equals(SelectedStreamType)); });
                    if (si != null)
                    {
                        updateVideo(si.Index);
                    }
                }
                break;

            case nameof(VideoId):
                IsShowStreamType    = false;
                PTZControl.VideoId  = VideoId;
                PresetModel.VideoId = VideoId;
                SwitchModel.VideoId = VideoId;
                updateVideo();
                if (TrackSource != null)
                {
                    TrackSource.PropertyChanged -= TrackSource_PropertyChanged;
                    TrackSource.Dispose();
                }
                TrackSource = new VideoTrackViewModel(VideoId);
                TrackSource.PropertyChanged += TrackSource_PropertyChanged;
                break;
            }
        }
 public RealTimeControlModel()
 {
     StreamType                   = new CollectionViewSource();
     SelectedStreamType           = DefaultStreamType;
     VideoInfoMessage             = new VideoInfoMessageViewModel();
     PTZControl                   = new PTZControlModel();
     PresetModel                  = new PresetViewModel();
     SwitchModel                  = new SwitchPanelViewModel();
     TrackSource                  = new VideoTrackViewModel(VideoId);
     PropertyChanged             += onPropertyChanged;
     PTZControl.PropertyChanged  += PTZControl_PropertyChanged;
     TrackSource.PropertyChanged += TrackSource_PropertyChanged;
 }
Example #3
0
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            VideoTrackViewModel model = new VideoTrackViewModel();

            foreach (var value in values)
            {
                if (value is Track)
                {
                    model.Track = value as Track;
                }
                else if (value is PlayVideoTrack)
                {
                    model.PlayVideoTrack = value as PlayVideoTrack;
                }
            }
            return(model);
        }
Example #4
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            VideoTrackViewModel model = value as VideoTrackViewModel;

            if (model?.Track == null)
            {
                return(null);
            }
            if (model.PlayVideoTrack != null)
            {
                return(new UiCommand(o => model.PlayVideoTrack(model.Track)));
            }
            if (model.Track.Serie != null)
            {
                return
                    (new UiCommand(
                         o =>
                         DispatcherLibrary.Dispatcher.Dispatch("Multiple Track Selected For Play", model.Track.Serie.Tracks,
                                                               model.Track.Serie.Tracks.FindIndex(t => t == model.Track))));
            }
            return(new UiCommand(o => Dispatcher.Dispatch("Multiple Track Selected For Play", new List <Track> {
                model.Track
            }, 0)));
        }