Example #1
1
        // Code compiled into PresentationFramework.dll

        // Initialize known object types
        internal static object CreateKnownElement(KnownElements knownElement) 
        {
            object o = null; 
            switch (knownElement) 
            {
                case KnownElements.AccessText: o = new System.Windows.Controls.AccessText();   break; 
                case KnownElements.AdornedElementPlaceholder: o = new System.Windows.Controls.AdornedElementPlaceholder();   break;
                case KnownElements.AdornerDecorator: o = new System.Windows.Documents.AdornerDecorator();   break;
                case KnownElements.AmbientLight: o = new System.Windows.Media.Media3D.AmbientLight();   break;
                case KnownElements.Application: o = new System.Windows.Application();   break; 
                case KnownElements.ArcSegment: o = new System.Windows.Media.ArcSegment();   break;
                case KnownElements.ArrayExtension: o = new System.Windows.Markup.ArrayExtension();   break; 
                case KnownElements.AxisAngleRotation3D: o = new System.Windows.Media.Media3D.AxisAngleRotation3D();   break; 
                case KnownElements.BeginStoryboard: o = new System.Windows.Media.Animation.BeginStoryboard();   break;
                case KnownElements.BevelBitmapEffect: o = new System.Windows.Media.Effects.BevelBitmapEffect();   break; 
                case KnownElements.BezierSegment: o = new System.Windows.Media.BezierSegment();   break;
                case KnownElements.Binding: o = new System.Windows.Data.Binding();   break;
                case KnownElements.BitmapEffectCollection: o = new System.Windows.Media.Effects.BitmapEffectCollection();   break;
                case KnownElements.BitmapEffectGroup: o = new System.Windows.Media.Effects.BitmapEffectGroup();   break; 
                case KnownElements.BitmapEffectInput: o = new System.Windows.Media.Effects.BitmapEffectInput();   break;
                case KnownElements.BitmapImage: o = new System.Windows.Media.Imaging.BitmapImage();   break; 
                case KnownElements.BlockUIContainer: o = new System.Windows.Documents.BlockUIContainer();   break; 
                case KnownElements.BlurBitmapEffect: o = new System.Windows.Media.Effects.BlurBitmapEffect();   break;
                case KnownElements.BmpBitmapEncoder: o = new System.Windows.Media.Imaging.BmpBitmapEncoder();   break; 
                case KnownElements.Bold: o = new System.Windows.Documents.Bold();   break;
                case KnownElements.BoolIListConverter: o = new System.Windows.Media.Converters.BoolIListConverter();   break;
                case KnownElements.BooleanAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.BooleanAnimationUsingKeyFrames();   break;
                case KnownElements.BooleanConverter: o = new System.ComponentModel.BooleanConverter();   break; 
                case KnownElements.BooleanKeyFrameCollection: o = new System.Windows.Media.Animation.BooleanKeyFrameCollection();   break;
                case KnownElements.BooleanToVisibilityConverter: o = new System.Windows.Controls.BooleanToVisibilityConverter();   break; 
                case KnownElements.Border: o = new System.Windows.Controls.Border();   break; 
                case KnownElements.BorderGapMaskConverter: o = new System.Windows.Controls.BorderGapMaskConverter();   break;
                case KnownElements.BrushConverter: o = new System.Windows.Media.BrushConverter();   break; 
                case KnownElements.BulletDecorator: o = new System.Windows.Controls.Primitives.BulletDecorator();   break;
                case KnownElements.Button: o = new System.Windows.Controls.Button();   break;
                case KnownElements.ByteAnimation: o = new System.Windows.Media.Animation.ByteAnimation();   break;
                case KnownElements.ByteAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.ByteAnimationUsingKeyFrames();   break; 
                case KnownElements.ByteConverter: o = new System.ComponentModel.ByteConverter();   break;
                case KnownElements.ByteKeyFrameCollection: o = new System.Windows.Media.Animation.ByteKeyFrameCollection();   break; 
                case KnownElements.Canvas: o = new System.Windows.Controls.Canvas();   break; 
                case KnownElements.CharAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.CharAnimationUsingKeyFrames();   break;
                case KnownElements.CharConverter: o = new System.ComponentModel.CharConverter();   break; 
                case KnownElements.CharIListConverter: o = new System.Windows.Media.Converters.CharIListConverter();   break;
                case KnownElements.CharKeyFrameCollection: o = new System.Windows.Media.Animation.CharKeyFrameCollection();   break;
                case KnownElements.CheckBox: o = new System.Windows.Controls.CheckBox();   break;
                case KnownElements.CollectionContainer: o = new System.Windows.Data.CollectionContainer();   break; 
                case KnownElements.CollectionViewSource: o = new System.Windows.Data.CollectionViewSource();   break;
                case KnownElements.Color: o = new System.Windows.Media.Color();   break; 
                case KnownElements.ColorAnimation: o = new System.Windows.Media.Animation.ColorAnimation();   break; 
                case KnownElements.ColorAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.ColorAnimationUsingKeyFrames();   break;
                case KnownElements.ColorConvertedBitmap: o = new System.Windows.Media.Imaging.ColorConvertedBitmap();   break; 
                case KnownElements.ColorConvertedBitmapExtension: o = new System.Windows.ColorConvertedBitmapExtension();   break;
                case KnownElements.ColorConverter: o = new System.Windows.Media.ColorConverter();   break;
                case KnownElements.ColorKeyFrameCollection: o = new System.Windows.Media.Animation.ColorKeyFrameCollection();   break;
                case KnownElements.ColumnDefinition: o = new System.Windows.Controls.ColumnDefinition();   break; 
                case KnownElements.CombinedGeometry: o = new System.Windows.Media.CombinedGeometry();   break;
                case KnownElements.ComboBox: o = new System.Windows.Controls.ComboBox();   break; 
                case KnownElements.ComboBoxItem: o = new System.Windows.Controls.ComboBoxItem();   break; 
                case KnownElements.CommandConverter: o = new System.Windows.Input.CommandConverter();   break;
                case KnownElements.ComponentResourceKey: o = new System.Windows.ComponentResourceKey();   break; 
                case KnownElements.ComponentResourceKeyConverter: o = new System.Windows.Markup.ComponentResourceKeyConverter();   break;
                case KnownElements.Condition: o = new System.Windows.Condition();   break;
                case KnownElements.ContainerVisual: o = new System.Windows.Media.ContainerVisual();   break;
                case KnownElements.ContentControl: o = new System.Windows.Controls.ContentControl();   break; 
                case KnownElements.ContentElement: o = new System.Windows.ContentElement();   break;
                case KnownElements.ContentPresenter: o = new System.Windows.Controls.ContentPresenter();   break; 
                case KnownElements.ContextMenu: o = new System.Windows.Controls.ContextMenu();   break; 
                case KnownElements.Control: o = new System.Windows.Controls.Control();   break;
                case KnownElements.ControlTemplate: o = new System.Windows.Controls.ControlTemplate();   break; 
                case KnownElements.CornerRadius: o = new System.Windows.CornerRadius();   break;
                case KnownElements.CornerRadiusConverter: o = new System.Windows.CornerRadiusConverter();   break;
                case KnownElements.CroppedBitmap: o = new System.Windows.Media.Imaging.CroppedBitmap();   break;
                case KnownElements.CultureInfoConverter: o = new System.ComponentModel.CultureInfoConverter();   break; 
                case KnownElements.CultureInfoIetfLanguageTagConverter: o = new System.Windows.CultureInfoIetfLanguageTagConverter();   break;
                case KnownElements.CursorConverter: o = new System.Windows.Input.CursorConverter();   break; 
                case KnownElements.DashStyle: o = new System.Windows.Media.DashStyle();   break; 
                case KnownElements.DataTemplate: o = new System.Windows.DataTemplate();   break;
                case KnownElements.DataTemplateKey: o = new System.Windows.DataTemplateKey();   break; 
                case KnownElements.DataTrigger: o = new System.Windows.DataTrigger();   break;
                case KnownElements.DateTimeConverter: o = new System.ComponentModel.DateTimeConverter();   break;
                case KnownElements.DateTimeConverter2: o = new System.Windows.Markup.DateTimeConverter2();   break;
                case KnownElements.DecimalAnimation: o = new System.Windows.Media.Animation.DecimalAnimation();   break; 
                case KnownElements.DecimalAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.DecimalAnimationUsingKeyFrames();   break;
                case KnownElements.DecimalConverter: o = new System.ComponentModel.DecimalConverter();   break; 
                case KnownElements.DecimalKeyFrameCollection: o = new System.Windows.Media.Animation.DecimalKeyFrameCollection();   break; 
                case KnownElements.Decorator: o = new System.Windows.Controls.Decorator();   break;
                case KnownElements.DependencyObject: o = new System.Windows.DependencyObject();   break; 
                case KnownElements.DependencyPropertyConverter: o = new System.Windows.Markup.DependencyPropertyConverter();   break;
                case KnownElements.DialogResultConverter: o = new System.Windows.DialogResultConverter();   break;
                case KnownElements.DiffuseMaterial: o = new System.Windows.Media.Media3D.DiffuseMaterial();   break;
                case KnownElements.DirectionalLight: o = new System.Windows.Media.Media3D.DirectionalLight();   break; 
                case KnownElements.DiscreteBooleanKeyFrame: o = new System.Windows.Media.Animation.DiscreteBooleanKeyFrame();   break;
                case KnownElements.DiscreteByteKeyFrame: o = new System.Windows.Media.Animation.DiscreteByteKeyFrame();   break; 
                case KnownElements.DiscreteCharKeyFrame: o = new System.Windows.Media.Animation.DiscreteCharKeyFrame();   break; 
                case KnownElements.DiscreteColorKeyFrame: o = new System.Windows.Media.Animation.DiscreteColorKeyFrame();   break;
                case KnownElements.DiscreteDecimalKeyFrame: o = new System.Windows.Media.Animation.DiscreteDecimalKeyFrame();   break; 
                case KnownElements.DiscreteDoubleKeyFrame: o = new System.Windows.Media.Animation.DiscreteDoubleKeyFrame();   break;
                case KnownElements.DiscreteInt16KeyFrame: o = new System.Windows.Media.Animation.DiscreteInt16KeyFrame();   break;
                case KnownElements.DiscreteInt32KeyFrame: o = new System.Windows.Media.Animation.DiscreteInt32KeyFrame();   break;
                case KnownElements.DiscreteInt64KeyFrame: o = new System.Windows.Media.Animation.DiscreteInt64KeyFrame();   break; 
                case KnownElements.DiscreteMatrixKeyFrame: o = new System.Windows.Media.Animation.DiscreteMatrixKeyFrame();   break;
                case KnownElements.DiscreteObjectKeyFrame: o = new System.Windows.Media.Animation.DiscreteObjectKeyFrame();   break; 
                case KnownElements.DiscretePoint3DKeyFrame: o = new System.Windows.Media.Animation.DiscretePoint3DKeyFrame();   break; 
                case KnownElements.DiscretePointKeyFrame: o = new System.Windows.Media.Animation.DiscretePointKeyFrame();   break;
                case KnownElements.DiscreteQuaternionKeyFrame: o = new System.Windows.Media.Animation.DiscreteQuaternionKeyFrame();   break; 
                case KnownElements.DiscreteRectKeyFrame: o = new System.Windows.Media.Animation.DiscreteRectKeyFrame();   break;
                case KnownElements.DiscreteRotation3DKeyFrame: o = new System.Windows.Media.Animation.DiscreteRotation3DKeyFrame();   break;
                case KnownElements.DiscreteSingleKeyFrame: o = new System.Windows.Media.Animation.DiscreteSingleKeyFrame();   break;
                case KnownElements.DiscreteSizeKeyFrame: o = new System.Windows.Media.Animation.DiscreteSizeKeyFrame();   break; 
                case KnownElements.DiscreteStringKeyFrame: o = new System.Windows.Media.Animation.DiscreteStringKeyFrame();   break;
                case KnownElements.DiscreteThicknessKeyFrame: o = new System.Windows.Media.Animation.DiscreteThicknessKeyFrame();   break; 
                case KnownElements.DiscreteVector3DKeyFrame: o = new System.Windows.Media.Animation.DiscreteVector3DKeyFrame();   break; 
                case KnownElements.DiscreteVectorKeyFrame: o = new System.Windows.Media.Animation.DiscreteVectorKeyFrame();   break;
                case KnownElements.DockPanel: o = new System.Windows.Controls.DockPanel();   break; 
                case KnownElements.DocumentPageView: o = new System.Windows.Controls.Primitives.DocumentPageView();   break;
                case KnownElements.DocumentReference: o = new System.Windows.Documents.DocumentReference();   break;
                case KnownElements.DocumentViewer: o = new System.Windows.Controls.DocumentViewer();   break;
                case KnownElements.DoubleAnimation: o = new System.Windows.Media.Animation.DoubleAnimation();   break; 
                case KnownElements.DoubleAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.DoubleAnimationUsingKeyFrames();   break;
                case KnownElements.DoubleAnimationUsingPath: o = new System.Windows.Media.Animation.DoubleAnimationUsingPath();   break; 
                case KnownElements.DoubleCollection: o = new System.Windows.Media.DoubleCollection();   break; 
                case KnownElements.DoubleCollectionConverter: o = new System.Windows.Media.DoubleCollectionConverter();   break;
                case KnownElements.DoubleConverter: o = new System.ComponentModel.DoubleConverter();   break; 
                case KnownElements.DoubleIListConverter: o = new System.Windows.Media.Converters.DoubleIListConverter();   break;
                case KnownElements.DoubleKeyFrameCollection: o = new System.Windows.Media.Animation.DoubleKeyFrameCollection();   break;
                case KnownElements.DrawingBrush: o = new System.Windows.Media.DrawingBrush();   break;
                case KnownElements.DrawingCollection: o = new System.Windows.Media.DrawingCollection();   break; 
                case KnownElements.DrawingGroup: o = new System.Windows.Media.DrawingGroup();   break;
                case KnownElements.DrawingImage: o = new System.Windows.Media.DrawingImage();   break; 
                case KnownElements.DrawingVisual: o = new System.Windows.Media.DrawingVisual();   break; 
                case KnownElements.DropShadowBitmapEffect: o = new System.Windows.Media.Effects.DropShadowBitmapEffect();   break;
                case KnownElements.Duration: o = new System.Windows.Duration();   break; 
                case KnownElements.DurationConverter: o = new System.Windows.DurationConverter();   break;
                case KnownElements.DynamicResourceExtension: o = new System.Windows.DynamicResourceExtension();   break;
                case KnownElements.DynamicResourceExtensionConverter: o = new System.Windows.DynamicResourceExtensionConverter();   break;
                case KnownElements.Ellipse: o = new System.Windows.Shapes.Ellipse();   break; 
                case KnownElements.EllipseGeometry: o = new System.Windows.Media.EllipseGeometry();   break;
                case KnownElements.EmbossBitmapEffect: o = new System.Windows.Media.Effects.EmbossBitmapEffect();   break; 
                case KnownElements.EmissiveMaterial: o = new System.Windows.Media.Media3D.EmissiveMaterial();   break; 
                case KnownElements.EventSetter: o = new System.Windows.EventSetter();   break;
                case KnownElements.EventTrigger: o = new System.Windows.EventTrigger();   break; 
                case KnownElements.Expander: o = new System.Windows.Controls.Expander();   break;
                case KnownElements.ExpressionConverter: o = new System.Windows.ExpressionConverter();   break;
                case KnownElements.Figure: o = new System.Windows.Documents.Figure();   break;
                case KnownElements.FigureLength: o = new System.Windows.FigureLength();   break; 
                case KnownElements.FigureLengthConverter: o = new System.Windows.FigureLengthConverter();   break;
                case KnownElements.FixedDocument: o = new System.Windows.Documents.FixedDocument();   break; 
                case KnownElements.FixedDocumentSequence: o = new System.Windows.Documents.FixedDocumentSequence();   break; 
                case KnownElements.FixedPage: o = new System.Windows.Documents.FixedPage();   break;
                case KnownElements.Floater: o = new System.Windows.Documents.Floater();   break; 
                case KnownElements.FlowDocument: o = new System.Windows.Documents.FlowDocument();   break;
                case KnownElements.FlowDocumentPageViewer: o = new System.Windows.Controls.FlowDocumentPageViewer();   break;
                case KnownElements.FlowDocumentReader: o = new System.Windows.Controls.FlowDocumentReader();   break;
                case KnownElements.FlowDocumentScrollViewer: o = new System.Windows.Controls.FlowDocumentScrollViewer();   break; 
                case KnownElements.FontFamily: o = new System.Windows.Media.FontFamily();   break;
                case KnownElements.FontFamilyConverter: o = new System.Windows.Media.FontFamilyConverter();   break; 
                case KnownElements.FontSizeConverter: o = new System.Windows.FontSizeConverter();   break; 
                case KnownElements.FontStretch: o = new System.Windows.FontStretch();   break;
                case KnownElements.FontStretchConverter: o = new System.Windows.FontStretchConverter();   break; 
                case KnownElements.FontStyle: o = new System.Windows.FontStyle();   break;
                case KnownElements.FontStyleConverter: o = new System.Windows.FontStyleConverter();   break;
                case KnownElements.FontWeight: o = new System.Windows.FontWeight();   break;
                case KnownElements.FontWeightConverter: o = new System.Windows.FontWeightConverter();   break; 
                case KnownElements.FormatConvertedBitmap: o = new System.Windows.Media.Imaging.FormatConvertedBitmap();   break;
                case KnownElements.Frame: o = new System.Windows.Controls.Frame();   break; 
                case KnownElements.FrameworkContentElement: o = new System.Windows.FrameworkContentElement();   break; 
                case KnownElements.FrameworkElement: o = new System.Windows.FrameworkElement();   break;
                case KnownElements.FrameworkElementFactory: o = new System.Windows.FrameworkElementFactory();   break; 
                case KnownElements.FrameworkPropertyMetadata: o = new System.Windows.FrameworkPropertyMetadata();   break;
                case KnownElements.GeneralTransformCollection: o = new System.Windows.Media.GeneralTransformCollection();   break;
                case KnownElements.GeneralTransformGroup: o = new System.Windows.Media.GeneralTransformGroup();   break;
                case KnownElements.GeometryCollection: o = new System.Windows.Media.GeometryCollection();   break; 
                case KnownElements.GeometryConverter: o = new System.Windows.Media.GeometryConverter();   break;
                case KnownElements.GeometryDrawing: o = new System.Windows.Media.GeometryDrawing();   break; 
                case KnownElements.GeometryGroup: o = new System.Windows.Media.GeometryGroup();   break; 
                case KnownElements.GeometryModel3D: o = new System.Windows.Media.Media3D.GeometryModel3D();   break;
                case KnownElements.GestureRecognizer: o = new System.Windows.Ink.GestureRecognizer();   break; 
                case KnownElements.GifBitmapEncoder: o = new System.Windows.Media.Imaging.GifBitmapEncoder();   break;
                case KnownElements.GlyphRun: o = new System.Windows.Media.GlyphRun();   break;
                case KnownElements.GlyphRunDrawing: o = new System.Windows.Media.GlyphRunDrawing();   break;
                case KnownElements.GlyphTypeface: o = new System.Windows.Media.GlyphTypeface();   break; 
                case KnownElements.Glyphs: o = new System.Windows.Documents.Glyphs();   break;
                case KnownElements.GradientStop: o = new System.Windows.Media.GradientStop();   break; 
                case KnownElements.GradientStopCollection: o = new System.Windows.Media.GradientStopCollection();   break; 
                case KnownElements.Grid: o = new System.Windows.Controls.Grid();   break;
                case KnownElements.GridLength: o = new System.Windows.GridLength();   break; 
                case KnownElements.GridLengthConverter: o = new System.Windows.GridLengthConverter();   break;
                case KnownElements.GridSplitter: o = new System.Windows.Controls.GridSplitter();   break;
                case KnownElements.GridView: o = new System.Windows.Controls.GridView();   break;
                case KnownElements.GridViewColumn: o = new System.Windows.Controls.GridViewColumn();   break; 
                case KnownElements.GridViewColumnHeader: o = new System.Windows.Controls.GridViewColumnHeader();   break;
                case KnownElements.GridViewHeaderRowPresenter: o = new System.Windows.Controls.GridViewHeaderRowPresenter();   break; 
                case KnownElements.GridViewRowPresenter: o = new System.Windows.Controls.GridViewRowPresenter();   break; 
                case KnownElements.GroupBox: o = new System.Windows.Controls.GroupBox();   break;
                case KnownElements.GroupItem: o = new System.Windows.Controls.GroupItem();   break; 
                case KnownElements.GuidConverter: o = new System.ComponentModel.GuidConverter();   break;
                case KnownElements.GuidelineSet: o = new System.Windows.Media.GuidelineSet();   break;
                case KnownElements.HeaderedContentControl: o = new System.Windows.Controls.HeaderedContentControl();   break;
                case KnownElements.HeaderedItemsControl: o = new System.Windows.Controls.HeaderedItemsControl();   break; 
                case KnownElements.HierarchicalDataTemplate: o = new System.Windows.HierarchicalDataTemplate();   break;
                case KnownElements.HostVisual: o = new System.Windows.Media.HostVisual();   break; 
                case KnownElements.Hyperlink: o = new System.Windows.Documents.Hyperlink();   break; 
                case KnownElements.Image: o = new System.Windows.Controls.Image();   break;
                case KnownElements.ImageBrush: o = new System.Windows.Media.ImageBrush();   break; 
                case KnownElements.ImageDrawing: o = new System.Windows.Media.ImageDrawing();   break;
                case KnownElements.ImageSourceConverter: o = new System.Windows.Media.ImageSourceConverter();   break;
                case KnownElements.InkCanvas: o = new System.Windows.Controls.InkCanvas();   break;
                case KnownElements.InkPresenter: o = new System.Windows.Controls.InkPresenter();   break; 
                case KnownElements.InlineUIContainer: o = new System.Windows.Documents.InlineUIContainer();   break;
                case KnownElements.InputScope: o = new System.Windows.Input.InputScope();   break; 
                case KnownElements.InputScopeConverter: o = new System.Windows.Input.InputScopeConverter();   break; 
                case KnownElements.InputScopeName: o = new System.Windows.Input.InputScopeName();   break;
                case KnownElements.InputScopeNameConverter: o = new System.Windows.Input.InputScopeNameConverter();   break; 
                case KnownElements.Int16Animation: o = new System.Windows.Media.Animation.Int16Animation();   break;
                case KnownElements.Int16AnimationUsingKeyFrames: o = new System.Windows.Media.Animation.Int16AnimationUsingKeyFrames();   break;
                case KnownElements.Int16Converter: o = new System.ComponentModel.Int16Converter();   break;
                case KnownElements.Int16KeyFrameCollection: o = new System.Windows.Media.Animation.Int16KeyFrameCollection();   break; 
                case KnownElements.Int32Animation: o = new System.Windows.Media.Animation.Int32Animation();   break;
                case KnownElements.Int32AnimationUsingKeyFrames: o = new System.Windows.Media.Animation.Int32AnimationUsingKeyFrames();   break; 
                case KnownElements.Int32Collection: o = new System.Windows.Media.Int32Collection();   break; 
                case KnownElements.Int32CollectionConverter: o = new System.Windows.Media.Int32CollectionConverter();   break;
                case KnownElements.Int32Converter: o = new System.ComponentModel.Int32Converter();   break; 
                case KnownElements.Int32KeyFrameCollection: o = new System.Windows.Media.Animation.Int32KeyFrameCollection();   break;
                case KnownElements.Int32Rect: o = new System.Windows.Int32Rect();   break;
                case KnownElements.Int32RectConverter: o = new System.Windows.Int32RectConverter();   break;
                case KnownElements.Int64Animation: o = new System.Windows.Media.Animation.Int64Animation();   break; 
                case KnownElements.Int64AnimationUsingKeyFrames: o = new System.Windows.Media.Animation.Int64AnimationUsingKeyFrames();   break;
                case KnownElements.Int64Converter: o = new System.ComponentModel.Int64Converter();   break; 
                case KnownElements.Int64KeyFrameCollection: o = new System.Windows.Media.Animation.Int64KeyFrameCollection();   break; 
                case KnownElements.Italic: o = new System.Windows.Documents.Italic();   break;
                case KnownElements.ItemsControl: o = new System.Windows.Controls.ItemsControl();   break; 
                case KnownElements.ItemsPanelTemplate: o = new System.Windows.Controls.ItemsPanelTemplate();   break;
                case KnownElements.ItemsPresenter: o = new System.Windows.Controls.ItemsPresenter();   break;
                case KnownElements.JournalEntryListConverter: o = new System.Windows.Navigation.JournalEntryListConverter();   break;
                case KnownElements.JournalEntryUnifiedViewConverter: o = new System.Windows.Navigation.JournalEntryUnifiedViewConverter();   break; 
                case KnownElements.JpegBitmapEncoder: o = new System.Windows.Media.Imaging.JpegBitmapEncoder();   break;
                case KnownElements.KeyBinding: o = new System.Windows.Input.KeyBinding();   break; 
                case KnownElements.KeyConverter: o = new System.Windows.Input.KeyConverter();   break; 
                case KnownElements.KeyGestureConverter: o = new System.Windows.Input.KeyGestureConverter();   break;
                case KnownElements.KeySpline: o = new System.Windows.Media.Animation.KeySpline();   break; 
                case KnownElements.KeySplineConverter: o = new System.Windows.KeySplineConverter();   break;
                case KnownElements.KeyTime: o = new System.Windows.Media.Animation.KeyTime();   break;
                case KnownElements.KeyTimeConverter: o = new System.Windows.KeyTimeConverter();   break;
                case KnownElements.Label: o = new System.Windows.Controls.Label();   break; 
                case KnownElements.LengthConverter: o = new System.Windows.LengthConverter();   break;
                case KnownElements.Line: o = new System.Windows.Shapes.Line();   break; 
                case KnownElements.LineBreak: o = new System.Windows.Documents.LineBreak();   break; 
                case KnownElements.LineGeometry: o = new System.Windows.Media.LineGeometry();   break;
                case KnownElements.LineSegment: o = new System.Windows.Media.LineSegment();   break; 
                case KnownElements.LinearByteKeyFrame: o = new System.Windows.Media.Animation.LinearByteKeyFrame();   break;
                case KnownElements.LinearColorKeyFrame: o = new System.Windows.Media.Animation.LinearColorKeyFrame();   break;
                case KnownElements.LinearDecimalKeyFrame: o = new System.Windows.Media.Animation.LinearDecimalKeyFrame();   break;
                case KnownElements.LinearDoubleKeyFrame: o = new System.Windows.Media.Animation.LinearDoubleKeyFrame();   break; 
                case KnownElements.LinearGradientBrush: o = new System.Windows.Media.LinearGradientBrush();   break;
                case KnownElements.LinearInt16KeyFrame: o = new System.Windows.Media.Animation.LinearInt16KeyFrame();   break; 
                case KnownElements.LinearInt32KeyFrame: o = new System.Windows.Media.Animation.LinearInt32KeyFrame();   break; 
                case KnownElements.LinearInt64KeyFrame: o = new System.Windows.Media.Animation.LinearInt64KeyFrame();   break;
                case KnownElements.LinearPoint3DKeyFrame: o = new System.Windows.Media.Animation.LinearPoint3DKeyFrame();   break; 
                case KnownElements.LinearPointKeyFrame: o = new System.Windows.Media.Animation.LinearPointKeyFrame();   break;
                case KnownElements.LinearQuaternionKeyFrame: o = new System.Windows.Media.Animation.LinearQuaternionKeyFrame();   break;
                case KnownElements.LinearRectKeyFrame: o = new System.Windows.Media.Animation.LinearRectKeyFrame();   break;
                case KnownElements.LinearRotation3DKeyFrame: o = new System.Windows.Media.Animation.LinearRotation3DKeyFrame();   break; 
                case KnownElements.LinearSingleKeyFrame: o = new System.Windows.Media.Animation.LinearSingleKeyFrame();   break;
                case KnownElements.LinearSizeKeyFrame: o = new System.Windows.Media.Animation.LinearSizeKeyFrame();   break; 
                case KnownElements.LinearThicknessKeyFrame: o = new System.Windows.Media.Animation.LinearThicknessKeyFrame();   break; 
                case KnownElements.LinearVector3DKeyFrame: o = new System.Windows.Media.Animation.LinearVector3DKeyFrame();   break;
                case KnownElements.LinearVectorKeyFrame: o = new System.Windows.Media.Animation.LinearVectorKeyFrame();   break; 
                case KnownElements.List: o = new System.Windows.Documents.List();   break;
                case KnownElements.ListBox: o = new System.Windows.Controls.ListBox();   break;
                case KnownElements.ListBoxItem: o = new System.Windows.Controls.ListBoxItem();   break;
                case KnownElements.ListItem: o = new System.Windows.Documents.ListItem();   break; 
                case KnownElements.ListView: o = new System.Windows.Controls.ListView();   break;
                case KnownElements.ListViewItem: o = new System.Windows.Controls.ListViewItem();   break; 
                case KnownElements.MaterialCollection: o = new System.Windows.Media.Media3D.MaterialCollection();   break; 
                case KnownElements.MaterialGroup: o = new System.Windows.Media.Media3D.MaterialGroup();   break;
                case KnownElements.Matrix: o = new System.Windows.Media.Matrix();   break; 
                case KnownElements.Matrix3D: o = new System.Windows.Media.Media3D.Matrix3D();   break;
                case KnownElements.Matrix3DConverter: o = new System.Windows.Media.Media3D.Matrix3DConverter();   break;
                case KnownElements.MatrixAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.MatrixAnimationUsingKeyFrames();   break;
                case KnownElements.MatrixAnimationUsingPath: o = new System.Windows.Media.Animation.MatrixAnimationUsingPath();   break; 
                case KnownElements.MatrixCamera: o = new System.Windows.Media.Media3D.MatrixCamera();   break;
                case KnownElements.MatrixConverter: o = new System.Windows.Media.MatrixConverter();   break; 
                case KnownElements.MatrixKeyFrameCollection: o = new System.Windows.Media.Animation.MatrixKeyFrameCollection();   break; 
                case KnownElements.MatrixTransform: o = new System.Windows.Media.MatrixTransform();   break;
                case KnownElements.MatrixTransform3D: o = new System.Windows.Media.Media3D.MatrixTransform3D();   break; 
                case KnownElements.MediaElement: o = new System.Windows.Controls.MediaElement();   break;
                case KnownElements.MediaPlayer: o = new System.Windows.Media.MediaPlayer();   break;
                case KnownElements.MediaTimeline: o = new System.Windows.Media.MediaTimeline();   break;
                case KnownElements.Menu: o = new System.Windows.Controls.Menu();   break; 
                case KnownElements.MenuItem: o = new System.Windows.Controls.MenuItem();   break;
                case KnownElements.MenuScrollingVisibilityConverter: o = new System.Windows.Controls.MenuScrollingVisibilityConverter();   break; 
                case KnownElements.MeshGeometry3D: o = new System.Windows.Media.Media3D.MeshGeometry3D();   break; 
                case KnownElements.Model3DCollection: o = new System.Windows.Media.Media3D.Model3DCollection();   break;
                case KnownElements.Model3DGroup: o = new System.Windows.Media.Media3D.Model3DGroup();   break; 
                case KnownElements.ModelVisual3D: o = new System.Windows.Media.Media3D.ModelVisual3D();   break;
                case KnownElements.ModifierKeysConverter: o = new System.Windows.Input.ModifierKeysConverter();   break;
                case KnownElements.MouseActionConverter: o = new System.Windows.Input.MouseActionConverter();   break;
                case KnownElements.MouseBinding: o = new System.Windows.Input.MouseBinding();   break; 
                case KnownElements.MouseGesture: o = new System.Windows.Input.MouseGesture();   break;
                case KnownElements.MouseGestureConverter: o = new System.Windows.Input.MouseGestureConverter();   break; 
                case KnownElements.MultiBinding: o = new System.Windows.Data.MultiBinding();   break; 
                case KnownElements.MultiDataTrigger: o = new System.Windows.MultiDataTrigger();   break;
                case KnownElements.MultiTrigger: o = new System.Windows.MultiTrigger();   break; 
                case KnownElements.NameScope: o = new System.Windows.NameScope();   break;
                case KnownElements.NavigationWindow: o = new System.Windows.Navigation.NavigationWindow();   break;
                case KnownElements.NullExtension: o = new System.Windows.Markup.NullExtension();   break;
                case KnownElements.NullableBoolConverter: o = new System.Windows.NullableBoolConverter();   break; 
                case KnownElements.NumberSubstitution: o = new System.Windows.Media.NumberSubstitution();   break;
                case KnownElements.Object: o = new System.Object();   break; 
                case KnownElements.ObjectAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.ObjectAnimationUsingKeyFrames();   break; 
                case KnownElements.ObjectDataProvider: o = new System.Windows.Data.ObjectDataProvider();   break;
                case KnownElements.ObjectKeyFrameCollection: o = new System.Windows.Media.Animation.ObjectKeyFrameCollection();   break; 
                case KnownElements.OrthographicCamera: o = new System.Windows.Media.Media3D.OrthographicCamera();   break;
                case KnownElements.OuterGlowBitmapEffect: o = new System.Windows.Media.Effects.OuterGlowBitmapEffect();   break;
                case KnownElements.Page: o = new System.Windows.Controls.Page();   break;
                case KnownElements.PageContent: o = new System.Windows.Documents.PageContent();   break; 
                case KnownElements.Paragraph: o = new System.Windows.Documents.Paragraph();   break;
                case KnownElements.ParallelTimeline: o = new System.Windows.Media.Animation.ParallelTimeline();   break; 
                case KnownElements.ParserContext: o = new System.Windows.Markup.ParserContext();   break; 
                case KnownElements.PasswordBox: o = new System.Windows.Controls.PasswordBox();   break;
                case KnownElements.Path: o = new System.Windows.Shapes.Path();   break; 
                case KnownElements.PathFigure: o = new System.Windows.Media.PathFigure();   break;
                case KnownElements.PathFigureCollection: o = new System.Windows.Media.PathFigureCollection();   break;
                case KnownElements.PathFigureCollectionConverter: o = new System.Windows.Media.PathFigureCollectionConverter();   break;
                case KnownElements.PathGeometry: o = new System.Windows.Media.PathGeometry();   break; 
                case KnownElements.PathSegmentCollection: o = new System.Windows.Media.PathSegmentCollection();   break;
                case KnownElements.PauseStoryboard: o = new System.Windows.Media.Animation.PauseStoryboard();   break; 
                case KnownElements.Pen: o = new System.Windows.Media.Pen();   break; 
                case KnownElements.PerspectiveCamera: o = new System.Windows.Media.Media3D.PerspectiveCamera();   break;
                case KnownElements.PixelFormat: o = new System.Windows.Media.PixelFormat();   break; 
                case KnownElements.PixelFormatConverter: o = new System.Windows.Media.PixelFormatConverter();   break;
                case KnownElements.PngBitmapEncoder: o = new System.Windows.Media.Imaging.PngBitmapEncoder();   break;
                case KnownElements.Point: o = new System.Windows.Point();   break;
                case KnownElements.Point3D: o = new System.Windows.Media.Media3D.Point3D();   break; 
                case KnownElements.Point3DAnimation: o = new System.Windows.Media.Animation.Point3DAnimation();   break;
                case KnownElements.Point3DAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.Point3DAnimationUsingKeyFrames();   break; 
                case KnownElements.Point3DCollection: o = new System.Windows.Media.Media3D.Point3DCollection();   break; 
                case KnownElements.Point3DCollectionConverter: o = new System.Windows.Media.Media3D.Point3DCollectionConverter();   break;
                case KnownElements.Point3DConverter: o = new System.Windows.Media.Media3D.Point3DConverter();   break; 
                case KnownElements.Point3DKeyFrameCollection: o = new System.Windows.Media.Animation.Point3DKeyFrameCollection();   break;
                case KnownElements.Point4D: o = new System.Windows.Media.Media3D.Point4D();   break;
                case KnownElements.Point4DConverter: o = new System.Windows.Media.Media3D.Point4DConverter();   break;
                case KnownElements.PointAnimation: o = new System.Windows.Media.Animation.PointAnimation();   break; 
                case KnownElements.PointAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.PointAnimationUsingKeyFrames();   break;
                case KnownElements.PointAnimationUsingPath: o = new System.Windows.Media.Animation.PointAnimationUsingPath();   break; 
                case KnownElements.PointCollection: o = new System.Windows.Media.PointCollection();   break; 
                case KnownElements.PointCollectionConverter: o = new System.Windows.Media.PointCollectionConverter();   break;
                case KnownElements.PointConverter: o = new System.Windows.PointConverter();   break; 
                case KnownElements.PointIListConverter: o = new System.Windows.Media.Converters.PointIListConverter();   break;
                case KnownElements.PointKeyFrameCollection: o = new System.Windows.Media.Animation.PointKeyFrameCollection();   break;
                case KnownElements.PointLight: o = new System.Windows.Media.Media3D.PointLight();   break;
                case KnownElements.PolyBezierSegment: o = new System.Windows.Media.PolyBezierSegment();   break; 
                case KnownElements.PolyLineSegment: o = new System.Windows.Media.PolyLineSegment();   break;
                case KnownElements.PolyQuadraticBezierSegment: o = new System.Windows.Media.PolyQuadraticBezierSegment();   break; 
                case KnownElements.Polygon: o = new System.Windows.Shapes.Polygon();   break; 
                case KnownElements.Polyline: o = new System.Windows.Shapes.Polyline();   break;
                case KnownElements.Popup: o = new System.Windows.Controls.Primitives.Popup();   break; 
                case KnownElements.PriorityBinding: o = new System.Windows.Data.PriorityBinding();   break;
                case KnownElements.ProgressBar: o = new System.Windows.Controls.ProgressBar();   break;
                case KnownElements.PropertyPathConverter: o = new System.Windows.PropertyPathConverter();   break;
                case KnownElements.QuadraticBezierSegment: o = new System.Windows.Media.QuadraticBezierSegment();   break; 
                case KnownElements.Quaternion: o = new System.Windows.Media.Media3D.Quaternion();   break;
                case KnownElements.QuaternionAnimation: o = new System.Windows.Media.Animation.QuaternionAnimation();   break; 
                case KnownElements.QuaternionAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.QuaternionAnimationUsingKeyFrames();   break; 
                case KnownElements.QuaternionConverter: o = new System.Windows.Media.Media3D.QuaternionConverter();   break;
                case KnownElements.QuaternionKeyFrameCollection: o = new System.Windows.Media.Animation.QuaternionKeyFrameCollection();   break; 
                case KnownElements.QuaternionRotation3D: o = new System.Windows.Media.Media3D.QuaternionRotation3D();   break;
                case KnownElements.RadialGradientBrush: o = new System.Windows.Media.RadialGradientBrush();   break;
                case KnownElements.RadioButton: o = new System.Windows.Controls.RadioButton();   break;
                case KnownElements.Rect: o = new System.Windows.Rect();   break; 
                case KnownElements.Rect3D: o = new System.Windows.Media.Media3D.Rect3D();   break;
                case KnownElements.Rect3DConverter: o = new System.Windows.Media.Media3D.Rect3DConverter();   break; 
                case KnownElements.RectAnimation: o = new System.Windows.Media.Animation.RectAnimation();   break; 
                case KnownElements.RectAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.RectAnimationUsingKeyFrames();   break;
                case KnownElements.RectConverter: o = new System.Windows.RectConverter();   break; 
                case KnownElements.RectKeyFrameCollection: o = new System.Windows.Media.Animation.RectKeyFrameCollection();   break;
                case KnownElements.Rectangle: o = new System.Windows.Shapes.Rectangle();   break;
                case KnownElements.RectangleGeometry: o = new System.Windows.Media.RectangleGeometry();   break;
                case KnownElements.RelativeSource: o = new System.Windows.Data.RelativeSource();   break; 
                case KnownElements.RemoveStoryboard: o = new System.Windows.Media.Animation.RemoveStoryboard();   break;
                case KnownElements.RepeatBehavior: o = new System.Windows.Media.Animation.RepeatBehavior();   break; 
                case KnownElements.RepeatBehaviorConverter: o = new System.Windows.Media.Animation.RepeatBehaviorConverter();   break; 
                case KnownElements.RepeatButton: o = new System.Windows.Controls.Primitives.RepeatButton();   break;
                case KnownElements.ResizeGrip: o = new System.Windows.Controls.Primitives.ResizeGrip();   break; 
                case KnownElements.ResourceDictionary: o = new System.Windows.ResourceDictionary();   break;
                case KnownElements.ResumeStoryboard: o = new System.Windows.Media.Animation.ResumeStoryboard();   break;
                case KnownElements.RichTextBox: o = new System.Windows.Controls.RichTextBox();   break;
                case KnownElements.RotateTransform: o = new System.Windows.Media.RotateTransform();   break; 
                case KnownElements.RotateTransform3D: o = new System.Windows.Media.Media3D.RotateTransform3D();   break;
                case KnownElements.Rotation3DAnimation: o = new System.Windows.Media.Animation.Rotation3DAnimation();   break; 
                case KnownElements.Rotation3DAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.Rotation3DAnimationUsingKeyFrames();   break; 
                case KnownElements.Rotation3DKeyFrameCollection: o = new System.Windows.Media.Animation.Rotation3DKeyFrameCollection();   break;
                case KnownElements.RoutedCommand: o = new System.Windows.Input.RoutedCommand();   break; 
                case KnownElements.RoutedEventConverter: o = new System.Windows.Markup.RoutedEventConverter();   break;
                case KnownElements.RoutedUICommand: o = new System.Windows.Input.RoutedUICommand();   break;
                case KnownElements.RowDefinition: o = new System.Windows.Controls.RowDefinition();   break;
                case KnownElements.Run: o = new System.Windows.Documents.Run();   break; 
                case KnownElements.SByteConverter: o = new System.ComponentModel.SByteConverter();   break;
                case KnownElements.ScaleTransform: o = new System.Windows.Media.ScaleTransform();   break; 
                case KnownElements.ScaleTransform3D: o = new System.Windows.Media.Media3D.ScaleTransform3D();   break; 
                case KnownElements.ScrollBar: o = new System.Windows.Controls.Primitives.ScrollBar();   break;
                case KnownElements.ScrollContentPresenter: o = new System.Windows.Controls.ScrollContentPresenter();   break; 
                case KnownElements.ScrollViewer: o = new System.Windows.Controls.ScrollViewer();   break;
                case KnownElements.Section: o = new System.Windows.Documents.Section();   break;
                case KnownElements.SeekStoryboard: o = new System.Windows.Media.Animation.SeekStoryboard();   break;
                case KnownElements.Separator: o = new System.Windows.Controls.Separator();   break; 
                case KnownElements.SetStoryboardSpeedRatio: o = new System.Windows.Media.Animation.SetStoryboardSpeedRatio();   break;
                case KnownElements.Setter: o = new System.Windows.Setter();   break; 
                case KnownElements.SingleAnimation: o = new System.Windows.Media.Animation.SingleAnimation();   break; 
                case KnownElements.SingleAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.SingleAnimationUsingKeyFrames();   break;
                case KnownElements.SingleConverter: o = new System.ComponentModel.SingleConverter();   break; 
                case KnownElements.SingleKeyFrameCollection: o = new System.Windows.Media.Animation.SingleKeyFrameCollection();   break;
                case KnownElements.Size: o = new System.Windows.Size();   break;
                case KnownElements.Size3D: o = new System.Windows.Media.Media3D.Size3D();   break;
                case KnownElements.Size3DConverter: o = new System.Windows.Media.Media3D.Size3DConverter();   break; 
                case KnownElements.SizeAnimation: o = new System.Windows.Media.Animation.SizeAnimation();   break;
                case KnownElements.SizeAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.SizeAnimationUsingKeyFrames();   break; 
                case KnownElements.SizeConverter: o = new System.Windows.SizeConverter();   break; 
                case KnownElements.SizeKeyFrameCollection: o = new System.Windows.Media.Animation.SizeKeyFrameCollection();   break;
                case KnownElements.SkewTransform: o = new System.Windows.Media.SkewTransform();   break; 
                case KnownElements.SkipStoryboardToFill: o = new System.Windows.Media.Animation.SkipStoryboardToFill();   break;
                case KnownElements.Slider: o = new System.Windows.Controls.Slider();   break;
                case KnownElements.SolidColorBrush: o = new System.Windows.Media.SolidColorBrush();   break;
                case KnownElements.SoundPlayerAction: o = new System.Windows.Controls.SoundPlayerAction();   break; 
                case KnownElements.Span: o = new System.Windows.Documents.Span();   break;
                case KnownElements.SpecularMaterial: o = new System.Windows.Media.Media3D.SpecularMaterial();   break; 
                case KnownElements.SplineByteKeyFrame: o = new System.Windows.Media.Animation.SplineByteKeyFrame();   break; 
                case KnownElements.SplineColorKeyFrame: o = new System.Windows.Media.Animation.SplineColorKeyFrame();   break;
                case KnownElements.SplineDecimalKeyFrame: o = new System.Windows.Media.Animation.SplineDecimalKeyFrame();   break; 
                case KnownElements.SplineDoubleKeyFrame: o = new System.Windows.Media.Animation.SplineDoubleKeyFrame();   break;
                case KnownElements.SplineInt16KeyFrame: o = new System.Windows.Media.Animation.SplineInt16KeyFrame();   break;
                case KnownElements.SplineInt32KeyFrame: o = new System.Windows.Media.Animation.SplineInt32KeyFrame();   break;
                case KnownElements.SplineInt64KeyFrame: o = new System.Windows.Media.Animation.SplineInt64KeyFrame();   break; 
                case KnownElements.SplinePoint3DKeyFrame: o = new System.Windows.Media.Animation.SplinePoint3DKeyFrame();   break;
                case KnownElements.SplinePointKeyFrame: o = new System.Windows.Media.Animation.SplinePointKeyFrame();   break; 
                case KnownElements.SplineQuaternionKeyFrame: o = new System.Windows.Media.Animation.SplineQuaternionKeyFrame();   break; 
                case KnownElements.SplineRectKeyFrame: o = new System.Windows.Media.Animation.SplineRectKeyFrame();   break;
                case KnownElements.SplineRotation3DKeyFrame: o = new System.Windows.Media.Animation.SplineRotation3DKeyFrame();   break; 
                case KnownElements.SplineSingleKeyFrame: o = new System.Windows.Media.Animation.SplineSingleKeyFrame();   break;
                case KnownElements.SplineSizeKeyFrame: o = new System.Windows.Media.Animation.SplineSizeKeyFrame();   break;
                case KnownElements.SplineThicknessKeyFrame: o = new System.Windows.Media.Animation.SplineThicknessKeyFrame();   break;
                case KnownElements.SplineVector3DKeyFrame: o = new System.Windows.Media.Animation.SplineVector3DKeyFrame();   break; 
                case KnownElements.SplineVectorKeyFrame: o = new System.Windows.Media.Animation.SplineVectorKeyFrame();   break;
                case KnownElements.SpotLight: o = new System.Windows.Media.Media3D.SpotLight();   break; 
                case KnownElements.StackPanel: o = new System.Windows.Controls.StackPanel();   break; 
                case KnownElements.StaticExtension: o = new System.Windows.Markup.StaticExtension();   break;
                case KnownElements.StaticResourceExtension: o = new System.Windows.StaticResourceExtension();   break; 
                case KnownElements.StatusBar: o = new System.Windows.Controls.Primitives.StatusBar();   break;
                case KnownElements.StatusBarItem: o = new System.Windows.Controls.Primitives.StatusBarItem();   break;
                case KnownElements.StopStoryboard: o = new System.Windows.Media.Animation.StopStoryboard();   break;
                case KnownElements.Storyboard: o = new System.Windows.Media.Animation.Storyboard();   break; 
                case KnownElements.StreamGeometry: o = new System.Windows.Media.StreamGeometry();   break;
                case KnownElements.StreamResourceInfo: o = new System.Windows.Resources.StreamResourceInfo();   break; 
                case KnownElements.StringAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.StringAnimationUsingKeyFrames();   break; 
                case KnownElements.StringConverter: o = new System.ComponentModel.StringConverter();   break;
                case KnownElements.StringKeyFrameCollection: o = new System.Windows.Media.Animation.StringKeyFrameCollection();   break; 
                case KnownElements.StrokeCollection: o = new System.Windows.Ink.StrokeCollection();   break;
                case KnownElements.StrokeCollectionConverter: o = new System.Windows.StrokeCollectionConverter();   break;
                case KnownElements.Style: o = new System.Windows.Style();   break;
                case KnownElements.TabControl: o = new System.Windows.Controls.TabControl();   break; 
                case KnownElements.TabItem: o = new System.Windows.Controls.TabItem();   break;
                case KnownElements.TabPanel: o = new System.Windows.Controls.Primitives.TabPanel();   break; 
                case KnownElements.Table: o = new System.Windows.Documents.Table();   break; 
                case KnownElements.TableCell: o = new System.Windows.Documents.TableCell();   break;
                case KnownElements.TableColumn: o = new System.Windows.Documents.TableColumn();   break; 
                case KnownElements.TableRow: o = new System.Windows.Documents.TableRow();   break;
                case KnownElements.TableRowGroup: o = new System.Windows.Documents.TableRowGroup();   break;
                case KnownElements.TemplateBindingExpressionConverter: o = new System.Windows.TemplateBindingExpressionConverter();   break;
                case KnownElements.TemplateBindingExtension: o = new System.Windows.TemplateBindingExtension();   break; 
                case KnownElements.TemplateBindingExtensionConverter: o = new System.Windows.TemplateBindingExtensionConverter();   break;
                case KnownElements.TemplateKeyConverter: o = new System.Windows.Markup.TemplateKeyConverter();   break; 
                case KnownElements.TextBlock: o = new System.Windows.Controls.TextBlock();   break; 
                case KnownElements.TextBox: o = new System.Windows.Controls.TextBox();   break;
                case KnownElements.TextDecoration: o = new System.Windows.TextDecoration();   break; 
                case KnownElements.TextDecorationCollection: o = new System.Windows.TextDecorationCollection();   break;
                case KnownElements.TextDecorationCollectionConverter: o = new System.Windows.TextDecorationCollectionConverter();   break;
                case KnownElements.TextEffect: o = new System.Windows.Media.TextEffect();   break;
                case KnownElements.TextEffectCollection: o = new System.Windows.Media.TextEffectCollection();   break; 
                case KnownElements.ThemeDictionaryExtension: o = new System.Windows.ThemeDictionaryExtension();   break;
                case KnownElements.Thickness: o = new System.Windows.Thickness();   break; 
                case KnownElements.ThicknessAnimation: o = new System.Windows.Media.Animation.ThicknessAnimation();   break; 
                case KnownElements.ThicknessAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.ThicknessAnimationUsingKeyFrames();   break;
                case KnownElements.ThicknessConverter: o = new System.Windows.ThicknessConverter();   break; 
                case KnownElements.ThicknessKeyFrameCollection: o = new System.Windows.Media.Animation.ThicknessKeyFrameCollection();   break;
                case KnownElements.Thumb: o = new System.Windows.Controls.Primitives.Thumb();   break;
                case KnownElements.TickBar: o = new System.Windows.Controls.Primitives.TickBar();   break;
                case KnownElements.TiffBitmapEncoder: o = new System.Windows.Media.Imaging.TiffBitmapEncoder();   break; 
                case KnownElements.TimeSpanConverter: o = new System.ComponentModel.TimeSpanConverter();   break;
                case KnownElements.TimelineCollection: o = new System.Windows.Media.Animation.TimelineCollection();   break; 
                case KnownElements.ToggleButton: o = new System.Windows.Controls.Primitives.ToggleButton();   break; 
                case KnownElements.ToolBar: o = new System.Windows.Controls.ToolBar();   break;
                case KnownElements.ToolBarOverflowPanel: o = new System.Windows.Controls.Primitives.ToolBarOverflowPanel();   break; 
                case KnownElements.ToolBarPanel: o = new System.Windows.Controls.Primitives.ToolBarPanel();   break;
                case KnownElements.ToolBarTray: o = new System.Windows.Controls.ToolBarTray();   break;
                case KnownElements.ToolTip: o = new System.Windows.Controls.ToolTip();   break;
                case KnownElements.Track: o = new System.Windows.Controls.Primitives.Track();   break; 
                case KnownElements.Transform3DCollection: o = new System.Windows.Media.Media3D.Transform3DCollection();   break;
                case KnownElements.Transform3DGroup: o = new System.Windows.Media.Media3D.Transform3DGroup();   break; 
                case KnownElements.TransformCollection: o = new System.Windows.Media.TransformCollection();   break; 
                case KnownElements.TransformConverter: o = new System.Windows.Media.TransformConverter();   break;
                case KnownElements.TransformGroup: o = new System.Windows.Media.TransformGroup();   break; 
                case KnownElements.TransformedBitmap: o = new System.Windows.Media.Imaging.TransformedBitmap();   break;
                case KnownElements.TranslateTransform: o = new System.Windows.Media.TranslateTransform();   break;
                case KnownElements.TranslateTransform3D: o = new System.Windows.Media.Media3D.TranslateTransform3D();   break;
                case KnownElements.TreeView: o = new System.Windows.Controls.TreeView();   break; 
                case KnownElements.TreeViewItem: o = new System.Windows.Controls.TreeViewItem();   break;
                case KnownElements.Trigger: o = new System.Windows.Trigger();   break; 
                case KnownElements.TypeExtension: o = new System.Windows.Markup.TypeExtension();   break; 
                case KnownElements.TypeTypeConverter: o = new System.Windows.Markup.TypeTypeConverter();   break;
                case KnownElements.UIElement: o = new System.Windows.UIElement();   break; 
                case KnownElements.UInt16Converter: o = new System.ComponentModel.UInt16Converter();   break;
                case KnownElements.UInt32Converter: o = new System.ComponentModel.UInt32Converter();   break;
                case KnownElements.UInt64Converter: o = new System.ComponentModel.UInt64Converter();   break;
                case KnownElements.UShortIListConverter: o = new System.Windows.Media.Converters.UShortIListConverter();   break; 
                case KnownElements.Underline: o = new System.Windows.Documents.Underline();   break;
                case KnownElements.UniformGrid: o = new System.Windows.Controls.Primitives.UniformGrid();   break; 
                case KnownElements.UriTypeConverter: o = new System.UriTypeConverter();   break; 
                case KnownElements.UserControl: o = new System.Windows.Controls.UserControl();   break;
                case KnownElements.Vector: o = new System.Windows.Vector();   break; 
                case KnownElements.Vector3D: o = new System.Windows.Media.Media3D.Vector3D();   break;
                case KnownElements.Vector3DAnimation: o = new System.Windows.Media.Animation.Vector3DAnimation();   break;
                case KnownElements.Vector3DAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.Vector3DAnimationUsingKeyFrames();   break;
                case KnownElements.Vector3DCollection: o = new System.Windows.Media.Media3D.Vector3DCollection();   break; 
                case KnownElements.Vector3DCollectionConverter: o = new System.Windows.Media.Media3D.Vector3DCollectionConverter();   break;
                case KnownElements.Vector3DConverter: o = new System.Windows.Media.Media3D.Vector3DConverter();   break; 
                case KnownElements.Vector3DKeyFrameCollection: o = new System.Windows.Media.Animation.Vector3DKeyFrameCollection();   break; 
                case KnownElements.VectorAnimation: o = new System.Windows.Media.Animation.VectorAnimation();   break;
                case KnownElements.VectorAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.VectorAnimationUsingKeyFrames();   break; 
                case KnownElements.VectorCollection: o = new System.Windows.Media.VectorCollection();   break;
                case KnownElements.VectorCollectionConverter: o = new System.Windows.Media.VectorCollectionConverter();   break;
                case KnownElements.VectorConverter: o = new System.Windows.VectorConverter();   break;
                case KnownElements.VectorKeyFrameCollection: o = new System.Windows.Media.Animation.VectorKeyFrameCollection();   break; 
                case KnownElements.VideoDrawing: o = new System.Windows.Media.VideoDrawing();   break;
                case KnownElements.Viewbox: o = new System.Windows.Controls.Viewbox();   break; 
                case KnownElements.Viewport3D: o = new System.Windows.Controls.Viewport3D();   break; 
                case KnownElements.Viewport3DVisual: o = new System.Windows.Media.Media3D.Viewport3DVisual();   break;
                case KnownElements.VirtualizingStackPanel: o = new System.Windows.Controls.VirtualizingStackPanel();   break; 
                case KnownElements.VisualBrush: o = new System.Windows.Media.VisualBrush();   break;
                case KnownElements.Window: o = new System.Windows.Window();   break;
                case KnownElements.WmpBitmapEncoder: o = new System.Windows.Media.Imaging.WmpBitmapEncoder();   break;
                case KnownElements.WrapPanel: o = new System.Windows.Controls.WrapPanel();   break; 
                case KnownElements.XamlBrushSerializer: o = new System.Windows.Markup.XamlBrushSerializer();   break;
                case KnownElements.XamlInt32CollectionSerializer: o = new System.Windows.Markup.XamlInt32CollectionSerializer();   break; 
                case KnownElements.XamlPathDataSerializer: o = new System.Windows.Markup.XamlPathDataSerializer();   break; 
                case KnownElements.XamlPoint3DCollectionSerializer: o = new System.Windows.Markup.XamlPoint3DCollectionSerializer();   break;
                case KnownElements.XamlPointCollectionSerializer: o = new System.Windows.Markup.XamlPointCollectionSerializer();   break; 
                case KnownElements.XamlStyleSerializer: o = new System.Windows.Markup.XamlStyleSerializer();   break;
                case KnownElements.XamlTemplateSerializer: o = new System.Windows.Markup.XamlTemplateSerializer();   break;
                case KnownElements.XamlVector3DCollectionSerializer: o = new System.Windows.Markup.XamlVector3DCollectionSerializer();   break;
                case KnownElements.XmlDataProvider: o = new System.Windows.Data.XmlDataProvider();   break; 
                case KnownElements.XmlLanguageConverter: o = new System.Windows.Markup.XmlLanguageConverter();   break;
                case KnownElements.XmlNamespaceMapping: o = new System.Windows.Data.XmlNamespaceMapping();   break; 
                case KnownElements.ZoomPercentageConverter: o = new System.Windows.Documents.ZoomPercentageConverter();   break; 
            }
            return o; 
        }
 public UIAutomationEnumerator()
 {
     DesktopBounds  = HitaHint.UIAssistantAPI.Screen.Bounds;
     Condition      = new PropertyCondition(AutomationElement.IsEnabledProperty, true);
     IgnoreElements = new HashSet <ControlType>();
     EndElements    = new HashSet <ControlType>(
         new ControlType[] {
         ControlType.Button,
         ControlType.RadioButton,
         ControlType.CheckBox,
         ControlType.Hyperlink,
         // ControlType.ListItem,
         ControlType.MenuItem,
         ControlType.SplitButton,
         ControlType.ComboBox,
         ControlType.Edit,
         ControlType.Text,
         ControlType.ScrollBar,
         ControlType.Thumb,
         ControlType.Slider,
         ControlType.Image,
     });
     CollectionElements = new HashSet <ControlType>(
         new ControlType[] {
         ControlType.List,
         ControlType.Tab,
         ControlType.Header,
     });
     ItemElements = new HashSet <ControlType>(
         new ControlType[] {
         ControlType.ListItem,
         ControlType.TabItem,
         ControlType.HeaderItem
     });
 }
