예제 #1
0
 private void CreateHostingEnvironment()
 {
     _hostEnvironment = new XamarinHostEnvironment
     {
         ApplicationName = _hostConfiguration[XamarinHostDefaults.ApplicationKey],
         EnvironmentName = _hostConfiguration[XamarinHostDefaults.EnvironmentKey] ?? Environments.Production,
         ContentRootPath = ResolveContentRootPath(_hostConfiguration[HostDefaults.ContentRootKey], AppContext.BaseDirectory),
         DevicePlatform  = Device.RuntimePlatform
     };
     _hostEnvironment.ContentRootFileProvider = new PhysicalFileProvider(_hostEnvironment.ContentRootPath);
 }
예제 #2
0
        public HostingViewModel(ILogger <T> logger, IXamarinHostEnvironment environment,
                                IConfiguration configuration, ISampleService sampleService, string derivedClass)
        {
            _logger        = logger;
            _environment   = environment;
            _configuration = configuration;
            _sampleService = sampleService;

            Environment  = _environment.Environment;
            DerivedClass = derivedClass;

            ConfigurationItems = new ObservableCollection <ConfigurationItem>();
            foreach (var kvp in _configuration.AsEnumerable())
            {
                if (kvp.Value != null)
                {
                    ConfigurationItems.Add(new ConfigurationItem
                    {
                        Key   = kvp.Key,
                        Value = kvp.Value
                    });
                }
            }
        }
예제 #3
0
 public SampleService(ILogger <SampleService> logger, IXamarinHostEnvironment environment, IConfiguration configuration)
 {
     _logger        = logger;
     _environment   = environment;
     _configuration = configuration;
 }