Esempio n. 1
0
        public bool Initialize(IBrokenHost host)
        {
            cmd = new CommandLine();
            host.ServiceContainer.RegisterService <ICommand>(cmd);

            return(true);
        }
Esempio n. 2
0
        public bool Initialize(IBrokenHost host)
        {
            var logger = new Logger(host.ServiceContainer.GetService <ISettings>());

            host.ServiceContainer.RegisterService <ILogger>(logger);

            return(true);
        }
Esempio n. 3
0
        public bool Initialize(IBrokenHost host)
        {
            var     settings = host.ServiceContainer.GetService <ISettings>();
            Storage st       = new Storage(settings);

            host.ServiceContainer.RegisterService <IStorage>(st);
            return(true);
        }
Esempio n. 4
0
        public bool Initialize(IBrokenHost host)
        {
            var settings = host.ServiceContainer.GetService <ISettings>();
            var player   = new BassPlayer(settings);

            host.ServiceContainer.RegisterService <IAudioPlayer>(player);

            return(true);
        }
Esempio n. 5
0
        public bool Initialize(IBrokenHost host)
        {
            if (host.ServiceContainer.HasService <ISettings>())
            {
                return(false);
            }

            settings = new Settings();

            //Register ISettings as service
            host.ServiceContainer.RegisterService <ISettings>(settings);

            //Save settings on exit
            host.OnHostEvent += (sender, e) =>
            {
                if (e.Category == HostEvents.Closing)
                {
                    settings?.Save();
                }
            };

            return(true);
        }