Beispiel #1
0
        public override void ConnectComponents(IDomain domain, IDynamic currentDynamic, IReadOnlyCollection <IComponent> components)
        {
            base.ConnectComponents(domain, currentDynamic, components);

            if (Items.Count < 1)
            {
                throw new ParsingException(203, Source, $"Panel '{GetType().Name}' has no item.");
            }

            double MaxWidthValue;

            if (MaxWidth != null && !ParserDomain.TryParseDouble(MaxWidth, out MaxWidthValue))
            {
                throw new ParsingException(204, Source, "Invalid max width.");
            }

            double MaxHeightValue;

            if (MaxHeight != null && !ParserDomain.TryParseDouble(MaxHeight, out MaxHeightValue))
            {
                throw new ParsingException(205, Source, "Invalid max height.");
            }

            foreach (ILayoutElement Item in Items)
            {
                Item.ConnectComponents(domain, currentDynamic, components);
            }
        }
Beispiel #2
0
        private IComponentIndex ParseComponentIndex(IDeclarationSource nameSource, IParsingSourceStream sourceStream, List <ComponentInfo> infoList)
        {
            IComponentProperty IndexProperty = null;

            foreach (ComponentInfo Info in infoList)
            {
                if (Info.NameSource.Name == "index" && IndexProperty == null)
                {
                    IndexProperty = new ComponentProperty(Info);
                }
                else if (Info.NameSource.Name != "index")
                {
                    throw new ParsingException(27, sourceStream, $"Unknown token '{Info.NameSource.Name}'.");
                }
                else
                {
                    throw new ParsingException(28, sourceStream, $"'{Info.NameSource.Name}' is repeated.");
                }
            }

            if (IndexProperty == null)
            {
                throw new ParsingException(64, sourceStream, "Index not specified.");
            }
            if (IndexProperty.FixedValueSource != null || IndexProperty.ObjectPropertyKey != null)
            {
                throw new ParsingException(65, sourceStream, "Index must be an integer, state or boolean property.");
            }

            return(new ComponentIndex(nameSource, ParserDomain.ToXamlName(nameSource.Source, nameSource.Name, "Index"), IndexProperty));
        }
Beispiel #3
0
        private string ReplaceTypeSyntax(string line, string prefix, string replace, bool renameType)
        {
            int TypeIndex = 0;

            while ((TypeIndex = line.IndexOf($"{prefix}{{x:Type ", TypeIndex)) >= 0)
            {
                int SeparatorIndex = line.IndexOf("}", TypeIndex);
                if (SeparatorIndex > TypeIndex + 8 + prefix.Length)
                {
                    string TypeName = line.Substring(TypeIndex + 8 + prefix.Length, SeparatorIndex - TypeIndex - 8 - prefix.Length);

                    if (renameType)
                    {
                        TypeName = ParserDomain.StyleTypeConverter(TypeName);
                    }

                    line = line.Substring(0, TypeIndex) + $"{prefix}{replace}" + TypeName + line.Substring(SeparatorIndex + 1);
                }
                else
                {
                    break;
                }
            }

            return(line);
        }
Beispiel #4
0
        private Dictionary <IDeclarationSource, string> ParseColors(IParsingSourceStream sourceStream)
        {
            Dictionary <IDeclarationSource, string> Colors = new Dictionary <IDeclarationSource, string>();

            while (!sourceStream.EndOfStream)
            {
                sourceStream.ReadLine();

                IDeclarationSource ColorSource;
                string             ColorValue;
                ParserDomain.ParseStringPair(sourceStream, ':', out ColorSource, out ColorValue);

                foreach (KeyValuePair <IDeclarationSource, string> Entry in Colors)
                {
                    if (Entry.Key.Name == ColorSource.Name)
                    {
                        throw new ParsingException(81, sourceStream, $"Color '{ColorSource.Name}' defined more than once.");
                    }
                }

                Colors.Add(ColorSource, ColorValue);
            }

            return(Colors);
        }
Beispiel #5
0
        private IComponentArea ParseComponentArea(IDeclarationSource nameSource, IParsingSourceStream sourceStream, List <ComponentInfo> infoList)
        {
            IComponentProperty AreaProperty = null;

            foreach (ComponentInfo Info in infoList)
            {
                if (Info.NameSource.Name == "name" && AreaProperty == null)
                {
                    AreaProperty = new ComponentProperty(Info);
                }
                else if (Info.NameSource.Name != "name")
                {
                    throw new ParsingException(27, sourceStream, $"Unknown token '{Info.NameSource.Name}'.");
                }
                else
                {
                    throw new ParsingException(28, sourceStream, $"'{Info.NameSource.Name}' is repeated.");
                }
            }

            if (AreaProperty == null)
            {
                throw new ParsingException(29, sourceStream, "Area name not specified.");
            }
            if (AreaProperty.FixedValueSource == null)
            {
                throw new ParsingException(30, sourceStream, "Area can only be a static name.");
            }

            return(new ComponentArea(nameSource, ParserDomain.ToXamlName(nameSource.Source, nameSource.Name, "Area"), AreaProperty.FixedValueSource));
        }
Beispiel #6
0
        private IComponentPasswordEdit ParseComponentPasswordEdit(IDeclarationSource nameSource, IParsingSourceStream sourceStream, List <ComponentInfo> infoList)
        {
            IComponentProperty TextProperty = null;

            foreach (ComponentInfo Info in infoList)
            {
                if (Info.NameSource.Name == "text" && TextProperty == null)
                {
                    TextProperty = new ComponentProperty(Info);
                }
                else if (Info.NameSource.Name != "text")
                {
                    throw new ParsingException(27, sourceStream, $"Unknown token '{Info.NameSource.Name}'.");
                }
                else
                {
                    throw new ParsingException(28, sourceStream, $"'{Info.NameSource.Name}' is repeated.");
                }
            }

            if (TextProperty == null)
            {
                throw new ParsingException(50, sourceStream, "Text not specified.");
            }
            if (TextProperty.FixedValueSource != null || TextProperty.ObjectPropertyKey != null)
            {
                throw new ParsingException(51, sourceStream, "Text must be a string property.");
            }

            return(new ComponentPasswordEdit(nameSource, ParserDomain.ToXamlName(nameSource.Source, nameSource.Name, "PasswordEdit"), TextProperty));
        }
