Beispiel #1
0
        /// <summary>
        /// Called when the model has changed or is initialized.
        /// </summary>
        public void UpdateAction(ActionEntity action, IProcessingData context)
        {
            _selectedQualifier = action.Qualifier;
            SetQualifierText((int)_selectedQualifier);
            _actionDescriptionNode.Text = action.Action;
            _isRelevant = !string.IsNullOrEmpty(_actionDescriptionNode.Text);
            AssignmentExpression expression = ActionMaster.InterpretTransitionText(action.Action, context);

            _actionDescriptionNode.HintTooltip = expression == null ? "???" : expression.ToString();
            bool  validExpression = expression != null && expression.IsValid();
            Color background      = validExpression ? new Color(1, 0, 0, 0f) : new Color(1, 0, 0, 0.2f);

            _actionDescriptionNode.AddColorOverride("background_color", background);
        }
        /// <summary>
        /// Loads the data from the stream. Written in "WriteTo".
        /// </summary>
        public static PatchEntity CreateFrom(System.IO.BinaryReader reader)
        {
            short       x      = reader.ReadInt16();
            short       y      = reader.ReadInt16();
            PatchEntity entity = new PatchEntity(x, y)
            {
                SfcStepType    = (StepType)reader.ReadInt32(),
                StepName       = reader.ReadString(),
                UpperBranch    = (BranchType)reader.ReadInt32(),
                LowerBranch    = (BranchType)reader.ReadInt32(),
                TransitionText = reader.ReadString()
            };
            int entryCount = reader.ReadInt32();

            for (int i = 0; i < entryCount; i++)
            {
                ActionEntity entry = ActionEntity.CreateFrom(reader);
                entity.ActionEntries.Add(entry);
            }
            return(entity);
        }