Example #3
0
        private void ParseDescriptionFile(string backDirectory, string[] descriptionLines)
        {
            var oneCardImageDescription = new OneCardImageDescription();

            var lineIndex = 0;

            _backImage = new BitmapImage(new Uri(Path.Combine(backDirectory, descriptionLines[lineIndex++])));

            var imageWidth  = _backImage.PixelWidth;
            var imageHeight = _backImage.PixelHeight;

            var backParts = descriptionLines[lineIndex++].Split(' ');

            oneCardImageDescription.HorizontalOffset = int.Parse(backParts[0]);
            oneCardImageDescription.VerticalOffset   = int.Parse(backParts[1]);

            var cardSizeParts = descriptionLines[lineIndex].Split(' ');

            oneCardImageDescription.CardWidth  = int.Parse(cardSizeParts[0]);
            oneCardImageDescription.CardHeight = int.Parse(cardSizeParts[1]);

            var oneCardImagePositionProvider = new OneCardImagePositionProvider(oneCardImageDescription);

            _viewBox = oneCardImagePositionProvider.GetCardRectangle().Normalize(new CardSize(imageWidth, imageHeight));
        }
        /// <summary>
        /// Creates a square image and attaches an event handler to the layout changed event that
        /// adds the the square in the upper right-hand corner of the TextView via the adornment layer
        /// </summary>
        /// <param name="view">The <see cref="IWpfTextView"/> upon which the adornment will be drawn</param>
        public TranslationAdornment(IWpfTextView view)
        {
            _view = view;

            Brush brush = new SolidColorBrush(Colors.BlueViolet);
            brush.Freeze();
            Brush penBrush = new SolidColorBrush(Colors.Red);
            penBrush.Freeze();
            Pen pen = new Pen(penBrush, 0.5);
            pen.Freeze();

            //draw a square with the created brush and pen
            System.Windows.Rect r = new System.Windows.Rect(0, 0, 30, 30);
            Geometry g = new RectangleGeometry(r);
            GeometryDrawing drawing = new GeometryDrawing(brush, pen, g);
            drawing.Freeze();

            DrawingImage drawingImage = new DrawingImage(drawing);
            drawingImage.Freeze();

            _image = new Image();
            _image.Source = drawingImage;

            //Grab a reference to the adornment layer that this adornment should be added to
            _adornmentLayer = view.GetAdornmentLayer("TranslationAdornment");

            _view.ViewportHeightChanged += delegate { this.onSizeChange(); };
            _view.ViewportWidthChanged += delegate { this.onSizeChange(); };
        }
