예제 #1
0
        /// ------------------------------------------------------------------------------------
        protected internal virtual bool Delete()
        {
            var annotationFile = GetAnnotationFile();

            if (PreDeleteAction != null)
            {
                PreDeleteAction();
            }

            var path = PathToAnnotatedFile;

            // Delete the underlying component file.
            if (!ConfirmRecycleDialog.Recycle(path))
            {
                return(false);
            }

            // Delete the file's metadata file.
            var metaPath = path + Settings.Default.MetadataFileExtension;

            if (File.Exists(metaPath))
            {
                ConfirmRecycleDialog.Recycle(metaPath);
            }

            if (annotationFile != null)
            {
                annotationFile.Delete();
            }

            return(true);
        }
예제 #2
0
        /// ------------------------------------------------------------------------------------
        protected bool RemoveItemFromFileSystem(T item)
        {
            if (item.FolderPath == "*mocked*")
            {
                return(true);
            }

            // Recycle only, since the user has already confirmed the delete by this time.
            return(ConfirmRecycleDialog.Recycle(item.FolderPath));
        }
예제 #3
0
        public void DeleteBook(Book.BookInfo bookInfo)
        {
            var didDelete = ConfirmRecycleDialog.Recycle(bookInfo.FolderPath);

            if (!didDelete)
            {
                return;
            }

            Logger.WriteEvent("After BookStorage.DeleteBook({0})", bookInfo.FolderPath);
            HandleBookDeletedFromCollection(bookInfo.FolderPath);
            if (_bookSelection != null)
            {
                _bookSelection.SelectBook(null);
            }
        }
예제 #4
0
        /// ------------------------------------------------------------------------------------
        protected internal override bool Delete()
        {
            // If the annotation file has an associated ELAN preference file, then delete it.
            var prefFilePath       = Path.ChangeExtension(PathToAnnotatedFile, ".pfsx");
            var oralAnnotationFile = OralAnnotationFile;

            if (!base.Delete())
            {
                return(false);
            }

            if (File.Exists(prefFilePath))
            {
                ConfirmRecycleDialog.Recycle(prefFilePath);
            }

            if (oralAnnotationFile != null)
            {
                oralAnnotationFile.Delete();
                _oralAnnotationFile = null;
            }

            var           segmentAnnotationFileFolder = SegmentAnnotationFileFolder;
            DirectoryInfo dirInfo = new DirectoryInfo(segmentAnnotationFileFolder);

            if (dirInfo.Exists)
            {
                try
                {
                    foreach (FileInfo file in dirInfo.EnumerateFiles())
                    {
                        ConfirmRecycleDialog.Recycle(file.FullName);
                    }
                    Directory.Delete(segmentAnnotationFileFolder, true);
                }
                catch (Exception e)
                {
                    Logger.WriteEvent("Handled Exception in AnnotationComponentFile.Delete:\r\n{0}", e.ToString());
                }
            }

            return(true);
        }
예제 #5
0
        // Request from sign language tool to delete the selected video.
        private void HandleDeleteVideoRequest(ApiRequest request)
        {
            lock (request)
            {
                string    videoPath;
                decimal[] dummy;
                if (!GetVideoDetailsFromRequest(request, true, out videoPath, out dummy))
                {
                    return;                     // request.Failed was called inside the above method
                }
                var label = LocalizationManager.GetString("EditTab.Toolbox.SignLanguage.SelectedVideo", "The selected video", "Appears in the context \"X will be moved to the recycle bin\"");
                if (!ConfirmRecycleDialog.JustConfirm(label))
                {
                    request.ReplyWithText("canceled");
                    return;
                }

                ConfirmRecycleDialog.Recycle(videoPath);
                request.ReplyWithText("deleted");
            }
        }
예제 #6
0
        public void DeleteBook(Book.BookInfo bookInfo)
        {
            var didDelete = ConfirmRecycleDialog.Recycle(bookInfo.FolderPath);

            if (!didDelete)
            {
                return;
            }

            Logger.WriteEvent("After BookStorage.DeleteBook({0})", bookInfo.FolderPath);
            //Debug.Assert(_bookInfos.Contains(bookInfo)); this will occur if we delete a book from the BloomLibrary section
            _bookInfos.Remove(bookInfo);

            if (CollectionChanged != null)
            {
                CollectionChanged.Invoke(this, null);
            }
            if (_bookSelection != null)
            {
                _bookSelection.SelectBook(null);
            }
        }
예제 #7
0
        public void DeleteBook(Book.BookInfo bookInfo)
        {
            var didDelete = ConfirmRecycleDialog.Recycle(bookInfo.FolderPath);

            if (!didDelete)
            {
                return;
            }

            Logger.WriteEvent("After BookStorage.DeleteBook({0})", bookInfo.FolderPath);
            //ListOfBooksIsOutOfDate();
            Debug.Assert(_bookInfos.Contains(bookInfo));
            _bookInfos.Remove(bookInfo);

            if (CollectionChanged != null)
            {
                CollectionChanged.Invoke(this, null);
            }
            if (_bookSelection != null)
            {
                _bookSelection.SelectBook(null);
            }
        }