private void Merge(int sourceIndex, int targetIndex) { if (!(this.mListBox.DataContext is ObservableCollection <MergedMacroConfiguration> dataContext)) { return; } foreach (string str in (Collection <string>)dataContext[sourceIndex].MacrosToRun) { dataContext[targetIndex].MacrosToRun.Add(str); } dataContext.RemoveAt(sourceIndex); MacroAddedDragControl.SetDefaultPropertiesForMergedMacroConfig(dataContext[targetIndex]); }
private void UnMerge(MergedMacroConfiguration source, int sourceIndex) { if (!(this.mListBox.DataContext is ObservableCollection <MergedMacroConfiguration> dataContext)) { return; } MacroAddedDragControl.SetDefaultPropertiesForMergedMacroConfig(source); for (int index = 0; index < source.MacrosToRun.Count; ++index) { string str = source.MacrosToRun[index]; MergedMacroConfiguration macroConfiguration = new MergedMacroConfiguration() { Tag = this.MergeMacroWindow.mAddedMacroTag++ }; macroConfiguration.MacrosToRun.Add(str); dataContext.Insert(sourceIndex + index + 1, macroConfiguration); } dataContext.RemoveAt(sourceIndex); }