Esempio n. 1
0
        private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems != null)
            {
                var addedStickers = e.AddedItems.OfType <Sticker>();

                foreach (var item in addedStickers)
                {
                    if (_pickerUi.CanAddFile(item.File))
                    {
                        _pickerUi.AddFile(item.File.Path, item.File);
                    }
                }
            }

            if (e.RemovedItems != null)
            {
                var removedItems = e.RemovedItems.OfType <Sticker>();

                foreach (var item in removedItems)
                {
                    if (_pickerUi.ContainsFile(item.File.Path))
                    {
                        _pickerUi.RemoveFile(item.File.Path);
                    }
                }
            }
        }
 private void RemoveFileButton_Click(object sender, RoutedEventArgs e)
 {
     if (fileOpenPickerUI.ContainsFile(id))
     {
         fileOpenPickerUI.RemoveFile(id);
         OutputTextBlock.Text = Status.FileRemoved;
     }
     UpdateButtonState(false);
 }
Esempio n. 3
0
 private async void RemoveLocalFileButton_Click(object sender, RoutedEventArgs e)
 {
     if (fileOpenPickerUI.ContainsFile(id))
     {
         fileOpenPickerUI.RemoveFile(id);
         await new Windows.UI.Popups.MessageDialog("File removed from the basket.").ShowAsync();
     }
     UpdateButtonState(false);
 }
 public async Task Remove(PickedFile file)
 {
     lock (syncObject)
     {
         if (fileOpenPickerUI.ContainsFile(file.Path))
         {
             fileOpenPickerUI.RemoveFile(file.Path);
         }
     }
     await Task.CompletedTask;
 }
        public async Task ShowRecordings()
        {
            var recordings = await RecordingStorage.GetRecordings();

            RecordingList.ItemsSource = recordings
                                        .Select(t =>
                                                new RecordingViewModel(t.Item1, () =>
            {
                if (!_pickerUi.ContainsFile(t.Item1))
                {
                    _pickerUi.AddFile(t.Item1, t.Item2);
                }
                else
                {
                    _pickerUi.RemoveFile(t.Item1);
                }
            }))
                                        .ToArray();
        }
        /// <summary>
        /// Invoked when the selected collection of files changes.
        /// </summary>
        /// <param name="sender">The GridView instance used to display the available files.</param>
        /// <param name="e">Event data that describes how the selection changed.</param>
        private void HandleSelectedFileChanged(Object sender,
                                               SelectionChangedEventArgs e)
        {
            // Update the picker 'basket' with the newly selected items
            foreach (var addedFile in e.AddedItems.Cast <FileInfo>())
            {
                if (_fileOpenPickerUI.CanAddFile(addedFile.File))
                {
                    _fileOpenPickerUI.AddFile(addedFile.Title, addedFile.File);
                }
            }

            // Update the picker 'basket' to remove any newly removed items
            foreach (var removedFile in e.RemovedItems.Cast <FileInfo>())
            {
                if (_fileOpenPickerUI.ContainsFile(removedFile.Title))
                {
                    _fileOpenPickerUI.RemoveFile(removedFile.Title);
                }
            }
        }
        async private void ResumeListSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (!_saving)
            {
                var grid_view   = sender as ListView;
                var resume      = grid_view.SelectedItem as Resume;
                var resume_file = resume?.GetFile();
                if (resume_file != null)
                {
                    if (_previous_id != null)
                    {
                        _open_basket.RemoveFile(_previous_id);
                    }

                    _open_basket.AddFile(resume.ResumeID, resume_file);
                    _open_basket.Title = $"{resume.Name} selected";
                    _previous_id       = resume.ResumeID;
                }
                else
                {
                    await new MessageDialog("Resume is null").ShowAsync();
                }
            }
        }
 public void RemoveFile(string id)
 {
     _fileOpenPicker.RemoveFile(id);
 }