Example #5
0
        /// <summary>
        /// Draws the background of a selected text.
        /// </summary>
        /// <param name="text">The text</param>
        /// <param name="origin">The location where to start drawing.</param>
        /// <param name="textStyle">The style used to measure selected text.</param>
        /// <param name="start">The starting point of the selection.</param>
        /// <param name="end">The ending point of the selection.</param>
        public virtual void DrawSelectionText(string text, Point origin, TextStyles textStyle, int start, int end)
        {
            Debug.Assert(WpfDrawingContext != null);
            Debug.Assert(start >= 0 && start <= text.Length);
            Debug.Assert(end >= 0 && end <= text.Length);
            Debug.Assert(start <= end);

            Brush         Brush = GetBrush(StyleToForegroundBrush(textStyle));
            FormattedText ft;
            double        X = PagePadding.Left.Draw + origin.X.Draw;
            double        Y = PagePadding.Top.Draw + origin.Y.Draw;

            if (textStyle == TextStyles.Comment)
            {
                X += CommentPadding.Left.Draw;
                Y += CommentPadding.Top.Draw;
            }

            ft = CreateFormattedText(text.Substring(0, start), EmSize, Brush);
            X += ft.WidthIncludingTrailingWhitespace;

            ft = CreateFormattedText(text.Substring(start, end - start), EmSize, Brush);
            System.Windows.Rect SelectionRect = new System.Windows.Rect(X, Y, ft.WidthIncludingTrailingWhitespace, LineHeight.Draw);

            WpfDrawingContext.DrawRectangle(GetBrush(BrushSettings.Selection), GetPen(PenSettings.SelectionText), SelectionRect);
        }
