public TX_ObjectSequence(IStream element, int index, eTypeObjectCollection typeCollection, eTypeObjectStream type, object data = null)
            : base(element, index, typeCollection)
        {
            Type = type;
            if (typeCollection == eTypeObjectCollection._1D)
            {
                switch (Type)
                {
                case eTypeObjectStream.Table:
                    Table = new TableSequence(this);
                    break;

                default:
                    Type = eTypeObjectStream.Default;
                    break;
                }
            }
            else if (Type == eTypeObjectStream.Table)
            {
                Table = new TableSequence(this);
            }
            else
            {
                Type = eTypeObjectStream.Default;
            }
        }
Exemple #2
0
 private void allTablesListBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (allTablesListBox.SelectedItem != null && allTablesListBox.SelectedItem != Table)
     {
         Table = (TableSequence)allTablesListBox.SelectedItem;
     }
 }
Exemple #3
0
 /// <summary>
 /// Добавление ссылки на объкт
 /// </summary>
 private void AddLinkToObject(IObjectStream @object)
 {
     if (((ObjectStream)@object).Table != null)
     {
         TableSequence table = ((ObjectStream)@object).Table;
         if (!_tables.ContainsKey(table.Name))
         {
             _tables.Add(table.Name, table);
             _tableObjects.Add(table.Name, new List <IObjectStream>( ));
         }
         ((ObjectStream)@object).Table = _tables[table.Name];
         _tableObjects[table.Name].Add(@object);
     }
     else if (((ObjectStream)@object).Variable != null)
     {
         Variable variable = ((ObjectStream)@object).Variable;
         if (!_sequenceVariables.ContainsKey(variable.Name))
         {
             _sequenceVariables.Add(variable.Name, variable);
             _variableObjects.Add(variable.Name, new List <IObjectStream>( ));
         }
         ((ObjectStream)@object).Variable = _sequenceVariables[variable.Name];
         _variableObjects[variable.Name].Add(@object);
     }
 }
Exemple #4
0
        /// <summary>
        /// Возвращает таблицу последовательности
        /// </summary>
        internal TableSequence GetTable(IObjectStream @object, string nameTable)
        {
            TableSequence table = null;

            if (_loadTables.TryGetValue(nameTable, out table))
            {
                _loadTableObjects[table.Name].Add(@object);
            }
            return(table);
        }
        public TX_ObjectSequence(IStream element, int index, eTypeObjectCollection typeCollection, string text)
            : base(element, index, typeCollection)
        {
            string @string = text.Trim();

            if (typeCollection == eTypeObjectCollection._1D)
            {
                if (@string.StartsWith("="))
                {
                    @string = @string.Substring(1).Trim();
                    if (IntegerValue.IsCheck(@string))
                    {
                        Value = new IntegerValue(@string);
                    }
                    else if (CheckedVariableName(ref @string))
                    {
                        Variable = new SequenceVariable(@string, new IntegerValue(0), new IntegerValue(0), new IntegerValue(1), null);
                    }
                    else
                    {
                        Type = eTypeObjectStream.Default;
                    }
                }
                else if (IntegerValue.IsCheck(@string))
                {
                    Value = new IntegerValue(@string);
                }
                else if (CheckedTableName(ref @string))
                {
                    Table = new TableSequence(this, @string);
                }
                else
                {
                    Type = eTypeObjectStream.Default;
                }
            }
            else
            {
                if (CheckedTableName(ref @string))
                {
                    Table = new TableSequence(this, @string);
                }
                else
                {
                    Type = eTypeObjectStream.Default;
                }
            }
        }
Exemple #6
0
        public TableEditForm(Document document = null, TableSequence table = null)
            : base(document)
        {
            _oldText         = new Dictionary <string, string>( );
            _oldData         = new Dictionary <string, DataTable>( );
            _oldDelayAuto    = new Dictionary <string, DelayAutoTable>( );
            _oldGenerateAuto = new Dictionary <string, GenerateAutoTable>( );

            InitializeComponent();

            _fullHeight = ClientSize.Height;
            ClientSize  = new Size(ClientSize.Width, listAllTablesLabel.Location.Y);

            if (table == null)
            {
                return;
            }

            Table = table;
            SetAllTablesList();
        }
