public Step4a_ReadTableInfoFromDbPage(int index) { InitializeComponent(); statusLbl.Visible = false; selectedScope = WizardHelper.Instance.SyncConfigSection.SyncScopes.GetElementAt(index); Init(); }
private void ReadAndBindTablesData() { SyncScopeConfigElement selectedScope = WizardHelper.Instance.SyncConfigSection.SyncScopes.GetElementAt(this.scopeComboBox.SelectedIndex); this.syncTablesBox.Items.Clear(); foreach (SyncTableConfigElement table in selectedScope.SyncTables) { this.syncTablesBox.Items.Add(table.Name); } this.syncTablesBox.SelectedIndex = -1; this.delBtn.Enabled = this.syncTablesBox.Items.Count > 0; }
private void syncScopeBox_SelectedIndexChanged(object sender, EventArgs e) { if (this.syncScopeBox.SelectedIndex != -1) { // When a SyncScope node is selected populate the values this.addMode = false; this.removeBtn.Enabled = true; this.editBtn.Enabled = true; SyncScopeConfigElement scope = WizardHelper.Instance.SyncConfigSection.SyncScopes.GetElementAt(this.syncScopeBox.SelectedIndex); this.scopeNameTxtBox.Text = scope.Name; this.schemaNameTxtBox.Text = scope.SchemaName; this.isTempScopeOption.Checked = scope.IsTemplateScope; this.enableBulkProcsOption.Checked = scope.EnableBulkApplyProcedures; } }
private void syncTablesBox_SelectedIndexChanged(object sender, EventArgs e) { if (this.syncTablesBox.SelectedIndex > -1) { SyncScopeConfigElement selectedScope = WizardHelper.Instance.SyncConfigSection.SyncScopes.GetElementAt(this.scopeComboBox.SelectedIndex); SyncTableConfigElement table = selectedScope.SyncTables.GetElementAt(this.syncTablesBox.SelectedIndex); if (string.IsNullOrEmpty(table.FilterClause)) { this.filterColTxtBox.Text = table.FilterClause; } this.allColsIncludedOption.Checked = table.IncludeAllColumns; this.filterColTxtBox.Text = table.FilterClause; } // Allow reordering the SyncTable orders. upBtn.Enabled = this.syncTablesBox.SelectedIndex > 0; downBtn.Enabled = this.syncTablesBox.SelectedIndex != this.syncTablesBox.Items.Count - 1; }
private void saveBtn_Click(object sender, EventArgs e) { // Now add this to the SyncScopes list if (string.IsNullOrEmpty(scopeNameTxtBox.Text)) { MessageBox.Show("Please enter a valid name for sync scope Name.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); scopeNameTxtBox.Focus(); } if (addMode) { var scope = new SyncScopeConfigElement { Name = scopeNameTxtBox.Text, IsTemplateScope = isTempScopeOption.Checked, EnableBulkApplyProcedures = enableBulkProcsOption.Checked }; if (!string.IsNullOrEmpty(schemaNameTxtBox.Text)) { scope.SchemaName = schemaNameTxtBox.Text; } WizardHelper.Instance.SyncConfigSection.SyncScopes.Add(scope); ReadAndBindData(); } else { var scope = WizardHelper.Instance.SyncConfigSection.SyncScopes.GetElementAt(syncScopeBox.SelectedIndex); scope.Name = scopeNameTxtBox.Text; if (!string.IsNullOrEmpty(schemaNameTxtBox.Text)) { scope.SchemaName = schemaNameTxtBox.Text; } scope.IsTemplateScope = isTempScopeOption.Checked; scope.EnableBulkApplyProcedures = enableBulkProcsOption.Checked; } scopeSettingsGrp.Enabled = false; }
private void MoveTable(int currentIndex, int newIndex) { SyncScopeConfigElement selectedScope = WizardHelper.Instance.SyncConfigSection.SyncScopes.GetElementAt(this.scopeComboBox.SelectedIndex); SyncTableConfigElement table = selectedScope.SyncTables.GetElementAt(currentIndex); // Remove element from current index selectedScope.SyncTables.RemoveAt(this.syncTablesBox.SelectedIndex); if (newIndex == selectedScope.SyncTables.Count) { // It means the element should go to the end of the list. Just call add selectedScope.SyncTables.Add(table); newIndex = selectedScope.SyncTables.Count - 1; } else { // Re-Add the element at the new index selectedScope.SyncTables.Add(newIndex, table); } // Rebind this.ReadAndBindTablesData(); this.syncTablesBox.SelectedIndex = newIndex; }