Beispiel #7
0
        private IComponentHtml ParseComponentHtml(IDeclarationSource nameSource, IParsingSourceStream sourceStream, List <ComponentInfo> infoList)
        {
            IComponentProperty HtmlProperty = null;

            foreach (ComponentInfo Info in infoList)
            {
                if (Info.NameSource.Name == "html" && HtmlProperty == null)
                {
                    HtmlProperty = new ComponentProperty(Info);
                }
                else if (Info.NameSource.Name != "html")
                {
                    throw new ParsingException(27, sourceStream, $"Unknown token '{Info.NameSource.Name}'.");
                }
                else
                {
                    throw new ParsingException(28, sourceStream, $"'{Info.NameSource.Name}' is repeated.");
                }
            }

            if (HtmlProperty == null)
            {
                throw new ParsingException(0, sourceStream, "Html not specified.");
            }

            return(new ComponentHtml(nameSource, ParserDomain.ToXamlName(nameSource.Source, nameSource.Name, "Html"), HtmlProperty));
        }
Beispiel #8
0
        private IPage Parse(string name, IParsingSourceStream sourceStream)
        {
            IComponentEvent    QueryEvent           = null;
            IDeclarationSource AreaSource           = null;
            IParsingSource     AllAreaLayoutsSource = null;
            Dictionary <IDeclarationSource, string> AreaLayoutsPairs = null;
            IDeclarationSource DesignSource = null;
            IDeclarationSource WidthSource  = null;
            IDeclarationSource HeightSource = null;
            bool IsScrollable = false;
            IDeclarationSource BackgroundSource      = null;
            IDeclarationSource BackgroundColorSource = null;
            string             Tag = null;

            while (!sourceStream.EndOfStream)
            {
                sourceStream.ReadLine();
                string Line = sourceStream.Line;
                if (!string.IsNullOrWhiteSpace(Line))
                {
                    ParseComponent(sourceStream, ref QueryEvent, ref AreaSource, ref AllAreaLayoutsSource, ref AreaLayoutsPairs, ref DesignSource, ref WidthSource, ref HeightSource, ref IsScrollable, ref BackgroundSource, ref BackgroundColorSource, ref Tag);
                }
            }

            if (AreaSource == null || string.IsNullOrEmpty(AreaSource.Name))
            {
                throw new ParsingException(109, sourceStream, "Missing area name.");
            }

            if (AreaLayoutsPairs == null)
            {
                throw new ParsingException(110, sourceStream, "Missing default area layout.");
            }

            if (DesignSource == null || string.IsNullOrEmpty(DesignSource.Name))
            {
                throw new ParsingException(111, sourceStream, "Missing design name.");
            }

            if (WidthSource == null || string.IsNullOrEmpty(WidthSource.Name))
            {
                throw new ParsingException(112, sourceStream, "Missing width.");
            }

            if (HeightSource == null || string.IsNullOrEmpty(HeightSource.Name))
            {
                throw new ParsingException(113, sourceStream, "Missing height.");
            }

            if (BackgroundColorSource == null || string.IsNullOrEmpty(BackgroundColorSource.Name))
            {
                throw new ParsingException(114, sourceStream, "Missing background color.");
            }

            return(new Page(name, ParserDomain.ToCSharpName(sourceStream, name + "Page"), ParserDomain.ToXamlName(sourceStream, name, "Page"), QueryEvent, AreaSource, AllAreaLayoutsSource, AreaLayoutsPairs, DesignSource, WidthSource, HeightSource, IsScrollable, BackgroundSource, BackgroundColorSource, Tag));
        }
Beispiel #9
0
        public override IBackground Parse(string fileName, IDictionary <ConditionalDefine, bool> conditionalDefineTable)
        {
            string Name = Path.GetFileNameWithoutExtension(fileName);
            IParsingSourceStream SourceStream = ParsingSourceStream.CreateFromFileName(fileName, conditionalDefineTable);

            List <string> Lines;

            LoadResourceFile(SourceStream, out Lines);

            return(new Background(Name, ParserDomain.ToXamlName(SourceStream, Name, "Background"), Lines));
        }
Beispiel #10
0
        private IObjectEvent ParseEvent(IParsingSourceStream sourceStream, string line)
        {
            string Name = line.Trim();

            if (Name.Length <= 0)
            {
                throw new ParsingException(107, sourceStream, "Event name cannot be empty.");
            }

            IDeclarationSource NameSource = new DeclarationSource(Name, sourceStream);

            return(new ObjectEvent(NameSource, ParserDomain.ToCSharpName(sourceStream, Name)));
        }
Beispiel #11
0
        public override IDesign Parse(string fileName, IDictionary <ConditionalDefine, bool> conditionalDefineTable)
        {
            IParsingSourceStream SourceStream = ParsingSourceStream.CreateFromFileName(fileName, conditionalDefineTable);

            ResourceDictionary Content;
            List <string>      FileNames;

            LoadResourceFile(SourceStream, out Content, out FileNames);

            if (!IsTypeStyleFound(Content, typeof(Windows.UI.Xaml.Controls.Button)))
            {
                throw new ParsingException(82, SourceStream, "Missing 'Button' style.");
            }
            if (!IsTypeStyleFound(Content, typeof(Windows.UI.Xaml.Controls.TextBox)))
            {
                throw new ParsingException(83, SourceStream, "Missing 'TextBox' style.");
            }
            if (!IsTypeStyleFound(Content, typeof(Windows.UI.Xaml.Controls.Image)))
            {
                throw new ParsingException(84, SourceStream, "Missing 'Image' style.");
            }
            if (!IsTypeStyleFound(Content, typeof(Windows.UI.Xaml.Controls.ListBox)))
            {
                throw new ParsingException(85, SourceStream, "Missing 'ListBox' style.");
            }
            if (!IsTypeStyleFound(Content, typeof(Windows.UI.Xaml.Controls.TextBlock)))
            {
                throw new ParsingException(86, SourceStream, "Missing 'TextBlock' style.");
            }
            if (!IsTypeStyleFound(Content, typeof(Windows.UI.Xaml.Controls.RadioButton)))
            {
                throw new ParsingException(87, SourceStream, "Missing 'RadioButton' style.");
            }
            if (!IsTypeStyleFound(Content, typeof(Windows.UI.Xaml.Controls.CheckBox)))
            {
                throw new ParsingException(88, SourceStream, "Missing 'CheckBox' style.");
            }
            if (!IsTypeStyleFound(Content, typeof(Windows.UI.Xaml.Controls.PasswordBox)))
            {
                throw new ParsingException(89, SourceStream, "Missing 'PasswordBox' style.");
            }
            if (!IsTypeStyleFound(Content, typeof(Windows.UI.Xaml.Controls.Primitives.ToggleButton)))
            {
                throw new ParsingException(206, SourceStream, "Missing 'ToggleButton' style.");
            }

            string MainFileName = FileNames[0];
            string Name         = Path.GetFileNameWithoutExtension(MainFileName);

            return(new Design(FileNames, ParserDomain.ToXamlName(SourceStream, Name, "Design"), Content));
        }
