public bool Initialise() { try { Serialiser = new Nil.Serialiser<Configuration>(ConfigurationPath); Configuration = Serialiser.Load(); } catch (Exception exception) { MessageBox.Show(exception.Message); return false; } Database databaseProvider = new Database(Configuration.Database); StatisticsService = new StatisticsService(this, Configuration, databaseProvider); WebService = new WebService(this, Configuration, StatisticsService, databaseProvider); MainWindow = new MainWindow(Configuration, this, StatisticsService); return true; }
static void Main(string[] arguments) { Configuration configuration; try { Nil.Serialiser<Configuration> serialiser = new Nil.Serialiser<Configuration>(ConfigurationPath); configuration = serialiser.Load(); } catch (Exception exception) { Console.WriteLine(exception.Message); return; } DatabaseConnectionProvider databaseProvider = new DatabaseConnectionProvider(configuration.Database); StatisticsService statisticsService = new StatisticsService(configuration, databaseProvider); statisticsService.Run(); WebService webService = new WebService(configuration, statisticsService, databaseProvider); webService.Run(); }