Example #6
0
 public RECT(System.Windows.Rect rect)
 {
     left   = (int)rect.Left;
     top    = (int)rect.Top;
     right  = (int)rect.Right;
     bottom = (int)rect.Bottom;
 }
Example #7
0
        /// <summary>
        /// Sets the window size but ensures that the window is always fully visible (within screen bounds)
        /// If prefferedSize is bigger than the screen bounds, prefferedSize is scaled to fit the screen keeping the aspect ratio
        /// </summary>
        /// <param name="prefferedSize"></param>
        private void SetPrefferedPreviewSize(Size prefferedSize)
        {
            var screen    = Screen.FromMainWindow();
            var maxBounds = Rect.Inflate(screen.WorkingArea, -100, -100);

            Size wndSize = prefferedSize;

            // scale the prefferedSize while keeping the aspect ratio
            double ratio = Math.Min(maxBounds.Width / prefferedSize.Width,
                                    maxBounds.Height / prefferedSize.Height);

            // but only scale if prefferedSize is bigger than the screen bounds
            if (ratio < 1.0)
            {
                int w = (int)Math.Floor(prefferedSize.Width * ratio);
                int h = (int)Math.Floor(prefferedSize.Height * ratio);

                wndSize = new Size(w, h);
            }

            // ensure visible
            Rect wndBounds = Application.Current.MainWindow.GetBounds();

            double xOffset = Math.Min(0.0, maxBounds.Right - (wndBounds.X + wndSize.Width));
            double yOffset = Math.Min(0.0, maxBounds.Bottom - (wndBounds.Y + wndSize.Height));

            // We break MVVM on purpose because binding these values doesn't work well
            Application.Current.MainWindow.Left = wndBounds.X + xOffset;
            Application.Current.MainWindow.Top  = wndBounds.Y + yOffset;
            Application.Current.MainWindow.SetClientSize(wndSize);
        }