Beispiel #12
0
        private IComponentText ParseComponentText(IDeclarationSource nameSource, IParsingSourceStream sourceStream, List <ComponentInfo> infoList)
        {
            IComponentProperty TextProperty           = null;
            IComponentProperty TextDecorationProperty = null;

            foreach (ComponentInfo Info in infoList)
            {
                if (Info.NameSource.Name == "text" && TextProperty == null)
                {
                    TextProperty = new ComponentProperty(Info);
                }
                else if (Info.NameSource.Name == "decoration" && TextDecorationProperty == null)
                {
                    TextDecorationProperty = new ComponentProperty(Info);
                }
                else if (Info.NameSource.Name != "text" && Info.NameSource.Name != "decoration")
                {
                    throw new ParsingException(27, sourceStream, $"Unknown token '{Info.NameSource.Name}'.");
                }
                else
                {
                    throw new ParsingException(28, sourceStream, $"'{Info.NameSource.Name}' is repeated.");
                }
            }

            if (TextProperty == null)
            {
                throw new ParsingException(38, sourceStream, "Text not specified.");
            }
            if (TextDecorationProperty != null && TextDecorationProperty.FixedValueSource == null)
            {
                throw new ParsingException(39, sourceStream, "Decoration can only be a constant.");
            }

            string TextDecoration = TextDecorationProperty != null ? TextDecorationProperty.FixedValueSource.Name : null;

            if (TextDecoration != null &&
                TextDecoration != Windows.UI.Text.TextDecorations.OverLine.ToString() &&
                TextDecoration != Windows.UI.Text.TextDecorations.Strikethrough.ToString() &&
                TextDecoration != Windows.UI.Text.TextDecorations.Underline.ToString())
            {
                throw new ParsingException(40, sourceStream, $"Invalid decoration for '{nameSource.Name}'.");
            }

            return(new ComponentText(nameSource, ParserDomain.ToXamlName(nameSource.Source, nameSource.Name, "Text"), TextProperty, TextDecoration));
        }
Beispiel #13
0
        private Dictionary <IDeclarationSource, string> ParseAreaLayoutsPairs(IParsingSourceStream sourceStream, string line)
        {
            Dictionary <IDeclarationSource, string> Result = new Dictionary <IDeclarationSource, string>();

            string[] Splitted = line.Split(',');

            foreach (string Split in Splitted)
            {
                IDeclarationSource AreaSource;
                string             LayoutName;
                ParserDomain.ParseStringPair(sourceStream, Split, '=', out AreaSource, out LayoutName);

                Result.Add(AreaSource, LayoutName);
            }

            return(Result);
        }
Beispiel #14
0
        public override IResource Parse(string fileName, IDictionary <ConditionalDefine, bool> conditionalDefineTable)
        {
            string Name = Path.GetFileNameWithoutExtension(fileName);
            IParsingSourceStream SourceStream = ParsingSourceStream.CreateFromFileName(fileName, conditionalDefineTable);

            try
            {
                using (SourceStream.Open())
                {
                    return(new Resource(Name, ParserDomain.ToXamlName(SourceStream, Name, "Resource"), fileName));
                }
            }
            catch (Exception e)
            {
                throw new ParsingException(116, SourceStream, e);
            }
        }
Beispiel #15
0
        private IComponentSelector ParseComponentSelector(IDeclarationSource nameSource, IParsingSourceStream sourceStream, List <ComponentInfo> infoList)
        {
            IComponentProperty IndexProperty = null;
            IComponentProperty ItemsProperty = null;

            foreach (ComponentInfo Info in infoList)
            {
                if (Info.NameSource.Name == "index" && IndexProperty == null)
                {
                    IndexProperty = new ComponentProperty(Info);
                }
                else if (Info.NameSource.Name == "items" && ItemsProperty == null)
                {
                    ItemsProperty = new ComponentProperty(Info);
                }
                else if (Info.NameSource.Name != "index" && Info.NameSource.Name != "items")
                {
                    throw new ParsingException(27, sourceStream, $"Unknown token '{Info.NameSource.Name}'.");
                }
                else
                {
                    throw new ParsingException(28, sourceStream, $"'{Info.NameSource.Name}' is repeated.");
                }
            }

            if (IndexProperty == null)
            {
                throw new ParsingException(60, sourceStream, "Index not specified.");
            }
            if (IndexProperty.FixedValueSource != null || IndexProperty.ObjectPropertyKey != null)
            {
                throw new ParsingException(61, sourceStream, "Index must be an integer property.");
            }

            if (ItemsProperty == null)
            {
                throw new ParsingException(62, sourceStream, "Items not specified.");
            }
            if (ItemsProperty.FixedValueSource != null || ItemsProperty.ObjectPropertyKey != null)
            {
                throw new ParsingException(63, sourceStream, "Items must be a list property.");
            }

            return(new ComponentSelector(nameSource, ParserDomain.ToXamlName(nameSource.Source, nameSource.Name, "Selector"), IndexProperty, ItemsProperty));
        }
Beispiel #16
0
        private IComponentCheckBox ParseComponentCheckBox(IDeclarationSource nameSource, IParsingSourceStream sourceStream, List <ComponentInfo> infoList)
        {
            IComponentProperty ContentProperty = null;
            IComponentProperty CheckedProperty = null;

            foreach (ComponentInfo Info in infoList)
            {
                if (Info.NameSource.Name == "content" && ContentProperty == null)
                {
                    ContentProperty = new ComponentProperty(Info);
                }
                else if (Info.NameSource.Name == "checked" && CheckedProperty == null)
                {
                    CheckedProperty = new ComponentProperty(Info);
                }
                else if (Info.NameSource.Name != "content" && Info.NameSource.Name != "checked")
                {
                    throw new ParsingException(27, sourceStream, $"Unknown token '{Info.NameSource.Name}'.");
                }
                else
                {
                    throw new ParsingException(28, sourceStream, $"'{Info.NameSource.Name}' is repeated.");
                }
            }

            if (ContentProperty == null)
            {
                throw new ParsingException(34, sourceStream, "CheckBox content not specified.");
            }
            if (CheckedProperty == null)
            {
                throw new ParsingException(35, sourceStream, "CheckBox checked property not specified.");
            }

            if (CheckedProperty.FixedValueSource != null)
            {
                throw new ParsingException(36, sourceStream, "Checked property cannot be a static name.");
            }
            if (CheckedProperty.ObjectPropertyKey != null)
            {
                throw new ParsingException(37, sourceStream, "Checked property cannot use a key.");
            }

            return(new ComponentCheckBox(nameSource, ParserDomain.ToXamlName(nameSource.Source, nameSource.Name, "CheckBox"), ContentProperty, CheckedProperty));
        }
