Ejemplo n.º 1
0
        public StagedControl StageControl(string filePath, string id)
        {
            var definition = File.ReadAllLines(filePath).Where(l => l.Length > 0)
                             .Where(l => l.ToLower().StartsWith("control") && l.Contains($"id={id}"))
                             .FirstOrDefault();

            if (definition.Length == 0)
            {
                return(new StagedControl());
            }

            var work = definition.Split(';');

            ControlType type = ControlType.None;

            for (int i = 0; i < work.Length; i++)
            {
                var pair = work[i].Split('=');
                if (pair[0].Trim().ToLower() == "control")
                {
                    type = ParseType(pair[1].Trim().ToLower());
                    break;
                }
            }

            if (type == ControlType.None)
            {
                return(new StagedControl());
            }

            var stagedGraphic = new StagedControl(id, filePath, type);

            return(stagedGraphic);
        }
Ejemplo n.º 2
0
        public IControl LoadControl(StagedControl stagedControl)
        {
            IControl control = null;

            switch (stagedControl.Type)
            {
            case (ControlType.Button):
                control = ParseButton(stagedControl.FilePath, stagedControl.Id);
                break;
            }
            return(control);
        }