Example #8
0
        /// <summary>
        /// Clear selection and unsubscribe any events
        /// </summary>
        public override void UnsubscribeFromPanel()
        {
            if (debug)
            {
                System.Console.WriteLine("Unsubscribed");
            }

            if (sketchPanel == null || !subscribed)
            {
                return;
            }

            sketchPanel.EnableDrawing();
            currentRect = new System.Windows.Rect();
            selection   = new StrokeCollection();
            Selection   = selection;

            // Remove SketchPanel events
            sketchPanel.InkCanvas.StylusMove      -= new System.Windows.Input.StylusEventHandler(InkCanvas_StylusMove);
            sketchPanel.InkCanvas.StylusLeave     -= new System.Windows.Input.StylusEventHandler(InkCanvas_StylusUp);
            sketchPanel.InkCanvas.StylusInAirMove -= new System.Windows.Input.StylusEventHandler(InkCanvas_StylusInAirMove);

            // Remove the Rectangle from the InkCanvas and make hidden
            sketchPanel.InkCanvas.Children.Remove(selectBox);
            sketchPanel.UseCustomCursor = false;
            selectBox.Visibility        = System.Windows.Visibility.Hidden;

            makingSelection = false;
            subscribed      = false;
            selectionMade   = false;
        }
        public static bool TryParseInvariant(this string str, out System.Windows.Rect rect)
        {
            try 
            {
                str = str.Replace("(", "").Replace(")", "").Trim();
                string[] parts = str.Split(new char[]{','}, StringSplitOptions.RemoveEmptyEntries);
                if (parts.Length == 4)
                {
                    double x1, x2, y1, y2;
                    if (true
                        && parts[0].TryParseInvariant(out x1)
                        && parts[1].TryParseInvariant(out y1)
                        && parts[2].TryParseInvariant(out x2)
                        && parts[3].TryParseInvariant(out y2))
                    {
                        rect = new System.Windows.Rect(new System.Windows.Point(x1, y1), new System.Windows.Point(x2, y2));
                        return true;
                    }
                }
            }
            catch (Exception)
            {}

            rect = System.Windows.Rect.Empty;
            return false;
        }
Example #10
0
        private static int CompareCoords(RectangleF Coords1, RectangleF Coords2)
        {
            int Result = Coords1.Left.CompareTo(Coords2.Left);

            if (Result != 0)
            {
                return(Result);
            }
            Result = Coords1.Top.CompareTo(Coords2.Top);
            if (Result != 0)
            {
                return(Result);
            }
            Result = Coords1.Right.CompareTo(Coords2.Right);
            if (Result != 0)
            {
                return(Result);
            }
            Result = Coords1.Bottom.CompareTo(Coords2.Bottom);
            if (Result != 0)
            {
                return(Result);
            }

            return(0);
        }
Example #11
0
        private void GetElementsByPoint(AutomationElement rootElement, Point point, ref AutomationElement targetElem)
        {
            Condition         condition1  = new PropertyCondition(AutomationElement.IsControlElementProperty, true);
            Condition         condition2  = new PropertyCondition(AutomationElement.IsEnabledProperty, true);
            TreeWalker        walker      = new TreeWalker(new AndCondition(condition1, condition2));
            AutomationElement elementNode = walker.GetFirstChild(rootElement);

            //bool flag = true;
            while (elementNode != null)
            {
                object controlTypeNoDefault = elementNode.GetCurrentPropertyValue(AutomationElement.ControlTypeProperty, true);
                //string name = "";
                if (controlTypeNoDefault != AutomationElement.NotSupported)
                {
                    ControlType         controlType  = controlTypeNoDefault as ControlType;
                    System.Windows.Rect boundingRect = (System.Windows.Rect)elementNode.GetCurrentPropertyValue(AutomationElement.BoundingRectangleProperty);
                    if (point.X > boundingRect.Left && point.X < boundingRect.Right && point.Y < boundingRect.Bottom && point.Y > boundingRect.Top && walker.GetFirstChild(elementNode) == null)
                    {
                        targetElem = elementNode;
                        return;
                    }
                }

                //TreeNode childTreeNode = treeNode.Nodes.Add(name);
                WalkEnabledElements(elementNode);
                elementNode = walker.GetNextSibling(elementNode);
            }

            return;
        }
        /// <summary>
        /// Returns the widget that the stylus is over.
        /// </summary>
        /// <param name="stylusPos"></param>
        /// <returns></returns>
        private bool stylusOverWidget(System.Windows.Point stylusPos)
        {
            bool value = false;

            System.Windows.Rect selectionRangeRect = new System.Windows.Rect(selectionPopup.HorizontalOffset - 5 - selectionPopup.Width,
                                                                             selectionPopup.VerticalOffset - 5, selectionPopup.Width + 10, selectionPopup.Height + 10);
            System.Windows.Rect labelRangeRect = new System.Windows.Rect(labelPopup.HorizontalOffset - 5 - labelPopup.Width,
                                                                         labelPopup.VerticalOffset - 5, labelPopup.Width + 10, labelPopup.Height + 10);
            System.Windows.Rect editRangeRect = new System.Windows.Rect(editPopup.HorizontalOffset - 5 - editPopup.Width,
                                                                        editPopup.VerticalOffset - 5, editPopup.Width + 10, editPopup.Height + 10);

            if (selectionActive)
            {
                value = false;
            }
            else if (selectionRangeRect.Contains(stylusPos))
            {
                value = true;
            }
            else if (labelRangeRect.Contains(stylusPos))
            {
                value = true;
            }
            else if (editRangeRect.Contains(stylusPos))
            {
                value = true;
            }

            return(value);
        }
Example #13
0
 /// <summary>
 /// General Constructor for GUIRegion.
 /// </summary>
 /// <param name="nativeHwnd">The window handle for the game window.</param>
 /// <param name="innerBounds">A Rect object to define where and how big the region will be.</param>
 public GUIRegion(IntPtr nativeHwnd, System.Windows.Rect innerBounds)
     : base(nativeHwnd, innerBounds)
 {
     logger.Trace("Creating a new GUIRegion.");
     Publish(this, EventType.ADD);
     Activate += new EventHandler <Tobii.TecSDK.Client.Interaction.ActivateEventArgs>(OnActivate);
 }
 public GeometryAndFlag(List <Geometry> unfilledGeometry, List <Geometry> filledGeometry, System.Windows.Rect rect)
 {
     UnfilledGeometry = unfilledGeometry;
     FilledGeometry   = filledGeometry;
     RecalcGeometry   = false;
     Rect             = rect;
 }
Example #15
0
        private static void CheckRectangleBySize(int width, int height)
        {
            var expected = new System.Windows.Rect(new System.Windows.Size(width, height));
            var actual   = DeepZoomImage.CreateRectangle(new Size(width, height));

            AssertAreEqual(expected, actual);
        }
Example #16
0
        /****************************************************************************/
        /*                          graphical element                               */
        /****************************************************************************/
        private void zoomImage(double x, double y, double scale)
        {
            double lengthC, lengthR;
            double percentC, percentR;
            int    lenC, lenR;

            percentC = (x - ImgCol1) / (ImgCol2 - ImgCol1);
            percentR = (y - ImgRow1) / (ImgRow2 - ImgRow1);

            lengthC = (ImgCol2 - ImgCol1) * scale;
            lengthR = (ImgRow2 - ImgRow1) * scale;

            ImgCol1 = x - lengthC * percentC;
            ImgCol2 = x + lengthC * (1 - percentC);

            ImgRow1 = y - lengthR * percentR;
            ImgRow2 = y + lengthR * (1 - percentR);

            lenC = (int)Math.Round(lengthC);
            lenR = (int)Math.Round(lengthR);

            System.Windows.Rect rect = viewPort.ImagePart;
            rect.X             = (int)Math.Round(ImgCol1);
            rect.Y             = (int)Math.Round(ImgRow1);
            rect.Width         = (lenC > 0) ? lenC : 1;
            rect.Height        = (lenR > 0) ? lenR : 1;
            viewPort.ImagePart = rect;

            zoomWndFactor *= scale;
            repaint();
        }
        private void UpdateAtlasList()
        {
            string filterString = this.textBoxSearch.Text.Trim();
            bool   nofilter     = string.IsNullOrEmpty(filterString);

            this.listViewAtlas.BeginUpdate();
            this.listViewAtlas.Items.Clear();
            NTexAtlasItem item = new NTexAtlasItem();
            bool          next = m_resource.FirstItem(ref item);

            System.Windows.Rect itemRc = new System.Windows.Rect();
            while (next)
            {
                Vector2 itemSize = item.uvEnd - item.uvStart;
                itemRc.X      = item.uvStart.x * m_imgSize.Width;
                itemRc.Y      = item.uvStart.y * m_imgSize.Height;
                itemRc.Width  = itemSize.x * m_imgSize.Width;
                itemRc.Height = itemSize.y * m_imgSize.Height;

                if (nofilter || item.Name.IndexOf(filterString, StringComparison.OrdinalIgnoreCase) != -1)
                {
                    ListViewItem listItem = new ListViewItem();
                    listItem.Text = string.Format("{0} [{1},{2}]", item.Name, itemRc.Width, itemRc.Height);
                    listItem.Tag  = item;
                    this.listViewAtlas.Items.Add(listItem);
                }

                next = m_resource.NextItem(ref item);
            }// end of while()
            this.listViewAtlas.EndUpdate();
        }
Example #18
0
        protected override System.Windows.Size ArrangeOverride( System.Windows.Size arrangeSize )
        {
            if ( Child != null )
            {
                var newSize = SizeToRatio ( arrangeSize, false );

                double widthDelta = arrangeSize.Width - newSize.Width;
                double heightDelta = arrangeSize.Height - newSize.Height;

                double top = 0;
                double left = 0;

                if ( !double.IsNaN ( widthDelta )
                   && !double.IsInfinity ( widthDelta ) )
                {
                    left = widthDelta / 2;
                }

                if ( !double.IsNaN ( heightDelta )
                   && !double.IsInfinity ( heightDelta ) )
                {
                    top = heightDelta / 2;
                }

                var finalRect = new System.Windows.Rect ( new System.Windows.Point ( left, top ), newSize );
                Child.Arrange ( finalRect );
            }

            return arrangeSize;
        }
Example #19
0
        protected override void InnerDraw(GraphicsDisplay display, GeoStar.Core.TrackCancel cancel)
        {
            if (m_TileList.Count == 0)
            {
                return;
            }

            List <QuadTile> vList = new List <QuadTile>();

            lock (this)
            {
                vList.AddRange(m_TileList);
            }
            System.Windows.Media.DrawingContext dc = display.DrawingContext;
            foreach (var item in vList)
            {
                Box box = m_Pyramid.TileExtent(item.Level, item.Row, item.Col);
                System.Windows.Rect rect = display.DT.FromMapWPF(box);

                dc.DrawRectangle(null,
                                 new System.Windows.Media.Pen(System.Windows.Media.Brushes.Red, 1), rect);

                System.Windows.Media.FormattedText formattedText = new System.Windows.Media.FormattedText(
                    string.Format(" {0},{1},{2}", item.Level, item.Row, item.Col),
                    System.Globalization.CultureInfo.CurrentCulture,
                    System.Windows.FlowDirection.LeftToRight,
                    new  System.Windows.Media.Typeface("微软雅黑"),
                    12,
                    System.Windows.Media.Brushes.Black);


                dc.DrawText(formattedText, rect.Location);
            }
        }