Beispiel #17
0
        private IArea Parse(string name, IParsingSourceStream sourceStream)
        {
            IComponentCollection ComponentList;

            try
            {
                ComponentList = ParseComponents(sourceStream);
            }
            catch (ParsingException)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new ParsingException(24, sourceStream, e);
            }

            return(new Area(name, ParserDomain.ToXamlName(sourceStream, name, "Area"), ComponentList));
        }
Beispiel #18
0
        private IDynamic Parse(string name, IParsingSourceStream sourceStream)
        {
            IDynamicPropertyCollection Properties = new DynamicPropertyCollection();

            sourceStream.ReadLine();
            string Line        = sourceStream.Line;
            int    Indentation = -1;
            bool   UseTab      = false;

            while (Line != null)
            {
                IDynamicProperty Property = Parse(sourceStream, ref Line, ref Indentation, ref UseTab);
                Properties.Add(Property);
            }

            string FileName     = ParserDomain.ToCSharpName(sourceStream, name + "PageDynamic");
            string XamlPageName = ParserDomain.ToXamlName(sourceStream, name, "Page");

            return(new Dynamic(name, FileName, XamlPageName, Properties));
        }
Beispiel #19
0
        private IComponentContainerList ParseComponentContainerList(IDeclarationSource nameSource, IParsingSourceStream sourceStream, List <ComponentInfo> infoList)
        {
            IComponentProperty ItemListProperty = null;
            IComponentProperty AreaProperty     = null;

            foreach (ComponentInfo Info in infoList)
            {
                if (Info.NameSource.Name == "items" && ItemListProperty == null)
                {
                    ItemListProperty = new ComponentProperty(Info);
                }
                else if (Info.NameSource.Name == "area" && AreaProperty == null)
                {
                    AreaProperty = new ComponentProperty(Info);
                }
                else if (Info.NameSource.Name != "items" && Info.NameSource.Name != "area")
                {
                    throw new ParsingException(27, sourceStream, $"Unknown token '{Info.NameSource.Name}'.");
                }
                else
                {
                    throw new ParsingException(28, sourceStream, $"'{Info.NameSource.Name}' is repeated.");
                }
            }

            if (ItemListProperty == null)
            {
                throw new ParsingException(69, sourceStream, "Items not specified.");
            }

            if (AreaProperty == null)
            {
                throw new ParsingException(70, sourceStream, "Area not specified.");
            }
            if (AreaProperty.FixedValueSource == null)
            {
                throw new ParsingException(71, sourceStream, "Area name can only be a static name.");
            }

            return(new ComponentContainerList(nameSource, ParserDomain.ToXamlName(nameSource.Source, nameSource.Name, "ContainerList"), ItemListProperty, AreaProperty.FixedValueSource));
        }
Beispiel #20
0
        private double[] ParseDoubleList(string stringList, int maxCount, string propertyName)
        {
            if (stringList == null)
            {
                stringList = "";
            }

            string[] Splitted = stringList.Split(',');
            if (Splitted.Length > maxCount)
            {
                throw new ParsingException(169, Source, $"Too many values in '{stringList}', expected at most {maxCount}.");
            }

            double[] Result = new double[maxCount];

            int i;

            for (i = 0; i < Splitted.Length; i++)
            {
                string WidthString = Splitted[i];
                if (WidthString.Length == 0)
                {
                    Result[i] = 0;
                }
                else if (WidthString.ToLower() == "auto")
                {
                    Result[i] = double.NaN;
                }
                else if (!ParserDomain.TryParseDouble(WidthString, out Result[i]))
                {
                    throw new ParsingException(170, Source, $"'{WidthString}' not parsed as a {propertyName}.");
                }
            }
            for (; i < maxCount; i++)
            {
                Result[i] = 0;
            }

            return(Result);
        }
Beispiel #21
0
        private IObject Parse(string name, IParsingSourceStream sourceStream)
        {
            IObjectPropertyCollection ObjectPropertyList;
            List <IObjectEvent>       ObjectEventList;

            sourceStream.ReadLine();
            string Line = sourceStream.Line;

            bool IsGlobal;

            if (!string.IsNullOrEmpty(Line) && Line.Trim().ToLower() == "global")
            {
                IsGlobal = true;
                sourceStream.ReadLine();
            }
            else
            {
                IsGlobal = false;
            }

            try
            {
                ObjectPropertyList = ParseObjectProperties(sourceStream, ref Line);
                ObjectEventList    = ParseEvents(sourceStream, ref Line);
            }
            catch (ParsingException)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new ParsingException(94, sourceStream, e);
            }

            string CSharpname = ParserDomain.ToCSharpName(sourceStream, name);

            return(new Object(name, CSharpname, IsGlobal, ObjectPropertyList, ObjectEventList));
        }
Beispiel #22
0
        private ILayout Parse(string fileName, IParsingSourceStream sourceStream)
        {
            Layout Root;

            try
            {
                Root = (Layout)sourceStream.LoadXaml();

                string Name     = Path.GetFileNameWithoutExtension(fileName);
                string XamlName = ParserDomain.ToXamlName(sourceStream, Name, "Layout");

                Root.SetName(Name, XamlName, fileName);
            }
            catch (ParsingException)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new ParsingException(93, sourceStream, e);
            }

            return(Root);
        }
