コード例 #1
0
        private async void deleteBtn_Click(object sender, RoutedEventArgs e)
        {
            previewImage.Source = null;
            if (m_selectedFile != null)
            {
                var res = MessageBox.Show("Delete photo?", "Confirm delete", MessageBoxButton.OKCancel);
                if (res == MessageBoxResult.OK)
                {
                    await m_selectedFile.DeleteAsync(StorageDeleteOption.PermanentDelete);

                    if (m_selectedThumbFile != null)
                    {
                        await m_selectedThumbFile.DeleteAsync(StorageDeleteOption.PermanentDelete);
                    }

                    viewModel.Remove(viewModel.PhotoList[m_selectionIndex] as Photo);
                    m_selectedFile         = null;
                    m_selectedThumbFile    = null;
                    photoList.SelectedItem = null;
                    UpdateNumPhotos();
                    m_selectionIndex--;
                    if (m_selectionIndex == viewModel.NumPhotos - 1 && viewModel.NumPhotos > 0)
                    {
                        m_selectionIndex--;
                    }

                    nextBtn_Click(this, null);
                }

                photoList.SelectedItem = null;
                editPopup.IsOpen       = viewModel.NumPhotos > 0;
            }
        }
コード例 #2
0
        private async Task RemoveUpload(Photo upload)
        {
            if (!App.SaveToCameraRollEnabled)
            {
                await upload.File.DeleteAsync(StorageDeleteOption.PermanentDelete);
            }

            m_viewModel.Remove(upload);
        }