コード例 #1
0
        /// <summary>
        /// プラグインを取得してリストにセット
        /// </summary>
        /// <param name="vm"></param>
        private void SetPlugins(MainWindowViewModel vm)
        {
            var plugins = FeaturesManager.FindPlugins()
                          .Select(plugin =>
            {
                plugin.Data.AddTab = new Action <string, UserControl>((name, content) =>
                {
                    TabControl.Items.Add(new TabItem()
                    {
                        IsSelected = true,
                        Header     = name,
                        Content    = content
                    });
                });

                if (plugin.Data.AutoRun)
                {
                    plugin.Data.Run();
                }
                return(plugin);
            })
                          .Where(x => x.Data.Visible)
                          .ToList();

            vm.Plugins.AddRangeOnScheduler(plugins);
        }
コード例 #2
0
 private void Awake()
 {
     if (instance != null)
     {
         Destroy(this);
     }
     instance = this;
 }
コード例 #3
0
 public App()
 {
     InitializeComponent();
     FeaturesManager = new FeaturesManager(new FileService());
     MainPage        = new NavigationPage(HomePage.Instance)
     {
         BarBackgroundColor = Color.Default, BarTextColor = Color.Default
     };
 }
コード例 #4
0
        private string GetFeatures(FeaturesManager featuresManager)
        {
            HashSet <string>            enabledFlightedFeatures = featuresManager.GetEnabledFlightedFeatures(FlightedFeatureScope.Any);
            IOrderedEnumerable <string> values = from feature in enabledFlightedFeatures
                                                 orderby feature
                                                 select feature;

            return(string.Join(",", values));
        }
コード例 #5
0
ファイル: Proxy.cs プロジェクト: cveld/reverse-proxy-dotnet
 public Proxy(
     FeaturesManager featuresManager,
     IHttpClient httpclient,
     IConfig config,
     ILogger <Proxy> log)
 {
     this.featuresManager = featuresManager;
     this.client          = httpclient;
     this.config          = config;
     this.log             = log;
 }
コード例 #6
0
        public FeaturesManagerTest(ITestOutputHelper log)
        {
            var services = new ServiceCollection()
                           .AddLogging((builder) => builder.AddXUnit(log))
                           .AddTransient <FeaturesManager>();


            var provider = services.BuildServiceProvider();

            this.target = provider.GetRequiredService <FeaturesManager>();
        }
コード例 #7
0
        private string GetFlights(FeaturesManager featuresManager)
        {
            string result = null;

            if (featuresManager.ConfigurationSnapshot != null)
            {
                string[] flights = featuresManager.ConfigurationSnapshot.Flights;
                Array.Sort <string>(flights);
                result = string.Join(",", flights);
            }
            return(result);
        }
コード例 #8
0
        /// <summary>
        /// 組み込み機能
        /// </summary>
        /// <param name="vm"></param>
        private void SetBuiltIns(MainWindowViewModel vm)
        {
            var builtins = FeaturesManager.GetBuiltins()
                           .Select(builtin =>
            {
                builtin.Click.Subscribe(() =>
                {
                    TabControl.Items.Add(new TabItem()
                    {
                        IsSelected = true,
                        Header     = builtin.TabName,
                        Content    = builtin.Control
                    });
                });

                return(builtin);
            })
                           .ToList();

            vm.Builtins.AddRangeOnScheduler(builtins);
        }
コード例 #9
0
ファイル: Startup.cs プロジェクト: cveld/reverse-proxy-dotnet
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(
            IApplicationBuilder app,
            IHostingEnvironment env,
            ILoggerFactory loggerFactory,
            IApplicationLifetime appLifetime,
            FeaturesManager featuresManager)
        {
            loggerFactory.AddConsole(this.Configuration.GetSection("Logging"));

            featuresManager.ReadConfig($"{env.ContentRootPath}\\features.json");

            // Uncomment these lines if you want to host static files in wwwroot/
            // More info: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/middleware
            // app.UseDefaultFiles();
            // app.UseStaticFiles();

            app.UseMvc();

            app.UseMiddleware <ProxyMiddleware>();

            // If you want to dispose of resources that have been resolved in the
            // application container, register for the "ApplicationStopped" event.
            appLifetime.ApplicationStopped.Register(() => this.ApplicationContainer.Dispose());
        }
コード例 #10
0
 public FeaturesController(FeaturesManager manager)
 {
     _manager = manager;
 }
コード例 #11
0
 public FeatureController(FeaturesManager featuresManager)
 {
     this.featuresManager = featuresManager;
 }