private async Task ImageDetailCommandCommandExecute(BindingModel parm)
 {
     if (parm.GetType() == typeof(VisualProjectLocationPhoto))
     {
         VisualProjectLocationPhoto = parm as VisualProjectLocationPhoto;
         // VisualProjectLocationPhoto = parm;
         ImgData.Path     = VisualProjectLocationPhoto.ImageUrl;
         ImgData.ParentID = VisualProjectLocationPhoto.VisualLocationId;
         ImgData.VisualProjectLocationPhoto = VisualProjectLocationPhoto;
         ImgData.IsEditVisual = IsEdit;
         //ImgData.VisualProjectLocationPhotos = VisualProjectLocationPhotoItems;
         ImgData.FormType = "VP";
         await CurrentWithoutDetail.EditImage(ImgData, GetImage);
     }
     if (parm.GetType() == typeof(VisualBuildingLocationPhoto))
     {
         VisualBuildingLocationPhoto = parm as VisualBuildingLocationPhoto;
         ImgData.Path         = VisualBuildingLocationPhoto.ImageUrl;
         ImgData.FormType     = "VB";
         ImgData.IsEditVisual = IsEdit;
         ImgData.VisualBuildingLocationPhoto = VisualBuildingLocationPhoto;
         await CurrentWithoutDetail.EditImage(ImgData, GetImage);
     }
     if (parm.GetType() == typeof(VisualApartmentLocationPhoto))
     {
         VisualApartmentLocationPhoto = parm as VisualApartmentLocationPhoto;
         ImgData.Path         = VisualApartmentLocationPhoto.ImageUrl;
         ImgData.FormType     = "VA";
         ImgData.IsEditVisual = IsEdit;
         ImgData.VisualApartmentLocationPhoto = VisualApartmentLocationPhoto;
         await CurrentWithoutDetail.EditImage(ImgData, GetImage);
     }
 }
        private async Task DeleteImageCommandCommandExecute(BindingModel parm)
        {
            var result = await Shell.Current.DisplayAlert(
                "Alert",
                "Are you sure you want to remove?",
                "Yes", "No");



            if (result)
            {
                if (parm.GetType() == typeof(VisualProjectLocationPhoto))
                {
                    VisualProjectLocationPhoto obj = parm as VisualProjectLocationPhoto;
                    await VisualProjectLocationPhotoDataStore.DeleteItemAsync(obj, IsEdit);
                }
                if (parm.GetType() == typeof(VisualBuildingLocationPhoto))
                {
                    VisualBuildingLocationPhoto obj = parm as VisualBuildingLocationPhoto;
                    await VisualBuildingLocationPhotoDataStore.DeleteItemAsync(obj);
                }
                if (parm.GetType() == typeof(VisualApartmentLocationPhoto))
                {
                    VisualApartmentLocationPhoto obj = parm as VisualApartmentLocationPhoto;
                    await VisualApartmentLocationPhotoDataStore.DeleteItemAsync(obj);
                }
                await LoadAsync();
            }
        }
Esempio n. 3
0
        private async Task DeleteImageCommandCommandExecute(BindingModel parm)
        {
            try {
                var result = await Shell.Current.DisplayAlert(
                    "Alert",
                    "Are you sure you want to remove?",
                    "Yes", "No");



                if (result)
                {
                    if (parm.GetType() == typeof(VisualProjectLocationPhoto))
                    {
                        VisualProjectLocationPhoto obj = parm as VisualProjectLocationPhoto;
                        await VisualProjectLocationPhotoDataStore.DeleteItemAsync(obj, IsEdit).ConfigureAwait(false);

                        VisualProjectLocationPhotoItems = new ObservableCollection <VisualProjectLocationPhoto>(await VisualProjectLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(ProjectLocation_Visual.Id, false));
                        if (VisualProjectLocationPhotoItems.Count == 0)
                        {
                            await Shell.Current.Navigation.PopAsync();
                        }
                    }
                    if (parm.GetType() == typeof(VisualBuildingLocationPhoto))
                    {
                        VisualBuildingLocationPhoto obj = parm as VisualBuildingLocationPhoto;
                        await VisualBuildingLocationPhotoDataStore.DeleteItemAsync(obj).ConfigureAwait(false);;

                        VisualBuildingLocationPhotoItems = new ObservableCollection <VisualBuildingLocationPhoto>(await VisualBuildingLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(BuildingLocation_Visual.Id, false));
                        if (VisualBuildingLocationPhotoItems.Count == 0)
                        {
                            await Shell.Current.Navigation.PopAsync();
                        }
                    }
                    if (parm.GetType() == typeof(VisualApartmentLocationPhoto))
                    {
                        VisualApartmentLocationPhoto obj = parm as VisualApartmentLocationPhoto;
                        await VisualApartmentLocationPhotoDataStore.DeleteItemAsync(obj).ConfigureAwait(false);;

                        VisualApartmentLocationPhotoItems = new ObservableCollection <VisualApartmentLocationPhoto>(await VisualApartmentLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(Apartment_Visual.Id, false));
                        if (VisualApartmentLocationPhotoItems.Count == 0)
                        {
                            await Shell.Current.Navigation.PopAsync();
                        }
                    }
                    //   await LoadAsync();
                }
            }
            catch (Exception)
            {
            }
        }