Example #20
0
        bool IMessageFilter.PreFilterMessage(ref Message m)
        {
            if (Form.tcMain.SelectedTabPage == Form.tpLibrary && m.Msg == MSG.WM_MOUSEWHEEL)
            {
                System.Windows.Rect  rect = new System.Windows.Rect(0, 0, Form.LibraryControl.PicturePreview.ActualWidth, Form.LibraryControl.PicturePreview.ActualHeight);
                System.Windows.Point pt   = System.Windows.Input.Mouse.GetPosition(Form.LibraryControl.PicturePreview);

                if (rect.Contains(pt))
                {
                    System.Windows.Interop.HwndSource hwndSource = (System.Windows.Interop.HwndSource)System.Windows.Interop.HwndSource.FromVisual(Form.LibraryControl.PicturePreview);
                    NativeMethods.SendMessage(hwndSource.Handle, m.Msg, m.WParam, m.LParam);
                    return(true);
                }
            }
            if (m.Msg == MSG.WM_KEYDOWN || m.Msg == MSG.WM_SYSKEYDOWN || m.Msg == MSG.WM_SYSKEYUP || m.Msg == MSG.WM_KEYUP)
            {
                if (Form.tcMain.SelectedTabPage == Form.tpLibrary)
                {
                    if (Form.LibraryControl.filterTree.ClientRectangle.Contains(Form.LibraryControl.filterTree.PointToClient(Control.MousePosition)))
                    {
                        Form.LibraryControl.TemporaryUpdateFilterOperation(true);
                    }
                }
                //else if(Form.tcMain.SelectedTabPage == Form.tpViewer) {
                //    Form.ViewerControl.ProcessKeyDown((Keys)m.WParam.ToInt32());
                //}
            }
            return(false);
        }
Example #21
0
        private void treeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            UIControlBase control = e.Node.Tag as UIControlBase;

            if (control != null)
            {
                TrackSelection(control);
                if (!(control is WebRoot || control is WPFRoot || control is WatinRoot))
                {
                    try
                    {
                        //Trying to get the layout, (an indication that the control exists
                        System.Windows.Rect dummy = control.Layout;
                        if (dummy == System.Windows.Rect.Empty)
                        {
                            throw new Exception("Layout is empty");
                        }
                    }
                    catch (Exception)
                    {
                        //Control does not exist, changing icon and disabling context menu
                        e.Node.SelectedImageKey = e.Node.ImageKey = "notexists.bmp";
                        e.Node.ContextMenuStrip = null;
                        treeView.Refresh();
                    }
                }
            }
        }
Example #22
0
        internal void SelectBrush(TPdfStream DataStream, PathGradientBrush aBrush, RectangleF Rect, RectangleF RotatedCoords, PointF CenterPoint, string DrawingMatrix)
        {
            ColorBlend cb = null;

            try
            {
                cb = aBrush.InterpolationColors;
            }
            catch (ArgumentException)//Awful way to tell if it has InterpolationColors, but the framework does not give us a choice.
            {
            }

            if (cb == null || cb.Colors.Length == 1)
            {
                cb = GetColorBlendWithoutInterpolationColors(aBrush.Blend, aBrush.SurroundColors[0], aBrush.CenterColor);
            }

            int n = cb.Colors.Length - 1;

            if (cb.Colors[0].A != 255 || cb.Colors[n].A != 255)
            {
                ColorBlend TransparencyBlend = new ColorBlend(2);
                TransparencyBlend.Colors[0]    = ColorUtil.FromArgb(cb.Colors[0].A, cb.Colors[0].A, cb.Colors[0].A);
                TransparencyBlend.Positions[0] = 0;
                TransparencyBlend.Colors[1]    = ColorUtil.FromArgb(cb.Colors[n].A, cb.Colors[n].A, cb.Colors[n].A);
                TransparencyBlend.Positions[1] = 1;
                TPdfGradient SMask = Resources.GetGradient(TGradientType.Radial, TransparencyBlend, Rect, aBrush.CenterPoint, RotatedCoords, DrawingMatrix);
                SelectTransparency(DataStream, 255, TPdfToken.CommandSetAlphaBrush, SMask.GetSMask(), PdfConv.ToRectangleXY(Rect, true));
            }

            Resources.SelectGradient(DataStream, TGradientType.Radial, cb, Rect, CenterPoint, RotatedCoords, DrawingMatrix);
        }
Example #23
0
 public OverlayForm(System.Windows.Rect rect)
 {
     start(rect);
     this.Size       = Screen.PrimaryScreen.Bounds.Size;
     this.Location   = new Point(0, 0);
     this.rectWindow = new Rectangle(this.Location, this.Size);
 }
        /// <summary>
        /// Does a one off calculation of the geometry to be rendered
        /// </summary>
        protected void CalculateGeometry(Factory d2dFactory, System.Windows.Rect rect)
        {
            Func <bool, int, PathGeometry> buildGeometry = (bool isFilled, int pointIndex) => {
                PathGeometry childGeometry = new PathGeometry(d2dFactory);
                using (GeometrySink ctx = childGeometry.Open()) {
                    // Break up into groups of 4
                    ctx.BeginFigure(Points[pointIndex].ToD2D(), isFilled ? FigureBegin.Filled : FigureBegin.Hollow);
                    for (int j = 1; j < 4; ++j)
                    {
                        ctx.AddLine(Points[pointIndex + j].ToD2D());
                    }
                    ctx.AddLine(Points[pointIndex].ToD2D());
                    ctx.EndFigure(isFilled ? FigureEnd.Closed : FigureEnd.Open);
                    ctx.Close();
                }
                return(childGeometry);
            };

            List <Geometry> filledGeometry   = new List <Geometry>();
            List <Geometry> unfilledGeometry = new List <Geometry>();

            if (Points.Count > 0)
            {
                for (int pointIndex = 0, colorIndex = 0; pointIndex < (Points.Count - 3); pointIndex += 4, colorIndex += 1)
                {
                    unfilledGeometry.Add(buildGeometry(false, pointIndex));
                    filledGeometry.Add(buildGeometry(true, pointIndex));
                }
            }
            _geometryByFactory[d2dFactory.NativePointer] = new GeometryAndFlag(unfilledGeometry, filledGeometry, rect);
        }
Example #25
0
 public RectStruct(System.Windows.Rect rect)
 {
     Left   = (int)rect.Left;
     Top    = (int)rect.Top;
     Right  = (int)rect.Right;
     Bottom = (int)rect.Bottom;
 }
        public void RenderFilledElements(PlotRendererD2D canvas, System.Windows.Rect chartArea, System.Windows.Media.MatrixTransform PrimitiveTransform)
        {
            GeometryAndFlag gnf = null;

            if (!_geometryByFactory.TryGetValue(canvas.D2DFactory.NativePointer, out gnf) || gnf.RecalcGeometry)
            {
                CalculateGeometry(canvas.D2DFactory, chartArea);
            }
            if (_geometryByFactory.TryGetValue(canvas.D2DFactory.NativePointer, out gnf))
            {
                int colorIndex = 0;
                foreach (var childGeometry in gnf.FilledGeometry)
                {
                    System.Windows.Media.Color fillColor = _colors[colorIndex].Item2;
                    if (fillColor != System.Windows.Media.Colors.Transparent)
                    {
                        //Brush brush = IsDashed ? (Brush)(ChartUtilities.CreateHatch50(fillColor, new Size(2, 2))) : (Brush)(new SolidColorBrush(fillColor));
                        var brush = new SolidColorBrush(canvas.RenderTarget, fillColor.ToD2D());
                        var transformedGeometry = new TransformedGeometry(canvas.D2DFactory, childGeometry, PrimitiveTransform.ToD2D());
                        canvas.RenderTarget.FillGeometry(transformedGeometry, brush);
                    }
                    ++colorIndex;
                }
            }
        }
Example #27
0
        internal void ConvertCoords(ref int x, ref int y, bool toScreen)
        {
            Adapter adapter = this;
            int     mult    = (toScreen? 1: -1);

            for (;;)
            {
                Adapter parent = adapter.Parent as Adapter;
                if (this is ContextMenu)
                {
                    parent = VirtualParent;
                }
                if (parent == null || parent is TopLevelRootItem)
                {
                    if (adapter is Window)
                    {
                        System.Windows.Rect rect = adapter.BoundingRectangle;
                        x += (int)rect.X * mult;
                        y += (int)rect.Y * mult;
                    }
                    return;
                }
                adapter = parent;
            }
        }
Example #28
0
        void foo(System.Windows.Rect r, int x = 0, int y = 0, int width = 0, int height = 0)
        {
            var rr = new System.Windows.Rect();

            this.foo(
                new System.Windows.Rect
            {
                X      = x,
                Y      = y,
                Width  = width,
                Height = height
            }
                );


            this.foo(
                new System.Windows.Rect
            {
                X      = x,
                Y      = y,
                Width  = width,
                Height = height
            }
                );
        }
Example #29
0
        void foo(System.Windows.Rect r, int x = 0, int y = 0, int width = 0, int height = 0)
        {
            var rr = new System.Windows.Rect();

            this.foo(
                new System.Windows.Rect
                {
                    X = x,
                    Y = y,
                    Width = width,
                    Height = height
                }
            );


            this.foo(
              new System.Windows.Rect
              {
                  X = x,
                  Y = y,
                  Width = width,
                  Height = height
              }
          );
        }
Example #30
0
        /// <summary>
        /// Resizes the given strokes to the specified bounds.
        /// </summary>
        private void Zoom(StrokeCollection strokes, System.Windows.Rect newBounds)
        {
            CM.ExecuteCommand(new CommandList.MoveResizeCmd(ref inkSketch, strokes,
                                                            strokes.GetBounds(), newBounds));

            InkChanged();
        }
        private void pictureBoxMain_MouseClick(object sender, MouseEventArgs e)
        {
            if (m_resource == null)
            {
                return;
            }

            System.Windows.Point clickPt = new System.Windows.Point(e.X, e.Y);
            System.Windows.Rect  itemRc  = new System.Windows.Rect();
            NTexAtlasItem        item    = new NTexAtlasItem();


            bool next = m_resource.FirstItem(ref item);

            while (next)
            {
                Vector2 itemSize = item.uvEnd - item.uvStart;

                itemRc.X      = item.uvStart.x * m_imgSize.Width;
                itemRc.Y      = item.uvStart.y * m_imgSize.Height;
                itemRc.Width  = itemSize.x * m_imgSize.Width;
                itemRc.Height = itemSize.y * m_imgSize.Height;

                if (itemRc.Contains(clickPt))
                {
                    m_selectedItem = item;
                    this.propertyGridItem.SelectedObject = m_selectedItem;
                    this.pictureBoxMain.Invalidate();
                    return;
                }
                next = m_resource.NextItem(ref item);
            }// end of while()

            m_selectedItem = new NTexAtlasItem();
        }
Example #32
0
 public static void SetBounds(this System.Windows.Window wnd, System.Windows.Rect bounds)
 {
     wnd.Left   = bounds.Left;
     wnd.Top    = bounds.Top;
     wnd.Width  = bounds.Width;
     wnd.Height = bounds.Height;
 }
        /// <summary>
        /// Clears a Area in a frame
        /// </summary>
        /// <param name="frame"></param>
        /// <param name="metadata"></param>
        /// <returns></returns>
        private static BitmapSource ClearFrameArea(BitmapSource frame, GifFrameMetaData metadata)
        {
            DrawingVisual visual = new DrawingVisual();

            using (var context = visual.RenderOpen())
            {
                // Clear the place where the new image is placed
                System.Windows.Rect fullRect  = new System.Windows.Rect(0, 0, frame.PixelWidth, frame.PixelHeight);
                System.Windows.Rect clearRect = new System.Windows.Rect(metadata.Left, metadata.Top, metadata.Width, metadata.Height);
                PathGeometry        clip      = Geometry.Combine(new RectangleGeometry(fullRect), new RectangleGeometry(clearRect), GeometryCombineMode.Exclude, null);
                context.PushClip(clip);
                context.DrawImage(frame, fullRect);
            }

            var bitmap = new RenderTargetBitmap(
                frame.PixelWidth, frame.PixelHeight,
                frame.DpiX, frame.DpiY,
                PixelFormats.Pbgra32);

            bitmap.Render(visual);

            var result = new WriteableBitmap(bitmap);

            if (result.CanFreeze && !result.IsFrozen)
            {
                result.Freeze();
            }
            return(result);
        }
 public GeometryAndFlag(GeometryGroup unfilledGeometry, GeometryGroup filledGeometry, System.Windows.Rect rect)
 {
     UnfilledGeometry = unfilledGeometry;
     FilledGeometry   = filledGeometry;
     RecalcGeometry   = false;
     Rect             = rect;
 }
Example #35
0
        public static Screen FromWindow(Window wnd)
        {
            if (wnd == null)
            {
                throw new ArgumentNullException("wnd");
            }

            var hwnd     = new WindowInteropHelper(wnd);
            var hMonitor = Interop.NativeMethods.MonitorFromWindow(hwnd.Handle, Interop.NativeMethods.MONITOR_DEFAULTTONEAREST);

            var mi = new Interop.NativeMethods.MONITORINFOEX();

            Interop.NativeMethods.GetMonitorInfo(hMonitor, mi);

            Rect bounds = new Rect(mi.rcMonitor.left,
                                   mi.rcMonitor.top,
                                   mi.rcMonitor.right - mi.rcMonitor.left,
                                   mi.rcMonitor.bottom - mi.rcMonitor.top);

            Rect workArea = new Rect(mi.rcWork.left,
                                     mi.rcWork.top,
                                     mi.rcWork.right - mi.rcWork.left,
                                     mi.rcWork.bottom - mi.rcWork.top);

            bool primary = (mi.dwFlags & Interop.NativeMethods.MONITORINFOF_PRIMARY) != 0;

            return(new Screen()
            {
                Bounds = bounds, WorkingArea = workArea, IsPrimary = primary
            });
        }
 /// <summary>
 /// UI specific implementation extension method GetBoundingClientRect()
 /// </summary>
 /// <param name="element"></param>
 /// <returns></returns>
 public static System.Windows.Rect GetBoundingClientRect( this GeckoElement element )
 {
     nsIDOMClientRect domRect = element.DOMElement.GetBoundingClientRect();
     if ( domRect == null ) return System.Windows.Rect.Empty;
     var r = new System.Windows.Rect(
         domRect.GetLeftAttribute(),
         domRect.GetTopAttribute(),
         domRect.GetWidthAttribute(),
         domRect.GetHeightAttribute() );
     return r;
 }
Example #37
0
        public override WriteableBitmap GetImageSource(double zoom)
        {
            var scaledOverlay = SpriteBitmapCache.Scale(_overlay, zoom);
            var spriteImg = BitmapFactory.ConvertToPbgra32Format(base.GetImageSource(zoom));
            var centerX = (spriteImg.Width - scaledOverlay.Width) / 2;
            var centerY = (spriteImg.Height - scaledOverlay.Height) / 2;
            var destRect = new System.Windows.Rect(centerX, centerY, scaledOverlay.Width, scaledOverlay.Height);
            spriteImg.Blit(destRect, scaledOverlay, new System.Windows.Rect(0, 0, scaledOverlay.Width, scaledOverlay.Height));

            return spriteImg;
        }
