Esempio n. 1
0
        /// <summary>
        /// The button callback to remove all highscores from the database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ClearHighscores_Click(object sender, RoutedEventArgs e)
        {
            var db = (DatabaseService)SL.Get(typeof(DatabaseService));

            db.ClearHighScores();
            dataGrid.ItemsSource = null;
        }
Esempio n. 2
0
        /// <summary>
        /// The constructor initializes gui components and ensures service instances are initialized and present in the SL system
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            ((ServerService)SL.Get(typeof(ServerService))).StartService();
            SL.Register(this);
            var db = (DatabaseService)SL.Get(typeof(DatabaseService));

            dataGrid.ItemsSource = db.GetAllLevelsWithScores();
        }
Esempio n. 3
0
 /// <summary>
 /// Upon window close the server service closes to prevent DB connection leaks.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void WindowClosing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     ((ServerService)SL.Get(typeof(ServerService))).StopService();
 }
Esempio n. 4
0
        /// <summary>
        /// This button causes the app to show all highscores for every level. A new highscore added needs manual refresh.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ShowLevelHighscoresButton_Click(object sender, RoutedEventArgs e)
        {
            var db = (DatabaseService)SL.Get(typeof(DatabaseService));

            dataGrid.ItemsSource = db.GetAllLevelsWithHighscores();
        }