Esempio n. 1
0
 /// <summary>
 /// Initializes the viewModel when the view has been loaded, and prevents reinitialization
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private async void OnLoaded(object sender, RoutedEventArgs e)
 {
     try
     {
         if (!isLoaded)
         {
             isLoaded = true;
             await viewModel.InitializeAsync();
         }
     }
     //Writes a message to the logger if an exception is caught while loading
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Der opstod en fejl.", MessageBoxButton.OK, MessageBoxImage.Error);
         await Logger.LogAsync(ex);
     }
 }
Esempio n. 2
0
        public async Task SetupAsync()
        {
            try
            {
                if (!_eventsSetup)
                {
                    SetupRaceEvents();
                }
                _currentSkier = await _activeRaceService.GetCurrentSkier(RaceState.Race.Id);
                await LoadStartList();

                await CurrentSkierViewModel.InitializeAsync();

                await RankingViewModel.InitializeAsync();
            }
            catch (Exception)
            {
                MessageBoxUtil.Error("Fehler beim Laden der Daten");
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Runs when Controller is loaded
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void OnLoaded(object sender, RoutedEventArgs e)
        {
            try
            {
                // Check if isLoaded is false
                if (!isLoaded)
                {
                    // Set isLoaded to true
                    isLoaded = !isLoaded;

                    await viewModel.InitializeAsync();
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
                Exception originalException = ex.GetOriginalException();

                MessageBox.Show(originalException.Message, "An error has occurred, please check the log file for further information.", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Initialize the viewModel when the view has been loaded, and prevents reinitialization
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void OnLoaded(object sender, RoutedEventArgs e)
        {
            try
            {
                // Check if this has already been loaded
                if (!isLoaded)
                {
                    // Change isLoaded value
                    isLoaded = !isLoaded;

                    // Initialize the viewModel
                    await viewModel.InitializeAsync();
                }
            }
            catch (Exception ex)
            {
                // Output error message
                MessageBox.Show(ex.Message, "Der opstod en fejl.", MessageBoxButton.OK, MessageBoxImage.Error);

                // Log Exception
                await Logger.LogAsync(ex);
            }
        }