Esempio n. 1
0
 public SpeakersViewModel(
     ISpeakersService service,
     IServiceCaller serviceCaller) : base(serviceCaller)
 {
     this.service = service;
     Speakers     = new ObservableCollection <Speaker>();
 }
        public void Merge(ISessionsService sessionsService, ISpeakersService speakersService)
        {
            if (null == sessionsService || null == speakersService)
                throw new NullReferenceException("Sessions and speakers services must both be set");

            var timer = CodeTimer.StartNew();

            if (null != sessionsService.Data)
            {
                sessionsService.Data.ToList().ForEach(s =>
                {
                    s.Speaker = speakersService.Data.Where(
                            sp => sp.SpeakerId == s.SpeakerId).FirstOrDefault();

                    if (null == s.Speaker)
                    {
                        // this can possibly happen if a new speaker was added and the speaker data is cached longer than the session data
                        // and session includes the new speaker that wasn't there at the point the speaker data was last cached
                        LogInstance.LogWarning("WARNING: No speaker found with speaker id {0} for session {1}. Speaker data may need to be refreshed",
                            s.SpeakerId, s.Title);
                    }
                });
            }

            // we don't need to load sessions for speaker anymore upfront; we delay load it later only if/when needed

            // 2.316 seconds roughly doing both. .031 seconds with skipping sessions for each speaker
            LogInstance.LogInfo("Session / speaker data merged in {0:##.000} seconds", timer.Stop());
        }
 public SpeakersController(ISpeakersService speakersService)
 {
     _speakersService = speakersService;
 }
Esempio n. 4
0
 public SessionsService(ISpeakersService speakers)
 {
     this.speakers = speakers;
 }
Esempio n. 5
0
        private void SpeakersBackgroundWorkDone(object sender, RunWorkerCompletedEventArgs e)
        {
            if (null != e.Error)
                throw e.Error;

            _speakersService = (ISpeakersService)e.Result;
            AfterServiceOperationCompleted();
        }
Esempio n. 6
0
 public SpeakersController(ISpeakersService service, IContext context)
 {
     _speakersService = service;
     _context         = context;
 }
Esempio n. 7
0
 public SpeakersController(ISpeakersService service)
 {
     Service = service;
 }
        public async void Initialize(IServicePool pool)
        {
            _isInititializing = true;
            this.State = "ReadOnly";

            if (Application.Current != null &&
                Application.Current.MainWindow != null &&
                !DesignerProperties.GetIsInDesignMode(Application.Current.MainWindow))
            {
                _speakerService = pool.GetService<ISpeakersService>();
                this.SaveCommand = new DelegateCommand(this.CanExecuteSaveCommand, this.ExecuteSaveCommand);
                var list = await _speakerService.GetSpeakerListAsync();
                this.SpeakerList = new ObservableCollection<SpeakerDto>(list);
                this.CurrentSpeaker = this.SpeakerList[0];
                this.SpeakerListView = new ListCollectionView(this.SpeakerList);
                this.SpeakerListView.CurrentChanged += SpeakerListView_CurrentChanged;
                this.SpeakerListView.MoveCurrentTo(this.SpeakerList[1]);
                //this.SpeakerListView.Filter = item => ((Speaker)item).FirstName.StartsWith("C");
                _speakerEditView = this.SpeakerListView as IEditableCollectionView;
            }

            _isInititializing = false;
        }
 public DetailsViewModel(INavigationService navigationService, ISpeakersService speakersService)
     : base()
 {
     _navigationService = navigationService;
     _speakersService   = speakersService;
 }