ToComboBoxOption() public static method

public static ToComboBoxOption ( Rank rank ) : string
rank Rank
return string
示例#1
0
 public void RebuildList() {
     comboBox.Items.Clear();
     comboBox.Items.Add(FirstItem);
     foreach (Rank rank in RankManager.Ranks) {
         comboBox.Items.Add(MainForm.ToComboBoxOption(rank));
     }
 }
示例#2
0
        void ApplyTabWorlds()
        {
            if (rankNameList == null)
            {
                rankNameList = new BindingList <string> {
                    WorldListEntry.DefaultRankOption
                };
                foreach (Rank rank in RankManager.Ranks)
                {
                    rankNameList.Add(MainForm.ToComboBoxOption(rank));
                }
                dgvcAccess.DataSource = rankNameList;
                dgvcBuild.DataSource  = rankNameList;
                dgvcBackup.DataSource = WorldListEntry.BackupEnumNames;

                LoadWorldList();
                dgvWorlds.DataSource = Worlds;
            }
            else
            {
                //dgvWorlds.DataSource = null;
                rankNameList.Clear();
                rankNameList.Add(WorldListEntry.DefaultRankOption);
                foreach (Rank rank in RankManager.Ranks)
                {
                    rankNameList.Add(MainForm.ToComboBoxOption(rank));
                }
                foreach (WorldListEntry world in Worlds)
                {
                    world.ReparseRanks();
                }
                Worlds.ResetBindings();
                //dgvWorlds.DataSource = worlds;
            }

            FillRankList(cDefaultBuildRank, "(default rank)");
            if (ConfigKey.DefaultBuildRank.IsBlank())
            {
                cDefaultBuildRank.SelectedIndex = 0;
            }
            else
            {
                RankManager.DefaultBuildRank    = Rank.Parse(ConfigKey.DefaultBuildRank.GetString());
                cDefaultBuildRank.SelectedIndex = RankManager.GetIndex(RankManager.DefaultBuildRank);
            }

            if (Paths.IsDefaultMapPath(ConfigKey.MapPath.GetString()))
            {
                tMapPath.Text    = Paths.MapPathDefault;
                xMapPath.Checked = false;
            }
            else
            {
                tMapPath.Text    = ConfigKey.MapPath.GetString();
                xMapPath.Checked = true;
            }

            xWoMEnableEnvExtensions.Checked = ConfigKey.WoMEnableEnvExtensions.Enabled();
        }
示例#3
0
        public AddWorldPopup(WorldListEntry world)
        {
            InitializeComponent();

            fileBrowser.Filter = MapLoadFilter;

            cBackup.Items.AddRange(WorldListEntry.BackupEnumNames);

            bwLoader.DoWork             += AsyncLoad;
            bwLoader.RunWorkerCompleted += AsyncLoadCompleted;

            bwGenerator.WorkerReportsProgress = true;
            bwGenerator.DoWork             += AsyncGen;
            bwGenerator.ProgressChanged    += AsyncGenProgress;
            bwGenerator.RunWorkerCompleted += AsyncGenCompleted;

            bwRenderer.WorkerReportsProgress = true;
            bwRenderer.DoWork             += AsyncDraw;
            bwRenderer.ProgressChanged    += AsyncDrawProgress;
            bwRenderer.RunWorkerCompleted += AsyncDrawCompleted;

            renderer = new IsoCat();
            // event routed through BackgroundWorker to avoid cross-thread invocation issues
            renderer.ProgressChanged +=
                (progressSender, progressArgs) =>
                bwRenderer.ReportProgress(progressArgs.ProgressPercentage, progressArgs.UserState);

            nMapWidth.Validating  += MapDimensionValidating;
            nMapHeight.Validating += MapDimensionValidating;
            nMapLength.Validating += MapDimensionValidating;

            cAccess.Items.Add("(everyone)");
            cBuild.Items.Add("(everyone)");
            foreach (Rank rank in RankManager.Ranks)
            {
                cAccess.Items.Add(MainForm.ToComboBoxOption(rank));
                cBuild.Items.Add(MainForm.ToComboBoxOption(rank));
            }

            progressBar.Visible = false;
            tStatus1.Text       = "";
            tStatus2.Text       = "";

            World = world;
            cPreviewMode.SelectedIndex = 0;

            savePreviewDialog.Filter =
                "PNG Image|*.png|TIFF Image|*.tif;*.tiff|Bitmap Image|*.bmp|JPEG Image|*.jpg;*.jpeg";
            savePreviewDialog.Title = "Saving preview image...";

            cGenerator.Items.AddRange(MapGenUtil.GeneratorList.Select(gen => gen.Name).ToArray());
            cGenerator.SelectedIndex = 0;

            tsbLoadPreset.DropDownItemClicked      += tsbLoadPreset_DropDownItemClicked;
            tsbCopyGenSettings.DropDownItemClicked += tsbImportSettings_DropDownItemClicked;
            Shown += LoadMap;
        }
