/// <summary>
        /// Delete the selected source
        /// </summary>
        /// <returns>Task Type</returns>
        private async Task DeleteSource()
        {
            if (IsWorking)
            {
                return;
            }
            IsWorking = true;

            try
            {
                MessageDialog showDialog = new MessageDialog("SourcesViewModelSourceDeleteAllRSSMessageDialog".GetLocalized());
                showDialog.Commands.Add(new UICommand("Yes".GetLocalized())
                {
                    Id = 0
                });
                showDialog.Commands.Add(new UICommand("No".GetLocalized())
                {
                    Id = 1
                });
                showDialog.DefaultCommandIndex = 0;
                showDialog.CancelCommandIndex  = 1;
                var result = await showDialog.ShowAsync();

                if ((int)result.Id == 0)
                {
                    await RSSDataService.DeleteManyFeedsAsync(x => x.PostSource.Id == SelectedSource.Id);
                }

                await SourceDataService.DeleteSourceAsync(SelectedSource);

                Sources.Remove(SelectedSource);
                ClearPopups();
                RefreshSourcesCommand.OnCanExecuteChanged();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsWorking = false;
            }
        }
Пример #2
0
        /// <summary>
        /// Delete the selected source
        /// </summary>
        /// <returns>Task Type</returns>
        private async Task DeleteSource()
        {
            if (IsWorking)
            {
                return;
            }
            IsWorking = true;

            try
            {
                await SourceDataService.DeleteSourceAsync(SelectedSource);

                Sources.Remove(SelectedSource);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsWorking = false;
            }
        }