Esempio n. 1
0
        //---------------------------------------------------------------------
        private void moveToDifferentMPMenuItem_Click(
            object sender,
            EventArgs e
            )
        {
            if (SelectedItems.Count == 0)
            {
                return;
            }

            MPBrowserDialog mpBrowserDialog = new MPBrowserDialog(m_managementGroup);

            if (mpBrowserDialog.ShowDialog(this) == DialogResult.OK)
            {
                MPOverride sourceOverride = ((OverrideInfo)SelectedItems[0].Tag).m_override;

                ManagementPack targetManagementPack = mpBrowserDialog.ManagementPack;
                ManagementPack sourceManagementPack = sourceOverride.ManagementPackOverride.GetManagementPack();

                if (!sourceManagementPack.Sealed)
                {
                    OverrideMover overrideMover = new OverrideMover(sourceManagementPack,
                                                                    targetManagementPack,
                                                                    sourceOverride.ManagementPackOverride,
                                                                    sourceOverride.Workflow);
                    ManagementPackOverride newOverride;

                    newOverride = overrideMover.PerformMove();

                    sourceOverride.Workflow.RemoveOverride(sourceOverride.ManagementPackOverride);
                    sourceOverride.Workflow.AddOverride(newOverride);
                }
                else
                {
                    MessageBox.Show("Cannot move an override out of a Sealed MP!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        //---------------------------------------------------------------------
        private void moveToDifferentMPMenuItem_Click(
            object      sender, 
            EventArgs   e
            )
        {
            if (SelectedItems.Count == 0)
            {
                return;
            }

            MPBrowserDialog mpBrowserDialog = new MPBrowserDialog(m_managementGroup);

            if (mpBrowserDialog.ShowDialog(this) == DialogResult.OK)
            {
                MPOverride sourceOverride = ((OverrideInfo)SelectedItems[0].Tag).m_override;

                ManagementPack targetManagementPack = mpBrowserDialog.ManagementPack;
                ManagementPack sourceManagementPack = sourceOverride.ManagementPackOverride.GetManagementPack();

                if (!sourceManagementPack.Sealed)
                {
                    OverrideMover overrideMover = new OverrideMover(sourceManagementPack,
                                                                    targetManagementPack,
                                                                    sourceOverride.ManagementPackOverride,
                                                                    sourceOverride.Workflow);
                    ManagementPackOverride newOverride;

                    newOverride = overrideMover.PerformMove();

                    sourceOverride.Workflow.RemoveOverride(sourceOverride.ManagementPackOverride);
                    sourceOverride.Workflow.AddOverride(newOverride);
                }
                else
                {
                    MessageBox.Show("Cannot move an override out of a Sealed MP!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }