コード例 #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);
     }
 }
コード例 #2
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, "An error has occurred, please check the log file for further information.", MessageBoxButton.OK, MessageBoxImage.Error);

                // Log Exception
                await Logger.LogAsync(ex);
            }
        }
コード例 #3
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);
            }
        }