Beispiel #23
0
        public string GetComponentValue(IGeneratorPage currentPage, IGeneratorObject currentObject, IGeneratorResource resourceValue, IGeneratorObject objectValue, IGeneratorObjectProperty objectPropertyValue, IDeclarationSource key, bool isTwoWays)
        {
            if (resourceValue != null)
            {
                return($"{{StaticResource {resourceValue.XamlName}}}");
            }

            else if (objectValue != null && objectPropertyValue != null)
            {
                string Mode          = isTwoWays ? ", Mode=TwoWay" : "";
                string ObjectBinding = GetObjectBinding(currentObject, objectValue, objectPropertyValue);

                if (key == null)
                {
                    return($"{{Binding {ObjectBinding}{Mode}}}");
                }
                else if (key.Name == GeneratorPage.CurrentPage.Name)
                {
                    return($"{{Binding {ObjectBinding}{Mode}, Converter={{StaticResource convKeyToValue}}, ConverterParameter=page-{ParserDomain.ToKeyName(currentPage.Name)}}}");
                }
                else
                {
                    return($"{{Binding {ObjectBinding}{Mode}, Converter={{StaticResource convKeyToValue}}, ConverterParameter={key.Name}}}");
                }
            }

            else
            {
                throw new InvalidOperationException();
            }
        }
Beispiel #24
0
        public virtual void ConnectComponents(IDomain domain, IDynamic currentDynamic, IReadOnlyCollection <IComponent> components)
        {
            double WidthValue;

            if (Width != null && !ParserDomain.TryParseDouble(Width, out WidthValue))
            {
                throw new ParsingException(193, Source, "Invalid width.");
            }

            double HeightValue;

            if (Height != null && !ParserDomain.TryParseDouble(Height, out HeightValue))
            {
                throw new ParsingException(194, Source, "Invalid height.");
            }

            double SingleMargin;

            if (Margin != null && !ParserDomain.TryParseDouble(Margin, out SingleMargin))
            {
                string[] ThicknessMargin = Margin.Split(',');
                int      i;

                for (i = 0; i < 4 && i < ThicknessMargin.Length; i++)
                {
                    if (!ParserDomain.TryParseDouble(ThicknessMargin[i], out SingleMargin))
                    {
                        break;
                    }
                }

                if (i < 4)
                {
                    throw new ParsingException(195, Source, "Invalid margin.");
                }
            }

            if (HorizontalAlignment != null &&
                HorizontalAlignment != Windows.UI.Xaml.HorizontalAlignment.Left.ToString() &&
                HorizontalAlignment != Windows.UI.Xaml.HorizontalAlignment.Center.ToString() &&
                HorizontalAlignment != Windows.UI.Xaml.HorizontalAlignment.Right.ToString() &&
                HorizontalAlignment != Windows.UI.Xaml.HorizontalAlignment.Stretch.ToString())
            {
                throw new ParsingException(196, Source, "Invalid horizontal alignment.");
            }

            if (VerticalAlignment != null &&
                VerticalAlignment != Windows.UI.Xaml.VerticalAlignment.Top.ToString() &&
                VerticalAlignment != Windows.UI.Xaml.VerticalAlignment.Center.ToString() &&
                VerticalAlignment != Windows.UI.Xaml.VerticalAlignment.Bottom.ToString() &&
                VerticalAlignment != Windows.UI.Xaml.VerticalAlignment.Stretch.ToString())
            {
                throw new ParsingException(197, Source, "Invalid vertical alignment.");
            }

            if (DynamicEnable != null && DynamicController == null)
            {
                foreach (IDynamicProperty Item in currentDynamic.Properties)
                {
                    if (DynamicEnable == Item.Source.Name)
                    {
                        DynamicController = Item;
                        break;
                    }
                }

                if (DynamicController == null)
                {
                    throw new ParsingException(198, Source, $"Dynamic property '{DynamicEnable}' not found in '{currentDynamic.Name}'.");
                }
                else if (DynamicController.Result != DynamicOperationResults.Boolean)
                {
                    throw new ParsingException(199, Source, $"Dynamic property '{DynamicEnable}' is not boolean.");
                }

                DynamicController.SetIsUsed();
            }
        }
Beispiel #25
0
        private void ParseComponent(IParsingSourceStream sourceStream, ref IComponentEvent queryEvent, ref IDeclarationSource areaSource, ref IParsingSource allAreaLayoutsSource, ref Dictionary <IDeclarationSource, string> areaLayoutsPairs, ref IDeclarationSource designSource, ref IDeclarationSource widthSource, ref IDeclarationSource heightSource, ref bool isScrollable, ref IDeclarationSource backgroundSource, ref IDeclarationSource backgroundColorSource, ref string tag)
        {
            string Line = sourceStream.Line;

            if (Line.Trim() == "scrollable")
            {
                isScrollable = true;
                return;
            }

            IDeclarationSource ComponentSource;
            string             ComponentValue;

            ParserDomain.ParseStringPair(sourceStream, ':', out ComponentSource, out ComponentValue);
            //ComponentValue = ComponentValue.ToLower();

            if (ComponentSource.Name == "open on query")
            {
                if (queryEvent == null)
                {
                    queryEvent = ParseQueryEvent(sourceStream, ComponentValue);
                }
                else
                {
                    throw new ParsingException(125, sourceStream, $"Specifier '{ComponentSource.Name}' found more than once.");
                }
            }
            else if (ComponentSource.Name == "area")
            {
                if (areaSource == null)
                {
                    areaSource = new DeclarationSource(ComponentValue, sourceStream);
                }
                else
                {
                    throw new ParsingException(125, sourceStream, $"Specifier '{ComponentSource.Name}' found more than once.");
                }
            }
            else if (ComponentSource.Name == "default area layout")
            {
                if (areaLayoutsPairs == null)
                {
                    allAreaLayoutsSource = sourceStream.FreezedPosition();
                    areaLayoutsPairs     = ParseAreaLayoutsPairs(sourceStream, ComponentValue);
                }
                else
                {
                    throw new ParsingException(125, sourceStream, $"Specifier '{ComponentSource.Name}' found more than once.");
                }
            }
            else if (ComponentSource.Name == "design")
            {
                if (designSource == null)
                {
                    designSource = new DeclarationSource(ComponentValue, sourceStream);
                }
                else
                {
                    throw new ParsingException(125, sourceStream, $"Specifier '{ComponentSource.Name}' found more than once.");
                }
            }
            else if (ComponentSource.Name == "width")
            {
                if (widthSource == null)
                {
                    widthSource = new DeclarationSource(ComponentValue, sourceStream);
                }
                else
                {
                    throw new ParsingException(125, sourceStream, $"Specifier '{ComponentSource.Name}' found more than once.");
                }
            }
            else if (ComponentSource.Name == "height")
            {
                if (heightSource == null)
                {
                    heightSource = new DeclarationSource(ComponentValue, sourceStream);
                }
                else
                {
                    throw new ParsingException(125, sourceStream, $"Specifier '{ComponentSource.Name}' found more than once.");
                }
            }
            else if (ComponentSource.Name == "background")
            {
                if (backgroundSource == null)
                {
                    backgroundSource = new DeclarationSource(ComponentValue, sourceStream);
                }
                else
                {
                    throw new ParsingException(125, sourceStream, $"Specifier '{ComponentSource.Name}' found more than once.");
                }
            }
            else if (ComponentSource.Name == "background color")
            {
                if (backgroundColorSource == null)
                {
                    backgroundColorSource = new DeclarationSource(ComponentValue, sourceStream);
                }
                else
                {
                    throw new ParsingException(125, sourceStream, $"Specifier '{ComponentSource.Name}' found more than once.");
                }
            }
            else if (ComponentSource.Name == "tag")
            {
                if (tag == null)
                {
                    tag = ComponentValue;
                }
                else
                {
                    throw new ParsingException(125, sourceStream, $"Specifier '{ComponentSource.Name}' found more than once.");
                }
            }
            else
            {
                throw new ParsingException(115, sourceStream, $"Specifier '{ComponentSource.Name}' was unexpected.");
            }
        }
