private void diagram_ConnectionManipulationCompleted_1(object sender, ManipulationRoutedEventArgs e)
        {
            ChooseConnectionType win = new ChooseConnectionType();

            if (win.ShowDialog() == true)
            {
                var    ConnectionContents = new ConnectionXML();
                Window wind = null;
                switch (win.SelectedIndex)
                {
                case ConnectionTypes.eDecision:
                    wind = new DecisionSettings(ConnectionContents);
                    break;

                case ConnectionTypes.eChance:
                    wind = new ChanceSettings(ConnectionContents);
                    break;

                case ConnectionTypes.eBattle:
                    wind = new BattleSettings(ConnectionContents);
                    break;

                case ConnectionTypes.eCondition:
                    wind = new ConditionSettings(ConnectionContents);
                    break;

                case ConnectionTypes.eChanceRollback:
                {
                    wind = new RollBackSettings(ConnectionContents);
                    break;
                }

                case ConnectionTypes.eInventoryCondition:
                    throw new ArgumentOutOfRangeException();
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
                ConnectionContents.Type = win.SelectedIndex;
                this.IgnoreSelection    = true;

                if (wind != null && wind.ShowDialog() == true)
                {
                    e.Connection.TargetCapType = CapType.Arrow1Filled;
                    e.Connection.Content       = ConnectionContents;

                    return;
                }
                // this.IgnoreSelection = false;
            }
            this.diagram.RemoveConnection(e.Connection);
        }
        private void diagram_ConnectionManipulationCompleted_1(object sender, ManipulationRoutedEventArgs e)
        {
            ChooseConnectionType win = new ChooseConnectionType();
            if (win.ShowDialog() == true)
            {
                var ConnectionContents = new ConnectionXML();
                Window wind = null;
                switch (win.SelectedIndex)
                {
                    case ConnectionTypes.eDecision:
                        wind = new DecisionSettings(ConnectionContents);
                        break;
                    case ConnectionTypes.eChance:
                        wind = new ChanceSettings(ConnectionContents);
                        break;
                    case ConnectionTypes.eBattle:
                        wind = new BattleSettings(ConnectionContents);
                        break;
                    case ConnectionTypes.eCondition:
                        wind = new ConditionSettings(ConnectionContents);
                        break;
                    case ConnectionTypes.eChanceRollback:
                        {
                            wind = new RollBackSettings(ConnectionContents);
                            break;
                        }
                    case ConnectionTypes.eInventoryCondition:
                        throw new ArgumentOutOfRangeException();
                        break;
                    default:
                        throw new ArgumentOutOfRangeException();
                }
                ConnectionContents.Type = win.SelectedIndex;
                this.IgnoreSelection = true;

                if (wind != null && wind.ShowDialog() == true)
                {
                    e.Connection.TargetCapType = CapType.Arrow1Filled;
                    e.Connection.Content = ConnectionContents;

                    return;
                }
               // this.IgnoreSelection = false;
            }
            this.diagram.RemoveConnection(e.Connection);
        }