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(); } }
public bool GetComposedValue(IGeneratorObject obj, IGeneratorObjectProperty objectProperty, out string ComposedValue) { string NestedComposedValue1; bool IsUsed1 = Operand1.GetComposedValue(obj, objectProperty, out NestedComposedValue1); string NestedComposedValue2; bool IsUsed2 = Operand2.GetComposedValue(obj, objectProperty, out NestedComposedValue2); switch (Type) { case DynamicOperationTypes.OR: ComposedValue = $"({NestedComposedValue1}) || ({NestedComposedValue2})"; break; case DynamicOperationTypes.AND: ComposedValue = $"({NestedComposedValue1}) && ({NestedComposedValue2})"; break; case DynamicOperationTypes.EQUALS: ComposedValue = $"({NestedComposedValue1}) == ({NestedComposedValue2})"; break; case DynamicOperationTypes.GREATER_THAN: ComposedValue = $"({NestedComposedValue1}) > ({NestedComposedValue2})"; break; default: throw new InvalidOperationException(); } return(IsUsed1 || IsUsed2); }
public GeneratorObjectProperty(IObjectProperty property, IGeneratorObject obj) { NameSource = property.NameSource; CSharpName = property.CSharpName; IsRead = property.IsRead; IsWrite = property.IsWrite; Object = obj; }
public GeneratorObjectPropertyInteger(IObjectPropertyInteger property, IGeneratorObject obj) : base(property, obj) { if (property == ObjectPropertyInteger.NavigationIndexProperty) { GeneratorObjectPropertyMap.Add(property, this); } }
public void GenerateNotification(IGeneratorObject obj, IGeneratorObjectProperty objectProperty, StreamWriter cSharpWriter) { string ComposedValue; if (RootOperation.GetComposedValue(obj, objectProperty, out ComposedValue)) { cSharpWriter.WriteLine($" NotifyPropertyChanged(nameof({CSharpName}));"); } }
public bool GetComposedValue(IGeneratorObject obj, IGeneratorObjectProperty objectProperty, out string ComposedValue) { bool IsUsed = (obj == ValueObject) && (objectProperty == ValueObjectProperty); string Cast = (ValueObjectProperty is IGeneratorObjectPropertyEnum) ? "(int)" : ""; ComposedValue = $"{Cast}Page.Get{ValueObject.CSharpName}.{ValueObjectProperty.CSharpName}"; return(IsUsed); }
private static void InitObj(IGeneratorObject t) { t.OnInit(); IDelayInit delayInit = t as IDelayInit; if (delayInit != null) { GeneratorConfig.AddDelayAction(delayInit.OnDelayInit); } }
public GeneratorObjectPropertyItemList(IObjectPropertyItemList property, IGeneratorObject obj) : base(property, obj) { BaseProperty = property; if (property == ObjectPropertyItemList.NavigationHistoryProperty) { GeneratorObjectPropertyMap.Add(property, this); } }
public override bool Connect(IGeneratorDomain domain) { bool IsConnected = false; if (NestedObject == null) { IsConnected = true; NestedObject = GeneratorObject.GeneratorObjectMap[BaseProperty.NestedObject]; } return(IsConnected); }
public bool Generate(IGeneratorObject obj, IGeneratorObjectProperty objectProperty, StreamWriter cSharpWriter) { string ComposedValue; if (RootOperation.GetComposedValue(obj, objectProperty, out ComposedValue)) { cSharpWriter.WriteLine($" public bool {CSharpName} {{ get {{ return {ComposedValue}; }} }}"); return(true); } else { return(false); } }
public static IGeneratorObjectProperty Convert(IObjectProperty property, IGeneratorObject obj) { IGeneratorObjectProperty Result; if (property is IObjectPropertyInteger AsObjectPropertyInteger) { Result = new GeneratorObjectPropertyInteger(AsObjectPropertyInteger, obj); } else if (property is IObjectPropertyBoolean AsObjectPropertyBoolean) { Result = new GeneratorObjectPropertyBoolean(AsObjectPropertyBoolean, obj); } else if (property is IObjectPropertyString AsObjectPropertyString) { Result = new GeneratorObjectPropertyString(AsObjectPropertyString, obj); } else if (property is IObjectPropertyReadonlyString AsObjectPropertyReadonlyString) { Result = new GeneratorObjectPropertyReadonlyString(AsObjectPropertyReadonlyString, obj); } else if (property is IObjectPropertyStringDictionary AsObjectPropertyStringDictionary) { Result = new GeneratorObjectPropertyStringDictionary(AsObjectPropertyStringDictionary, obj); } else if (property is IObjectPropertyStringList AsObjectPropertyStringList) { Result = new GeneratorObjectPropertyStringList(AsObjectPropertyStringList, obj); } else if (property is IObjectPropertyEnum AsObjectPropertyEnum) { Result = new GeneratorObjectPropertyEnum(AsObjectPropertyEnum, obj); } else if (property is IObjectPropertyItem AsObjectPropertyItem) { Result = new GeneratorObjectPropertyItem(AsObjectPropertyItem, obj); } else if (property is IObjectPropertyItemList AsObjectPropertyItemList) { Result = new GeneratorObjectPropertyItemList(AsObjectPropertyItemList, obj); } else { throw new InvalidOperationException(); } GeneratorObjectPropertyMap.Add(property, Result); return(Result); }
public void CollectGoTo(List <Tuple <IGeneratorPageNavigation, IGeneratorObject, IGeneratorObjectPropertyBoolean> > goToList, IGeneratorPage currentPage) { if (this == EmptyArea) { return; } foreach (IGeneratorComponent Component in Components) { if (Component is IGeneratorComponentButton AsButton) { bool IsIncluded = false; foreach (Tuple <IGeneratorPageNavigation, IGeneratorObject, IGeneratorObjectPropertyBoolean> Item in goToList) { if (Item.Item1.IsEqual(AsButton.GoTo, currentPage)) { IsIncluded = true; break; } } if (!IsIncluded) { IGeneratorPageNavigation Copy = AsButton.GoTo.CreateCopyForPage(currentPage, AsButton); IGeneratorObject ClosePopupObject = AsButton.ClosePopupObject; IGeneratorObjectPropertyBoolean ClosePopupObjectProperty = AsButton.ClosePopupObjectProperty; goToList.Add(new Tuple <IGeneratorPageNavigation, IGeneratorObject, IGeneratorObjectPropertyBoolean>(Copy, ClosePopupObject, ClosePopupObjectProperty)); } } else if (Component is IGeneratorComponentPopup AsPopup) { AsPopup.Area.CollectGoTo(goToList, currentPage); } else if (Component is IGeneratorComponentArea AsArea) { AsArea.Area.CollectGoTo(goToList, currentPage); } else if (Component is IGeneratorComponentContainer AsContainer) { AsContainer.ItemNestedArea.CollectGoTo(goToList, currentPage); } else if (Component is IGeneratorComponentContainerList AsContainerList) { AsContainerList.ItemNestedArea.CollectGoTo(goToList, currentPage); } } }
public bool Connect(IGeneratorDomain domain) { bool IsConnected = false; foreach (IGeneratorComponent Component in Components) { IsConnected |= Component.Connect(domain); } if (CurrentObject == null && BaseArea.CurrentObject != null) { IsConnected = true; CurrentObject = GeneratorObject.GeneratorObjectMap[BaseArea.CurrentObject]; } return(IsConnected); }
protected string GetElementProperties(IGeneratorPage currentPage, IGeneratorObject currentObject) { string Result = ""; if (!string.IsNullOrEmpty(Margin)) { Result += $" Margin=\"{Margin}\""; } if (!string.IsNullOrEmpty(HorizontalAlignment)) { Result += $" HorizontalAlignment=\"{HorizontalAlignment}\""; } if (!string.IsNullOrEmpty(VerticalAlignment)) { Result += $" VerticalAlignment=\"{VerticalAlignment}\""; } if (!string.IsNullOrEmpty(Width)) { Result += $" Width=\"{Width}\""; } if (!string.IsNullOrEmpty(Height)) { Result += $" Height=\"{Height}\""; } if (DynamicController != null) { switch (DynamicController.Result) { case DynamicOperationResults.Boolean: Result += $" IsEnabled=\"{{Binding Dynamic.{DynamicController.CSharpName}}}\" IsEnabledChanged=\"OnIsEnabledChanged\""; break; default: throw new InvalidOperationException(); } } return(Result); }
public bool GetComposedValue(IGeneratorObject obj, IGeneratorObjectProperty objectProperty, out string ComposedValue) { string NestedComposedValue; bool IsUsed = Operand.GetComposedValue(obj, objectProperty, out NestedComposedValue); switch (Type) { case DynamicOperationTypes.NOT: ComposedValue = $"!({NestedComposedValue})"; break; case DynamicOperationTypes.IS_EMPTY: if ((Operand is IGeneratorPropertyValueOperation AsValue) && AsValue.ValueObjectProperty is IGeneratorObjectPropertyItemList) { ComposedValue = $"{NestedComposedValue}.Count == 0"; } else { ComposedValue = $"string.IsNullOrEmpty({NestedComposedValue})"; } break;
protected string GetPanelProperties(IGeneratorPage currentPage, IGeneratorObject currentObject) { string Result = ""; if (!string.IsNullOrEmpty(MaxWidth)) { Result += $" MaxWidth=\"{MaxWidth}\""; } if (!string.IsNullOrEmpty(MaxHeight)) { Result += $" MaxHeight=\"{MaxHeight}\""; } if (!string.IsNullOrEmpty(Background)) { Result += $" Background=\"{Background}\""; } return(Result); }
public string GetObjectBinding(IGeneratorObject currentObject, IGeneratorObject objectValue, IGeneratorObjectProperty objectPropertyValue) { if (objectValue == GeneratorObject.TranslationObject && objectPropertyValue == GeneratorObjectPropertyStringDictionary.StringsProperty) { return("GetTranslation.Strings"); } else if (objectValue == GeneratorObject.ApplicationObject && objectPropertyValue == GeneratorObjectPropertyItemList.NavigationHistoryProperty) { return("App.NavigationHistory"); } else if (objectValue == GeneratorObject.ApplicationObject && objectPropertyValue == GeneratorObjectPropertyInteger.NavigationIndexProperty) { return("App.NavigationIndex"); } else if (objectValue == currentObject) { return(objectPropertyValue.CSharpName); } else { return($"Get{objectValue.CSharpName}.{objectPropertyValue.CSharpName}"); } }
public override void Generate(IGeneratorDesign design, string styleName, string attachedProperties, string elementProperties, TextWrapping?textWrapping, bool isHorizontalAlignmentStretch, int indentation, IGeneratorPage currentPage, IGeneratorObject currentObject, IGeneratorColorTheme colorTheme, StreamWriter xamlWriter, string visibilityBinding) { string Indentation = GeneratorLayout.IndentationString(indentation); string MaximumLengthProperty = ((TextObjectProperty != null && TextObjectProperty.MaximumLength > 0) ? $" MaxLength=\"{TextObjectProperty.MaximumLength}\"" : ""); string AcceptsReturnProperty = (AcceptsReturn ? " AcceptsReturn=\"True\"" : ""); string AlignmentProperty = (isHorizontalAlignmentStretch ? $" TextAlignment=\"Justify\"" : ""); string WrappingProperty = ((textWrapping.HasValue && textWrapping.Value == TextWrapping.Wrap) ? " TextWrapping=\"Wrap\"" : " TextWrapping=\"NoWrap\""); string DecorationProperty = (TextDecoration != null ? $" TextDecorations=\"{TextDecoration}\"" : ""); string HorizontalScrollBarProperty = (HorizontalScrollBarVisibility != null ? $" HorizontalScrollBarVisibility=\"{HorizontalScrollBarVisibility}\"" : ""); string VerticalScrollBarProperty = (VerticalScrollBarVisibility != null ? $" VerticalScrollBarVisibility=\"{VerticalScrollBarVisibility}\"" : ""); string Properties = $" Style=\"{{StaticResource {GetStyleResourceKey(design, styleName)}}}\"{MaximumLengthProperty}{AcceptsReturnProperty}{AlignmentProperty}{WrappingProperty}{DecorationProperty}{HorizontalScrollBarProperty}{VerticalScrollBarProperty}"; string Value = GetComponentValue(currentPage, currentObject, null, TextObject, TextObjectProperty, null, true); string ValueChangedEvent = currentPage.Dynamic.HasProperties ? $" TextChanged=\"{TextChangedEventName}\"" : ""; colorTheme.WriteXamlLine(xamlWriter, $"{Indentation}<TextBox x:Name=\"{ControlName}\"{attachedProperties}{visibilityBinding} Text=\"{Value}\"{ValueChangedEvent}{Properties}{elementProperties}/>"); }
public override void Generate(Dictionary <IGeneratorArea, IGeneratorLayout> areaLayouts, IList <IGeneratorPage> pageList, IGeneratorDesign design, int indentation, IGeneratorPage currentPage, IGeneratorObject currentObject, IGeneratorColorTheme colorTheme, StreamWriter xamlWriter, string visibilityBinding) { string Indentation = GeneratorLayout.IndentationString(indentation); string AttachedProperties = GetAttachedProperties(); string ElementProperties = GetElementProperties(currentPage, currentObject); string DockPanelProperties = GetPanelProperties(currentPage, currentObject); string AllProperties = $"{AttachedProperties}{visibilityBinding}{DockPanelProperties}{ElementProperties}"; colorTheme.WriteXamlLine(xamlWriter, $"{Indentation}<DockPanel{AllProperties}>"); foreach (IGeneratorLayoutElement element in Items) { element.Generate(areaLayouts, pageList, design, indentation + 1, currentPage, currentObject, colorTheme, xamlWriter, ""); } colorTheme.WriteXamlLine(xamlWriter, $"{Indentation}</DockPanel>"); }
public override void Generate(IGeneratorDesign design, string styleName, string attachedProperties, string elementProperties, TextWrapping?textWrapping, bool isHorizontalAlignmentStretch, int indentation, IGeneratorPage currentPage, IGeneratorObject currentObject, IGeneratorColorTheme colorTheme, StreamWriter xamlWriter, string visibilityBinding) { string Indentation = GeneratorLayout.IndentationString(indentation); string Properties = $" Style=\"{{StaticResource {GetStyleResourceKey(design, styleName)}}}\""; string ClickEventHandler = $" Click=\"{ClickEventName(currentPage)}\""; string Value = GetComponentValue(currentPage, currentObject, ContentResource, ContentObject, ContentObjectProperty, ContentKey, false); if (ContentResource != null) { string ImageValue = $"<Image Source=\"{Value}\"/>"; colorTheme.WriteXamlLine(xamlWriter, $"{Indentation}<Button x:Name=\"{ControlName}\"{attachedProperties}{visibilityBinding}{Properties}{elementProperties}{ClickEventHandler}>"); colorTheme.WriteXamlLine(xamlWriter, $"{Indentation} {ImageValue}"); colorTheme.WriteXamlLine(xamlWriter, $"{Indentation}</Button>"); } else { colorTheme.WriteXamlLine(xamlWriter, $"{Indentation}<Button x:Name=\"{ControlName}\"{attachedProperties}{visibilityBinding}{Properties}{elementProperties}{ClickEventHandler} Content=\"{Value}\"/>"); } }
public GeneratorObjectPropertyStringList(IObjectPropertyStringList property, IGeneratorObject obj) : base(property, obj) { }
public override void Generate(Dictionary <IGeneratorArea, IGeneratorLayout> areaLayouts, IList <IGeneratorPage> pageList, IGeneratorDesign design, int indentation, IGeneratorPage currentPage, IGeneratorObject currentObject, IGeneratorColorTheme colorTheme, StreamWriter xamlWriter, string visibilityBinding) { bool IsHorizontalAlignmentStretch = (HorizontalAlignment == Windows.UI.Xaml.HorizontalAlignment.Stretch.ToString()); string AttachedProperties = GetAttachedProperties(); string ElementProperties = GetElementProperties(currentPage, currentObject); Component.Generate(design, Style, AttachedProperties, ElementProperties, TextWrapping, IsHorizontalAlignmentStretch, indentation, currentPage, currentObject, colorTheme, xamlWriter, visibilityBinding); }
public GeneratorObjectPropertyEnum(IObjectPropertyEnum property, IGeneratorObject obj) : base(property, obj) { }
public void Generate(IGeneratorArea area, Dictionary <IGeneratorArea, IGeneratorLayout> areaLayouts, IList <IGeneratorPage> pageList, IGeneratorDesign design, int indentation, IGeneratorPage currentPage, IGeneratorObject currentObject, IGeneratorColorTheme colorTheme, StreamWriter xamlWriter) { Content.Generate(areaLayouts, pageList, design, indentation, currentPage, currentObject, colorTheme, xamlWriter, ""); }
public abstract void Generate(IGeneratorDesign design, string styleName, string attachedProperties, string elementProperties, TextWrapping?textWrapping, bool isHorizontalAlignmentStretch, int indentation, IGeneratorPage currentPage, IGeneratorObject currentObject, IGeneratorColorTheme colorTheme, StreamWriter xamlWriter, string visibilityBinding);
public GeneratorObjectPropertyString(IObjectPropertyString property, IGeneratorObject obj) : base(property, obj) { MaximumLength = property.MaximumLength; }
public override void Generate(Dictionary <IGeneratorArea, IGeneratorLayout> areaLayouts, IList <IGeneratorPage> pageList, IGeneratorDesign design, int indentation, IGeneratorPage currentPage, IGeneratorObject currentObject, IGeneratorColorTheme colorTheme, StreamWriter xamlWriter, string visibilityBinding) { string Indentation = GeneratorLayout.IndentationString(indentation); string AttachedProperties = GetAttachedProperties(); string ElementProperties = GetElementProperties(currentPage, currentObject); string BorderProperties = GetPanelProperties(currentPage, currentObject); if (!string.IsNullOrEmpty(CornerRadius)) { BorderProperties += $" CornerRadius=\"{CornerRadius}\""; } if (!string.IsNullOrEmpty(BorderBrush)) { BorderProperties += $" BorderBrush=\"{BorderBrush}\""; } if (!string.IsNullOrEmpty(BorderThickness)) { BorderProperties += $" BorderThickness=\"{BorderThickness}\""; } colorTheme.WriteXamlLine(xamlWriter, $"{Indentation}<Border{AttachedProperties}{visibilityBinding}{BorderProperties}{ElementProperties}>"); foreach (IGeneratorLayoutElement element in Items) { element.Generate(areaLayouts, pageList, design, indentation + 1, currentPage, currentObject, colorTheme, xamlWriter, ""); } colorTheme.WriteXamlLine(xamlWriter, $"{Indentation}</Border>"); }
public GeneratorObjectPropertyIndex(IObjectPropertyIndex property, IGeneratorObject obj) : base(property, obj) { }
public static string GetLoadedHandlerName(IGeneratorObject boundObject, IGeneratorObjectProperty boundObjectProperty) { return($"OnLoaded_{boundObject.CSharpName}_{boundObjectProperty.CSharpName}"); }
public override void Generate(IGeneratorDesign design, string styleName, string attachedProperties, string elementProperties, TextWrapping?textWrapping, bool isHorizontalAlignmentStretch, int indentation, IGeneratorPage currentPage, IGeneratorObject currentObject, IGeneratorColorTheme colorTheme, StreamWriter xamlWriter, string visibilityBinding) { string Indentation = GeneratorLayout.IndentationString(indentation); string Properties = ""; string Value = GetComponentValue(currentPage, currentObject, HtmlResource, HtmlObject, HtmlObjectProperty, HtmlKey, false); colorTheme.WriteXamlLine(xamlWriter, $"{Indentation}<n:HtmlPresenter{attachedProperties}{visibilityBinding} Content=\"{Value}\"{Properties}{elementProperties}/>"); }