示例#1
0
        public override void ReadChanged(DataValue Structure)
        {
            Subfile subfile = Subfiles[Structure.GetName()];

            this._RowPointer += 1;

            while (this._RowPointer >= 0 && this._RowPointer < subfile.rows.Count)
            {
                if (subfile.rows[this._RowPointer].Changed)
                {
                    this._EOF = false;

                    foreach (string varName in subfile.rows[this._RowPointer].Columns.Keys.ToArray())
                    {
                        Structure.GetData(varName).Set(subfile.rows[this._RowPointer].Columns[varName]);
                    }

                    return;
                }

                this._RowPointer += 1;
            }

            this._EOF = true;
        }
示例#2
0
        public void WriteSubfileRow(RecordInfo format, int plusRow = 0)
        {
            View    currentView = null;
            Subfile subfile     = Subfiles[format.Name];

            foreach (FieldInfo field in format.Fields)
            {
                currentView = null;

                switch (field.fieldType)
                {
                case FieldInfo.FieldType.Const:
                    currentView = new Label(subfile.rows[plusRow].Columns[field.Name])
                    {
                        X = field.Position.X, Y = field.Position.Y + plusRow
                    };
                    break;

                case FieldInfo.FieldType.Output:
                    currentView = new Label(subfile.rows[plusRow].Columns[field.Name])
                    {
                        X = field.Position.X, Y = field.Position.Y + plusRow
                    };
                    break;

                case FieldInfo.FieldType.Input:
                    currentView = new TextField("")
                    {
                        X      = field.Position.X, Y = field.Position.Y + plusRow,
                        Width  = field.dataType._Length,
                        Height = 1
                    };
                    break;

                case FieldInfo.FieldType.Both:
                    currentView = new TextField("")
                    {
                        X      = field.Position.X, Y = field.Position.Y + plusRow,
                        Width  = field.dataType._Length,
                        Height = 1, Text = subfile.rows[plusRow].Columns[field.Name]
                    };
                    break;
                }

                if (field.Keywords != null)
                {
                    foreach (string keyword in field.Keywords.Keys)
                    {
                        switch (keyword)
                        {
                        case "COLOR":
                            currentView.ColorScheme        = new ColorScheme();
                            currentView.ColorScheme.Normal = Application.Driver.MakeAttribute(TextToColor(field.Keywords[keyword]), Color.Black);
                            currentView.ColorScheme.Focus  = Application.Driver.MakeAttribute(TextToColor(field.Keywords[keyword]), Color.Black);
                            break;

                        case "SYSNAME":
                            (currentView as Label).Text = Environment.MachineName.Substring(0, Math.Min(8, Environment.MachineName.Length));
                            break;
                        }
                    }
                }

                if (currentView != null)
                {
                    localFields.Add(field.Name + "-" + plusRow.ToString(), currentView);
                }
            }
        }