/// <summary> /// Pull data from config resources and populate the form. /// </summary> private void init() { cbDefaultMaterial.DisplayMember = "DESCR"; cbDefaultMaterial.ValueMember = "MATID"; cbDefaultMaterial.DataSource = cd.Materials.Tables[0]; cbDefaultMaterial.SelectedValue = Properties.Settings.Default.DefaultMaterial; cbDept.DisplayMember = "DEPT_NAME"; cbDept.ValueMember = "DEPT_ID"; cbDept.DataSource = cd.GetDepartments().Tables[0]; for (int i = 0; i < 26; i++) { cbRevLimit.Items.Add("A" + (char)(i + 65)); } chbDBEnabled.Checked = Properties.Settings.Default.EnableDBWrite; chbFlameWar.Checked = Properties.Settings.Default.FlameWar; chbTestingMode.Checked = Properties.Settings.Default.Testing; cbDept.SelectedValue = Properties.Settings.Default.UserDept; cbRevLimit.SelectedIndex = Properties.Settings.Default.RevLimit - 1; chbSounds.Checked = Properties.Settings.Default.MakeSounds; chbWarnings.Checked = Properties.Settings.Default.Warn; chbOpWarnings.Checked = Properties.Settings.Default.ProgWarn; chbIdiotLight.Checked = Properties.Settings.Default.IdiotLight; chbOnlyActive.Checked = Properties.Settings.Default.OnlyActiveAuthors; chbOnlyActiveCustomers.Checked = Properties.Settings.Default.OnlyCurrentCustomers; chbRememberCustomer.Checked = Properties.Settings.Default.RememberLastCustomer; checkBox1.Checked = Properties.Settings.Default.WarnExcludeAssy; checkBox2.Checked = Properties.Settings.Default.CHIHideLWH; textBox1.Text = Properties.Settings.Default.BOMFilter[0].ToString(); textBox2.Text = Properties.Settings.Default.GaugePath; textBox3.Text = Properties.Settings.Default.BOMTemplatePath; checkBox3.Checked = Properties.Settings.Default.SaveFirst; checkBox4.Checked = Properties.Settings.Default.SilenceGaugeErrors; checkBox5.Checked = Properties.Settings.Default.ExportEDrw; checkBox6.Checked = Properties.Settings.Default.ExportImg; checkBox7.Checked = Properties.Settings.Default.CutlistNotSelectedWarning; checkBox8.Checked = Properties.Settings.Default.AutoOpenPriority; chbFilterBOM.Checked = Properties.Settings.Default.FilterBOM; textBox4.Text = Properties.Settings.Default.DrawingTemplate; textBox5.Text = Properties.Settings.Default.DraftingStandard; ToolTip tt = new ToolTip(); tt.ShowAlways = true; tt.SetToolTip(label4, "You probably don't want to mess with this."); var t = new System.Globalization.CultureInfo("en-US", false).TextInfo; string currentUserName = t.ToTitleCase(cd.GetAuthorFullName(cd.GetCurrentAuthorInitial()).ToLower()); dataGridView1.AutoResizeRows(); dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; dataGridView1.AutoResizeColumns(); dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; dataGridView1.DataSource = get_stats(); dataGridView1.Columns["Avg Daily Usage"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dataGridView1.Columns["Total Since Reset"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dataGridView1.Columns["Your Avg Daily Usage"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dataGridView1.Columns["Your Total Since Reset"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dataGridView1.Columns["σ"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dataGridView1.Columns["Avg Daily Usage"].ToolTipText = string.Format(@"{0} work days since {1}", workDays, odometerStart.ToShortDateString()); dataGridView1.Columns["Total Since Reset"].ToolTipText = @"Reset @ " + odometerStart.ToShortDateString(); dataGridView1.Columns["Your Avg Daily Usage"].ToolTipText = string.Format(@"{0}'s average", currentUserName); dataGridView1.Columns["Your Total Since Reset"].ToolTipText = string.Format(@"{0}'s total, reset @ {1}", currentUserName, odometerStart.ToShortDateString()); dataGridView1.Columns["σ"].ToolTipText = @"Standard deviation"; dataGridView1.Columns["Avg Daily Usage"].DefaultCellStyle.Format = @"#.###"; dataGridView1.Columns["Your Avg Daily Usage"].DefaultCellStyle.Format = @"#.###"; dataGridView1.Columns["σ"].DefaultCellStyle.Format = @"#.###"; initialated = true; }