Skip to content

Instantly share code, notes, and snippets.

@juucustodio
Created July 20, 2019 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juucustodio/5bc707bc72281c3e8437b1100e7bd444 to your computer and use it in GitHub Desktop.
Save juucustodio/5bc707bc72281c3e8437b1100e7bd444 to your computer and use it in GitHub Desktop.
Example of how to use Feature Toggle in your Xamarin.Forms applications.
using System.ComponentModel;
using ConfigCat.Client;
using Xamarin.Forms;
namespace DemoFeatureToggle
{
[DesignTimeVisible(false)]
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
void Handle_Clicked(object sender, System.EventArgs e)
{
var client = new ConfigCatClient("API KEY");
if (client.GetValue("isAwesomeFeatureEnabled", false))
{
LblResult.Text = "ON";
LblResult.TextColor = Color.GreenYellow;
}
else
{
LblResult.Text = "OFF";
LblResult.TextColor = Color.Red;
}
client.Dispose();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment