예제 #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var form = new UnleashForm();

            JsonSerializerTester.Assert(new NewtonsoftJson7Serializer());

            settings = new UnleashSettings
            {
                UnleashApi = new Uri("http://unleash.herokuapp.com/"),
                //UnleashApi = new Uri("http://localhost:4242/"),
                AppName                = "dotnet-forms-test",
                InstanceTag            = "instance 1",
                SendMetricsInterval    = TimeSpan.FromSeconds(5),
                FetchTogglesInterval   = TimeSpan.FromSeconds(10),
                UnleashContextProvider = new WinFormsContextProvider(form),
                JsonSerializer         = new NewtonsoftJson7Serializer()
            };

            unleash       = new DefaultUnleash(settings);
            form.Unleash  = unleash;
            form.Settings = settings;

            Application.ApplicationExit += (sender, args) =>
            {
                unleash?.Dispose();
            };

            Application.Run(form);
        }
예제 #2
0
 public WinFormsContextProvider(UnleashForm form)
 {
     this.form = form;
 }