private FieldStructure CreateFieldStructure(GenerateCodeTypeElementTreeNavigationItem generatedCodeTypeElementTreeNavigationItem, Dictionary <string, Settings> codeDataTypeConversionToName) { string dataType = GetDataType(generatedCodeTypeElementTreeNavigationItem, codeDataTypeConversionToName); FieldStructure fieldStructure = new FieldStructure(Modifier.PRIVATE, dataType, generatedCodeTypeElementTreeNavigationItem.CompositeTypeElementTreeNavigationItem.Name); if (generatedCodeTypeElementTreeNavigationItem.Id) { fieldStructure.AddAnnotation(Annotation.CreateAnnotation(Annotation.IdAnnotation)); } if (generatedCodeTypeElementTreeNavigationItem.Transient) { fieldStructure.AddAnnotation(Annotation.CreateAnnotation(Annotation.TransientAnnotation)); } if (!string.IsNullOrEmpty(generatedCodeTypeElementTreeNavigationItem.ColumnName)) { fieldStructure.AddAnnotation(Annotation.CreateAnnotation(Annotation.ColumnAnnotation, generatedCodeTypeElementTreeNavigationItem.ColumnName)); } return(fieldStructure); }
private ClassStructure CreateClassStructure(GenerateCodeTypeTreeNavigationItem generateCodeTypeTreeNavigationItem) { ClassStructure classStructure = new ClassStructure(Modifier.PUBLIC, generateCodeTypeTreeNavigationItem.Name); classStructure.Namespace = generateCodeTypeTreeNavigationItem.Namespace; if (generateCodeTypeTreeNavigationItem.Table) { classStructure.AddAnnotation(Annotation.CreateAnnotation(Annotation.TableAnnotation, CreateColumnName(generateCodeTypeTreeNavigationItem.Name))); } if (generateCodeTypeTreeNavigationItem.DiscriminatorValue) { classStructure.AddAnnotation(Annotation.CreateAnnotation(Annotation.DiscriminatorValueAnnotation)); } Dictionary <string, Settings> codeDataTypeConversionToName = GetCodeDataTypeConversionToName(); foreach (GenerateCodeTypeElementTreeNavigationItem generatedCodeTypeElementTreeNavigationItem in generateCodeTypeTreeNavigationItem.Fields) { classStructure.Fields.Add(CreateFieldStructure(generatedCodeTypeElementTreeNavigationItem, codeDataTypeConversionToName)); } return(classStructure); }
internal void AddOrRemoveAnnotations(Annotation annotation, bool isRemoval) { annotation.Chart = chart; UIElement annotationElement = null; if (annotation.IsVisbilityChanged) { annotationElement = annotation.GetRenderedAnnotation(); } else { annotationElement = !isRemoval?annotation.CreateAnnotation() : annotation.GetRenderedAnnotation(); } var axisMarker = annotation as AxisMarker; if (annotationElement != null && axisMarker == null) { switch (annotation.CoordinateUnit) { case CoordinateUnit.Axis: if (this.chart.SeriesAnnotationCanvas.Children.Contains(annotationElement) && isRemoval) { RemoveSeriesAnnotation(annotation, annotationElement); } else if (annotation.Visibility == Visibility.Visible) { // The following code is dynamic changing the Coordinate from Pixel to Axis. if (this.chart.ChartAnnotationCanvas.Children.Contains(annotationElement)) { RemoveChartAnnotation(annotation, annotationElement); } if (!this.chart.SeriesAnnotationCanvas.Children.Contains(annotation)) { this.chart.SeriesAnnotationCanvas.Children.Add(annotation); } this.chart.SeriesAnnotationCanvas.Children.Add(annotationElement); annotation.UpdateAnnotation(); } break; case CoordinateUnit.Pixel: if (this.chart.ChartAnnotationCanvas.Children.Contains(annotationElement) && isRemoval) { RemoveChartAnnotation(annotation, annotationElement); } else if (annotation.Visibility == Visibility.Visible) { // The following code is dynamic changing the Coordinate from Axis to Pixel. if (this.chart.SeriesAnnotationCanvas.Children.Contains(annotationElement)) { RemoveSeriesAnnotation(annotation, annotationElement); } if (!this.chart.ChartAnnotationCanvas.Children.Contains(annotation)) { this.chart.ChartAnnotationCanvas.Children.Add(annotation); } this.chart.ChartAnnotationCanvas.Children.Add(annotationElement); annotation.UpdateAnnotation(); } break; } } else { if (axisMarker != null) { if (this.chart.ChartAnnotationCanvas.Children.Contains(axisMarker.MarkerCanvas) && isRemoval) { this.chart.ChartAnnotationCanvas.Children.Remove(axisMarker.MarkerCanvas); } else if (axisMarker.ParentAnnotation.Visibility != Visibility.Collapsed) { this.chart.ChartAnnotationCanvas.Children.Add(annotationElement); annotation.UpdateAnnotation(); } } } annotation.IsVisbilityChanged = false; }
internal void AddOrRemoveAnnotationResizer(Annotation annotation, bool isRemoval) { annotation.Chart = chart; UIElement resizerControl = null; resizerControl = !isRemoval?annotation.CreateAnnotation() : annotation.GetRenderedAnnotation(); if (resizerControl != null) { switch (annotation.CoordinateUnit) { case CoordinateUnit.Axis: if (isRemoval) { if (this.chart.SeriesAnnotationCanvas.Children.Contains(annotation)) { this.chart.SeriesAnnotationCanvas.Children.Remove(annotation); RemoveAxisMarker(annotation); } Grid annotationElement = this.previouseSelectedAnnotation.GetRenderedAnnotation() as Grid; if (annotationElement.Children.Contains(resizerControl)) { annotationElement.Children.Remove(resizerControl); } } else { Grid annotationElement = this.SelectedAnnotation.GetRenderedAnnotation() as Grid; this.chart.SeriesAnnotationCanvas.Children.Add(annotation); annotationElement.Children.Add(resizerControl); annotation.UpdateAnnotation(); } break; case CoordinateUnit.Pixel: if (isRemoval) { if (this.chart.ChartAnnotationCanvas.Children.Contains(annotation)) { this.chart.ChartAnnotationCanvas.Children.Remove(annotation); } Grid annotationElement = this.previouseSelectedAnnotation.GetRenderedAnnotation() as Grid; if (annotationElement.Children.Contains(resizerControl)) { annotationElement.Children.Remove(resizerControl); } } else { Grid annotationElement = this.SelectedAnnotation.GetRenderedAnnotation() as Grid; this.chart.ChartAnnotationCanvas.Children.Add(annotation); annotationElement.Children.Add(resizerControl); annotation.UpdateAnnotation(); } break; } } }