Пример #1
0
 public StreamViewModel()
 {
     _name = "StreamName";
     _status = StreamStateType.UnLoaded;
     CompositeDisposable.Add((IDisposable)(Items = new ReadOnlyDispatcherCollection<ViewModel>(
         new DispatcherCollection<ViewModel>(
         new ObservableCollection<ViewModel>(
             Enumerable.Range(0, 3).Select(idx => new ActivityViewModel())), App.Current.Dispatcher))));
     ResumeButton = new ResumeButtonViewModel();
 }
Пример #2
0
        public StreamViewModel(Stream circle)
        {
            _circleModel = circle;
            _name = circle.Name;
            _status = StreamStateType.UnLoaded;
            ReconnectCommand = new ViewModelCommand(ReconnectCommand_Executed);
            ResumeCommand = new ViewModelCommand(ReconnectCommand_Executed);
            ResumeButton = new ResumeButtonViewModel() { ClickCommand = ReconnectCommand };
            CompositeDisposable.Add(_modelPropChangedEventListener = new PropertyChangedEventListener(circle));
            CompositeDisposable.Add(_thisPropChangedEventListener = new PropertyChangedEventListener(this));
            CompositeDisposable.Add(_activities = ViewModelHelper.CreateReadOnlyDispatcherCollection<Activity, ViewModel>(
                _circleModel.Activities, item => new ActivityViewModel(item, _isActive), App.Current.Dispatcher));

            _modelPropChangedEventListener.Add(() => circle.Status, Model_Status_PropertyChanged);
            _modelPropChangedEventListener.Add(() => circle.ChangedActivityCount, Model_ChangedActivityCount_PropertyChanged);
            _thisPropChangedEventListener.Add(() => ScrollOffset, ScrollOffset_PropertyChanged);
        }