private void bg_DoWork(object sender, DoWorkEventArgs e) { try { Models.DataSource.ConnectionString = Settings.Default.ConnectionString; Console.Write(new UnitOfWork().ObligationsRepo.Fetch().Count()); MachineTime.UpdateTime(); } catch (Exception exception) { Invoke(new Action(() => { ConnectionDialog.ShowDialog(); })); } }
public static string Connection() { var cd = new ConnectionDialog(); DataSource.AddStandardDataSources(cd); cd.SelectedDataSource = DataSource.SqlDataSource; cd.ConnectionString = Settings.Default.ConnectionString; cd.SelectedDataProvider = DataProvider.SqlDataProvider; DataConnectionDialog.Show(cd); Settings.Default.ConnectionString = cd.ConnectionString; Settings.Default.Save(); return(cd.ConnectionString); }
private void Bg_DoWork(object sender, DoWorkEventArgs e) { try { var unitOfWork = new UnitOfWork(); Debug.Write(unitOfWork.UsersRepo.Fetch().Select(x => new { x.Id }).Any()); Thread.Sleep(100); } catch (Exception ex) { Invoke(new Action(() => { MessageBox.Show(ex.Message, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error); UnitOfWork.DataSource = ConnectionDialog.Connection(); })); } }
private void btnServerSetup_Click(object sender, EventArgs e) { ConnectionDialog.ShowDialog(); }