Пример #1
0
        /// <summary>
        /// Method that initializes the Municipality list
        /// </summary>
        private void InitList(List <Municipality> resultList)
        {
            _munList.Clear();

            foreach (var item in resultList)
            {
                var munCellModel = new MunCellModel {
                    Name = item.Name
                };


                if (!string.IsNullOrEmpty(item.ImgUrl))
                {
                    munCellModel.ImageSource = new UriImageSource {
                        Uri = new Uri(item.ImgUrl)
                    };
                }
                else
                {
                    munCellModel.ImageSource = new UriImageSource();
                }


                _munList.Add(munCellModel);
            }

            MunList = _munList;
        }
Пример #2
0
 /// <summary>
 /// Method called from the page when an item is Selected.
 /// It pushes a coupling page initialized to the Selected Municipality.
 /// Used instead of messagingcenter
 /// </summary>
 public void OnSelectedItem(MunCellModel selectedItem)
 {
     foreach (var item in _objectList)
     {
         if (item.Name == selectedItem.Name)
         {
             App.Navigation.PushAsync(
                 (ContentPage)
                 ViewFactory.CreatePage <CouplingViewModel, CouplingPage>((v, vm) =>
             {
                 v.InitVm(item);
                 vm.SetMunicipality(item);
             }));
             break;
         }
     }
 }