示例#4
0
        public AddWorldPopup(WorldListEntry world)
        {
            InitializeComponent();
            renderer           = new IsoCat();
            fileBrowser.Filter = MapLoadFilter;

            cBackup.Items.AddRange(WorldListEntry.BackupEnumNames);
            cTemplates.Items.AddRange(Enum.GetNames(typeof(MapGenTemplate)));
            cTheme.Items.AddRange(Enum.GetNames(typeof(MapGenTheme)));

            bwLoader.DoWork             += AsyncLoad;
            bwLoader.RunWorkerCompleted += AsyncLoadCompleted;

            bwGenerator.DoWork += AsyncGen;
            bwGenerator.WorkerReportsProgress = true;
            bwGenerator.ProgressChanged      += AsyncGenProgress;
            bwGenerator.RunWorkerCompleted   += AsyncGenCompleted;

            bwRenderer.WorkerReportsProgress      = true;
            bwRenderer.WorkerSupportsCancellation = true;
            bwRenderer.DoWork             += AsyncDraw;
            bwRenderer.ProgressChanged    += AsyncDrawProgress;
            bwRenderer.RunWorkerCompleted += AsyncDrawCompleted;

            nMapWidth.Validating  += MapDimensionValidating;
            nMapLength.Validating += MapDimensionValidating;
            nMapHeight.Validating += MapDimensionValidating;

            cAccess.Items.Add("(everyone)");
            cBuild.Items.Add("(everyone)");
            foreach (Rank rank in RankManager.Ranks)
            {
                cAccess.Items.Add(MainForm.ToComboBoxOption(rank));
                cBuild.Items.Add(MainForm.ToComboBoxOption(rank));
            }

            tStatus1.Text = "";
            tStatus2.Text = "";

            World = world;

            savePreviewDialog.Filter = "PNG Image|*.png|TIFF Image|*.tif;*.tiff|Bitmap Image|*.bmp|JPEG Image|*.jpg;*.jpeg";
            savePreviewDialog.Title  = "Saving preview image...";

            browseTemplateDialog.Filter = "MapGenerator Template|*.ftpl";
            browseTemplateDialog.Title  = "Opening a MapGenerator template...";

            saveTemplateDialog.Filter = browseTemplateDialog.Filter;
            saveTemplateDialog.Title  = "Saving a MapGenerator template...";

            Shown += LoadMap;
        }
示例#5
0
 public DeleteRankPopup(Rank deletedRank)
 {
     InitializeComponent();
     foreach (Rank rank in RankManager.Ranks)
     {
         if (rank != deletedRank)
         {
             cSubstitute.Items.Add(MainForm.ToComboBoxOption(rank));
         }
     }
     lWarning.Text             = String.Format(lWarning.Text, deletedRank.Name);
     cSubstitute.SelectedIndex = cSubstitute.Items.Count - 1;
 }
示例#6
0
 private void cSubstitute_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cSubstitute.SelectedIndex < 0)
     {
         return;
     }
     foreach (Rank rank in RankManager.Ranks)
     {
         if (cSubstitute.SelectedItem.ToString() != MainForm.ToComboBoxOption(rank))
         {
             continue;
         }
         SubstituteRank  = rank;
         bDelete.Enabled = true;
         break;
     }
 }