public void AddMenuItem(ToolStripItemCollection collection, int index, String fileName, EventHandler handler) { ToolStripMenuItem item = new ToolStripMenuItem (); item.Text = fileName; item.Click += new EventHandler (handler); collection.Insert (index, item); }
public void RecordHistory(IDataObject dataObject) { TSMenuItem item; if (unused.Count > 0) { item = unused.First(); unused.Remove(item); } else { item = new TSMenuItem(); item.DropDownItems.AddRange(new TSItem[] { new TSMenuItem(Language.RestoreHistory, null, HandleUseClick) { Tag = item }, new TSMenuItem(Language.ForgetHistory, null, HandleRemoveClick) { Tag = item }, new TSSeparator(), }); } ClipboardApplication.UpdateDisplay(dataObject, item); item.Tag = CloneDataObject(dataObject); item.Enabled = true; root.Insert(root.IndexOf(index) + 1, item); list.Add(item); UpdateClearEnabled(); }
public override void InitializeBackend(object frontend, ApplicationContext context) { base.InitializeBackend(frontend, context); Menu = new SWF.MenuStrip(); ItemsCollection = Menu.Items; _items.CollectionChanged += (sender, args) => { var backend = args.NewItems.Cast <MenuItemBackend> ().FirstOrDefault(); if (args.Action == NotifyCollectionChangedAction.Add) { ItemsCollection.Insert(args.NewStartingIndex, backend.MenuItem); } if (args.Action == NotifyCollectionChangedAction.Remove) { ItemsCollection.Remove(backend.MenuItem); } }; }
public void Insert_Item_Null () { ToolStrip toolStrip = CreateToolStrip (); ToolStripItemCollection items = new ToolStripItemCollection ( toolStrip, new ToolStripItem [0]); try { items.Insert (0, (ToolStripItem) null); Assert.Fail ("#1"); } catch (ArgumentNullException ex) { Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2"); Assert.IsNull (ex.InnerException, "#3"); Assert.IsNotNull (ex.Message, "#4"); Assert.AreEqual ("value", ex.ParamName, "#5"); } }
public void Remove_StandAlone () { ToolStrip toolStrip = CreateToolStrip (); ToolStripItemCollection items = new ToolStripItemCollection ( toolStrip, new ToolStripItem [0]); MockToolStripButton buttonA = new MockToolStripButton ("A"); MockToolStripButton buttonB = new MockToolStripButton ("B"); MockToolStripButton buttonC = new MockToolStripButton ("B"); items.Insert (0, buttonA); items.Insert (0, buttonB); items.Remove (buttonB); Assert.AreEqual (1, items.Count, "#A1"); Assert.AreEqual (0, itemsRemoved.Count, "#A2"); Assert.AreSame (buttonA, items [0], "#A3"); items.Remove ((ToolStripItem) null); Assert.AreEqual (1, items.Count, "#B1"); Assert.AreEqual (0, itemsRemoved.Count, "#B2"); Assert.AreSame (buttonA, items [0], "#B3"); items.Remove (buttonC); Assert.AreEqual (1, items.Count, "#C1"); Assert.AreEqual (0, itemsRemoved.Count, "#C2"); Assert.AreSame (buttonA, items [0], "#C3"); items.Remove (buttonA); Assert.AreEqual (0, items.Count, "#D1"); Assert.AreEqual (0, itemsRemoved.Count, "#D2"); items.Remove (buttonA); Assert.AreEqual (0, items.Count, "#E1"); Assert.AreEqual (0, itemsRemoved.Count, "#E2"); // remove item owned by other toolstrip ToolStrip otherToolStrip = new ToolStrip (); MockToolStripButton buttonD = new MockToolStripButton ("B"); otherToolStrip.Items.Add (buttonD); Assert.AreSame (otherToolStrip, buttonD.Owner, "#F1"); Assert.IsNull (buttonD.ParentToolStrip, "#F2"); items.Remove (buttonD); Assert.AreEqual (0, items.Count, "#F3"); Assert.AreEqual (0, itemsRemoved.Count, "#F4"); Assert.AreSame (otherToolStrip, buttonD.Owner, "#F5"); Assert.IsNull (buttonD.ParentToolStrip, "#F6"); }
public void Insert_StandAlone () { ToolStrip toolStrip = CreateToolStrip (); ToolStripItemCollection items = new ToolStripItemCollection ( toolStrip, new ToolStripItem [0]); MockToolStripButton buttonA = new MockToolStripButton ("A"); items.Insert (0, buttonA); Assert.AreEqual (1, items.Count, "#A1"); Assert.AreEqual (0, itemsAdded.Count, "#A2"); Assert.AreSame (buttonA, items [0], "#A3"); Assert.IsNull (buttonA.Owner, "#A4"); Assert.IsNull (buttonA.ParentToolStrip, "#A5"); MockToolStripButton buttonB = new MockToolStripButton ("B"); items.Insert (0, buttonB); Assert.AreEqual (2, items.Count, "#B1"); Assert.AreEqual (0, itemsAdded.Count, "#B2"); Assert.AreSame (buttonB, items [0], "#B3"); Assert.AreSame (buttonA, items [1], "#B4"); Assert.IsNull (buttonB.Owner, "#B5"); Assert.IsNull (buttonB.ParentToolStrip, "#B6"); MockToolStripButton buttonC = new MockToolStripButton ("C"); items.Insert (1, buttonC); Assert.AreEqual (3, items.Count, "#C1"); Assert.AreEqual (0, itemsAdded.Count, "#C2"); Assert.AreSame (buttonB, items [0], "#C3"); Assert.AreSame (buttonC, items [1], "#C4"); Assert.AreSame (buttonA, items [2], "#C5"); Assert.IsNull (buttonC.Owner, "#C6"); Assert.IsNull (buttonC.ParentToolStrip, "#C7"); }
public void Insert_Index_OutOfRange () { ToolStrip toolStrip = CreateToolStrip (); ToolStripItemCollection items = new ToolStripItemCollection ( toolStrip, new ToolStripItem [0]); try { items.Insert (-1, new ToolStripButton ()); Assert.Fail ("#A1"); } catch (ArgumentOutOfRangeException ex) { Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#A2"); Assert.IsNull (ex.InnerException, "#A3"); Assert.IsNotNull (ex.Message, "#A4"); Assert.AreEqual ("index", ex.ParamName, "#A5"); } try { items.Insert (1, new ToolStripButton ()); Assert.Fail ("#B1"); } catch (ArgumentOutOfRangeException ex) { Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#B2"); Assert.IsNull (ex.InnerException, "#B3"); Assert.IsNotNull (ex.Message, "#B4"); Assert.AreEqual ("index", ex.ParamName, "#B5"); } }
private ToolStripItemCollection shadingModes_ensureToolStripItems(ToolStripItemCollection items, int minCount = 1, int toolStipInsertionIndex = 0) { Debug.Assert(items != null); // First time - Third Item is separator if (items.Count < minCount) { // Insert normal shading mode ShadingEffectMenuItem item = new ShadingEffectMenuItem( ShadingEffectMenuItem.NORMAL_SHADING_STRING, ShadingEffectMenuItem.NORMAL_SHADING_INDEX, ToolStripSplitButton_Rendering); item.BeforeChangingShadingMode += normalShadingItem_BeforeChangingShadingMode; items.Insert(toolStipInsertionIndex, item); // Add all rendering effects that are loaded by the engine manager for this purpose: VisionEngineManager em = (VisionEngineManager)EditorManager.EngineManager; StringCollection names = new StringCollection(); em.GetReplacementRenderLoopEffects(names); // Insert shading items for (int i = 0; i < names.Count; i++) { ShadingEffectMenuItem shadingMenuItem = new ShadingEffectMenuItem( names[i], ShadingEffectMenuItem.NORMAL_SHADING_INDEX + 1 + i, ToolStripSplitButton_Rendering); items.Insert(i + toolStipInsertionIndex + 1, shadingMenuItem); } } return items; }
private static void MergeRecursive(ToolStripItem source, ToolStripItemCollection destinationItems, Stack<MergeHistoryItem> history) { MergeHistoryItem item; ToolStripItem item2; switch (source.MergeAction) { case MergeAction.Append: { item = new MergeHistoryItem(MergeAction.Remove) { PreviousIndexCollection = source.Owner.Items, PreviousIndex = item.PreviousIndexCollection.IndexOf(source), TargetItem = source }; int num8 = destinationItems.Add(source); item.Index = num8; item.IndexCollection = destinationItems; history.Push(item); return; } case MergeAction.Insert: if (source.MergeIndex > -1) { item = new MergeHistoryItem(MergeAction.Remove) { PreviousIndexCollection = source.Owner.Items, PreviousIndex = item.PreviousIndexCollection.IndexOf(source), TargetItem = source }; int num7 = Math.Min(destinationItems.Count, source.MergeIndex); destinationItems.Insert(num7, source); item.IndexCollection = destinationItems; item.Index = num7; history.Push(item); } return; case MergeAction.Replace: case MergeAction.Remove: case MergeAction.MatchOnly: item2 = FindMatch(source, destinationItems); if (item2 != null) { switch (source.MergeAction) { case MergeAction.MatchOnly: { ToolStripDropDownItem item3 = item2 as ToolStripDropDownItem; ToolStripDropDownItem item4 = source as ToolStripDropDownItem; if (((item3 == null) || (item4 == null)) || (item4.DropDownItems.Count == 0)) { return; } int count = item4.DropDownItems.Count; if (count <= 0) { return; } int num2 = count; item4.DropDown.SuspendLayout(); try { int num3 = 0; int num4 = 0; while (num3 < count) { MergeRecursive(item4.DropDownItems[num4], item3.DropDownItems, history); int num5 = num2 - item4.DropDownItems.Count; num4 = (num5 > 0) ? num4 : (num4 + 1); num2 = item4.DropDownItems.Count; num3++; } return; } finally { item4.DropDown.ResumeLayout(); } goto Label_0108; } } } return; default: return; } Label_0108: item = new MergeHistoryItem(MergeAction.Insert); item.TargetItem = item2; int index = destinationItems.IndexOf(item2); destinationItems.RemoveAt(index); item.Index = index; item.IndexCollection = destinationItems; item.TargetItem = item2; history.Push(item); if (source.MergeAction == MergeAction.Replace) { item = new MergeHistoryItem(MergeAction.Remove) { PreviousIndexCollection = source.Owner.Items, PreviousIndex = item.PreviousIndexCollection.IndexOf(source), TargetItem = source }; destinationItems.Insert(index, source); item.Index = index; item.IndexCollection = destinationItems; history.Push(item); } }
private ToolStripItem newLoadingListToolStripItem(long listId, String index) { ToolStripMenuItem item = new ToolStripMenuItem(LL_DeserializeName(index), WarehouseApp.Properties.Resources.table, null, "l" + listId); item.Tag = listId; item.Click += new System.EventHandler(LoadingList_MoveToSelected_Click); Events_LoadingListButton(item); if (cmsLoadingLists.Tag != null) { ToolStripItemCollection col2 = new ToolStripItemCollection(cmsLoadingLists, ((ToolStripItem[])cmsLoadingLists.Tag)); if (col2.IndexOfKey(item.Name) == -1) { col2.Insert(col2.IndexOf(tsmiNewLL), item); cmsLoadingLists.Tag = new ToolStripItem[col2.Count]; col2.CopyTo((ToolStripItem[])cmsLoadingLists.Tag, 0); } } return item; }
protected void AddMenuItemIntoMenu(ConnectionPointContainer container, ToolStripItemCollection toolStripItemCollection, PluginConfigItem theItem, PluginMenuPath thePath, IList<PluginMenuItemPart> thePaths, ExecutePluginCallback callback) { if (thePaths.Count < 1) return; PluginMenuItemPart firstPart = thePaths[0]; PluginMenuPartStruct menuStruct = GetMenuItemIndex(firstPart, toolStripItemCollection); IList<PluginMenuItemPart> otherParts = GetLeavesMenuItemParts(thePaths); if (!menuStruct.IsCreate) { AddMenuItemIntoMenu(container, (toolStripItemCollection[menuStruct.Index] as ToolStripMenuItem).DropDownItems, theItem, thePath, otherParts, callback); } else { if (firstPart.TextStyle.Text.Trim() == "-") { toolStripItemCollection.Insert( menuStruct.Index, new ToolStripSeparator() ); return; } ToolStripMenuItem theMenuItem = new ToolStripMenuItem(firstPart.TextStyle.Text); CreateMenuEndItem(firstPart, theMenuItem, GetImageList(container, thePath.MenuImageIndex)); toolStripItemCollection.Insert( menuStruct.Index, theMenuItem ); if (thePaths.Count > 1) { AddMenuItemIntoMenu(container, theMenuItem.DropDownItems, theItem, thePath, otherParts, callback); } else { theMenuItem.Name = theItem.Url; theMenuItem.Tag = new object[] { theItem, callback }; string[] behaviors = theItem.Behavior.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); foreach (string action in behaviors) { PluginConfigItemBehaviorMode theBehavior = (PluginConfigItemBehaviorMode)Enum.Parse(typeof(PluginConfigItemBehaviorMode), action, true); switch (theBehavior) { case PluginConfigItemBehaviorMode.Click: theMenuItem.Click -= TheMenuItem_Click; theMenuItem.Click += TheMenuItem_Click; break; case PluginConfigItemBehaviorMode.MouseOver: theMenuItem.MouseMove -= new MouseEventHandler(TheMenuItem_MouseMove); theMenuItem.MouseMove += new MouseEventHandler(TheMenuItem_MouseMove); break; } } return; } } }
// Maintains separators between different command groups private void MaintainSeparateGroups(ToolStripItemCollection commands, ToolStripItem item, object groupTag) { int index = commands.IndexOf(item); if (index > 0) // look for previous item { ToolStripItem prevItem = commands[index - 1]; object prevTag = prevItem.Tag; while (prevTag == null) { ToolStripMenuItem prevMenuItem = prevItem as ToolStripMenuItem; if (prevMenuItem == null) break; ToolStripItemCollection prevItems = prevMenuItem.DropDownItems; prevItem = prevItems[prevItems.Count - 1]; prevTag = prevItem.Tag; } // add a separator if the new command is from a different group CommandInfo prevInfo = GetCommandInfo(prevTag); if (prevInfo != null && !TagsEqual(groupTag, prevInfo.GroupTag)) { commands.Insert(index, new ToolStripSeparator()); } } }
/// <summary> /// If the predicted retention time is auto calculated, add a "Show {Prediction} score" menu item. /// If there are retention time alignments available for the specified chromFileInfoId, then adds /// a "Align Times To {Specified File}" menu item to a context menu. /// </summary> private int InsertAlignmentMenuItems(ToolStripItemCollection items, ChromFileInfoId chromFileInfoId, int iInsert) { var predictRT = Document.Settings.PeptideSettings.Prediction.RetentionTime; if (predictRT != null && predictRT.IsAutoCalculated) { var menuItem = new ToolStripMenuItem(string.Format(Resources.SkylineWindow_ShowCalculatorScoreFormat, predictRT.Calculator.Name), null, (sender, eventArgs)=>AlignToRtPrediction=!AlignToRtPrediction) { Checked = AlignToRtPrediction, }; items.Insert(iInsert++, menuItem); } if (null != chromFileInfoId && DocumentUI.Settings.HasResults && !DocumentUI.Settings.DocumentRetentionTimes.FileAlignments.IsEmpty) { foreach (var chromatogramSet in DocumentUI.Settings.MeasuredResults.Chromatograms) { var chromFileInfo = chromatogramSet.MSDataFileInfos .FirstOrDefault( chromFileInfoMatch => ReferenceEquals(chromFileInfoMatch.FileId, chromFileInfoId)); if (null == chromFileInfo) { continue; } string fileItemName = Path.GetFileNameWithoutExtension(SampleHelp.GetFileName(chromFileInfo.FilePath)); var menuItemText = string.Format(Resources.SkylineWindow_AlignTimesToFileFormat, fileItemName); var alignToFileItem = new ToolStripMenuItem(menuItemText); if (ReferenceEquals(chromFileInfoId, AlignToFile)) { alignToFileItem.Click += (sender, eventArgs) => AlignToFile = null; alignToFileItem.Checked = true; } else { alignToFileItem.Click += (sender, eventArgs) => AlignToFile = chromFileInfoId; alignToFileItem.Checked = false; } items.Insert(iInsert++, alignToFileItem); } } return iInsert; }
private void SetPreviewControlItems(ToolStripItemCollection dropdown, ToolStripItem tss, string prefix, IEnumerable<ToolStripItem> items) { int i = dropdown.Count - 1; int j = dropdown.Count - dropdown.IndexOf(tss); foreach (var item in items) { item.Name = prefix + (++j); dropdown.Insert(++i, item); } }
private void SetHelpers(ToolStripItemCollection dropdown, ToolStripItem tss, string prefix, IEnumerable<s3pi.Helpers.HelperManager.Helper> helpers) { if (helpers.Count() == 0) return; int i = dropdown.IndexOf(tss); int j = 0; dropdown.Insert(++i, new ToolStripSeparator() { Name = prefix + j, }); foreach (var helper in helpers) { ToolStripMenuItem tsiHelper = new ToolStripMenuItem(helper.label, null, tsHelper_Click) { Name = prefix + j, Tag = j++, }; dropdown.Insert(++i, tsiHelper); } }
private void AddHelper(ToolStripItemCollection dropdown, ToolStripItem tss, string prefix, int helper, string value) { ToolStripMenuItem tsiHelper = new ToolStripMenuItem(value, null, tsHelper_Click) { Name = prefix + helper, Tag = helper, }; int i = dropdown.IndexOf(tss); while (true) { i++; if (i >= dropdown.Count) break; if (!dropdown[i].Name.StartsWith(prefix)) break; } dropdown.Insert(i, tsiHelper); }
private static int BuildMenuContentsForGroup(int index, ICommandTarget target, ToolStripItemCollection children, IPoderosaMenuGroup grp) { int count = 0; foreach (IPoderosaMenu m in grp.ChildMenus) { ToolStripMenuItem mi = new ToolStripMenuItem(); children.Insert(index++, mi); //途中挿入のことも mi.DropDownOpening += new EventHandler(OnPopupMenu); mi.Enabled = m.IsEnabled(target); mi.Checked = mi.Enabled ? m.IsChecked(target) : false; mi.Text = m.Text; //Enabledを先に mi.Tag = new MenuItemTag(grp, m, target); IPoderosaMenuFolder folder; IPoderosaMenuItem leaf; if ((folder = m as IPoderosaMenuFolder) != null) { BuildMenuContents(mi, folder); } else if ((leaf = m as IPoderosaMenuItem) != null) { mi.Click += new EventHandler(OnClickMenu); IGeneralCommand gc = leaf.AssociatedCommand as IGeneralCommand; if (gc != null) mi.ShortcutKeyDisplayString = WinFormsUtil.FormatShortcut(CommandManagerPlugin.Instance.CurrentKeyBinds.GetKey(gc)); } count++; } return count; }
/// <summary> /// Immerge l'itemReport dans la collection cible source /// </summary> /// <param name="target">collection cible de l'immersion</param> /// <param name="sourceItem">élément à immerger dans la collection cible</param> /// <param name="kept">true si l'élément à immerger a été retenu</param> private static void DoMergeItem( ToolStripItemCollection target, ToolStripItem sourceItem, out bool kept ) { int targetMatch; // -1 ou index de l'itemReport cible mis en correspondance avec l'itemReport source int targetAnchor; // -1 ou index d'insertion éventuel dans la collection cible // recherche d'un match kept = false; targetMatch = IndexOfMatch( target, sourceItem ); switch (sourceItem.MergeAction) { // adjonction en fin de collection case MergeAction.Append: target.Add( sourceItem ); break; // insertion case MergeAction.Insert: targetAnchor = IndexOfAnchor( target, targetMatch, sourceItem.MergeIndex ); target.Insert( targetAnchor, sourceItem ); break; // fusion case MergeAction.MatchOnly: if (targetMatch != -1 && target[ targetMatch ] is ToolStripMenuItem && sourceItem is ToolStripMenuItem) { kept = true; DoMergeItems( (target[ targetMatch ] as ToolStripMenuItem).DropDownItems, (sourceItem as ToolStripMenuItem).DropDownItems ); } else { targetAnchor = IndexOfAnchor( target, targetMatch, sourceItem.MergeIndex ); target.Insert( targetAnchor, sourceItem ); } break; // suppression case MergeAction.Remove: kept = true; if (targetMatch == -1) break; target.RemoveAt( targetMatch ); break; // remplacement case MergeAction.Replace: if (targetMatch == -1) target.Add( sourceItem ); else { target.RemoveAt( targetMatch ); target.Insert( targetMatch, sourceItem ); } break; } }
private void MergeMenu(ToolStripItemCollection source, ToolStripItemCollection dest) { while(source.Count > 0) { ToolStripMenuItem item = (ToolStripMenuItem) source[0]; if(item.MergeAction == MergeAction.Insert) { for(int index = 0; index < dest.Count; ++index) { if(dest[index].MergeIndex > item.MergeIndex) { dest.Insert(index, item); break; } } } else if (item.MergeAction == MergeAction.Append) { dest.Add(item); } else if (item.MergeAction == MergeAction.MatchOnly) { ToolStripMenuItem match = null; foreach(ToolStripMenuItem destitem in dest) { if(destitem.Text == item.Text) { match = destitem; break; } } if(match == null) throw new ApplicationException("Can't merge with nonexistent menu '" + item.Text + "'"); MergeMenu(item.DropDownItems, match.DropDownItems); source.Remove(item); } else { throw new ApplicationException("Unsupported menu merge action"); } } }
private static void MergeRecursive(ToolStripItem source, ToolStripItemCollection destinationItems, Stack<MergeHistoryItem> history) { Debug.Indent(); MergeHistoryItem maction; switch (source.MergeAction) { case MergeAction.MatchOnly: case MergeAction.Replace: case MergeAction.Remove: ToolStripItem item = FindMatch(source, destinationItems); if (item != null) { switch (source.MergeAction) { case MergeAction.MatchOnly: //Debug.WriteLine("matchonly"); ToolStripDropDownItem tsddownDest = item as ToolStripDropDownItem; ToolStripDropDownItem tsddownSrc = source as ToolStripDropDownItem; if (tsddownDest != null && tsddownSrc != null && tsddownSrc.DropDownItems.Count != 0) { int originalCount = tsddownSrc.DropDownItems.Count; if (originalCount > 0) { int lastCount = originalCount; tsddownSrc.DropDown.SuspendLayout(); try { // the act of walking through this collection removes items from // the dropdown. for (int i = 0, itemToLookAt = 0; i < originalCount; i++) { MergeRecursive(tsddownSrc.DropDownItems[itemToLookAt], tsddownDest.DropDownItems, history); int numberOfItemsMerged = lastCount - tsddownSrc.DropDownItems.Count; itemToLookAt = (numberOfItemsMerged > 0) ? itemToLookAt : itemToLookAt + 1; lastCount = tsddownSrc.DropDownItems.Count; } } finally { tsddownSrc.DropDown.ResumeLayout(); } } } break; case MergeAction.Replace: case MergeAction.Remove: //Debug.WriteLine("remove"); maction = new MergeHistoryItem(MergeAction.Insert); maction.TargetItem = item; int indexOfDestinationItem = destinationItems.IndexOf(item); destinationItems.RemoveAt(indexOfDestinationItem); maction.Index = indexOfDestinationItem; maction.IndexCollection = destinationItems; maction.TargetItem = item; history.Push(maction); //Debug.WriteLine(maction.ToString()); if (source.MergeAction == MergeAction.Replace) { //Debug.WriteLine("replace"); //ToolStripItem clonedItem = source.Clone(); maction = new MergeHistoryItem(MergeAction.Remove); maction.PreviousIndexCollection = source.Owner.Items; maction.PreviousIndex = maction.PreviousIndexCollection.IndexOf(source); maction.TargetItem = source; destinationItems.Insert(indexOfDestinationItem, source); maction.Index = indexOfDestinationItem; maction.IndexCollection = destinationItems; history.Push(maction); //Debug.WriteLine(maction.ToString()); } break; } } break; case MergeAction.Insert: if (source.MergeIndex > -1) { maction = new MergeHistoryItem(MergeAction.Remove); maction.PreviousIndexCollection = source.Owner.Items; maction.PreviousIndex = maction.PreviousIndexCollection.IndexOf(source); maction.TargetItem = source; int insertIndex = Math.Min(destinationItems.Count, source.MergeIndex); destinationItems.Insert(insertIndex, source); maction.IndexCollection = destinationItems; maction.Index = insertIndex; history.Push(maction); //Debug.WriteLine(maction.ToString()); } break; case MergeAction.Append: maction = new MergeHistoryItem(MergeAction.Remove); maction.PreviousIndexCollection = source.Owner.Items; maction.PreviousIndex = maction.PreviousIndexCollection.IndexOf(source); maction.TargetItem = source; int index = destinationItems.Add(source); maction.Index = index; maction.IndexCollection = destinationItems; history.Push(maction); //Debug.WriteLine(maction.ToString()); break; } Debug.Unindent(); }