private async void DeleteItem()
        {
            if (SettingsService.DeleteItemSetting)
            {
                ContentDialog deleteItem = new ContentDialog
                {
                    Title               = "Delete item from list",
                    Content             = "You can change your preferences in the settings?",
                    CloseButtonText     = "Cancel",
                    PrimaryButtonText   = "Delete",
                    SecondaryButtonText = "Never show again",
                    DefaultButton       = ContentDialogButton.Primary
                };

                ContentDialogResult result = await deleteItem.ShowAsync();

                if (result == ContentDialogResult.Primary)
                {
                    DeleteItemCall();
                }
                if (result == ContentDialogResult.Secondary)
                {
                    SettingsService.ChangeDeleteItemSetting(false);
                    DeleteItemCall();
                }
                if (result == ContentDialogResult.None)
                {
                }
            }
            if (!SettingsService.DeleteItemSetting)
            {
                DeleteItemCall();
            }
        }
Exemplo n.º 2
0
 private void ToggleSwitch_Toggled(object sender, RoutedEventArgs e)
 {
     if (sender is ToggleSwitch toggleSwitch)
     {
         if (toggleSwitch.IsOn == true)
         {
             SettingsService.ChangeDeleteItemSetting(true);
         }
         else
         {
             SettingsService.ChangeDeleteItemSetting(false);
         }
     }
 }