Beispiel #26
0
        private IComponentPopup ParseComponentPopup(IDeclarationSource nameSource, IParsingSourceStream sourceStream, List <ComponentInfo> infoList)
        {
            IComponentProperty SourceProperty        = null;
            IComponentProperty SourcePressedProperty = null;
            IComponentProperty AreaProperty          = null;
            IComponentProperty WidthProperty         = null;
            IComponentProperty HeightProperty        = null;

            foreach (ComponentInfo Info in infoList)
            {
                if (Info.NameSource.Name == "source" && SourceProperty == null)
                {
                    SourceProperty = new ComponentProperty(Info);
                }
                else if (Info.NameSource.Name == "source pressed" && SourcePressedProperty == null)
                {
                    SourcePressedProperty = new ComponentProperty(Info);
                }
                else if (Info.NameSource.Name == "area" && AreaProperty == null)
                {
                    AreaProperty = new ComponentProperty(Info);
                }
                else if (Info.NameSource.Name == "width" && WidthProperty == null)
                {
                    WidthProperty = new ComponentProperty(Info);
                }
                else if (Info.NameSource.Name == "height" && HeightProperty == null)
                {
                    HeightProperty = new ComponentProperty(Info);
                }
                else if (Info.NameSource.Name != "source" && Info.NameSource.Name != "source pressed" && Info.NameSource.Name != "area" && Info.NameSource.Name != "width" && Info.NameSource.Name != "height")
                {
                    throw new ParsingException(27, sourceStream, $"Unknown token '{Info.NameSource.Name}'.");
                }
                else
                {
                    throw new ParsingException(28, sourceStream, $"'{Info.NameSource.Name}' is repeated.");
                }
            }

            if (SourceProperty == null)
            {
                throw new ParsingException(57, sourceStream, "Source not specified.");
            }
            if (SourceProperty.FixedValueSource == null)
            {
                throw new ParsingException(186, sourceStream, "Source can only be a static name.");
            }

            if (SourcePressedProperty != null && SourcePressedProperty.FixedValueSource == null)
            {
                throw new ParsingException(186, sourceStream, "Source pressed can only be a static name.");
            }

            if (AreaProperty == null)
            {
                throw new ParsingException(58, sourceStream, "Area not specified.");
            }
            if (AreaProperty.FixedValueSource == null)
            {
                throw new ParsingException(59, sourceStream, "Area name can only be a static name.");
            }

            double WidthValue;

            if (WidthProperty != null)
            {
                if (WidthProperty.FixedValueSource == null)
                {
                    throw new ParsingException(54, sourceStream, "Width can only be a static value.");
                }

                string ImageWidth = WidthProperty.FixedValueSource.Name;
                if (!ParserDomain.TryParseDouble(ImageWidth, out WidthValue))
                {
                    throw new ParsingException(128, WidthProperty.FixedValueSource.Source, $"'{ImageWidth}' not parsed as a width.");
                }
            }
            else
            {
                WidthValue = double.NaN;
            }

            double HeightValue;

            if (HeightProperty != null)
            {
                if (HeightProperty.FixedValueSource == null)
                {
                    throw new ParsingException(56, sourceStream, "Height can only be a static value.");
                }

                string ImageHeight = HeightProperty.FixedValueSource.Name;
                if (!ParserDomain.TryParseDouble(ImageHeight, out HeightValue))
                {
                    throw new ParsingException(129, HeightProperty.FixedValueSource.Source, $"'{ImageHeight}' not parsed as a height.");
                }
            }
            else
            {
                HeightValue = double.NaN;
            }

            return(new ComponentPopup(nameSource, ParserDomain.ToXamlName(nameSource.Source, nameSource.Name, "Popup"), SourceProperty, SourcePressedProperty, AreaProperty.FixedValueSource, WidthValue, HeightValue));
        }