Exemple #7
0
 /// <summary>
 /// Удаляем ссылку на объект
 /// </summary>
 private void RemoveLinkObject(IObjectStream @object)
 {
     if (((ObjectStream)@object).Table != null)
     {
         TableSequence table = ((ObjectStream)@object).Table;
         _tableObjects[table.Name].Remove(@object);
         if (_tableObjects[table.Name].Count == 0)
         {
             _tableObjects.Remove(table.Name);
             _tables.Remove(table.Name);
         }
     }
     else if (((ObjectStream)@object).Variable != null)
     {
         Variable variable = ((ObjectStream)@object).Variable;
         _variableObjects[variable.Name].Remove(@object);
         if (_variableObjects[variable.Name].Count == 0)
         {
             _variableObjects.Remove(variable.Name);
             _sequenceVariables.Remove(variable.Name);
         }
     }
 }
Exemple #8
0
        /// <summary>
        /// Устанавливаем данные импорта
        /// </summary>
        public void SetDataImport(PulseSequence pulseSequence)
        {
            List <Variable>       variablelist = new List <Variable>();
            List <TableSequence>  tableList    = new List <TableSequence>( );
            List <StreamSequence> streamList   = new List <StreamSequence>( );

            if (pulseSequence.sequenceParameters.variableSequence != null)
            {
                foreach (SequenceParameters.Parameter parametr in pulseSequence.sequenceParameters.variableSequence)
                {
                    SequenceVariable variable  = new SequenceVariable( );
                    Type             typeValue = Value.GetAutoType(parametr.value, parametr.minimum, parametr.maximum);
                    variable.Name       = parametr.name;
                    variable.IsReadOnly = parametr.isReadOnly;

                    if (!string.IsNullOrWhiteSpace(parametr.minimum))
                    {
                        variable.Min = (Value)Activator.CreateInstance(typeValue, new object[] { parametr.minimum, null });
                    }
                    if (!string.IsNullOrWhiteSpace(parametr.maximum))
                    {
                        variable.Max = (Value)Activator.CreateInstance(typeValue, new object[] { parametr.maximum, null });
                    }
                    variable.Value = (Value)Activator.CreateInstance(typeValue, new object[] { parametr.value, null });

                    variablelist.Add(variable);
                }
            }
            SequenceVariables = variablelist.ToArray( );

            variablelist.Clear( );
            if (pulseSequence.sequenceParameters.variableTable != null)
            {
                foreach (SequenceParameters.Parameter parametr in pulseSequence.sequenceParameters.variableTable)
                {
                    TableVariable variable = new TableVariable( );
                    variable.Name       = parametr.name;
                    variable.IsReadOnly = parametr.isReadOnly;
                    if (!string.IsNullOrWhiteSpace(parametr.minimum))
                    {
                        variable.Min = Value.CreateInstance(parametr.minimum);
                    }
                    if (!string.IsNullOrWhiteSpace(parametr.maximum))
                    {
                        if (variable.Min != null)
                        {
                            variable.Max = (Value)Activator.CreateInstance(variable.Min.GetType( ), new object[] { parametr.maximum, null });
                        }
                        else
                        {
                            variable.Max = Value.CreateInstance(parametr.maximum);
                        }
                    }
                    if (variable.Min != null)
                    {
                        variable.Value = (Value)Activator.CreateInstance(variable.Min.GetType( ), new object[] { parametr.value, null });
                    }
                    else if (variable.Max != null)
                    {
                        variable.Value = (Value)Activator.CreateInstance(variable.Max.GetType( ), new object[] { parametr.value, null });
                    }
                    else
                    {
                        variable.Value = Value.CreateInstance(parametr.value);
                    }

                    variablelist.Add(variable);
                }
            }
            TableVariables = variablelist.ToArray( );

            foreach (SequenceTable table in pulseSequence.sequenceTables)
            {
                tableList.Add(TableSequence.CreateInstance(table));
            }
            Tables = tableList.ToArray( );

            foreach (SequenceRow row in pulseSequence.sequenceRows)
            {
                streamList.Add(new StreamSequence(row));
            }
            Streams = streamList.ToArray( );
        }