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);
 }
        void IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.mMaskBorder = (Border)target;
                break;

            case 2:
                this.mMergeMacroWindowHeading = (TextBlock)target;
                break;

            case 3:
                this.mUnifyButton        = (CustomButton)target;
                this.mUnifyButton.Click += new RoutedEventHandler(this.UnifyButton_Click);
                break;

            case 4:
                ((UIElement)target).MouseLeftButtonUp += new MouseButtonEventHandler(this.Close_MouseLeftButtonUp);
                break;

            case 5:
                this.mCurrentMacroScripts = (StackPanel)target;
                break;

            case 6:
                this.mLineSeperator = (Line)target;
                break;

            case 7:
                this.mMergedMacrosHeader = (TextBlock)target;
                break;

            case 8:
                this.mHelpCenterImage            = (CustomPictureBox)target;
                this.mHelpCenterImage.MouseDown += new MouseButtonEventHandler(this.mHelpCenterImage_MouseDown);
                break;

            case 9:
                this.mMacroDragControl = (MacroAddedDragControl)target;
                break;

            case 10:
                this.mMergedMacrosFooter = (StackPanel)target;
                break;

            case 11:
                this.mMacroNameStackPanel = (StackPanel)target;
                break;

            case 12:
                this.MacroName              = (CustomTextBox)target;
                this.MacroName.MouseEnter  += new MouseEventHandler(this.MacroName_MouseEnter);
                this.MacroName.MouseLeave  += new MouseEventHandler(this.MacroName_MouseLeave);
                this.MacroName.TextChanged += new TextChangedEventHandler(this.MacroName_TextChanged);
                break;

            case 13:
                this.mMacroSettings        = (CustomButton)target;
                this.mMacroSettings.Click += new RoutedEventHandler(this.MacroSettings_Click);
                break;

            case 14:
                this.mMergeButton        = (CustomButton)target;
                this.mMergeButton.Click += new RoutedEventHandler(this.MergeButton_Click);
                break;

            case 15:
                this.mErrorNamePopup = (CustomPopUp)target;
                break;

            case 16:
                this.mMaskBorder1 = (Border)target;
                break;

            case 17:
                this.mErrorText = (TextBlock)target;
                break;

            case 18:
                this.mDownArrow = (System.Windows.Shapes.Path)target;
                break;

            default:
                this._contentLoaded = true;
                break;
            }
        }