Example #38
0
		public object Create (Image image, float opacity)
		{
			var rect = new System.Windows.Rect (0, 0, image.Size.Width, image.Size.Height);
			return new swm.ImageBrush (image.ToWpf ()) {
				TileMode = swm.TileMode.Tile,
				Opacity = opacity,
				Stretch = swm.Stretch.None,
				ViewboxUnits = swm.BrushMappingMode.Absolute,
				Viewbox = rect,
				ViewportUnits = swm.BrushMappingMode.Absolute,
				Viewport = rect
			};
		}
 private static void CheckRectangleWithTwoPoints(int x1, int y1, int x2, int y2)
 {
     // The constructor below is documented as:
     // "Initializes a new instance of the Rect structure that is
     // exactly large enough to contain the two specified points."
     var expected = new System.Windows.Rect
     (
         new System.Windows.Point (x1, y1),
         new System.Windows.Point (x2 + 1, y2 + 1)
     );
     var actual = DeepZoomImage.CreateRectangle (new Point (x1, y1), new Point (x2, y2));
     AssertAreEqual (expected, actual);
 }
Example #40
0
        public static void Init(TestContext context)
        {
            dp1 = new System.Drawing.Point(10, 10);
            dp2 = new System.Drawing.Point(100, 100);
            drect = new System.Drawing.Rectangle(5, 5, 15, 15);

            wp1 = new System.Windows.Point(10, 10);
            wp2 = new System.Windows.Point(100, 100);
            wrect = new System.Windows.Rect(5, 5, 15, 15);

            fp1 = new System.Drawing.PointF(10, 10);
            fp2 = new System.Drawing.PointF(100, 100);
            frect = new System.Drawing.RectangleF(5, 5, 15, 15);
        }
Example #41
0
 private Monitor(IntPtr monitor)
 {
     var info = new MonitorInfoEx();
     GetMonitorInfo(new HandleRef(null, monitor), info);
     Bounds = new System.Windows.Rect(
                 info.rcMonitor.left, info.rcMonitor.top,
                 info.rcMonitor.right - info.rcMonitor.left,
                 info.rcMonitor.bottom - info.rcMonitor.top);
     WorkingArea = new System.Windows.Rect(
                 info.rcWork.left, info.rcWork.top,
                 info.rcWork.right - info.rcWork.left,
                 info.rcWork.bottom - info.rcWork.top);
     IsPrimary = ((info.dwFlags & MonitorinfofPrimary) != 0);
     Name = new string(info.szDevice).TrimEnd((char)0);
 }
Example #42
0
        public static ImageBrush OverlayImage(ImageSource overlay, ImageSource baseImage)
        {
            ImageBrush brush = null;
            var dv = new DrawingVisual();
            var dc = dv.RenderOpen();
            var rect = new System.Windows.Rect(new System.Windows.Size(baseImage.Width,baseImage.Height));
            dc.DrawImage(baseImage,rect);
            dc.DrawImage(overlay, rect);

            var bmp = new RenderTargetBitmap( (int)rect.Width, (int)rect.Height, 120, 96, PixelFormats.Pbgra32);
            dc.Close();
            bmp.Render(dv);
            brush = new ImageBrush(bmp);

            return brush;
        }
 public static System.Windows.Rect[] GetClientRects( this GeckoElement element )
 {
     nsIDOMClientRectList domRects = element.DOMElement.GetClientRects();
     uint count = domRects.GetLengthAttribute();
     System.Windows.Rect[] rects = new System.Windows.Rect[count];
     for ( uint i = 0; i < count; i++ )
     {
         nsIDOMClientRect domRect = domRects.Item( i );
         rects[ i ] = new System.Windows.Rect(
             domRect.GetLeftAttribute(),
             domRect.GetTopAttribute(),
             domRect.GetWidthAttribute(),
             domRect.GetHeightAttribute() );
         // TODO - check code for memory leaks
         //	Marshal.ReleaseComObject( domRect );
     }
     //Marshal.ReleaseComObject( domRects );
     return rects;
 }
Example #44
0
        public string DownloadAndProcessImage(Uri uri, Rect regionPercentage)
        {
            var engine = new TesseractEngine(_tessdataPath, "hun");

            byte[] imageData;
            try
            {
                var client = new WebClient();
                imageData = client.DownloadData(uri);
                StatisticsCollector.GetInstance().IncrementOutgoingWebRequestCount();

                _log.Debug("Image downloaded from `" + uri + "`. Size: " + imageData.Length + " Byte(s).");
            }
            catch (Exception e)
            {
                _log.Error("Failed to download image from `" + uri + "`. Error: e");
                return "";
            }

            var bitmap = new Bitmap(new MemoryStream(imageData));
            _log.Debug("Image size: " + bitmap.Size);

            // Calculate image region
            var region = new Tesseract.Rect(
                (int) (regionPercentage.Left*bitmap.Width),
                (int) (regionPercentage.Top*bitmap.Height),
                (int) (regionPercentage.Width*bitmap.Width),
                (int) (regionPercentage.Height*bitmap.Height));

            _log.Debug("OCR region: " + region);

            Page page = engine.Process(bitmap, region, PageSegMode.Auto);
            string text = page.GetText();

            _log.Debug("Processed text length: " + text.Length);

            StatisticsCollector.GetInstance().IncrementOcredPageCount();

            return text;
        }
Example #45
0
        private void ParseDescriptionFile(string backDirectory, string[] descriptionLines)
        {
            var oneCardImageDescription = new OneCardImageDescription();

            var lineIndex = 0;

            _backImage = new BitmapImage(new Uri(Path.Combine(backDirectory, descriptionLines[lineIndex++])));

            var imageWidth = _backImage.PixelWidth;
            var imageHeight = _backImage.PixelHeight;

            var backParts = descriptionLines[lineIndex++].Split(' ');
            oneCardImageDescription.HorizontalOffset = int.Parse(backParts[0]);
            oneCardImageDescription.VerticalOffset = int.Parse(backParts[1]);

            var cardSizeParts = descriptionLines[lineIndex].Split(' ');
            oneCardImageDescription.CardWidth = int.Parse(cardSizeParts[0]);
            oneCardImageDescription.CardHeight = int.Parse(cardSizeParts[1]);

            var oneCardImagePositionProvider = new OneCardImagePositionProvider(oneCardImageDescription);

            _viewBox = oneCardImagePositionProvider.GetCardRectangle().Normalize(new CardSize(imageWidth, imageHeight));
        }
Example #46
0
        public static void Init(TestContext context)
        {
            drect = new System.Drawing.Rectangle(5, 5, 5, 5);
            dr1 = new System.Drawing.Rectangle(6, 6, 1, 1); //In
            dr2 = new System.Drawing.Rectangle(3, 3, 5, 5); //Overlap TopLeft
            dr3 = new System.Drawing.Rectangle(0, 0, 15, 15); //Over
            dr4 = new System.Drawing.Rectangle(0, 0, 1, 1); //Out
            dr5 = new System.Drawing.Rectangle(8, 8, 5, 5); //Overlap RightBottom

            frect = new System.Drawing.RectangleF(5, 5, 5, 5);
            fr1 = new System.Drawing.RectangleF(6, 6, 1, 1); //In
            fr2 = new System.Drawing.RectangleF(3, 3, 5, 5); //Overlap TopLeft
            fr3 = new System.Drawing.RectangleF(0, 0, 15, 15); //Over
            fr4 = new System.Drawing.RectangleF(0, 0, 1, 1); //Out
            fr5 = new System.Drawing.RectangleF(8, 8, 5, 5); //Overlap RightBottom

            wrect = new System.Windows.Rect(5, 5, 5, 5);
            wr1 = new System.Windows.Rect(6, 6, 1, 1); //In
            wr2 = new System.Windows.Rect(3, 3, 5, 5); //Overlap TopLeft
            wr3 = new System.Windows.Rect(0, 0, 15, 15); //Over
            wr4 = new System.Windows.Rect(0, 0, 1, 1); //Out
            wr5 = new System.Windows.Rect(8, 8, 5, 5); //Overlap RightBottom
        }
Example #47
0
        public static void UserDrawRasterWPFScreenCoordinate(System.Windows.Media.DrawingContext dc, System.Windows.Media.ImageSource ImageSource,
                                                              int PixelX, int PixelY, int Width, int Height, double angle = 0.0, System.Windows.Media.ImageBrush pImageBrush = null)
        {
            System.Windows.Size sz = new System.Windows.Size(Width, Height);
            System.Windows.Point pnt = new System.Windows.Point(PixelX - sz.Width / 2, PixelY - sz.Height / 2);
            System.Windows.Rect rectBack = new System.Windows.Rect(pnt, sz);
            //if (angle == 0.0)
            //{
            //    dc.DrawImage(ImageSource, rectBack);
            //}
            //else
            //{
            System.Windows.Media.RotateTransform rotRect = new System.Windows.Media.RotateTransform(angle, PixelX, PixelY);

            System.Windows.Media.RectangleGeometry RectGeo = new System.Windows.Media.RectangleGeometry(rectBack);
            RectGeo.Transform = rotRect;
            System.Windows.Media.ImageBrush imbrush = null;
            if (pImageBrush != null)
            {
                imbrush = pImageBrush;
            }
            else if (ImageSource != null)
            {
                imbrush = new System.Windows.Media.ImageBrush(ImageSource);
            }
            // imbrush.Viewport = imbrush.Viewport = new Rect(0, 0, 16, 16);
            //dc.DrawImage(_ImageSource, rectBack);

            if (imbrush != null)
            {
                imbrush.Transform = rotRect;
                dc.DrawGeometry(imbrush, null, RectGeo);
            }


            // }
        }
Example #48
0
        public override void Draw(Graphics dc)
        {
            Pen p = IsDashed ? PensAndBrushes.DashedPen : ThePen;
            float R = (float) (center-p1).Length;   // the radius of the circle
            var diag = new System.Windows.Vector(R,R);
            RectangleF re = new System.Windows.Rect(center+diag, center-diag).ToRectangleF();  // BB of the circle
            System.Windows.Vector v1 = p1 - center, v2 = p2 - center;


            if (IsPie)
            {
                dc.DrawLine(p, center.ToPointF(), p1.ToPointF());
                dc.DrawLine(p, center.ToPointF(), p2.ToPointF());
            }

            float angle2 = (float)( Math.Atan2(v2.Y, v2.X) *180 / Math.PI);
            float angle1 = (float)( Math.Atan2(v1.Y, v1.X) *180 / Math.PI);
            float angle = angle2 - angle1;
            float bngle = angle + (angle>0?-360:360);


            if (     ( IsLargeArc && Math.Abs(angle) < 180)
                 ||  (!IsLargeArc && Math.Abs(angle) > 180) )
                angle = bngle;

            if (re.Height * re.Width > 0)
                dc.DrawArc(p, re, angle1, angle );
            /* TODO
            context.BeginFigure(p1, false, IsPie);
            
            SweepDirection sd;
            if ((v1.X * v2.Y - v1.Y * v2.X > 0) != LargeArc)
                sd = SweepDirection.Clockwise;
            else
                sd = SweepDirection.Counterclockwise;

            context.ArcTo(p2, new Size(r, r), 0, LargeArc, sd, true, false);*/

            
        }
Example #49
0
        public void PropertyConditionTest()
        {
            PropertyCondition cond1 = new PropertyCondition(
                AutomationElement.NameProperty, 
                "foo");
            Assert.IsNotNull(cond1);
            Assert.AreEqual(cond1.Value, "foo");
            Assert.AreEqual(cond1.Property.ProgrammaticName, "AutomationElementIdentifiers.NameProperty");

            System.Windows.Rect rect = new System.Windows.Rect(0, 0, 20, 20);
            PropertyCondition cond2 = new PropertyCondition(
                AutomationElement.BoundingRectangleProperty,
                rect);
            Assert.IsNotNull(cond2);
            object value = cond2.Value;
            Assert.IsInstanceOfType(value, typeof(double[]));
            Assert.AreEqual(((double[])value).Length, 4);
            Assert.AreEqual(cond2.Property.ProgrammaticName, "AutomationElementIdentifiers.BoundingRectangleProperty");

            PropertyCondition cond3 = new PropertyCondition(
                AutomationElement.ClickablePointProperty,
                new System.Windows.Point(0, 0));
            Assert.IsNotNull(cond3);
            value = cond3.Value;
            Assert.IsInstanceOfType(value, typeof(double[]));
            Assert.AreEqual(((double[])value).Length, 2);
            Assert.AreEqual(cond3.Property.ProgrammaticName, "AutomationElementIdentifiers.ClickablePointProperty");

            // Negative case
            try
            {
                PropertyCondition cond4 = new PropertyCondition(
                    null, null);

                Assert.Fail("expected exception");
            }
            catch (System.ArgumentException)
            {
            }



        }
Example #50
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WhereAmI"/> class.
        /// Creates a square image and attaches an event handler to the layout changed event that
        /// adds the the square in the upper right-hand corner of the TextView via the adornment layer
        /// </summary>
        /// <param name="view">The <see cref="IWpfTextView"/> upon which the adornment will be drawn</param>
        /// <param name="settings">The <see cref="IWhereAmISettings"/> injected by the provider</param>
        public WhereAmI(IWpfTextView view, IWhereAmISettings settings)
        {
            _view = view;
            _settings = settings;

            _fileName = new TextBlock();
            _folderStructure = new TextBlock();
            _projectName = new TextBlock();

            ITextDocument textDoc;
            object obj;
            if (view.TextBuffer.Properties.TryGetProperty<ITextDocument>(typeof(ITextDocument), out textDoc))
            {
                // Retrieved the ITextDocument from the first level
            }
            else if (view.TextBuffer.Properties.TryGetProperty<object>("IdentityMapping", out obj))
            {
                // Try to get the ITextDocument from the second level (e.g. Razor files)
                if ((obj as ITextBuffer) != null)
                {
                    (obj as ITextBuffer).Properties.TryGetProperty<ITextDocument>(typeof(ITextDocument), out textDoc);
                }
            }

            // If I found an ITextDocument, access to its FilePath prop to retrieve informations about Proj
            if (textDoc != null)
            {
                string fileName = System.IO.Path.GetFileName(textDoc.FilePath);

                Project proj = GetContainingProject(fileName);
                if (proj != null)
                {
                    string projectName = proj.Name;

                    if (_settings.ViewFilename)
                    {
                        _fileName.Text = fileName;

                        Brush fileNameBrush = new SolidColorBrush(Color.FromArgb(_settings.FilenameColor.A, _settings.FilenameColor.R, _settings.FilenameColor.G, _settings.FilenameColor.B));
                        _fileName.FontFamily = new FontFamily("Consolas");
                        _fileName.FontSize = _settings.FilenameSize;
                        _fileName.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
                        _fileName.TextAlignment = System.Windows.TextAlignment.Right;
                        _fileName.Foreground = fileNameBrush;
                        _fileName.Opacity = _settings.Opacity;
                    }

                    if (_settings.ViewFolders)
                    {
                        _folderStructure.Text = GetFolderDiffs(textDoc.FilePath, proj.FullName);

                        Brush foldersBrush = new SolidColorBrush(Color.FromArgb(_settings.FoldersColor.A, _settings.FoldersColor.R, _settings.FoldersColor.G, _settings.FoldersColor.B));
                        _folderStructure.FontFamily = new FontFamily("Consolas");
                        _folderStructure.FontSize = _settings.FoldersSize;
                        _folderStructure.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
                        _folderStructure.TextAlignment = System.Windows.TextAlignment.Right;
                        _folderStructure.Foreground = foldersBrush;
                        _folderStructure.Opacity = _settings.Opacity;
                    }

                    if (_settings.ViewProject)
                    {
                        _projectName.Text = projectName;

                        Brush projectNameBrush = new SolidColorBrush(Color.FromArgb(_settings.ProjectColor.A, _settings.ProjectColor.R, _settings.ProjectColor.G, _settings.ProjectColor.B));
                        _projectName.FontFamily = new FontFamily("Consolas");
                        _projectName.FontSize = _settings.ProjectSize;
                        _projectName.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
                        _projectName.TextAlignment = System.Windows.TextAlignment.Right;
                        _projectName.Foreground = projectNameBrush;
                        _projectName.Opacity = _settings.Opacity;
                    }
                }
            }

            // Force to have an ActualWidth
            System.Windows.Rect finalRect = new System.Windows.Rect();
            _fileName.Arrange(finalRect);
            _folderStructure.Arrange(finalRect);
            _projectName.Arrange(finalRect);

            //Grab a reference to the adornment layer that this adornment should be added to
            _adornmentLayer = view.GetAdornmentLayer("WhereAmIAdornment");

            _view.ViewportHeightChanged += delegate { this.onSizeChange(); };
            _view.ViewportWidthChanged += delegate { this.onSizeChange(); };
        }
