Exemplo n.º 1
0
        public void Init(int recordId)
        {
            _recordId = recordId;

            _recordDetailViewModelList = new List <RecordDetailViewModel> ();

            var viewModelCount = RecordCount < 3 ? RecordCount : 3;

            if (_recordId == 1)
            {
                for (int i = 0; i < viewModelCount; i++)
                {
                    RecordDetailViewModel recordDetailViewModel = Mvx.IocConstruct <RecordDetailViewModel>();
                    RefreshRecordDetail(recordDetailViewModel, _recordId + i);
                    _recordDetailViewModelList.Add(recordDetailViewModel);
                }
            }
            else if (_recordId == RecordCount)
            {
                for (int i = 0; i < viewModelCount; i++)
                {
                    RecordDetailViewModel recordDetailViewModel = Mvx.IocConstruct <RecordDetailViewModel>();
                    var startModel = viewModelCount == 2 ? _recordId - 1 : _recordId - 2;
                    RefreshRecordDetail(recordDetailViewModel, startModel + i);
                    _recordDetailViewModelList.Add(recordDetailViewModel);
                }
            }
            else
            {
                for (int i = 0; i < viewModelCount; i++)
                {
                    RecordDetailViewModel recordDetailViewModel = Mvx.IocConstruct <RecordDetailViewModel>();
                    RefreshRecordDetail(recordDetailViewModel, _recordId - 1 + i);
                    _recordDetailViewModelList.Add(recordDetailViewModel);
                }
            }
        }
Exemplo n.º 2
0
        public void RefreshRecordDetail(RecordDetailViewModel viewModel, int index)
        {
            var recordInfo = _recordService.FindRecordById(index);

            viewModel.RecordId = recordInfo.Id;
        }