Пример #1
0
        private void diagram_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
        {
            if (this.IgnoreSelection == true)
            {
                this.IgnoreSelection = false;
                return;
            }
            if (e.AddedItems.Count > 0 && e.AddedItems[0] is RadDiagramConnection)
            {
                var Item = e.AddedItems[0] as RadDiagramConnection;
                var ConXML = Item.Content as ConnectionXML;
                Window wind = null;
                switch (ConXML.Type)
                {
                    case ConnectionTypes.eDecision:
                        wind = new DecisionSettings(ConXML);
                        break;
                    case ConnectionTypes.eChance:
                        wind = new ChanceSettings(ConXML);
                        break;
                    case ConnectionTypes.eBattle:
                        wind = new BattleSettings(ConXML);
                        break;
                    case ConnectionTypes.eCondition:
                        wind = new ConditionSettings(ConXML);
                        break;
                    case ConnectionTypes.eInventoryCondition:
                        throw new ArgumentOutOfRangeException();
                        break;
                    default:
                        throw new ArgumentOutOfRangeException();
                }

                if (wind != null && wind.ShowDialog() == true)
                {
                    return;
                }
            }
        }
Пример #2
0
        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);
        }