Beispiel #27
0
        public void Verify()
        {
            foreach (IPage Page in Pages)
            {
                IFormCollection <IArea> UsedAreas = new FormCollection <IArea>();
                Dictionary <IArea, IDeclarationSource> SpecifiedAreas = new Dictionary <IArea, IDeclarationSource>();
                foreach (KeyValuePair <IArea, ILayout> Entry in Page.AreaLayouts)
                {
                    UsedAreas.Add(Entry.Key);
                }

                ListAreas(Page.Area, Page.AreaSource, UsedAreas, SpecifiedAreas);

                if (UsedAreas.Count > 0)
                {
                    IArea SpecifiedArea = UsedAreas[0];
                    if (Page.AreaLayoutBacktracks.ContainsKey(SpecifiedArea))
                    {
                        throw new ParsingException(9, Page.AreaLayoutBacktracks[SpecifiedArea].Source, $"Layout specified for area '{SpecifiedArea.Name}' but this area isn't used in page '{Page.Name}'.");
                    }
                    else
                    {
                        throw new ParsingException(9, Page.AreaSource.Source, $"Layout specified for area '{SpecifiedArea.Name}' but this area isn't used in page '{Page.Name}'.");
                    }
                }

                foreach (KeyValuePair <IArea, IDeclarationSource> Entry in SpecifiedAreas)
                {
                    IArea SpecifiedArea = Entry.Key;

                    if (!Page.AreaLayouts.ContainsKey(SpecifiedArea))
                    {
                        throw new ParsingException(10, Page.AllAreaLayoutsSource, $"Area '{SpecifiedArea.Name}' has not layout specified.");
                    }

                    if (ComponentProperty.AreaWithCurrentPage.ContainsKey(SpecifiedArea))
                    {
                        IDeclarationSource Declaration = ComponentProperty.AreaWithCurrentPage[SpecifiedArea];

                        string PageKey = ParserDomain.ToKeyName($"page {Page.Name}");
                        if (Translation == null)
                        {
                            throw new ParsingException(11, Declaration.Source, $"Translation key used in area '{SpecifiedArea.Name}' but no translation file provided.");
                        }
                        if (!Translation.KeyList.Contains(PageKey))
                        {
                            throw new ParsingException(12, Declaration.Source, $"Translation key for page '{Page.Name}' used in area '{SpecifiedArea.Name}' not found.");
                        }

                        if (!Translation.UsedKeyList.Contains(PageKey))
                        {
                            Translation.UsedKeyList.Add(PageKey);
                        }
                    }

                    ILayout SpecifiedLayout = Page.AreaLayouts[SpecifiedArea];
                    foreach (IComponent Component in SpecifiedArea.Components)
                    {
                        if (Component is IComponentWithEvent AsComponentWithEvent)
                        {
                            List <IControl> ControlList = new List <IControl>();
                            SpecifiedLayout.Content.ReportControlsUsingComponent(ControlList, AsComponentWithEvent);
                            if (ControlList.Count > 1)
                            {
                                throw new ParsingException(220, Component.Source.Source, $"Component '{Component.Source.Name}' is used more than once in page '{Page.Name}'.");
                            }
                        }
                    }
                }

                List <string> KeyList = new List <string>();
                foreach (KeyValuePair <IArea, ILayout> Entry in Page.AreaLayouts)
                {
                    Entry.Value.ReportResourceKeys(Page.Design, KeyList);
                }

                List <string> DesignKeyList = new List <string>();
                foreach (object Key in Page.Design.Root)
                {
                    if (Key is DictionaryEntry AsEntry)
                    {
                        if (AsEntry.Key is string AsStringKey)
                        {
                            DesignKeyList.Add(AsStringKey);
                        }
                        else if (AsEntry.Key is Type AsTypeKey)
                        {
                            DesignKeyList.Add($"{Page.Design.XamlName}{ParserDomain.StyleTypeConverter(AsTypeKey.Name)}");
                        }
                        else
                        {
                            throw new ParsingException(240, "", $"Unexpected key in design '{Page.Design.Name}'.");
                        }
                    }
                    else
                    {
                        throw new ParsingException(240, "", $"Unexpected key in design '{Page.Design.Name}'.");
                    }
                }

                foreach (string Key in KeyList)
                {
                    if (!DesignKeyList.Contains(Key) && !Key.EndsWith("DesignHtml"))
                    {
                        throw new ParsingException(241, "", $"Resource key '{Key}' not found in design '{Page.Design.Name}'.");
                    }
                }
            }

            VerifyAttachedProperties();
        }
