public bool Initialize(IBrokenHost host) { cmd = new CommandLine(); host.ServiceContainer.RegisterService <ICommand>(cmd); return(true); }
public bool Initialize(IBrokenHost host) { var logger = new Logger(host.ServiceContainer.GetService <ISettings>()); host.ServiceContainer.RegisterService <ILogger>(logger); return(true); }
public bool Initialize(IBrokenHost host) { var settings = host.ServiceContainer.GetService <ISettings>(); Storage st = new Storage(settings); host.ServiceContainer.RegisterService <IStorage>(st); return(true); }
public bool Initialize(IBrokenHost host) { var settings = host.ServiceContainer.GetService <ISettings>(); var player = new BassPlayer(settings); host.ServiceContainer.RegisterService <IAudioPlayer>(player); return(true); }
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); }