public App()
        {
            Locator.CurrentMutable.RegisterViewsForViewModels(Assembly.GetCallingAssembly());
            Locator.CurrentMutable.RegisterConstant(new ConverterBoolAndVisibility(), typeof(IBindingTypeConverter));

            IConfigurationRoot configuration;

            configuration = WritableJsonConfigurationFabric.Create("Settings.json");
            Locator.CurrentMutable.RegisterConstant(configuration, typeof(IConfiguration));
        }
Beispiel #2
0
        public App()
        {
            Locator.CurrentMutable.RegisterViewsForViewModels(Assembly.GetCallingAssembly());
            Locator.CurrentMutable.RegisterViewsForViewModels(Assembly.LoadWithPartialName("DataConveyor.Views.WPF"));
            Locator.CurrentMutable.RegisterConstant(new ConverterBoolAndVisibility(), typeof(IBindingTypeConverter));

            IConfigurationRoot configuration = WritableJsonConfigurationFabric.Create("Settings.json");

            configuration.GetSection("Appearance:DarkThemePath").Set("Themes/Dark.xaml");
            configuration.GetSection("Appearance:LightThemePath").Set("Themes/Light.xaml");
            Locator.CurrentMutable.RegisterConstant(configuration, typeof(IConfiguration));
        }
Beispiel #3
0
        public App()
        {
            Thread.CurrentThread.CurrentCulture   = new CultureInfo("en-US");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
            FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(
                                                                   XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));

            Locator.CurrentMutable.RegisterViewsForViewModels(Assembly.GetCallingAssembly());
            Locator.CurrentMutable.RegisterConstant(new ConverterBoolAndVisibility(), typeof(IBindingTypeConverter));

            IConfigurationRoot configuration;

            configuration = WritableJsonConfigurationFabric.Create("Settings.json");
            Locator.CurrentMutable.RegisterConstant(configuration, typeof(IConfiguration));
        }
Beispiel #4
0
        // Initialization code. Don't use any Avalonia, third-party APIs or any
        // SynchronizationContext-reliant code before AppMain is called: things aren't initialized
        // yet and stuff might break.
        public static void Main(string[] args)
        {
            //Регистрация подсистемы конфигурации
            IConfigurationRoot configuration = WritableJsonConfigurationFabric.Create("Settings.json", false);
            var section = configuration.GetSection("ChatClientSettings");

            if (section == null)
            {
                configuration.Set(new { ChatClientSettings = new ChatClientSettings() });
            }
            Locator.CurrentMutable.RegisterConstant(configuration, typeof(IConfiguration));
            Locator.CurrentMutable.Register <INotify>(() => new NotifyWindow());
            Locator.CurrentMutable.Register <ICanOpenFileDialog>(() => new CanOpenFileDialog());

            var mapper = AppModelMapping.ConfigureMapping();

            Locator.CurrentMutable.Register <IMapper>(() => mapper);

            //Запуск авалонии
            BuildAvaloniaApp()
            .StartWithClassicDesktopLifetime(args);
        }