private void CreateLoginModuleDialog(UiTreeNode node) { if (node == null || !(node.ContextObject is GUILoginModule)) { MessageBox.Show("请选择结点"); return; } LoginWindowDlg dlg = new LoginWindowDlg(); dlg.Project = this.project; dlg.Text = "添加登录窗口"; foreach (TableInfo entity in this.project.Database.Tables) { dlg.cmbEntity.Items.Add(entity); } dlg.cmbEntity.SelectedIndex = 0; if (dlg.ShowDialog() == DialogResult.OK) { GUILoginModule module = node.ContextObject as GUILoginModule; if (module == null) { return; } TableInfo entityInfo = this.project.Database.Tables.Find(e => e.Name == dlg.cmbEntity.SelectedItem.ToString()); if (entityInfo == null) { return; } module.TableName = ((TableInfo)entityInfo).Name; module.AccountField = dlg.cmbAccountField.SelectedItem.ToString(); module.PasswordField = dlg.cmbPasswordField.SelectedItem.ToString(); } }
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { GUILoginModule loginModule = context.Instance as GUILoginModule; string tableName = loginModule.TableName; ContextObject rootContextObject = loginModule.GetRoot(); if (!(rootContextObject is Project)) { return(new StandardValuesCollection(new string[] { })); } Project project = rootContextObject as Project; List <string> list = new List <string>(); foreach (ColumnInfo column in project.Database.Tables.Find(e => e.Name == tableName).Columns) { list.Add(column.Name); } return(new StandardValuesCollection(list.ToArray())); }