Beispiel #1
0
        public void Delete(int id)
        {
            var model = localDb.GetById(id);

            if (model != null)
            {
                var dr = MessageBox.Show($"{model.Name}を削除しますか?", "提示", MessageBoxButton.YesNo, MessageBoxImage.Question);
                if (dr == MessageBoxResult.Yes)
                {
                    localDb.Delete(id);
                    Query();
                }
            }
        }
Beispiel #2
0
        public static void RemoveNoteReminders(Note note, bool reflectOnRoaming = true)
        {
            if (note == null || note.Reminder == null)
            {
                return;
            }

            LocalDB.Delete(note.Reminder);
            if (reflectOnRoaming)
            {
                RoamingDB.Delete(note.Reminder);
            }

            NotificationsManager.RemoveScheduledToastsIfExists(note);
            note.Reminder = new Reminder();
        }
Beispiel #3
0
        public static async Task <bool> RemoveNoteImage(NoteImage noteImage, bool deleteFromDB = true)
        {
            if (noteImage == null)
            {
                return(true);
            }
            bool success = true;

            try
            {
                Debug.WriteLine("Delete " + noteImage.URL);
                var file = await StorageFile.GetFileFromPathAsync(noteImage.URL);

                await file.DeleteAsync();

                if (deleteFromDB)
                {
                    LocalDB.Delete(noteImage);
                    RoamingDB.Delete(noteImage);
                }
            }
            catch (Exception)
            {
                success = false;
            }

            if (deleteFromDB)
            {
                var handler2 = NotesSaved;
                if (handler2 != null)
                {
                    handler2(null, EventArgs.Empty);
                }
            }

            return(success);
        }