Inheritance: System.Windows.Forms.Form
Exemplo n.º 1
0
 private void tName_Validating(object sender, CancelEventArgs e)
 {
     if (World.IsValidName(tName.Text) &&
         (!ConfigUI.IsWorldNameTaken(tName.Text) ||
          (originalWorldName != null && tName.Text.ToLower() == originalWorldName.ToLower())))
     {
         tName.ForeColor = SystemColors.ControlText;
     }
     else
     {
         tName.ForeColor = Color.Red;
         e.Cancel        = true;
     }
 }
Exemplo n.º 2
0
        void LoadMap(object sender, EventArgs args)
        {
            // Fill in the "Copy existing world" combobox
            foreach (WorldListEntry otherWorld in ConfigUI.worlds)
            {
                if (otherWorld != world)
                {
                    cWorld.Items.Add(otherWorld.name + " (" + otherWorld.Description + ")");
                    copyOptionsList.Add(otherWorld);
                }
            }

            if (world == null)
            {
                Text  = "Adding a New World";
                world = new WorldListEntry();
                int worldNameCounter = 1;
                for ( ; ConfigUI.IsWorldNameTaken("NewWorld" + worldNameCounter); worldNameCounter++)
                {
                    ;
                }
                world.name            = "NewWorld" + worldNameCounter;
                tName.Text            = world.Name;
                cAccess.SelectedIndex = 0;
                cBuild.SelectedIndex  = 0;
                cBackup.SelectedIndex = 5;
                map = null;
            }
            else
            {
                world                = new WorldListEntry(world);
                Text                 = "Editing World \"" + world.Name + "\"";
                originalWorldName    = world.Name;
                tName.Text           = world.Name;
                cAccess.SelectedItem = world.AccessPermission;
                cBuild.SelectedItem  = world.BuildPermission;
                cBackup.SelectedItem = world.Backup;
                xHidden.Checked      = world.Hidden;
            }

            // Disable "copy" tab if there are no other worlds
            if (cWorld.Items.Count > 0)
            {
                cWorld.SelectedIndex = 0;
            }
            else
            {
                tabs.TabPages.Remove(tabCopy);
            }

            // Disable "existing map" tab if there are no other worlds
            fileToLoad = Path.Combine(Paths.MapPath, world.Name + ".fcm");
            if (File.Exists(fileToLoad))
            {
                ShowMapDetails(tExistingMapInfo, fileToLoad);
                StartLoadingMap();
            }
            else
            {
                tabs.TabPages.Remove(tabExisting);
                tabs.SelectTab(tabLoad);
            }

            // Set Generator comboboxes to defaults
            cTemplates.SelectedIndex = (int)MapGenTemplate.River;

            savePreviewDialog.FileName = world.name;
        }
Exemplo n.º 3
0
 public ConfigUI( string[] args ) {
     instance = this;
     InitializeComponent();
     bold = new Font( Font, FontStyle.Bold );
     Shown += Init;
 }