示例#1
0
文件: Macro.cs 项目: kwonus/Quelle
        public Macro(string label, HMIStatement statement)  // Persist
        {
            this.search  = QuelleControlConfig.search.CreateCopy;
            this.display = QuelleControlConfig.display.CreateCopy;

            this.label     = HMIStatement.SquenchText(label);
            this.expansion = "";
            if (statement != null)
            {
                var searches = (from key in statement.segmentation.Keys orderby key select statement.segmentation[key]);
                foreach (var clause in searches)
                {
                    if (clause.verb == Search.FIND)
                    {
                        var find = new QClauseSearch((Search)clause);
                        if (find.segment.Length > 0)
                        {
                            if (this.expansion.Length > 0)
                            {
                                this.expansion += " ; ";
                            }
                            if (find.polarity == '-')
                            {
                                this.expansion += "-- ";
                            }
                            this.expansion += HMIStatement.SquenchText(find.segment);
                        }
                    }
                }
            }
            // statement.Notify("warning", "There is no active search statement; This label will only preserve control variables if any are activated");

            this.Persist();
        }