NodeViewModel AddNode(double offx, double offy, StyleId styleid) { NodeViewModel node = new NodeViewModel() { OffsetX = offx, OffsetY = offy, UnitWidth = 75, UnitHeight = 75, Shape = App.Current.Resources["Rectangle"], ShapeStyle = App.Current.Resources["shapeStyle"] as Style, ThemeStyleId = styleid, }; node.Annotations = new ObservableCollection <IAnnotation>() { new TextAnnotationViewModel() { //Content = new TextSettings() //{ // Text = styleid.ToString() //}, // ViewTemplate = this.Resources["viewTemplate"] as DataTemplate Text = styleid.ToString(), TextWrapping = TextWrapping.Wrap, } }; (sfdiagram.Nodes as ObservableCollection <NodeViewModel>).Add(node); return(node); }
ConnectorViewModel AddConnector(Point sp, Point ep, StyleId styleid) { ConnectorViewModel connector = new ConnectorViewModel() { SourcePoint = sp, TargetPoint = ep, ThemeStyleId = styleid, ConnectorGeometryStyle = App.Current.Resources["geometryStyle"] as Style }; connector.Annotations = new ObservableCollection <IAnnotation>() { new TextAnnotationViewModel() { Text = styleid.ToString() //Content = new TextSettings() //{ // Text = styleid.ToString() //}, // ViewTemplate = this.Resources["viewTemplate"] as DataTemplate } }; (sfdiagram.Connectors as ObservableCollection <ConnectorViewModel>).Add(connector); return(connector); }
public StyleSimple GetStyleFromStyleId(StyleId key) { if (!Styles.ContainsKey(key)) { return(StyleSimple.None); } return(Styles[key]); }
private static bool GetBytes(StyleId styleId, SpreadsheetBuffer buffer) { var bytes = buffer.GetSpan(); var bytesWritten = SpanHelper.GetBytes(StyledCellHelper.BeginStyledNumberCell, bytes); bytesWritten += Utf8Helper.GetBytes(styleId.Id, bytes.Slice(bytesWritten)); bytesWritten += SpanHelper.GetBytes(StyledCellHelper.EndStyleNullValue, bytes.Slice(bytesWritten)); buffer.Advance(bytesWritten); return(true); }
private bool GetBytes(StyleId styleId, SpreadsheetBuffer buffer) { var bytes = buffer.GetSpan(); var bytesWritten = SpanHelper.GetBytes(StyledCellHelper.BeginStyledBooleanCell, bytes); bytesWritten += Utf8Helper.GetBytes(styleId.Id, bytes.Slice(bytesWritten)); bytesWritten += SpanHelper.GetBytes(EndStyleValueBytes(), bytes.Slice(bytesWritten)); buffer.Advance(bytesWritten); return(true); }
/// <summary> /// Get template of each attribute type /// it is used in TextRangeFindDialog. /// </summary> /// <returns></returns> public static IList <TemplateData> GetTemplate() { var boolList = new List <KeyValuePair <bool, string> >() { new KeyValuePair <bool, string>(false, "False"), new KeyValuePair <bool, string>(true, "True") }; return(new List <TemplateData> { CreateTemplateData <int>(UIA_AnimationStyleAttributeId, AnimationStyle.GetInstance()), CreateTemplateData <int>(UIA_BackgroundColorAttributeId), CreateTemplateData <int>(UIA_BulletStyleAttributeId, BulletStyle.GetInstance()), CreateTemplateData <int>(UIA_CapStyleAttributeId, CapStyle.GetInstance()), CreateTemplateData <int>(UIA_CultureAttributeId, CultureInfo.GetCultures(CultureTypes.InstalledWin32Cultures).Select(c => new KeyValuePair <int, string>(c.LCID, c.EnglishName)).ToList()), CreateTemplateData <string>(UIA_FontNameAttributeId), CreateTemplateData <double>(UIA_FontSizeAttributeId), CreateTemplateData <int>(UIA_FontWeightAttributeId, FontWeight.GetInstance()), CreateTemplateData <int>(UIA_ForegroundColorAttributeId), CreateTemplateData <int>(UIA_HorizontalTextAlignmentAttributeId, HorizontalTextAlignment.GetInstance()), CreateTemplateData <int>(UIA_IndentationFirstLineAttributeId), CreateTemplateData <int>(UIA_IndentationLeadingAttributeId), CreateTemplateData <int>(UIA_IndentationTrailingAttributeId), CreateTemplateData <bool>(UIA_IsHiddenAttributeId, boolList), CreateTemplateData <bool>(UIA_IsItalicAttributeId, boolList), CreateTemplateData <bool>(UIA_IsReadOnlyAttributeId, boolList), CreateTemplateData <bool>(UIA_IsSubscriptAttributeId, boolList), CreateTemplateData <bool>(UIA_IsSuperscriptAttributeId, boolList), CreateTemplateData <int>(UIA_MarginBottomAttributeId), CreateTemplateData <int>(UIA_MarginLeadingAttributeId), CreateTemplateData <int>(UIA_MarginTopAttributeId), CreateTemplateData <int>(UIA_MarginTrailingAttributeId), CreateTemplateData <int>(UIA_OutlineStylesAttributeId, OutlineStyle.GetInstance()), CreateTemplateData <int>(UIA_OverlineColorAttributeId), CreateTemplateData <int>(UIA_OverlineStyleAttributeId, TextDecorationLineStyle.GetInstance()), CreateTemplateData <int>(UIA_StrikethroughColorAttributeId), CreateTemplateData <int>(UIA_StrikethroughStyleAttributeId, TextDecorationLineStyle.GetInstance()), CreateTemplateData <int>(UIA_TabsAttributeId), CreateTemplateData <int>(UIA_TextFlowDirectionsAttributeId, FlowDirection.GetInstance()), CreateTemplateData <int>(UIA_UnderlineColorAttributeId), CreateTemplateData <int>(UIA_UnderlineStyleAttributeId, TextDecorationLineStyle.GetInstance()), CreateTemplateData <int>(UIA_AnnotationTypesAttributeId, AnnotationType.GetInstance()), //CreateTemplateData<int>(UIA_AnnotationObjectsAttributeId, AnimationStyles.GetInstance()), CreateTemplateData <string>(UIA_StyleNameAttributeId), CreateTemplateData <int>(UIA_StyleIdAttributeId, StyleId.GetInstance()), //CreateTemplateData<int>(UIA_LinkAttributeId, AnimationStyles.GetInstance()), CreateTemplateData <bool>(UIA_IsActiveAttributeId, boolList), CreateTemplateData <int>(UIA_SelectionActiveEndAttributeId, ActiveEnd.GetInstance()), CreateTemplateData <int>(UIA_CaretPositionAttributeId, CaretPosition.GetInstance()), CreateTemplateData <int>(UIA_CaretBidiModeAttributeId, CaretBidiMode.GetInstance()), CreateTemplateData <string>(UIA_LineSpacingAttributeId), CreateTemplateData <double>(UIA_BeforeParagraphSpacingAttributeId), CreateTemplateData <double>(UIA_AfterParagraphSpacingAttributeId), CreateTemplateData <int>(UIA_SayAsInterpretAsAttributeId, SayAsInterpretAs.GetInstance()), }); }
internal object EvaluateStyle(Microsoft.ReportingServices.ReportProcessing.ObjectType objectType, string objectName, string styleAttributeName, OnDemandProcessingContext context) { AttributeInfo styleAttribute = null; if (GetAttributeInfo(styleAttributeName, out styleAttribute)) { StyleId styleId = GetStyleId(styleAttributeName); return(EvaluateStyle(objectType, objectName, styleAttribute, styleId, context)); } return(null); }
public object EvaluateStyle(AspNetCore.ReportingServices.ReportProcessing.ObjectType objectType, string objectName, string styleAttributeName, OnDemandProcessingContext context) { AttributeInfo attribute = null; if (this.GetAttributeInfo(styleAttributeName, out attribute)) { StyleId styleId = Style.GetStyleId(styleAttributeName); return(this.EvaluateStyle(objectType, objectName, attribute, styleId, context)); } return(null); }
private void connectorEffectStylesGallery_SelectedItemChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { SelectorViewModel selector = sfdiagram.SelectedItems as SelectorViewModel; if (e.NewValue is HomeRibbonGalleryItem) { StyleId styleId = (e.NewValue as HomeRibbonGalleryItem).ThemeStyleId; foreach (IConnector selectedConnector in selector.Connectors as ObservableCollection <object> ) { selectedConnector.ThemeStyleId = styleId; } } }
/// <summary> /// Applying level based style from diagram to style diagram. /// </summary> internal void ApplyLevelStyle() { SelectedLevel = 0; StyleDiagram.Theme = DiagramBuilderVM.SelectedDiagram.Theme; var nodes = (DiagramBuilderVM.SelectedDiagram.Nodes as NodeVMCollection).GroupBy(x => x.Level).Select(x => x.FirstOrDefault()); SelectedDiagramLevelStyles = new Dictionary <int, StyleId>(); SelectedDiagramLevelShapes = new Dictionary <int, string>(); foreach (BrainstormingNodeVM node in nodes) { SelectedDiagramLevelStyles.Add(node.Level, node.ThemeStyleId); SelectedDiagramLevelShapes.Add(node.Level, node.ShapeName.ToString()); } foreach (BrainstormingNodeVM node in StyleDiagram.Nodes as NodeVMCollection) { if (SelectedDiagramLevelStyles.Count - 1 >= node.Level) { node.ThemeStyleId = SelectedDiagramLevelStyles[node.Level]; } if (SelectedDiagramLevelShapes.Count - 1 >= node.Level) { node.ShapeName = SelectedDiagramLevelShapes[node.Level]; } } SelectedShape = SelectedDiagramLevelShapes[SelectedLevel]; StyleId selectedLevelStyleID = (nodes.ToList()[SelectedLevel] as BrainstormingNodeVM).ThemeStyleId; foreach (ThemeStyleButtonVM themeStyleButtonVM in ThemeStylesCollection) { if (themeStyleButtonVM.ThemeStyleId == selectedLevelStyleID) { SelectedStyle = themeStyleButtonVM; break; } } if (DiagramBuilderVM.SelectedDiagram.DefaultConnectorType == ConnectorType.CubicBezier) { StyleDiagram.DefaultConnectorType = ConnectorType.CubicBezier; //SelectedConnectorStyle = "Curved"; IsStraightConnectorType = false; } else { StyleDiagram.DefaultConnectorType = ConnectorType.Orthogonal; //SelectedConnectorStyle = "Straight"; IsStraightConnectorType = true; } }
/// <summary> /// Create and add the connector to the connector collection. /// </summary> /// <param name="spoint">Sourcepoint of the connector</param> /// <param name="tpoint">Targetpoint of the connector</param> /// <param name="styleid">ThemestyleId</param> /// <returns></returns> ConnectorViewModel AddConnector(Point spoint, Point tpoint, StyleId styleid) { ConnectorViewModel connector = new ConnectorViewModel() { SourcePoint = spoint, TargetPoint = tpoint, ThemeStyleId = styleid, ConnectorGeometryStyle = View.Resources["geometryStyle"] as Style }; connector.Annotations = new ObservableCollection <IAnnotation>() { new TextAnnotationViewModel() { Text = styleid.ToString() } }; (this.Connectors as ObservableCollection <ConnectorViewModel>).Add(connector); return(connector); }
private void LevelBasedStyleChanged() { StyleId styleId = (SelectedStyle as ThemeStyleButtonVM).ThemeStyleId; if (SelectedDiagramLevelStyles.ContainsKey(SelectedLevel)) { SelectedDiagramLevelStyles[SelectedLevel] = styleId; } else { SelectedDiagramLevelStyles.Add(SelectedLevel, styleId); } foreach (BrainstormingNodeVM node in StyleDiagram.Nodes as NodeVMCollection) { if (node.Level == SelectedLevel) { node.ThemeStyleId = styleId; } } }
private void LevelBasedStyleChanged() { StyleId styleId = (SelectedStyle as ThemeStyleButtonVM).ThemeStyleId; if (SelectedDiagramLevelStyles.ContainsKey(SelectedLevel)) { SelectedDiagramLevelStyles[SelectedLevel] = styleId; } else { SelectedDiagramLevelStyles.Add(SelectedLevel, styleId); } foreach (NodeViewModel node in StyleDiagram.Nodes as NodeCollection) { if (((node is Root) ? (node as Root).Level : (node as RootChild).Level) == SelectedLevel) { node.ThemeStyleId = styleId; } } }
private void SelectedLevelChanged() { var nodes = (DiagramBuilderVM.SelectedDiagram.Nodes as NodeVMCollection).GroupBy(x => x.Level).Select(x => x.FirstOrDefault()); if (SelectedDiagramLevelShapes.Count - 1 >= SelectedLevel) { SelectedShape = SelectedDiagramLevelShapes[SelectedLevel]; } if (SelectedDiagramLevelStyles.Count - 1 >= SelectedLevel) { StyleId selectedStyleID = (nodes.ToList()[SelectedLevel] as BrainstormingNodeVM).ThemeStyleId; foreach (ThemeStyleButtonVM themeStyleButtonVM in ThemeStylesCollection) { if (themeStyleButtonVM.ThemeStyleId == selectedStyleID) { SelectedStyle = themeStyleButtonVM; break; } } } }
private void SelectedLevelChanged() { var nodes = (MindMapViewModel.Nodes as NodeCollection).GroupBy(x => (x is Root) ? (x as Root).Level : (x as RootChild).Level).Select(x => x.FirstOrDefault()); if (SelectedDiagramLevelShapes.ContainsKey(SelectedLevel)) { SelectedShape = SelectedDiagramLevelShapes[SelectedLevel]; } if (SelectedDiagramLevelStyles.ContainsKey(SelectedLevel)) { StyleId selectedStyleID = (nodes.ToList()[SelectedLevel] as NodeViewModel).ThemeStyleId; foreach (ThemeStyleButtonVM themeStyleButtonVM in ThemeStylesCollection) { if (themeStyleButtonVM.ThemeStyleId == selectedStyleID) { SelectedStyle = themeStyleButtonVM; break; } } } }
private void shapeEffectStylesGallery_SelectedItemChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { SelectorViewModel selector = sfdiagram.SelectedItems as SelectorViewModel; if (e.NewValue is HomeRibbonGalleryItem) { StyleId styleId = (e.NewValue as HomeRibbonGalleryItem).ThemeStyleId; foreach (INode selectedNode in selector.Nodes as ObservableCollection <object> ) { bool removeThemeStyle = false; if (!selectedNode.Constraints.Contains(NodeConstraints.ThemeStyle)) { removeThemeStyle = true; selectedNode.Constraints |= NodeConstraints.ThemeStyle; } selectedNode.ThemeStyleId = styleId; if (removeThemeStyle) { selectedNode.Constraints &= ~NodeConstraints.ThemeStyle; } } } }
/// <summary> /// Create and add the Node to the Nodes collection. /// </summary> /// <param name="offsetx">specifies the offsetx of the Node</param> /// <param name="offsety">specifies the offsety of the Node</param> /// <param name="styleid">ThemestyleId</param> /// <returns></returns> NodeViewModel AddNode(double offsetx, double offsety, StyleId styleid) { NodeViewModel node = new NodeViewModel() { OffsetX = offsetx, OffsetY = offsety, UnitWidth = 75, UnitHeight = 75, Shape = resourceDictionary["Rectangle"], ShapeStyle = View.Resources["shapeStyle"] as Style, ThemeStyleId = styleid, }; node.Annotations = new ObservableCollection <IAnnotation>() { new TextAnnotationViewModel() { Text = styleid.ToString(), TextWrapping = TextWrapping.Wrap, } }; (this.Nodes as ObservableCollection <NodeViewModel>).Add(node); return(node); }
public string Get(string propertyName) { switch (propertyName) { //ELEMENT case nameof(ClassId): return(ClassId.ToString()); case nameof(AutomationId): return(AutomationId.ToString()); case nameof(Id): return(Id.ToString()); case nameof(StyleId): return(StyleId.ToString()); //VISUAL ELEMENT case nameof(AnchorX): return(AnchorX.ToString()); case nameof(AnchorY): return(AnchorY.ToString()); case nameof(BackgroundColor): return(BackgroundColor.ToHex()); case nameof(Width): return(this.Width.ToString()); case nameof(Height): return(this.Height.ToString()); case nameof(IsEnabled): return(IsEnabled.ToString()); case nameof(WidthRequest): return(this.WidthRequest.ToString()); case nameof(HeightRequest): return(this.HeightRequest.ToString()); case nameof(IsFocused): return(IsFocused.ToString()); case nameof(IsVisible): return(IsVisible.ToString()); case nameof(InputTransparent): return(InputTransparent.ToString()); case nameof(X): return(this.X.ToString()); case nameof(Y): return(this.Y.ToString()); case nameof(Opacity): return(this.Opacity.ToString()); case nameof(TranslationX): return(this.TranslationX.ToString()); case nameof(TranslationY): return(this.TranslationY.ToString()); case nameof(Rotation): return(this.Rotation.ToString()); case nameof(RotationX): return(this.RotationX.ToString()); case nameof(RotationY): return(this.RotationY.ToString()); case nameof(Scale): return(this.Scale.ToString()); //VIEW case nameof(Margin): return(this.Margin.ToString()); case nameof(VerticalOptions): return(this.VerticalOptions.ToString()); case nameof(HorizontalOptions): return(this.HorizontalOptions.ToString()); //STEPPER case nameof(Maximum): return(Maximum.ToString()); case nameof(Minimum): return(Minimum.ToString()); case nameof(Value): return(Value.ToString()); case nameof(Increment): return(Increment.ToString()); default: return(string.Empty); } }
public string Get(string propertyName) { switch (propertyName) { //ELEMENT case nameof(ClassId): return(ClassId.ToString()); case nameof(AutomationId): return(AutomationId.ToString()); case nameof(Id): return(Id.ToString()); case nameof(StyleId): return(StyleId.ToString()); //VISUAL ELEMENT case nameof(AnchorX): return(AnchorX.ToString()); case nameof(AnchorY): return(AnchorY.ToString()); case nameof(BackgroundColor): return(BackgroundColor.ToHex()); case nameof(Width): return(this.Width.ToString()); case nameof(Height): return(this.Height.ToString()); case nameof(IsEnabled): return(IsEnabled.ToString()); case nameof(WidthRequest): return(this.WidthRequest.ToString()); case nameof(HeightRequest): return(this.HeightRequest.ToString()); case nameof(IsFocused): return(IsFocused.ToString()); case nameof(IsVisible): return(IsVisible.ToString()); case nameof(InputTransparent): return(InputTransparent.ToString()); case nameof(X): return(this.X.ToString()); case nameof(Y): return(this.Y.ToString()); case nameof(Opacity): return(this.Opacity.ToString()); case nameof(TranslationX): return(this.TranslationX.ToString()); case nameof(TranslationY): return(this.TranslationY.ToString()); case nameof(Rotation): return(this.Rotation.ToString()); case nameof(RotationX): return(this.RotationX.ToString()); case nameof(RotationY): return(this.RotationY.ToString()); case nameof(Scale): return(this.Scale.ToString()); //VIEW case nameof(Margin): return(this.Margin.ToString()); case nameof(VerticalOptions): return(this.VerticalOptions.ToString()); case nameof(HorizontalOptions): return(this.HorizontalOptions.ToString()); //PICKER case nameof(ItemsSource): return(ItemsSource.OfType <object>().Select(x => x.ToString()).Aggregate((x, y) => x + "," + y)); case nameof(SelectedItem): return(SelectedItem.ToString()); case nameof(SelectedIndex): return(SelectedIndex.ToString()); case nameof(Items): return(Items.Aggregate((x, y) => x + "," + y)); case nameof(Title): return(Title); default: return(string.Empty); } }
/// <summary> /// Applying level based style from diagram to style diagram. /// </summary> internal void ApplyLevelStyle() { SelectedLevel = 0; StyleDiagram.Theme = MindMapViewModel.Theme; var nodes = (MindMapViewModel.Nodes as NodeCollection).GroupBy(x => (x is Root) ? (x as Root).Level : (x as RootChild).Level).Select(x => x.FirstOrDefault()); SelectedDiagramLevelStyles = new Dictionary <int, StyleId>(); SelectedDiagramLevelShapes = new Dictionary <int, string>(); foreach (NodeViewModel node in nodes) { SelectedDiagramLevelStyles.Add((node is Root) ? (node as Root).Level : (node as RootChild).Level, node.ThemeStyleId); SelectedDiagramLevelShapes.Add((node is Root) ? (node as Root).Level : (node as RootChild).Level, (node is Root) ? (node as Root).ShapeName : (node as RootChild).ShapeName); } foreach (NodeViewModel node in StyleDiagram.Nodes as NodeCollection) { if (SelectedDiagramLevelStyles.ContainsKey(((node is Root) ? (node as Root).Level : (node as RootChild).Level))) { node.ThemeStyleId = SelectedDiagramLevelStyles[(node is Root) ? (node as Root).Level : (node as RootChild).Level]; } if (SelectedDiagramLevelShapes.ContainsKey(((node is Root) ? (node as Root).Level : (node as RootChild).Level))) { if (node is Root) { (node as Root).ShapeName = SelectedDiagramLevelShapes[(node is Root) ? (node as Root).Level : (node as RootChild).Level]; } else { (node as RootChild).ShapeName = SelectedDiagramLevelShapes[(node is Root) ? (node as Root).Level : (node as RootChild).Level]; } } } SelectedShape = SelectedDiagramLevelShapes[SelectedLevel]; StyleId selectedLevelStyleID = (nodes.ToList()[SelectedLevel] as NodeViewModel).ThemeStyleId; foreach (ThemeStyleButtonVM themeStyleButtonVM in ThemeStylesCollection) { if (themeStyleButtonVM.ThemeStyleId == selectedLevelStyleID) { SelectedStyle = themeStyleButtonVM; break; } } if ((MindMapViewModel.Connectors as ConnectorCollection).Count() > 0) { IConnector connector = (MindMapViewModel.Connectors as ConnectorCollection)[0]; if (connector.Segments is ObservableCollection <IConnectorSegment> ) { if ((connector.Segments as ObservableCollection <IConnectorSegment>)[0] is CubicCurveSegment) { StyleDiagram.DefaultConnectorType = ConnectorType.CubicBezier; IsStraightConnectorType = false; } else { StyleDiagram.DefaultConnectorType = ConnectorType.Orthogonal; IsStraightConnectorType = true; } } } else { if (MindMapViewModel.DefaultConnectorType == ConnectorType.CubicBezier) { StyleDiagram.DefaultConnectorType = ConnectorType.CubicBezier; //SelectedConnectorStyle = "Curved"; IsStraightConnectorType = false; } else { StyleDiagram.DefaultConnectorType = ConnectorType.Orthogonal; //SelectedConnectorStyle = "Straight"; IsStraightConnectorType = true; } } }
public string Get(string propertyName) { switch (propertyName) { //ELEMENT case nameof(ClassId): return(ClassId.ToString()); case nameof(AutomationId): return(AutomationId.ToString()); case nameof(Id): return(Id.ToString()); case nameof(StyleId): return(StyleId.ToString()); //VISUAL ELEMENT case nameof(AnchorX): return(AnchorX.ToString()); case nameof(AnchorY): return(AnchorY.ToString()); case nameof(BackgroundColor): return(BackgroundColor.ToHex()); case nameof(Width): return(this.Width.ToString()); case nameof(Height): return(this.Height.ToString()); case nameof(IsEnabled): return(IsEnabled.ToString()); case nameof(WidthRequest): return(this.WidthRequest.ToString()); case nameof(HeightRequest): return(this.HeightRequest.ToString()); case nameof(IsFocused): return(IsFocused.ToString()); case nameof(IsVisible): return(IsVisible.ToString()); case nameof(InputTransparent): return(InputTransparent.ToString()); case nameof(X): return(this.X.ToString()); case nameof(Y): return(this.Y.ToString()); case nameof(Opacity): return(this.Opacity.ToString()); case nameof(TranslationX): return(this.TranslationX.ToString()); case nameof(TranslationY): return(this.TranslationY.ToString()); case nameof(Rotation): return(this.Rotation.ToString()); case nameof(RotationX): return(this.RotationX.ToString()); case nameof(RotationY): return(this.RotationY.ToString()); case nameof(Scale): return(this.Scale.ToString()); //VIEW case nameof(Margin): return(this.Margin.ToString()); case nameof(VerticalOptions): return(this.VerticalOptions.ToString()); case nameof(HorizontalOptions): return(this.HorizontalOptions.ToString()); //ITEMSVIEW case nameof(ItemsSource): return(ItemsSource.OfType <object>().Select(x => x.ToString()).Aggregate((x, y) => x + "," + y)); //LISTVIEW case nameof(HasUnevenRows): return(HasUnevenRows.ToString()); case nameof(IsGroupingEnabled): return(IsGroupingEnabled.ToString()); case nameof(RowHeight): return(RowHeight.ToString()); case nameof(Footer): return(Footer.ToString()); case nameof(Header): return(Header.ToString()); case nameof(IsPullToRefreshEnabled): return(IsPullToRefreshEnabled.ToString()); case nameof(IsRefreshing): return(IsRefreshing.ToString()); case nameof(SelectedItem): return(SelectedItem.ToString()); case nameof(SeparatorColor): return(SeparatorColor.ToHex()); case nameof(this.SeparatorVisibility): return(SeparatorVisibility.ToString()); default: return(string.Empty); } }
public string Get(string propertyName) { switch (propertyName) { //ELEMENT case nameof(ClassId): return ClassId.ToString(); case nameof(AutomationId): return AutomationId.ToString(); case nameof(Id): return Id.ToString(); case nameof(StyleId): return StyleId.ToString(); //VISUAL ELEMENT case nameof(AnchorX): return AnchorX.ToString(); case nameof(AnchorY): return AnchorY.ToString(); case nameof(BackgroundColor): return BackgroundColor.ToHex(); case nameof(Width): return this.Width.ToString(); case nameof(Height): return this.Height.ToString(); case nameof(IsEnabled): return IsEnabled.ToString(); case nameof(WidthRequest): return this.WidthRequest.ToString(); case nameof(HeightRequest): return this.HeightRequest.ToString(); case nameof(IsFocused): return IsFocused.ToString(); case nameof(IsVisible): return IsVisible.ToString(); case nameof(InputTransparent): return InputTransparent.ToString(); case nameof(X): return this.X.ToString(); case nameof(Y): return this.Y.ToString(); case nameof(Opacity): return this.Opacity.ToString(); case nameof(TranslationX): return this.TranslationX.ToString(); case nameof(TranslationY): return this.TranslationY.ToString(); case nameof(Rotation): return this.Rotation.ToString(); case nameof(RotationX): return this.RotationX.ToString(); case nameof(RotationY): return this.RotationY.ToString(); case nameof(Scale): return this.Scale.ToString(); //VIEW case nameof(Margin): return this.Margin.ToString(); case nameof(VerticalOptions): return this.VerticalOptions.ToString(); case nameof(HorizontalOptions): return this.HorizontalOptions.ToString(); //PROGRESSBAR case nameof(Progress): return this.Progress.ToString(); default: return string.Empty; } }
public void StyleId_Normal() { Assert.AreEqual("Normal (70012)", StyleId.GetInstance().GetNameById(StyleId.StyleId_Normal)); }
public string Get(string propertyName) { switch (propertyName) { //ELEMENT case nameof(ClassId): return(ClassId.ToString()); case nameof(AutomationId): return(AutomationId.ToString()); case nameof(Id): return(Id.ToString()); case nameof(StyleId): return(StyleId.ToString()); //VISUAL ELEMENT case nameof(AnchorX): return(AnchorX.ToString()); case nameof(AnchorY): return(AnchorY.ToString()); case nameof(BackgroundColor): return(BackgroundColor.ToHex()); case nameof(Width): return(this.Width.ToString()); case nameof(Height): return(this.Height.ToString()); case nameof(IsEnabled): return(IsEnabled.ToString()); case nameof(WidthRequest): return(this.WidthRequest.ToString()); case nameof(HeightRequest): return(this.HeightRequest.ToString()); case nameof(IsFocused): return(IsFocused.ToString()); case nameof(IsVisible): return(IsVisible.ToString()); case nameof(InputTransparent): return(InputTransparent.ToString()); case nameof(X): return(this.X.ToString()); case nameof(Y): return(this.Y.ToString()); case nameof(Opacity): return(this.Opacity.ToString()); case nameof(TranslationX): return(this.TranslationX.ToString()); case nameof(TranslationY): return(this.TranslationY.ToString()); case nameof(Rotation): return(this.Rotation.ToString()); case nameof(RotationX): return(this.RotationX.ToString()); case nameof(RotationY): return(this.RotationY.ToString()); case nameof(Scale): return(this.Scale.ToString()); //VIEW case nameof(Margin): return(this.Margin.ToString()); case nameof(VerticalOptions): return(this.VerticalOptions.ToString()); case nameof(HorizontalOptions): return(this.HorizontalOptions.ToString()); //SEARCHBAR case nameof(CancelButtonColor): return(this.CancelButtonColor.ToHex()); case nameof(Placeholder): return(this.Placeholder); case nameof(SearchCommandParameter): return(SearchCommandParameter.ToString()); case nameof(Text): return(Text); default: return(string.Empty); } }
public string Get(string propertyName) { switch (propertyName) { //ELEMENT case nameof(ClassId): return(ClassId.ToString()); case nameof(AutomationId): return(AutomationId.ToString()); case nameof(Id): return(Id.ToString()); case nameof(StyleId): return(StyleId.ToString()); //VISUAL ELEMENT case nameof(AnchorX): return(AnchorX.ToString()); case nameof(AnchorY): return(AnchorY.ToString()); case nameof(BackgroundColor): return(BackgroundColor.ToHex()); case nameof(Width): return(this.Width.ToString()); case nameof(Height): return(this.Height.ToString()); case nameof(IsEnabled): return(IsEnabled.ToString()); case nameof(WidthRequest): return(this.WidthRequest.ToString()); case nameof(HeightRequest): return(this.HeightRequest.ToString()); case nameof(IsFocused): return(IsFocused.ToString()); case nameof(IsVisible): return(IsVisible.ToString()); case nameof(InputTransparent): return(InputTransparent.ToString()); case nameof(X): return(this.X.ToString()); case nameof(Y): return(this.Y.ToString()); case nameof(Opacity): return(this.Opacity.ToString()); case nameof(TranslationX): return(this.TranslationX.ToString()); case nameof(TranslationY): return(this.TranslationY.ToString()); case nameof(Rotation): return(this.Rotation.ToString()); case nameof(RotationX): return(this.RotationX.ToString()); case nameof(RotationY): return(this.RotationY.ToString()); case nameof(Scale): return(this.Scale.ToString()); //VIEW case nameof(Margin): return(this.Margin.ToString()); case nameof(VerticalOptions): return(this.VerticalOptions.ToString()); case nameof(HorizontalOptions): return(this.HorizontalOptions.ToString()); //IMAGE case nameof(Source): switch (Source) { case FileImageSource file: return(file.File); case UriImageSource uri: return(uri.Uri.ToString()); default: return(string.Empty); } case nameof(Aspect): return(this.Aspect.ToString()); case nameof(IsOpaque): return(this.IsOpaque.ToString()); default: return(string.Empty); } }
public void StyleId_Quote() { Assert.AreEqual("Quote (70014)", StyleId.GetInstance().GetNameById(StyleId.StyleId_Quote)); }
public void StyleId_Emphasis() { Assert.AreEqual("Emphasis (70013)", StyleId.GetInstance().GetNameById(StyleId.StyleId_Emphasis)); }
private List <TextAttributeViewModel> GetTextRangeAttributeKeyValuePair(TextRange tr, KeyValuePair <int, string> kv, bool collapse) { List <TextAttributeViewModel> list = new List <TextAttributeViewModel>(); dynamic value = tr.GetAttributeValue(kv.Key); switch (kv.Key) { case TextAttributeType.UIA_AnimationStyleAttributeId: if (value is int) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, AnimationStyle.GetInstance().GetNameById(value))); } break; case TextAttributeType.UIA_BackgroundColorAttributeId: case TextAttributeType.UIA_ForegroundColorAttributeId: case TextAttributeType.UIA_OverlineColorAttributeId: case TextAttributeType.UIA_StrikethroughColorAttributeId: case TextAttributeType.UIA_UnderlineColorAttributeId: if (value is int) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, string.Format("#{0:X8}", value))); } break; case TextAttributeType.UIA_BulletStyleAttributeId: if (value is int) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, BulletStyle.GetInstance().GetNameById(value))); } break; case TextAttributeType.UIA_CapStyleAttributeId: if (value is int) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, CapStyle.GetInstance().GetNameById(value))); } break; case TextAttributeType.UIA_CultureAttributeId: if (value is int culture) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, Invariant($"{CultureInfo.GetCultureInfo(culture).EnglishName} ({culture})"))); } break; case TextAttributeType.UIA_StyleIdAttributeId: if (value is int) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, StyleId.GetInstance().GetNameById(value))); } break; case TextAttributeType.UIA_SayAsInterpretAsAttributeId: // VT_I4 if (value is int) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, SayAsInterpretAs.GetInstance().GetNameById(value))); } break; case TextAttributeType.UIA_FontNameAttributeId: case TextAttributeType.UIA_StyleNameAttributeId: case TextAttributeType.UIA_LineSpacingAttributeId: // VT_BSTR if (value is string) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, value)); } break; case TextAttributeType.UIA_FontSizeAttributeId: case TextAttributeType.UIA_IndentationFirstLineAttributeId: case TextAttributeType.UIA_IndentationLeadingAttributeId: case TextAttributeType.UIA_IndentationTrailingAttributeId: case TextAttributeType.UIA_MarginBottomAttributeId: case TextAttributeType.UIA_MarginLeadingAttributeId: case TextAttributeType.UIA_MarginTopAttributeId: case TextAttributeType.UIA_MarginTrailingAttributeId: case TextAttributeType.UIA_BeforeParagraphSpacingAttributeId: case TextAttributeType.UIA_AfterParagraphSpacingAttributeId: // VT_R8 if (value is double || value is long) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, value.ToString())); } break; case TextAttributeType.UIA_FontWeightAttributeId: if (value is int) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, Axe.Windows.Desktop.Styles.FontWeight.GetInstance().GetNameById(value))); } break; case TextAttributeType.UIA_HorizontalTextAlignmentAttributeId: if (value is int) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, Axe.Windows.Desktop.Styles.FontWeight.GetInstance().GetNameById(value))); } break; case TextAttributeType.UIA_IsHiddenAttributeId: case TextAttributeType.UIA_IsItalicAttributeId: case TextAttributeType.UIA_IsReadOnlyAttributeId: case TextAttributeType.UIA_IsSubscriptAttributeId: case TextAttributeType.UIA_IsSuperscriptAttributeId: case TextAttributeType.UIA_IsActiveAttributeId: if (value is bool) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, value.ToString())); } break; case TextAttributeType.UIA_OutlineStylesAttributeId: if (value is int) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, OutlineStyle.GetInstance().GetNameById(value))); } break; case TextAttributeType.UIA_OverlineStyleAttributeId: case TextAttributeType.UIA_StrikethroughStyleAttributeId: case TextAttributeType.UIA_UnderlineStyleAttributeId: if (value is int) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, TextDecorationLineStyle.GetInstance().GetNameById(value))); } break; case TextAttributeType.UIA_TabsAttributeId: var txt = ConvertArrayToString(value); if (txt != null) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, txt)); } break; case TextAttributeType.UIA_TextFlowDirectionsAttributeId: if (value is int) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, Axe.Windows.Desktop.Styles.FlowDirection.GetInstance().GetNameById(value))); } break; case TextAttributeType.UIA_AnnotationTypesAttributeId: StringBuilder sb = new StringBuilder(); if (value is double) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, AnnotationType.GetInstance().GetNameById((int)value))); } else if (value is Array arr) { if (collapse && arr.Length > 0) // collapse the array into a single row { var count = new Dictionary <string, int>(); foreach (var val in arr) { var key = AnnotationType.GetInstance().GetNameById((int)val); if (count.ContainsKey(key)) { count[key]++; } else { count[key] = 1; } } StringBuilder strBuild = new StringBuilder(); foreach (var item in count) { strBuild.Append(Invariant($"{item.Key}: {item.Value}, ")); } strBuild.Length -= 2; //remove final , and <space> list.Add(new TextAttributeViewModel(kv.Key, kv.Value, strBuild.ToString())); } else // create a row for each array value { if (arr.Length > 0) { for (int i = 0; i < arr.Length; i++) { list.Add(new TextAttributeViewModel(kv.Key, string.Format(CultureInfo.InvariantCulture, "{0}[{1}]", kv.Value, i), AnnotationType.GetInstance().GetNameById((int)arr.GetValue(i)))); } } } } break; case TextAttributeType.UIA_SelectionActiveEndAttributeId: if (value is int) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, ActiveEnd.GetInstance().GetNameById(value))); } break; case TextAttributeType.UIA_CaretPositionAttributeId: if (value is int) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, CaretPosition.GetInstance().GetNameById(value))); } break; case TextAttributeType.UIA_CaretBidiModeAttributeId: if (value is int) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, CaretBidiMode.GetInstance().GetNameById(value))); } break; case TextAttributeType.UIA_AnnotationObjectsAttributeId: if (value is IUIAutomationElementArray) { IUIAutomationElementArray arr = value; if (arr.Length > 0) { for (int i = 0; i < arr.Length; i++) { list.Add(new TextAttributeViewModel(kv.Key, string.Format(CultureInfo.InvariantCulture, Resources.TextRangeViewModel_GetTextRangeAttributeKeyValuePair_AnnotationObjects_0, i), new DesktopElement((IUIAutomationElement)arr.GetElement(i)))); } } } break; case TextAttributeType.UIA_LinkAttributeId: // do nothing for now until it is shown as necessary information. //try //{ // IUIAutomationTextRange lnk = Marshal.GetObjectForIUnknown(value) as IUIAutomationTextRange; // list.Add(new TextAttributeViewModel(kv.Value, new TextRangeViewModel(new TextRange(lnk)))); //} //catch (Exception e) //{ // e.ReportException(); //} break; default: // need to make a decision for these Attributes since it return Object. if (value.GetType().Name != "__ComObject") { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, value)); } break; } return(list); }
public string Get(string propertyName) { switch (propertyName) { //ELEMENT case nameof(ClassId): return(ClassId.ToString()); case nameof(AutomationId): return(AutomationId.ToString()); case nameof(Id): return(Id.ToString()); case nameof(StyleId): return(StyleId.ToString()); //VISUAL ELEMENT case nameof(AnchorX): return(AnchorX.ToString()); case nameof(AnchorY): return(AnchorY.ToString()); case nameof(BackgroundColor): return(BackgroundColor.ToHex()); case nameof(Width): return(this.Width.ToString()); case nameof(Height): return(this.Height.ToString()); case nameof(IsEnabled): return(IsEnabled.ToString()); case nameof(WidthRequest): return(this.WidthRequest.ToString()); case nameof(HeightRequest): return(this.HeightRequest.ToString()); case nameof(IsFocused): return(IsFocused.ToString()); case nameof(IsVisible): return(IsVisible.ToString()); case nameof(InputTransparent): return(InputTransparent.ToString()); case nameof(X): return(this.X.ToString()); case nameof(Y): return(this.Y.ToString()); case nameof(Opacity): return(this.Opacity.ToString()); case nameof(TranslationX): return(this.TranslationX.ToString()); case nameof(TranslationY): return(this.TranslationY.ToString()); case nameof(Rotation): return(this.Rotation.ToString()); case nameof(RotationX): return(this.RotationX.ToString()); case nameof(RotationY): return(this.RotationY.ToString()); case nameof(Scale): return(this.Scale.ToString()); //VIEW case nameof(Margin): return(this.Margin.ToString()); case nameof(VerticalOptions): return(this.VerticalOptions.ToString()); case nameof(HorizontalOptions): return(this.HorizontalOptions.ToString()); //INPUTVIEW case nameof(Keyboard): return(this.Keyboard.ToString()); //EDITOR case nameof(FontAttributes): return(this.FontAttributes.ToString()); case nameof(FontFamily): return(this.FontFamily); case nameof(FontSize): return(this.FontSize.ToString()); case nameof(Text): return(this.Text); case nameof(TextColor): return(this.TextColor.ToHex()); default: return(string.Empty); } }
public string Get(string propertyName) { switch (propertyName) { //ELEMENT case nameof(ClassId): return(ClassId.ToString()); case nameof(AutomationId): return(AutomationId.ToString()); case nameof(Id): return(Id.ToString()); case nameof(StyleId): return(StyleId.ToString()); //VISUAL ELEMENT case nameof(AnchorX): return(AnchorX.ToString()); case nameof(AnchorY): return(AnchorY.ToString()); case nameof(BackgroundColor): return(BackgroundColor.ToHex()); case nameof(Width): return(this.Width.ToString()); case nameof(Height): return(this.Height.ToString()); case nameof(IsEnabled): return(IsEnabled.ToString()); case nameof(WidthRequest): return(this.WidthRequest.ToString()); case nameof(HeightRequest): return(this.HeightRequest.ToString()); case nameof(IsFocused): return(IsFocused.ToString()); case nameof(IsVisible): return(IsVisible.ToString()); case nameof(InputTransparent): return(InputTransparent.ToString()); case nameof(X): return(this.X.ToString()); case nameof(Y): return(this.Y.ToString()); case nameof(Opacity): return(this.Opacity.ToString()); case nameof(TranslationX): return(this.TranslationX.ToString()); case nameof(TranslationY): return(this.TranslationY.ToString()); case nameof(Rotation): return(this.Rotation.ToString()); case nameof(RotationX): return(this.RotationX.ToString()); case nameof(RotationY): return(this.RotationY.ToString()); case nameof(Scale): return(this.Scale.ToString()); //VIEW case nameof(Margin): return(this.Margin.ToString()); case nameof(VerticalOptions): return(this.VerticalOptions.ToString()); case nameof(HorizontalOptions): return(this.HorizontalOptions.ToString()); //BUTTON case nameof(BorderColor): return(BorderColor.ToHex()); #pragma warning disable CS0618 // Type or member is obsolete case nameof(BorderRadius): return(BorderRadius.ToString()); #pragma warning restore CS0618 // Type or member is obsolete case nameof(BorderWidth): return(BorderWidth.ToString()); case nameof(CornerRadius): return(CornerRadius.ToString()); case nameof(CommandParameter): return(CommandParameter.ToString()); case nameof(FontAttributes): return(FontAttributes.ToString()); case nameof(FontFamily): return(FontFamily); case nameof(FontSize): return(FontSize.ToString()); case nameof(TextColor): return(TextColor.ToHex()); case nameof(Text): return(Text); default: return(string.Empty); } }