void btnOK_Click(object sender, EventArgs e) { if (!Directory.Exists(txtCountryFolder.Text)) { UserInfoHandler.ShowError("Import Country Folder does not exist."); return; } if (Directory.Exists(EMPath.Folder_Countries(EM_AppContext.FolderEuromodFiles) + txtShortName.Text)) { UserInfoHandler.ShowError("Country folder '" + txtShortName.Text + "' already exists at '" + EMPath.Folder_Countries(EM_AppContext.FolderEuromodFiles) + "'."); return; } if (txtFlag.Text != string.Empty && !CountryAdministrator.IsValidFlagFilePath(txtFlag.Text)) { return; } //out-commented as it does not really make sense to not allow for longer country-short-names //if (txtShortName.Text.Length != 2) //{ // if (UserInfoHandler.GetInfo("Short Name is supposed to have two characters. Do you want to correct?", MessageBoxButtons.YesNo) == DialogResult.Yes) // return; //} DialogResult = DialogResult.OK; Close(); }
void btnOK_Click(object sender, EventArgs e) { string potCountryFolder = EMPath.Folder_Countries(EM_AppContext.FolderEuromodFiles) + txtShortName.Text; string potAddOnFolder = EMPath.Folder_AddOns(EM_AppContext.FolderEuromodFiles) + txtShortName.Text; if (Directory.Exists(potCountryFolder) || Directory.Exists(potAddOnFolder)) { UserInfoHandler.ShowError("Country or Add-on '" + txtShortName.Text + "' already exists."); return; } if (txtFlag.Text != string.Empty && !CountryAdministrator.IsValidFlagFilePath(txtFlag.Text)) { return; } DialogResult = DialogResult.OK; Close(); }
void btnOK_Click(object sender, EventArgs e) { if (txtShortName.Text == string.Empty || txtLongName.Text == string.Empty) { Tools.UserInfoHandler.ShowError("Please indicate a short name and a long name for the add-on."); return; } if (CountryAdministrator.DoesCountryExist(txtShortName.Text)) { Tools.UserInfoHandler.ShowError("Add-on named '" + txtShortName.Text + "' already exists."); return; } if (txtSymbol.Text != string.Empty && !CountryAdministrator.IsValidFlagFilePath(txtSymbol.Text)) { return; } if (lstAddOnSystems.CheckedItems.Count == 0 || lstBaseSystems.CheckedItems.Count == 0) { Tools.UserInfoHandler.ShowError("Please select an add-on system and a base system."); return; } _addOnSystemName = lstAddOnSystems.SelectedItem.ToString(); _baseSystemName = lstBaseSystems.SelectedItem.ToString(); if (_addOnSystemName == _baseSystemName) { Tools.UserInfoHandler.ShowError("Add-on system must be different from base system."); return; } DialogResult = DialogResult.OK; Close(); }