Ejemplo n.º 1
0
        public static void DoMain(string[] args)
        {
            InitConfig();

            // show properties
            Console.WriteLine("app.id: " + _appId.Value);
            Console.WriteLine("app.name: " + _appName.Value);
            Console.WriteLine("user.list: " + _userList.Value);
            Console.WriteLine("user.data: " + _userData.Value);
            Console.WriteLine("sleep.time: " + _sleepTime.Value);

            // Get some property value for non-stable property (the key is not stable, not sure it exists or not)
            string somePropertyValue = _properties.GetStringPropertyValue("some.data", "not-sure");

            Console.WriteLine();
            Console.WriteLine("some.data: " + somePropertyValue);

            Console.WriteLine();

            Console.WriteLine("Now sleep {0} ms ...", _sleepTime.Value);
            Thread.Sleep(_sleepTime.Value.Value);

            Console.WriteLine();
            Console.WriteLine("My custom property data: " + _myCustomData.Value);

            Console.WriteLine();
            for (int i = 0; i < _myCustomData.Value.Times; i++)
            {
                Console.WriteLine("{0} {1}!", _myCustomData.Value.Say, _myCustomData.Value.Name);
            }

            Console.WriteLine();
            Console.WriteLine("Bye!");
        }
Ejemplo n.º 2
0
        public void DoAppThing()
        {
            // do component work
            _ownManagerComponent.YourComponentApi();
            _outerManagerComponent.YourComponentApi();
            _labeledPropertyComponent.YourComponentApi();

            // do app owner work
            String appName = _appProperties.GetStringPropertyValue("app.name");

            Console.WriteLine("I'm {0}. I use my app config to do work!", appName);
        }
Ejemplo n.º 3
0
        public static void DoMain(string[] args)
        {
            InitConfig();

            // show properties
            Console.WriteLine("app.id: " + _appId.Value);
            Console.WriteLine("app.name: " + _appName.Value);
            Console.WriteLine("user.list: " + _userList.Value);
            Console.WriteLine("user.data: " + _userData.Value);
            Console.WriteLine("sleep.time: " + _sleepTime.Value);

            // Get some property value for non-stable property (the key is not stable, not sure it exists or not)
            string somePropertyValue = _properties.GetStringPropertyValue("some.data", "not-sure");

            Console.WriteLine();
            Console.WriteLine("some.data: " + somePropertyValue);

            Console.WriteLine();

            Console.WriteLine("Now sleep {0} ms ...", _sleepTime.Value);
            Thread.Sleep(_sleepTime.Value.Value);

            Console.WriteLine();
            Console.WriteLine("My custom property data: " + _myCustomData.Value);

            Console.WriteLine();
            for (int i = 0; i < _myCustomData.Value.Times; i++)
            {
                Console.WriteLine("{0} {1}!", _myCustomData.Value.Say, _myCustomData.Value.Name);
            }

            // system source has higher priority than app.properties,
            // change the system property, configuration manager will auto update it
            // the change listener will be auto-called as well
            _systemPropertiesSource.SetPropertyValue("app.name", "new-little-app");

            Console.WriteLine();
            Console.WriteLine("Bye!");
        }