Example #1
0
        private async void LoadingForm_Load(object sender, EventArgs e)
        {
            /*
             * Used Task.Run(..) here because here is the first call to DB with context (create connection, etg.)
             * and it will take much time and will lock main UI thread, even though the call is asynchronous
             */
            var result = await Task.Run(async() => await _healthCheckService.IsApplicationAvailable());

            if (!result)
            {
                throw new Exception("Ошибка инициализации базы данных");
            }

            Context.SetExecutableForm(DIContainer.Resolve <LoginForm>());
            Context.ShowExecutableForm();

            Close();
        }