Ejemplo n.º 1
0
        public ThreadUnit(ConfigurationUnit confConfigurationUnit)
        {
            if (confConfigurationUnit.Type == ConfigurationUnitType.Thread)
            {
                StartPos  = new Point();
                FinishPos = new Point();

                foreach (KeyValuePair <string, string> param in confConfigurationUnit.Parameters)
                {
                    string value = param.Value;
                    string tmpVal;
                    double dbValue;

                    switch (param.Key.ToUpper())
                    {
                    case "ИДЕНТИФИКАТОР":
                        Uid = Convert.ToInt32(value);
                        break;

                    case "ИМЯ":
                        Name = value;
                        break;

                    case "КООРДИНАТАНАЧАЛА":
                        tmpVal        = value.Replace(".", ",");
                        dbValue       = Convert.ToDouble(tmpVal);
                        StartPos.PosX = dbValue;
                        break;

                    case "КООРДИНАТАЗАВЕРШЕНИЯ":
                        tmpVal         = value.Replace(".", ",");
                        dbValue        = Convert.ToDouble(tmpVal);
                        FinishPos.PosX = dbValue;
                        break;

                    case "НАПРАВЛЕНИЕ":
                        ThreadDirection direction = getThreadDirection(value);
                        Direction = direction;
                        break;

                    case "ПРЕДЫДУЩАЯНИТЬ":
                        PrevThread = Convert.ToInt32(value);
                        break;

                    case "СЛЕДУЮЩАЯНИТЬ":
                        NextThread = Convert.ToInt32(value);
                        break;

                    case "НОМЕРНИТИ":
                        ThreadNumber = Convert.ToInt32(value);
                        break;

                    case "ОСТАНАВЛИВАТЬНАКОНЦАХНИТИ":
                        int tmpValue = Convert.ToInt32(value);
                        StopOnEnds = tmpValue > 0;
                        break;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private ThreadDirection getThreadDirection(string value)
        {
            ThreadDirection res = ThreadDirection.Horizontal;

            switch (value.ToUpper())
            {
            case "ГОРИЗОНТАЛЬНО":
                res = ThreadDirection.Horizontal;
                break;

            case "ВЕРТИКАЛЬНО":
                res = ThreadDirection.Vertical;
                break;
            }

            return(res);
        }