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

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

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

            return(true);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }