public Program() { Serialiser = new Nil.Serialiser<Configuration>(ConfigurationPath); Configuration = Serialiser.Load(); //Check for configuration errors Configuration.Check(); //Store it right away to automatically remove unused content and provide new default values Serialiser.Store(Configuration); Database databaseProvider = new Database(Configuration); StatisticsService = new StatisticsService(this, Configuration, databaseProvider); WebService = new WebService(this, Configuration, StatisticsService, databaseProvider); UpdateService = new UpdateService(Configuration, this, this); MainWindow = new MainWindow(Configuration, this, StatisticsService); }
public EditDialogue(EngineRegionProfile profile, MainWindow parent) { Profile = profile; InitializeComponent(); Title = "Edit login for " + profile.Description; Login login = profile.Login; if (login != null) { UsernameTextBox.Text = login.Username; PasswordTextBox.Password = login.Password; } //Center it Left = parent.Left + (parent.Width - Width) / 2; Top = parent.Top + (parent.Height - Height) / 2; //Default to false, this way nothing special needs to be done when the user closes the window without using the Ok/Cancel button UserProvidedNewLogin = false; }
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; }