public TypeNameCreator(ExistingNames existingNames) { this.existingNames = existingNames; createUnknownTypeName = CreateNameCreator("Type"); createEnumName = CreateNameCreator("Enum"); createStructName = CreateNameCreator("Struct"); createDelegateName = CreateNameCreator("Delegate"); createClassName = CreateNameCreator("Class"); createInterfaceName = CreateNameCreator("Interface"); var names = new string[] { "Exception", "EventArgs", "Attribute", "Form", "Dialog", "Control", "Stream", }; foreach (var name in names) { nameInfos.Add(name, CreateNameCreator(name)); } }
public void OkDialog() { if (ExistingNames.Contains(textName.Text)) { var message = TextUtil.LineSeparate( string.Format(Resources.RenameResultDlg_ReplicateName_The_name__0__is_already_in_use, textName.Text), Resources.RenameResultDlg_OkDialog_Please_use_a_different_name); MessageDlg.Show(this, message); return; } DialogResult = DialogResult.OK; }
public void Load(List <ColorPalette> colorPalettes) { foreach (ColorPalette colorPalette in colorPalettes) { if (ExistingNames.Overlaps(colorPalette.Names)) { string[] validNames = colorPalette.Names.Except(ExistingNames).ToArray(); if (validNames.Any()) { AddPalette(new ColorPalette(colorPalette.MenuColors, validNames)); } } else { AddPalette(colorPalette); } } }
public bool ValidateForm() { // Sanity check to avoid empty string names txtName.Text = txtName.Text.Trim(); if ((string.IsNullOrEmpty(txtName.Text.Trim()))) { MessageBox.Show(string.Format("You must provide a unique name for the {0}.", Noun), GCDCore.Properties.Resources.ApplicationNameLong, MessageBoxButtons.OK, MessageBoxIcon.Information); txtName.Select(); return(false); } if (ExistingNames.Contains(txtName.Text)) { MessageBox.Show(string.Format("There is another {0} in this GCD Project that possesses this name. You must provide a unique name for the {0}.", Noun), GCDCore.Properties.Resources.ApplicationNameLong, MessageBoxButtons.OK, MessageBoxIcon.Information); txtName.Select(txtName.Text.Length, 0); return(false); } return(true); }
/// <summary> /// Validates the form field. /// </summary> private bool ValidateField() { string name = ItemName; if (name == "") { ScadaUiUtils.ShowError(AppPhrases.ItemNameEmpty); return(false); } if (!AdminUtils.NameIsValid(name)) { ScadaUiUtils.ShowError(AppPhrases.ItemNameInvalid); return(false); } if (ExistingNames != null && ExistingNames.Contains(name.ToLowerInvariant())) { ScadaUiUtils.ShowError(AppPhrases.ItemNameDuplicated); return(false); } return(true); }
public void AddPalette(ColorPalette colorPalette) { All.Add(colorPalette); ExistingNames.UnionWith(colorPalette.Names); }
public GlobalTypeNameCreator(ExistingNames existingNames) : base(existingNames) { }