Esempio n. 1
0
        private void Login_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                App.AppInitialize();
            }
            catch (System.Security.SecurityException sec_ex)
            {
                ViewModels.HandledError err = ViewModels.ErrorTemplates.GetFileSecurityError(sec_ex);
                new ErrorDialog(err.Title, err.Description, err.ErrorException.ToString()).ShowDialog();
            }
            catch (PathTooLongException path_ex)
            {
                ViewModels.HandledError err = ViewModels.ErrorTemplates.GetPathTooLongException(path_ex);
                new ErrorDialog(err.Title, err.Description, err.ErrorException.ToString()).ShowDialog();
            }
            catch (System.Data.SqlClient.SqlException sql_ex)
            {
                ViewModels.HandledError err = ViewModels.ErrorTemplates.GetDBInteractionError(sql_ex);
                new ErrorDialog(err.Title, err.Description, err.ErrorException.ToString()).ShowDialog();
            }
            catch (Exception ex)
            {
                new ErrorDialog("Lỗi tạo file", @"Không thể khởi tạo Log file.
ứng dụng sẽ hoạt động mà không ghi log file", ex.ToString()).ShowDialog();
            }
        }
Esempio n. 2
0
 protected void FireHandledExeptionAndLogErorrAsync(HandledError e)
 {
     System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback((o) =>
     {
         if (App.Log != null)
         {
             App.Log.AppendLog(e.ErrorException);
         }
         HandledExceptionOccured?.Invoke(this, e);
     }));
 }