Exemplo n.º 1
0
        private void OnPictureOverwritten(Guid guid)
        {
            var picture         = Pictures.First(pic => pic.Guid == guid);
            var reloadedPicture = _pictureRepository.GetPicturesAsync(new string[] { picture.FullFileName }).Result;

            Pictures.Remove(picture);
            Pictures.Add(reloadedPicture.First());
        }
Exemplo n.º 2
0
        public async Task DeletePicture(ChadderPicture picture)
        {
            var record = await sqlDB.GetPicture(picture.RecordId);

            await sqlDB.DeleteAsync(record);

            Pictures.Remove(picture);
        }
 private void DeleteQuestion()
 {
     if (MessageBox.Show("Är du säker på att du vill ta bort frågan?", "Bekräftelse", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
     {
         Pictures.Remove(SelectedPicture);
         QuestionsAnswers.RemoveAt(SelectedQuestion - 1);
         LoadPreviousQuestion();
     }
 }
Exemplo n.º 4
0
        private async void DeletePicture(MyImages myImages)
        {
            bool decision = await pageService.DisplayAlert("Are you sure to delete this picture?", null, "Yes", "No");

            if (decision)
            {
                Pictures.Remove(myImages);
            }
        }
        public void ClearDB()
        {
            foreach (var p in Pictures)
            {
                Pictures.Remove(p);
            }
            foreach (var d in Details)
            {
                Details.Remove(d);
            }

            SaveChanges();
        }
Exemplo n.º 6
0
        public void DetachPicture(Guid pictureId)
        {
            var picture = Pictures.FirstOrDefault(x => x.PictureId.Equals(pictureId));

            if (picture is null)
            {
                throw new NotFoundDomainException("Picture does not exist!");
            }

            Pictures.Remove(picture);

            var @event = new ProductPictureRemovedDomainEvent(Id, picture.PictureId);

            AddDomainEvent(@event);
        }
Exemplo n.º 7
0
        public void RemovePicture(Guid id)
        {
            if (Pictures == null || Pictures.Any())
            {
                throw SheaftException.NotFound("Cet utilisateur ne contient aucune images.");
            }

            var existingPicture = Pictures.FirstOrDefault(p => p.Id == id);

            if (existingPicture == null)
            {
                throw SheaftException.NotFound("L'image est introuvable.");
            }

            Pictures.Remove(existingPicture);
            PicturesCount = Pictures?.Count ?? 0;
        }
Exemplo n.º 8
0
 public void DeletePictures(ICollection <int> aPictureIdCollection)
 {
     if (Pictures != null && Pictures.Count > 0)
     {
         if (aPictureIdCollection != null && aPictureIdCollection.Count > 0)
         {
             foreach (var item in aPictureIdCollection)
             {
                 var removeItem = Pictures.FirstOrDefault(p => p.UId == item);
                 if (removeItem != null)
                 {
                     Pictures.Remove(removeItem);
                 }
             }
         }
     }
 }
Exemplo n.º 9
0
        private void OnDeletePicturesCommand(List <Picture> pictures)
        {
            var pictureContext = pictures.Count > 1 ? "these pictures" : "this picture";
            var pictureNames   = string.Join("\n", pictures.Select(pic => pic.FullFileName).ToList());

            if (_modalDialog.ShowQuestion(
                    $"Are you sure you want to delete {pictureContext}:\n\n{pictureNames}\n",
                    $"Delete {pictureContext}?"))
            {
                pictures.ForEach(pic =>
                {
                    if (_pictureRepository.TryDelete(pic.FullFileName).Success.Value)
                    {
                        Pictures.Remove(pic);
                    }
                    ;
                });
            }
        }
        public void RemovePicture(Model.Picture picture)
        {
            XML.MediaXML mediaXML = new XML.MediaXML();

            mediaXML.Load("pictures.xml");
            mediaXML.Remove(picture.Path);
            mediaXML.WriteInFile("pictures.xml");
            String namePathFile = picture.Path;

            Pictures.Remove(picture);
            var medias   = from media in PicturesTmp where media.Path.Contains(namePathFile) select media;
            var selected = picture;

            foreach (var media in medias)
            {
                selected = media;
            }
            PicturesTmp.Remove(selected);
        }
Exemplo n.º 11
0
        /// <summary>
        ///     Removes the current picture locally and from the server
        /// </summary>
        public void RemovePicture()
        {
            if (Pictures.Count <= 0 || ImageNames.Count <= 0)
            {
                return;
            }
            var file = GetCurrentPictureName();

            Pictures.Remove(GetCurrentPicture());
            ImageNames.RemoveAt(_currentPictureIndex);

            _currentPictureIndex = 0;

            new InformationProtocol(Protocol.Data)
            .SetHandler("finderRemovePicture", InformationProtocol.HandlerType.Update)
            .AddParameter("uid", PlayerPrefs.GetString("uid"))
            .AddParameter("file", file)
            .Send();
        }
Exemplo n.º 12
0
        public void Init(Event evnt)
        {
            SelectedEvent = evnt;
            Pictures.Remove(p => true);
            Participate = SelectedEvent.Participate;

            var imageSourceLocations = _pictureSaver.GetPicturesFromDisk(SelectedEvent.IdForFileSystem).ToList();

            if (imageSourceLocations.Count >= 1)
            {
                HeaderPicture = new Picture(imageSourceLocations.Last());

                foreach (var imageSourceLocation in imageSourceLocations)
                {
                    Pictures.Insert(0, new Picture(imageSourceLocation));
                }
            }
            else
            {
                HeaderPicture = new Picture("journey3");
                Pictures.Add(new Picture("pictureDefault"));
            }
        }
Exemplo n.º 13
0
 /// <summary>
 /// 往工作类里面添加图片以及代号
 /// </summary>
 /// <param name="key">代号,默认为每个listbox的代号</param>
 /// <param name="filePath">完整的图片路径</param>
 public static void AddPicture(int key, string filePath)
 {
     Pictures.Remove(key);
     Pictures.Add(key, filePath);
 }
Exemplo n.º 14
0
 private void ResetPictures()
 {
     Pictures.Remove(p => true);
     _pictureSaver.RemoveAllPictures(SelectedEvent.IdForFileSystem);
 }
Exemplo n.º 15
0
 private void RemovePicture(Picture picture)
 {
     Pictures.Remove(picture);
     NotifyPropertyChanged(() => HasNoPictures);
 }
Exemplo n.º 16
0
 void IPortfolioDataSource.DeletePicture(int id)
 {
     Pictures.Remove(Pictures.Single(p => p.PictureId == id));
     SaveChanges();
 }