Example #51
0
            private ImageSource PlatedImage(BitmapImage image)
            {
                if (!string.IsNullOrEmpty(BackgroundColor) && BackgroundColor != "transparent")
                {
                    var width = image.Width;
                    var height = image.Height;
                    var x = 0;
                    var y = 0;

                    var group = new DrawingGroup();

                    var converted = ColorConverter.ConvertFromString(BackgroundColor);
                    if (converted != null)
                    {
                        var color = (Color)converted;
                        var brush = new SolidColorBrush(color);
                        var pen = new Pen(brush, 1);
                        var backgroundArea = new Rect(0, 0, width, width);
                        var rectabgle = new RectangleGeometry(backgroundArea);
                        var rectDrawing = new GeometryDrawing(brush, pen, rectabgle);
                        group.Children.Add(rectDrawing);

                        var imageArea = new Rect(x, y, image.Width, image.Height);
                        var imageDrawing = new ImageDrawing(image, imageArea);
                        group.Children.Add(imageDrawing);

                        // http://stackoverflow.com/questions/6676072/get-system-drawing-bitmap-of-a-wpf-area-using-visualbrush
                        var visual = new DrawingVisual();
                        var context = visual.RenderOpen();
                        context.DrawDrawing(group);
                        context.Close();
                        const int dpiScale100 = 96;
                        var bitmap = new RenderTargetBitmap(
                            Convert.ToInt32(width), Convert.ToInt32(height),
                            dpiScale100, dpiScale100,
                            PixelFormats.Pbgra32
                        );
                        bitmap.Render(visual);
                        return bitmap;
                    }
                    else
                    {
                        Log.Error($"Can't convert background string <{BackgroundColor}> to color, Package location: <{Package.Location}>.");
                        return new BitmapImage(new Uri(Constant.ErrorIcon));
                    }
                }
                else
                {
                    // todo use windows theme as background
                    return image;
                }
            }
 private WriteableBitmap CutFrame(WriteableBitmap sheet, Common.Geometry.Rectangle frameRect)
 {
     var wb = new WriteableBitmap(frameRect.Width, frameRect.Height, 96, 96, PixelFormats.Pbgra32, null);
     var srcRect = new System.Windows.Rect(frameRect.X, frameRect.Y, frameRect.Width, frameRect.Height);
     var destRect = new System.Windows.Rect(0, 0, frameRect.Width, frameRect.Height);
     wb.Blit(destRect, sheet, srcRect);
     return wb;
 }
Example #53
0
        private void Calculate()
        {
            // check if already calculated
            if (m_blocks.Count != 0)
                return;

            // calculate first block that is displayed
            int blockIndex = 0;
            for (; blockIndex < m_blame.Blocks.Count; blockIndex++)
            {
                Block block = m_blame.Blocks[blockIndex];
                if (block.StartLine <= m_topLineNumber && block.StartLine + block.LineCount > m_topLineNumber)
                    break;
            }

            // determine the position of each block that is displayed
            int lineCount = 0;
            while (lineCount < m_lineCount && blockIndex < m_blame.Blocks.Count)
            {
                Block block = m_blame.Blocks[blockIndex];
                int hiddenLines = m_topLineNumber - block.StartLine;
                int remainingLines = m_lineCount - lineCount;
                int linesFromThisBlock = Math.Min(block.LineCount - Math.Max(0, hiddenLines), remainingLines);
                double alpha = 0.75 - (block.Commit.CommitDate - m_oldestCommit).TotalDays * m_dateScale;

                const double authorWidth = 10;
                Rect authorPosition = new Rect(0, lineCount * m_lineHeight, authorWidth, linesFromThisBlock * m_lineHeight);
                Rect commitPosition = new Rect(authorWidth, authorPosition.Top, m_columnWidths[0] - authorWidth, authorPosition.Height);

                // add the commit summary if there is space
                Rect summaryPosition = Rect.Empty;

                if (linesFromThisBlock > 1)
                {
                    summaryPosition = commitPosition;
                    summaryPosition.Inflate(-1, -1);
                    summaryPosition.Offset(0, m_lineHeight);
                    summaryPosition.Height = Math.Min(summaryPosition.Height - m_lineHeight, m_renderSize.Height);
                }

                m_blocks.Add(new DisplayBlock(authorPosition, commitPosition, summaryPosition, alpha, m_authorIndex.ContainsKey(block.Commit.Author) ? m_authorIndex[block.Commit.Author] : 0, block));

                blockIndex++;
                lineCount += linesFromThisBlock;
            }

            // determine the source code lines that are visible
            m_lines.Capacity = m_lineCount;
            m_lines.AddRange(m_blame.Lines
                .Skip(m_topLineNumber - 1)
                .Take(m_lineCount)
                .Select((l, n) => new DisplayLine(l, n + m_topLineNumber)));

            // determine which of those lines are new in their respective commits
            lineCount = 0;
            double newLineX = CodeMarginColumn.Right - 5;
            foreach (var lineGroup in m_lines.GroupConsecutiveBy(l => l.IsNew))
            {
                if (lineGroup.Key)
                    m_newLines.Add(new Rect(newLineX, lineCount * m_lineHeight, 5, lineGroup.Count() * m_lineHeight));

                lineCount += lineGroup.Count();
            }
        }
Example #54
0
 public DisplayBlock(Rect authorPosition, Rect commitPosition, Rect summaryPosition, double alpha, int authorIndex, Block block)
 {
     m_authorPosition = authorPosition;
     m_commitPosition = commitPosition;
     m_summaryPosition = summaryPosition;
     m_alpha = alpha;
     m_authorIndex = authorIndex;
     m_block = block;
     m_commit = block.Commit;
 }
 private static void CheckRectangleBySize(int width, int height)
 {
     var expected = new System.Windows.Rect (new System.Windows.Size (width, height));
     var actual = DeepZoomImage.CreateRectangle (new Size (width, height));
     AssertAreEqual (expected, actual);
 }
Example #56
0
        public void ReGenImage(double theight)
        {
            Brush brush = new SolidColorBrush(Colors.LemonChiffon);
            brush.Freeze();
            Brush penBrush = new SolidColorBrush(Colors.White);               //no paddings
            penBrush.Freeze();
            Pen pen = new Pen(penBrush, 0.5);
            pen.Freeze();

            //draw a square with the created brush and pen, specify the start point and width, length of the rect
            System.Windows.Rect r = new System.Windows.Rect(0, 0, _view.ViewportWidth, theight);
            Geometry g = new RectangleGeometry(r);
            GeometryDrawing drawing = new GeometryDrawing(brush, pen, g);
            drawing.Freeze();

            DrawingImage drawingImage = new DrawingImage(drawing);
            drawingImage.Freeze();

            _image = new Image();//
            _image.Source = drawingImage;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ViewportAdornment"/> class.
        /// Creates a square image and attaches an event handler to the layout changed event that
        /// adds the the square in the upper right-hand corner of the TextView via the adornment layer
        /// </summary>
        /// <param name="view">The <see cref="IWpfTextView"/> upon which the adornment will be drawn</param>
        public ViewportAdornment(IWpfTextView view)
        {
            if (view == null)
            {
                throw new ArgumentNullException("view");
            }

            this.view = view;

            var brush = new SolidColorBrush(Colors.BlueViolet);
            brush.Freeze();
            var penBrush = new SolidColorBrush(Colors.Red);
            penBrush.Freeze();
            var pen = new Pen(penBrush, 0.5);
            pen.Freeze();

            // Draw a square with the created brush and pen
            System.Windows.Rect r = new System.Windows.Rect(0, 0, AdornmentWidth, AdornmentHeight);
            var geometry = new RectangleGeometry(r);

            var drawing = new GeometryDrawing(brush, pen, geometry);
            drawing.Freeze();

            var drawingImage = new DrawingImage(drawing);
            drawingImage.Freeze();

            this.image = new Image
            {
                Source = drawingImage,
            };

            this.adornmentLayer = view.GetAdornmentLayer("ViewportAdornment");

            this.view.ViewportHeightChanged += this.OnSizeChanged;
            this.view.ViewportWidthChanged += this.OnSizeChanged;
        }
        private void AppendNewTilesToSheet(List<WriteableBitmap> tempTiles)
        {
            var total = tempTiles.Count;
            var tileWidth = Tilesheet.PixelWidth / 16;
            var addedTileHeight = (int)Math.Ceiling(total / (double)tileWidth);

            var tilesheet = new WriteableBitmap(Tilesheet.PixelWidth, Tilesheet.PixelHeight + addedTileHeight * 16, 96, 96, PixelFormats.Pbgra32, null);
            var writeableSource = BitmapFactory.ConvertToPbgra32Format(Tilesheet);
            var originalRect = new System.Windows.Rect(0, 0, Tilesheet.PixelWidth, Tilesheet.PixelHeight);
            tilesheet.Blit(originalRect, writeableSource, originalRect);

            var x = 0;
            var y = Tilesheet.PixelHeight;
            var source = new System.Windows.Rect(0, 0, 16, 16);

            foreach (var frame in tempTiles)
            {
                var dest = new System.Windows.Rect(x, y, 16, 16);
                tilesheet.Blit(dest, frame, source);

                var tile = Tileset.AddTile();
                tile.Sprite.CurrentFrame.SetSheetPosition(x, y);

                if (x < 16 * (tileWidth - 1))
                {
                    x += 16;
                }
                else
                {
                    x = 0;
                    y += 16;
                }
            }

            Tilesheet = tilesheet;
            SpriteBitmapCache.InsertSource(Tileset.SheetPath.Absolute, tilesheet);
            Tileset.RefreshSheet();
        }
        public void CompactTilesheet()
        {
            var allFrames = RipAllFrames();
            var total = allFrames.Count;
            var root = Math.Sqrt(total);
            var width = (int)Math.Ceiling(root);
            var height = (int)Math.Ceiling(total / (double)width);

            var tilesheet = new WriteableBitmap(width * 16, height * 16, 96, 96, PixelFormats.Pbgra32, null);

            var x = 0;
            var y = 0;
            var source = new System.Windows.Rect(0, 0, 16, 16);

            foreach (var frame in allFrames)
            {
                var dest = new System.Windows.Rect(x, y, 16, 16);
                tilesheet.Blit(dest, frame.Key, source);

                foreach (var spriteFrame in frame.Value)
                {
                    spriteFrame.SetSheetPosition(x, y);
                }

                if (x < 16 * (width - 1))
                {
                    x += 16;
                }
                else
                {
                    x = 0;
                    y += 16;
                }
            }
            
            Tilesheet = tilesheet;
            SpriteBitmapCache.InsertSource(Tileset.SheetPath.Absolute, tilesheet);
            Tileset.RefreshSheet();
        }
Example #60
0
        public static ImageSource ImageSourceAtom(structTransportCommonProperty refTarget)
        {

            string imageKey = "";

            ImageSource imageSource = null;

            System.Windows.Size sz = new System.Windows.Size(24, 24);
            System.Windows.Size szFor = new System.Windows.Size(15, 15);

            System.Windows.Size szP = new System.Windows.Size(20, 20);

            System.Windows.Point pnt = new System.Windows.Point(0, 0);
            System.Windows.Point pntP = new System.Windows.Point(5, 5);
            System.Windows.Point pntFor = new System.Windows.Point(2, 2);


            System.Windows.Rect rectBack = new System.Windows.Rect(pnt, sz);
            System.Windows.Rect rectP = new System.Windows.Rect(pntP, szP);

            System.Windows.Rect rectFor = new System.Windows.Rect(pntFor, szFor);

            ImageSource ImageSourceDrawHand = new BitmapImage(new Uri("pack://application:,,,/Images/PanDrag.ico"));


            

          //  if (refTarget.AtomClass == "GameService.clsGroundAtom" || refTarget.AtomClass == "GameService.clsTarget" || refTarget.AtomClass == "GameService.NavalTask.clsNavalAtom")
            {
                char ch = new char();
                System.Windows.Media.SolidColorBrush curBrush = new System.Windows.Media.SolidColorBrush();


               
                curBrush.Color = System.Windows.Media.Colors.Red;
               



               // ch = (char)refTarget.FontKey;
                ch = (char)150;
                //switch (refTarget.CountryColorSide)
                //{
                //    case COLOR_SIDE.BLUE:
                //        curBrush.Color = System.Windows.Media.Colors.Blue;
                //        break;
                //    case COLOR_SIDE.RED:
                //        curBrush.Color = System.Windows.Media.Colors.Red;
                //        break;
                //    case COLOR_SIDE.GREEN:
                //        curBrush.Color = System.Windows.Media.Colors.Green;
                //        break;
                //    case COLOR_SIDE.WHITE:
                //        curBrush.Color = System.Windows.Media.Colors.Gray;
                //        break;
                //}

                //System.Windows.Media.FormattedText frm = new System.Windows.Media.FormattedText(new string(ch, 1),
                //                                     System.Globalization.CultureInfo.GetCultureInfo("en-us"),
                //                                     System.Windows.FlowDirection.LeftToRight,
                //                                     new System.Windows.Media.Typeface("Simulation Font Environmental"),
                //                                     14, curBrush);

                System.Windows.Media.FormattedText frm = new System.Windows.Media.FormattedText(new string(ch, 1),
                                               System.Globalization.CultureInfo.GetCultureInfo("en-us"),
                                               System.Windows.FlowDirection.LeftToRight,
                                               new System.Windows.Media.Typeface("Wingdings 2"),
                                               42, curBrush);


                frm.TextAlignment = System.Windows.TextAlignment.Center;
                // frm.SetFontWeight(System.Windows.FontWeights.Bold);

                RenderTargetBitmap bmp = new RenderTargetBitmap(36, 36, 120, 96, PixelFormats.Pbgra32);

                DrawingVisual drawingVisual = new DrawingVisual();
                DrawingContext drawingContext = drawingVisual.RenderOpen();

                drawingContext.DrawText(frm, new System.Windows.Point(15, 5));
                drawingContext.DrawImage(ImageSourceDrawHand, rectP);

                drawingContext.Close();

                bmp.Render(drawingVisual);
                imageSource = bmp;


            }

            return imageSource;
        }