public override void OnConnectAddOutput(Shadow shadow)
        {
            base.OnConnectAddOutput(shadow);
            Table table = GetTransitions();

            // make sure it's not already in there - this can happen with undo/redo
            for (int r = 0; r < table.GetNumRows(); r++)
                if (table.GetData(r, (int)TableColumns.Transitions.Goto).Equals(shadow.GetUniqueId()))
                    return;

            if (table.IsEmpty())
                table = new Table(1, Enum.GetNames(typeof(TableColumns.Transitions)).Length);
            else
                table.AddRow();

            ConnectorShadow connector = shadow as ConnectorShadow;
            if (connector != null) {
                string label = connector.GetLabelName();
                if (label.Length > 0) {
                    table.SetData(table.GetNumRows() - 1, (int)TableColumns.Transitions.Condition, CommonShadow.GetStringWithNewConnectorLabel("", label));
                    table.SetData(table.GetNumRows() - 1, (int)TableColumns.Transitions.ConditionDateStamp, DateTime.Today.ToString(Strings.DateColumnFormatString));
                }
            }

            table.SetData(table.GetNumRows() - 1, (int)TableColumns.Transitions.Goto, shadow.GetUniqueId());
            table.SetData(table.GetNumRows() - 1, (int)TableColumns.Transitions.GotoDateStamp, DateTime.Today.ToString(Strings.DateColumnFormatString));
            SetTransitionsWithoutRemovingOutputsForDeletedTransitions(table);
        }
示例#2
0
        public override void OnConnectDeleteOutput(Shadow shadow)
        {
            base.OnConnectDeleteOutput(shadow);
            Table table = GetTransitions();

            for (int r = 0; r < table.GetNumRows(); r++)
            {
                string data = table.GetData(r, (int)TableColumns.Transitions.Goto);
                string uid  = shadow.GetUniqueId();

                if (data.Equals(uid))
                {
                    // cleanup the connector label
                    ConnectorShadow connectorShadow = PathMaker.LookupShadowByUID(uid) as ConnectorShadow;
                    if (connectorShadow != null)
                    {
                        connectorShadow.SetLabelName(String.Empty);
                    }

                    table.DeleteRow(r);
                    SetTransitionsWithoutRemovingOutputsForDeletedTransitions(table);
                    // only one per link possible
                    return;
                }
            }
        }
示例#3
0
        public override void OnConnectAddOutput(Shadow shadow)
        {
            base.OnConnectAddOutput(shadow);
            Table table = GetTransitions();

            // make sure it's not already in there - this can happen with undo/redo
            for (int r = 0; r < table.GetNumRows(); r++)
            {
                if (table.GetData(r, (int)TableColumns.Transitions.Goto).Equals(shadow.GetUniqueId()))
                {
                    return;
                }
            }

            if (table.IsEmpty())
            {
                table = new Table(1, Enum.GetNames(typeof(TableColumns.Transitions)).Length);
            }
            else
            {
                table.AddRow();
            }

            ConnectorShadow connector = shadow as ConnectorShadow;

            if (connector != null)
            {
                string label = connector.GetLabelName();
                if (label.Length > 0)
                {
                    table.SetData(table.GetNumRows() - 1, (int)TableColumns.Transitions.Condition, CommonShadow.GetStringWithNewConnectorLabel("", label));
                    //table.SetData(table.GetNumRows() - 1, (int)TableColumns.Transitions.ConditionDateStamp, DateTime.Today.ToString(Strings.DateColumnFormatString));
                    table.SetData(table.GetNumRows() - 1, (int)TableColumns.Transitions.ConditionDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion());
                }
            }

            table.SetData(table.GetNumRows() - 1, (int)TableColumns.Transitions.Goto, shadow.GetUniqueId());
            //table.SetData(table.GetNumRows() - 1, (int)TableColumns.Transitions.GotoDateStamp, DateTime.Today.ToString(Strings.DateColumnFormatString));
            table.SetData(table.GetNumRows() - 1, (int)TableColumns.Transitions.GotoDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion());
            SetTransitionsWithoutRemovingOutputsForDeletedTransitions(table);
        }
        public override void OnConnectDeleteOutput(Shadow shadow)
        {
            base.OnConnectDeleteOutput(shadow);
            Table table = GetTransitions();
            for (int r = 0; r < table.GetNumRows(); r++) {
                string data = table.GetData(r, (int)TableColumns.Transitions.Goto);
                string uid = shadow.GetUniqueId();

                if (data.Equals(uid)) {
                    // cleanup the connector label
                    ConnectorShadow connectorShadow = PathMaker.LookupShadowByUID(uid) as ConnectorShadow;
                    if (connectorShadow != null)
                        connectorShadow.SetLabelName(String.Empty);

                    table.DeleteRow(r);
                    SetTransitionsWithoutRemovingOutputsForDeletedTransitions(table);
                    // only one per link possible
                    return;
                }
            }
        }