public async void Initialize(IServicePool servicePool) { _sessionService = servicePool.GetService <ISessionService>(); this.AddCommand = new DelegateCommand(p => !this.IsBusy, this.ExecuteAddCommand); this.EditCommand = new DelegateCommand(p => !this.IsBusy, this.ExecuteEditCommand); this.OkCommand = new DelegateCommand(p => !this.IsBusy, this.ExecuteOkCommand); this.CancelEditCommand = new DelegateCommand(p => !this.IsBusy, this.ExecuteCancelEditCommand); this.DeleteCommand = new DelegateCommand(p => !this.IsBusy, this.ExecuteDeleteCommand); this.CancelDeleteCommand = new DelegateCommand(p => !this.IsBusy, this.ExecuteCancelDeleteCommand); this.IsBusy = true; _speakerList = await _sessionService.GetSpeakerListAsync(); _speakerList.Insert(0, new Speaker { Id = 0, Name = " " }); this.SpeakersView = new ListCollectionView(_speakerList); var trackList = await _sessionService.GetTrackListAsync(); _uiTrackList = new List <UITrack>(); foreach (var track in trackList) { var uiTrack = new UITrack(track); _uiTrackList.Add(uiTrack); uiTrack.PropertyChanged += this.OnUITrackPropertyChanged; } this.TracksView = new ListCollectionView(_uiTrackList); var sessionTypeList = await _sessionService.GetSessionTypesAsync(); this.SessionTypesView = new ListCollectionView(sessionTypeList); this.Sessions = await _sessionService.GetSessionListAsync(); this.SessionsView = new ListCollectionView(this.Sessions); this.SessionsView.CurrentChanged += this.OnCurrentSessionChanged; this.SessionsView.CurrentChanging += this.OnCurrentSessionChanging; _editView = this.SessionsView as IEditableCollectionViewAddNewItem; if (this.SessionsView.CurrentItem != null) { this.SetCurrentSession(this.SessionsView.CurrentItem as SessionDto); } this.IsBusy = false; }
public async void Initialize(IServicePool servicePool) { _sessionService = servicePool.GetService<ISessionService>(); this.AddCommand = new DelegateCommand(p => !this.IsBusy, this.ExecuteAddCommand); this.EditCommand = new DelegateCommand(p => !this.IsBusy, this.ExecuteEditCommand); this.OkCommand = new DelegateCommand(p => !this.IsBusy, this.ExecuteOkCommand); this.CancelEditCommand = new DelegateCommand(p => !this.IsBusy, this.ExecuteCancelEditCommand); this.DeleteCommand = new DelegateCommand(p => !this.IsBusy, this.ExecuteDeleteCommand); this.CancelDeleteCommand = new DelegateCommand(p => !this.IsBusy, this.ExecuteCancelDeleteCommand); this.IsBusy = true; _speakerList = await _sessionService.GetSpeakerListAsync(); _speakerList.Insert(0, new Speaker { Id = 0, Name = " " }); this.SpeakersView = new ListCollectionView(_speakerList); var trackList = await _sessionService.GetTrackListAsync(); _uiTrackList = new List<UITrack>(); foreach (var track in trackList) { var uiTrack = new UITrack(track); _uiTrackList.Add(uiTrack); uiTrack.PropertyChanged += this.OnUITrackPropertyChanged; } this.TracksView = new ListCollectionView(_uiTrackList); var sessionTypeList = await _sessionService.GetSessionTypesAsync(); this.SessionTypesView = new ListCollectionView(sessionTypeList); this.Sessions = await _sessionService.GetSessionListAsync(); this.SessionsView = new ListCollectionView(this.Sessions); this.SessionsView.CurrentChanged += this.OnCurrentSessionChanged; this.SessionsView.CurrentChanging += this.OnCurrentSessionChanging; _editView = this.SessionsView as IEditableCollectionViewAddNewItem; if (this.SessionsView.CurrentItem != null) this.SetCurrentSession(this.SessionsView.CurrentItem as SessionDto); this.IsBusy = false; }