Пример #1
0
        public Window1()
        {
            Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
            Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");

            InitializeComponent();

            #if use_config_file
            CioConfiguration config = ConfigurationLoader.Load();
            #else
            CioConfiguration config = new CioConfiguration();
            config.RegisterServiceVisitor(new DisplayNameServiceVisitor());
            config.RegisterServiceVisitor(new EditableServiceVisitor());
            config.RegisterService(CreateDisplayNameService());

            config.Elements = new ElementConfiguration();
            #endif
            config.Elements.RegisterDefaultControls();

            IElementResolver resolver = config.Elements.CreateResolver();

            IFormBuilder formBuilder = new WpfFormBuilder(resolver);

            var form = new UserForm(config, formBuilder);

            User user = CreateUser();

            grid.Children.Add((UIElement)form.Render(user));
        }
Пример #2
0
        public static void Main(string[] args)
        {
            #if use_config_file
            CioConfiguration config = ConfigurationLoader.Load();
            #else
            CioConfiguration config = new CioConfiguration();
            config.RegisterServiceVisitor(new DisplayNameServiceVisitor());
            config.RegisterServiceVisitor(new EditableServiceVisitor());
            config.RegisterService(CreateDisplayNameService());

            config.Elements = new ElementConfiguration();
            #endif
            config.Elements.RegisterDefaultControls();

            CioWindow wnd = new CioWindow(config, new WpfWindowBuilder());

            wnd.Render();
            new Application().Run();
        }
Пример #3
0
        public static CioConfiguration Load(string sectionName)
        {
            CioConfigurationSection section = (CioConfigurationSection)ConfigurationManager.GetSection(sectionName);

            Type elementsConfigType = section.ElementsConfigType;

            IElementConfiguration elementConfig = GetElementConfiguration(elementsConfigType);

            CioConfiguration config = new CioConfiguration(elementConfig);

            foreach (IServiceVisitor visitor in GetServiceVisitors(section.ServiceVistors))
            {
                config.RegisterServiceVisitor(visitor);
            }

            foreach (object service in GetServices(section.Services))
            {
                config.RegisterService(service);
            }

            return config;
        }