// 编辑书签——点击事件 public void EditBookmarks_Click(object sender, EventArgs args) { List <string> leftList = new List <string>(bookmarks); List <string> rightList = new List <string>(); ListEditor listEditor = new ListEditor(); listEditor.LeftLabel = "Current Bookmarks"; listEditor.LeftList = leftList; listEditor.RightLabel = "Delete Bookmarks"; listEditor.RightList = rightList; ListEditor listEditor2 = listEditor; if (listEditor2.ShowDialog() == DialogResult.OK) { foreach (string right in listEditor2.RightList) { bookmarks.Remove(right); bookmarkToPath.Remove(right); foreach (ToolStripItem dropDownItem in _bookmarksToolStripMenuItem.DropDownItems) { if (dropDownItem is BookmarkItem && dropDownItem.Text.Equals(right)) { _bookmarksToolStripMenuItem.DropDownItems.Remove(dropDownItem); break; } } } SaveBookmarks(); } }
public void EditBookmarks(object sender, EventArgs args) { List <string> bm = new List <string>(bookmarks); List <string> delete = new List <string>(); ListEditor editor = new ListEditor { LeftLabel = "Current Bookmarks", LeftList = bm, RightLabel = "Delete Bookmarks", RightList = delete }; if (editor.ShowDialog() == DialogResult.OK) { foreach (string toDelete in editor.RightList) { bookmarks.Remove(toDelete); bookmarkToPath.Remove(toDelete); foreach (ToolStripItem item in bookmarksToolStripMenuItem.DropDownItems) { if (item is BookmarkItem && item.Text.Equals(toDelete)) { bookmarksToolStripMenuItem.DropDownItems.Remove(item); break; } } } SaveBookmarks(); } }
/// <summary> /// Opens the Animation List Editor. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mManageAnimationsToolStripButton_Click(object sender, EventArgs e) { ListEditor <GUIAnimation> animSetEditor = new ListEditor <GUIAnimation>(View.Animations.AnimationList); animSetEditor.AddingItem += new ListEditor <GUIAnimation> .ListEditorEventHandler(animSetEditor_AddingItem); animSetEditor.RemovingItem += new ListEditor <GUIAnimation> .ListEditorEventHandler(animSetEditor_RemovingItem); animSetEditor.Text = "Animations"; animSetEditor.ShowDialog(); GUIAnimation animation = View.CurrentAnimation; View.Animations = new GUIAnimationCollection(animSetEditor.List.ToArray()); PopulateAnimations(View.Animations); // We've replaced the entire channel list. See if the timeline control's current channel is still // present. If so, nothing needs to be done. But if it was removed, select the "OnActivate" channel if (!View.Animations.Contains(mTimelineControl.Animation)) { mTimelineControl.Animation = View.Animations["OnActivate"]; mAnimationsToolStripComboBox.SelectedItem = mTimelineControl.Animation; } else { mTimelineControl.Animation = animation; mAnimationsToolStripComboBox.SelectedItem = animation; } }
private void EditList(string name, IList <string> listToEdit) { ListEditor editor = new ListEditor(name, listToEdit); List <string> original = listToEdit.ToList <string>(); editor.ShowDialog(); int commonCount = listToEdit.Intersect(original).Count <string>(); if (commonCount != listToEdit.Count || commonCount != original.Count) { TitleChanges(null, null); } }
private void EditVisibleLists() { List <string> ignored = new List <string>(Settings.Default.IgnoredColumns(CurrentPackedFile.FullPath)); List <string> all = new List <string>(); EditedFile.CurrentType.Fields.ForEach(f => all.Add(f.Name)); List <string> shown = new List <string>(all); shown.RemoveAll(e => ignored.Contains(e)); ListEditor editor = new ListEditor { OriginalOrder = all, LeftLabel = "Shown Columns", RightLabel = "Hidden Columns", LeftList = shown, RightList = ignored }; if (editor.ShowDialog() == DialogResult.OK) { Settings.Default.ResetIgnores(CurrentPackedFile.FullPath); editor.RightList.ForEach(i => Settings.Default.IgnoreColumn(CurrentPackedFile.FullPath, i)); ApplyColumnVisibility(); } }
private void EditList(string name, IList<string> listToEdit) { ListEditor editor = new ListEditor(name, listToEdit); List<string> original = listToEdit.ToList<string>(); editor.ShowDialog(); int commonCount = listToEdit.Intersect(original).Count<string>(); if (commonCount != listToEdit.Count || commonCount != original.Count) { TitleChanges(null, null); } }
private void manageWeaponButton_Click(object sender, EventArgs e) { var x = new ListEditor<Weapon, WeaponEditor>("Weapon", wpl); if (x.ShowDialog() == DialogResult.OK) { wpl = new List<Weapon>(x.Items); weaponBox.Items.Clear(); weaponBox.Items.AddRange(wpl.Map(a => a.Name).ToArray()); UpdateDamage(); } }
/// <summary> /// Opens the Animation List Editor. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mManageAnimationsToolStripButton_Click(object sender, EventArgs e) { ListEditor<GUIAnimation> animSetEditor = new ListEditor<GUIAnimation>(View.Animations.AnimationList); animSetEditor.AddingItem += new ListEditor<GUIAnimation>.ListEditorEventHandler(animSetEditor_AddingItem); animSetEditor.RemovingItem += new ListEditor<GUIAnimation>.ListEditorEventHandler(animSetEditor_RemovingItem); animSetEditor.Text = "Animations"; animSetEditor.ShowDialog(); GUIAnimation animation = View.CurrentAnimation; View.Animations = new GUIAnimationCollection(animSetEditor.List.ToArray()); PopulateAnimations(View.Animations); // We've replaced the entire channel list. See if the timeline control's current channel is still // present. If so, nothing needs to be done. But if it was removed, select the "OnActivate" channel if (!View.Animations.Contains(mTimelineControl.Animation)) { mTimelineControl.Animation = View.Animations["OnActivate"]; mAnimationsToolStripComboBox.SelectedItem = mTimelineControl.Animation; } else { mTimelineControl.Animation = animation; mAnimationsToolStripComboBox.SelectedItem = animation; } }
/// <summary> /// Brings up the Resolutions List Editor /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mResolutionsToolStripMenuItem_Click(object sender, EventArgs e) { ListEditor<Resolution> resolutionListEditor = new ListEditor<Resolution>(GUIProject.CurrentProject.Resolutions); resolutionListEditor.Text = "Resolutions"; resolutionListEditor.ShowDialog(); GUIProject.CurrentProject.Resolutions = resolutionListEditor.List; Globals.ProjectView.ProjectModified = true; foreach (SceneView view in mDockPanel.Documents) { view.SetResolutions(GUIProject.CurrentProject.Resolutions); } }
/// <summary> /// Brings up the Platforms List Editor /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mPlatformsToolStripMenuItem_Click(object sender, EventArgs e) { ListEditor<Platform> platformListEditor = new ListEditor<Platform>(GUIProject.CurrentProject.Platforms); platformListEditor.AddingItem += new ListEditor<Platform>.ListEditorEventHandler(platformListEditor_AddingItem); platformListEditor.Text = "Platforms"; platformListEditor.ShowDialog(); GUIProject.CurrentProject.Platforms = platformListEditor.List; Globals.ProjectView.ProjectModified = true; foreach (SceneView view in mDockPanel.Documents) { view.SetPlatforms(GUIProject.CurrentProject.Platforms); } }
/// <summary> /// Brings up the font editor /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mFontsToolStripMenuItem_Click(object sender, EventArgs e) { ListEditor<GUIFont> fontListEditor = new ListEditor<GUIFont>(GUIProject.CurrentProject.Fonts); fontListEditor.AddingItem += new ListEditor<GUIFont>.ListEditorEventHandler(fontListEditor_AddingItem); fontListEditor.Text = "Fonts"; fontListEditor.ShowDialog(); GUIProject.CurrentProject.Fonts = fontListEditor.List; Globals.ProjectView.ProjectModified = true; SceneView sceneView = mDockPanel.ActiveDocument as SceneView; if (sceneView != null) sceneView.RefreshRenderPanel(); }