public void RebuildList() { comboBox.Items.Clear(); comboBox.Items.Add(FirstItem); foreach (Rank rank in RankManager.Ranks) { comboBox.Items.Add(MainForm.ToComboBoxOption(rank)); } }
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(); }
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; }
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; }
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; }
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; } }