Beispiel #28
0
        private IDynamicProperty Parse(IParsingSourceStream sourceStream, ref string line, ref int indentation, ref bool useTab)
        {
            while (string.IsNullOrEmpty(line) && !sourceStream.EndOfStream)
            {
                sourceStream.ReadLine();
                line = sourceStream.Line;
            }

            IDeclarationSource PropertySource;
            string             ResultValue;

            ParserDomain.ParseStringPair(sourceStream, ':', out PropertySource, out ResultValue);

            if (string.IsNullOrEmpty(PropertySource.Name))
            {
                throw new ParsingException(209, sourceStream, "Missing dynamic property name.");
            }

            string CSharpName = ParserDomain.ToCSharpName(PropertySource.Source, PropertySource.Name);

            DynamicOperationResults Result;

            if (ResultValue == "boolean")
            {
                Result = DynamicOperationResults.Boolean;
            }
            else
            {
                throw new ParsingException(210, sourceStream, $"Invalid dynamic property type '{ResultValue}'.");
            }

            Stack <IDynamicOperation> OperationStack = new Stack <IDynamicOperation>();
            IDynamicOperation         RootOperation  = null;

            for (;;)
            {
                sourceStream.ReadLine();
                line = sourceStream.Line;

                if (string.IsNullOrEmpty(line))
                {
                    break;
                }

                if (indentation < 0)
                {
                    MeasureIndentation(sourceStream, ref indentation, ref useTab);
                }

                int Depth = GetIndentation(sourceStream, indentation, useTab);

                string Text = line.Trim();
                if (Text == "NOT")
                {
                    OperationStack.Push(new UnaryOperation(DynamicOperationTypes.NOT));
                }
                else if (Text == "OR")
                {
                    OperationStack.Push(new BinaryOperation(DynamicOperationTypes.OR));
                }
                else if (Text == "AND")
                {
                    OperationStack.Push(new BinaryOperation(DynamicOperationTypes.AND));
                }
                else if (Text == "EQUALS")
                {
                    OperationStack.Push(new BinaryOperation(DynamicOperationTypes.EQUALS));
                }
                else if (Text == "GREATER THAN")
                {
                    OperationStack.Push(new BinaryOperation(DynamicOperationTypes.GREATER_THAN));
                }
                else if (Text == "IS EMPTY")
                {
                    OperationStack.Push(new UnaryOperation(DynamicOperationTypes.IS_EMPTY));
                }
                else
                {
                    IDynamicOperation Operand;

                    int IntegerConstantValue;
                    if (int.TryParse(Text, out IntegerConstantValue))
                    {
                        Operand = new IntegerConstantOperation(IntegerConstantValue);
                    }
                    else
                    {
                        IDeclarationSource ObjectSource;
                        IDeclarationSource MemberSource;
                        IDeclarationSource KeySource;
                        if (!ParserDomain.TryParseObjectProperty(sourceStream, Text, out ObjectSource, out MemberSource, out KeySource))
                        {
                            throw new ParsingException(211, sourceStream, $"Expected operator, integer constant or object property.");
                        }

                        ComponentInfo Info = new ComponentInfo();
                        Info.ObjectSource = ObjectSource;
                        Info.MemberSource = MemberSource;
                        Info.KeySource    = KeySource;

                        ComponentProperty ValueProperty = new ComponentProperty(Info);

                        Operand = new PropertyValueOperation(ValueProperty);
                    }

                    while (OperationStack.Count > 0)
                    {
                        IDynamicOperation CurrentOperation = OperationStack.Peek();

                        if ((CurrentOperation is IUnaryOperation AsUnary) && (AsUnary.Operand == null))
                        {
                            AsUnary.SetOperand(Operand);

                            RootOperation = OperationStack.Pop();
                            Operand       = RootOperation;
                        }
Beispiel #29
0
        private IComponent ParseComponent(IParsingSourceStream sourceStream)
        {
            IDeclarationSource NameSource;
            string             ComponentInfo;

            ParserDomain.ParseStringPair(sourceStream, ':', out NameSource, out ComponentInfo);

            string[] SplittedInfo = ComponentInfo.Split(',');
            if (SplittedInfo.Length < 1)
            {
                throw new ParsingException(25, sourceStream, "Component type expected.");
            }

            string ComponentTypeName = SplittedInfo[0].Trim();

            if (string.IsNullOrEmpty(ComponentTypeName))
            {
                throw new ParsingException(25, sourceStream, "Component type expected.");
            }

            List <ComponentInfo> InfoList = new List <ComponentInfo>();

            for (int i = 1; i < SplittedInfo.Length; i++)
            {
                InfoList.Add(Parser.ComponentInfo.Parse(sourceStream, SplittedInfo[i]));
            }

            if (ComponentTypeName == "area")
            {
                return(ParseComponentArea(NameSource, sourceStream, InfoList));
            }
            else if (ComponentTypeName == "button")
            {
                return(ParseComponentButton(NameSource, sourceStream, InfoList));
            }
            else if (ComponentTypeName == "checkbox")
            {
                return(ParseComponentCheckBox(NameSource, sourceStream, InfoList));
            }
            else if (ComponentTypeName == "text")
            {
                return(ParseComponentText(NameSource, sourceStream, InfoList));
            }
            else if (ComponentTypeName == "html")
            {
                return(ParseComponentHtml(NameSource, sourceStream, InfoList));
            }
            else if (ComponentTypeName == "image")
            {
                return(ParseComponentImage(NameSource, sourceStream, InfoList));
            }
            else if (ComponentTypeName == "edit")
            {
                return(ParseComponentEdit(NameSource, sourceStream, InfoList));
            }
            else if (ComponentTypeName == "password edit")
            {
                return(ParseComponentPasswordEdit(NameSource, sourceStream, InfoList));
            }
            else if (ComponentTypeName == "popup")
            {
                return(ParseComponentPopup(NameSource, sourceStream, InfoList));
            }
            else if (ComponentTypeName == "selector")
            {
                return(ParseComponentSelector(NameSource, sourceStream, InfoList));
            }
            else if (ComponentTypeName == "index")
            {
                return(ParseComponentIndex(NameSource, sourceStream, InfoList));
            }
            else if (ComponentTypeName == "container")
            {
                return(ParseComponentContainer(NameSource, sourceStream, InfoList));
            }
            else if (ComponentTypeName == "container list")
            {
                return(ParseComponentContainerList(NameSource, sourceStream, InfoList));
            }
            else if (ComponentTypeName == "radio button")
            {
                return(ParseComponentRadioButton(NameSource, sourceStream, InfoList));
            }
            else
            {
                throw new ParsingException(26, sourceStream, $"Unknown component type '{ComponentTypeName}'.");
            }
        }
Beispiel #30
0
        private IComponentRadioButton ParseComponentRadioButton(IDeclarationSource nameSource, IParsingSourceStream sourceStream, List <ComponentInfo> infoList)
        {
            IComponentProperty ContentProperty    = null;
            IComponentProperty IndexProperty      = null;
            IComponentProperty GroupNameProperty  = null;
            IComponentProperty GroupIndexProperty = null;

            foreach (ComponentInfo Info in infoList)
            {
                if (Info.NameSource.Name == "content" && ContentProperty == null)
                {
                    ContentProperty = new ComponentProperty(Info);
                }
                else if (Info.NameSource.Name == "index" && IndexProperty == null)
                {
                    IndexProperty = new ComponentProperty(Info);
                }
                else if (Info.NameSource.Name == "group name" && GroupNameProperty == null)
                {
                    GroupNameProperty = new ComponentProperty(Info);
                }
                else if (Info.NameSource.Name == "group index" && GroupIndexProperty == null)
                {
                    GroupIndexProperty = new ComponentProperty(Info);
                }
                else if (Info.NameSource.Name != "content" && Info.NameSource.Name != "index" && Info.NameSource.Name != "group name" && Info.NameSource.Name != "group index")
                {
                    throw new ParsingException(27, sourceStream, $"Unknown token '{Info.NameSource.Name}'.");
                }
                else
                {
                    throw new ParsingException(28, sourceStream, $"'{Info.NameSource.Name}' is repeated.");
                }
            }

            if (ContentProperty == null)
            {
                throw new ParsingException(72, sourceStream, "Radio button content not specified.");
            }

            if (IndexProperty == null)
            {
                throw new ParsingException(73, sourceStream, "Index not specified.");
            }
            if (IndexProperty.FixedValueSource != null || IndexProperty.ObjectPropertyKey != null)
            {
                throw new ParsingException(74, sourceStream, "Index must be an integer, state or boolean property.");
            }

            if (GroupNameProperty == null)
            {
                throw new ParsingException(75, sourceStream, "Group name not specified.");
            }
            if (GroupNameProperty.FixedValueSource == null)
            {
                throw new ParsingException(76, sourceStream, "Group name can only be a static name.");
            }

            if (GroupIndexProperty == null)
            {
                throw new ParsingException(77, sourceStream, "Group index not specified.");
            }

            int GroupIndex;

            if (GroupIndexProperty.FixedValueSource == null || !int.TryParse(GroupIndexProperty.FixedValueSource.Name, out GroupIndex))
            {
                throw new ParsingException(78, sourceStream, "Group index must be an integer constant.");
            }

            return(new ComponentRadioButton(nameSource, ParserDomain.ToXamlName(nameSource.Source, nameSource.Name, "RadioButton"), ContentProperty, IndexProperty, GroupNameProperty.FixedValueSource.Name, GroupIndex));
        }