public async override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // the following code demonstrates how to fetch config and apply next time.

            // apply default config if you want
            var keys = new[]
            {
                new NSString("test1"),
                new NSString("test2")
            };

            var objects = new NSObject[]
            {
                new NSString("value1"),
                new NSNumber(2),
            };

            var dictionary = new NSDictionary <NSString, NSObject>(keys, objects);

            remoteInstance = AGCRemoteConfig.GetSharedInstance();
            remoteInstance.ApplyDefaults(dictionary);
            // load and apply the last fetched config
            AGCConfigValues lastFetchedConfig = remoteInstance.LoadLastFetched();

            remoteInstance.Apply(lastFetchedConfig);

            // get all applied config and show it in label
            this.ShowAllValues();

            // only fetch config, you can apply the fetched config next time.
            var   resultTask = remoteInstance.Fetch().AddOnSuccessCallbackAsync();
            await resultTask;

            if (resultTask.IsCompleted)
            {
                Console.Write("fetch successfully");
            }
            else
            {
                Console.Write("fetch failed");
            }
        }
        public async override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // the following code demonstrates how to fetch config and apply immediately.

            // apply default config if you want
            var keys = new[]
            {
                new NSString("test1"),
                new NSString("test2")
            };

            var objects = new NSObject[]
            {
                new NSString("value1"),
                new NSNumber(2),
            };

            var dictionary = new NSDictionary <NSString, NSObject>(keys, objects);

            remoteInstance = AGCRemoteConfig.GetSharedInstance();
            remoteInstance.ApplyDefaults(dictionary);



            // fetch config
            var   resultTask = remoteInstance.Fetch().AddOnSuccessCallbackAsync();
            await resultTask;

            if (resultTask.IsCompleted)
            {
                Console.Write("fetch success");
                if (resultTask.Result != null)
                {
                    remoteInstance.Apply((AGCConfigValues)resultTask.Result); // apply the config when fetch is successful
                }
                ShowAllValues();                                              // get all applied config and show it in label
            }
            else
            {
                Console.Write("fetch failed");
            }
        }
Пример #3
0
 partial void Clear_TouchUpInside(UIButton sender)
 {
     AGCRemoteConfig.GetSharedInstance().ClearAll();
 }