Ejemplo n.º 1
0
        /// <summary>
        /// Revert to the original value.
        /// </summary>
        /// <param name="data">
        /// The data.
        /// </param>
        /// <returns>
        /// The <see cref="object"/>.
        /// </returns>
        public object RevertTo(object data)
        {
            if (data is AnnotationState)
            {
                object          current = this.GetData();
                AnnotationState toState = (AnnotationState)data;

                if (toState.Font != this.Font)
                {
                    this.Font = toState.Font;
                }

                if (toState.TextAlignment != this.TextAlignment)
                {
                    this.TextAlignment = toState.TextAlignment;
                }

                if (toState.FontSize != this.FontSize)
                {
                    this.FontSize = toState.FontSize;
                }

                if (toState.FontStyle != this.FontStyle)
                {
                    this.FontStyle = toState.FontStyle;
                }

                if (toState.FontWeight != this.FontWeight)
                {
                    this.FontWeight = toState.FontWeight;
                }

                if (toState.LabelForeground != this.LabelForeground)
                {
                    this.LabelForeground = toState.LabelForeground;
                }

                if (toState.LabelBackground != this.LabelBackground)
                {
                    this.LabelBackground = toState.LabelBackground;
                }

                if (toState.RotateAngle != this.RotateAngle)
                {
                    this.RotateAngle = toState.RotateAngle;
                }

                if (toState.Decoration != this.Decoration)
                {
                    this.Decoration = toState.Decoration;
                }

                return(current);
            }

            return(data);
        }
 public static AnnotationHighlighting CreateHighlighting(AnnotationState annotation)
 {
     switch (annotation.Type)
     {
         case AnnotationType.Error:
             return new ErrorAnnotationHighlighting(annotation);
         case AnnotationType.Warning:
             return new WarningAnnotationHighlighting(annotation);
         case AnnotationType.Info:
             return new InfoAnnotationHighlighting(annotation);
         default:
             throw new ArgumentException("Unsupported annotation.", "annotation");
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="LabelVM" /> class.
        /// </summary>
        public LabelVM()
        {
            // "TextDecorations=\"{Binding Path=Decoration}\"" +
            const string vTemplate =
                "<DataTemplate xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\">"
                + "<Border Padding=\"0\" BorderThickness =\"0\">"
                + "<TextBlock TextAlignment=\"{Binding Path=TextHorizontalAlignment}\""
                + " VerticalAlignment=\"{Binding Path=TextVerticalAlignment}\"" + " FontFamily=\"{Binding Path=Font}\""
                + " FontWeight=\"{Binding Path=FontWeight}\"" + " FontStyle=\"{Binding Path=FontStyle}\""
                + " FontSize=\"{Binding Path=FontSize}\"" + " TextWrapping=\"{Binding Path=WrapText}\""
                + " Margin=\"{Binding Path=LabelMargin}\"" + " Foreground=\"{Binding Path=LabelForeground}\""
                + " TextDecorations=\"{Binding Path=Decoration}\"" + " Text=\"{Binding Path=Content, Mode=TwoWay}\"/>"
                + "</Border>" + "</DataTemplate>";

            const string eTemplate = "<DataTemplate"
                                     + " xmlns:util=\"clr-namespace:Syncfusion.UI.Xaml.Diagram.Utility;assembly=Syncfusion.SfDiagram.Wpf\""
                                     + " xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\">"
                                     + "<TextBox util:FocusUtility.FocusOnLoad=\"True\" "
                                     + "TextAlignment =\"{Binding Path=TextHorizontalAlignment}\""
                                     + " FontFamily=\"{Binding Path=Font}\""
                                     + " TextWrapping=\"{Binding Path=WrapText}\""
                                     + " FontWeight=\"{Binding Path=FontWeight}\""
                                     + " FontStyle=\"{Binding Path=FontStyle}\""
                                     + " FontSize=\"{Binding Path=FontSize}\""
                                     + " Margin=\"{Binding Path=LabelMargin}\"" + " AcceptsReturn=\"True\""
                                     + " TextDecorations=\"{Binding Path=Decoration}\""
                                     + " Background=\"{Binding Path=LabelBackground}\""
                                     + " Text=\"{Binding Path=Content, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}\"/>"
                                     + "</DataTemplate>";
            StringReader srReader  = new StringReader(vTemplate);
            StringReader srReader1 = new StringReader(eTemplate);
            XmlReader    ms        = XmlReader.Create(srReader);
            XmlReader    ms1       = XmlReader.Create(srReader1);

            this.ViewTemplate = XamlReader.Load(ms) as DataTemplate;
            this.EditTemplate = XamlReader.Load(ms1) as DataTemplate;

            // this.WrapText = TextWrapping.Wrap;
            this._mCollectionData = new AnnotationState(
                this.Font,
                this.FontWeight,
                this.FontStyle,
                this.TextAlignment,
                this.FontSize,
                this.LabelBackground,
                this.LabelForeground,
                this.RotateAngle,
                this.Decoration);
        }
        public static AnnotationHighlighting CreateHighlighting(AnnotationState annotation)
        {
            switch (annotation.Type)
            {
            case AnnotationType.Error:
                return(new ErrorAnnotationHighlighting(annotation));

            case AnnotationType.Warning:
                return(new WarningAnnotationHighlighting(annotation));

            case AnnotationType.Info:
                return(new InfoAnnotationHighlighting(annotation));

            default:
                throw new ArgumentException("Unsupported annotation.", "annotation");
            }
        }
Ejemplo n.º 5
0
        /*
         * Returns true if annotations are supported (we are running on Android
         * and successfully initiatised the library, false otherwise
         */
        private static bool canDoAnnotations()
        {
#if UNITY_ANDROID
            if (state == AnnotationState.Uninitialised)
            {
                try
                {
                    gator_annotate_setup();
                    state = AnnotationState.Active;
                    return(true);
                }
                catch (System.EntryPointNotFoundException)
                {
                    state = AnnotationState.Inactive;
                    return(false);
                }
            }
#else
            state = AnnotationState.Inactive;
#endif
            return(state == AnnotationState.Active);
        }
Ejemplo n.º 6
0
        public static PDFString PDFAnnotationStateToPDFString(AnnotationState state)
        {
            switch (state)
            {
            case AnnotationState.Accepted:
                return(new PDFString(System.Text.Encoding.ASCII.GetBytes("Accepted"), false));

            case AnnotationState.Cancelled:
                return(new PDFString(System.Text.Encoding.ASCII.GetBytes("Cancelled"), false));

            case AnnotationState.Completed:
                return(new PDFString(System.Text.Encoding.ASCII.GetBytes("Completed"), false));

            case AnnotationState.Marked:
                return(new PDFString(System.Text.Encoding.ASCII.GetBytes("Marked"), false));

            case AnnotationState.Rejected:
                return(new PDFString(System.Text.Encoding.ASCII.GetBytes("Rejected"), false));

            case AnnotationState.Unmarked:
                return(new PDFString(System.Text.Encoding.ASCII.GetBytes("Unmarked"), false));
            }
            return(new PDFString(System.Text.Encoding.ASCII.GetBytes("None"), false));
        }
 protected AnnotationHighlighting(AnnotationState annotation)
 {
     this.annotation = annotation;
 }
Ejemplo n.º 8
0
 public WarningAnnotationHighlighting(AnnotationState annotation)
     : base(annotation)
 {
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TextAnnotation" /> class.
 /// </summary>
 /// <param name="Links">Link to the document..</param>
 /// <param name="Color">Color of the annotation..</param>
 /// <param name="Contents">Get the annotation content..</param>
 /// <param name="Modified">The date and time when the annotation was last modified..</param>
 /// <param name="Id">Gets ID of the annotation..</param>
 /// <param name="Flags">Gets Flags of the annotation..</param>
 /// <param name="Name">Gets Name of the annotation..</param>
 /// <param name="Rect">Gets Rect of the annotation..</param>
 /// <param name="PageIndex">Gets PageIndex of the annotation..</param>
 /// <param name="ZIndex">Gets ZIndex of the annotation..</param>
 /// <param name="HorizontalAlignment">Gets HorizontalAlignment of the annotation..</param>
 /// <param name="VerticalAlignment">Gets VerticalAlignment of the annotation..</param>
 /// <param name="CreationDate">The date and time when the annotation was created..</param>
 /// <param name="Subject">Get the annotation subject..</param>
 /// <param name="Title">Get the annotation title..</param>
 /// <param name="RichText">Get the annotation RichText..</param>
 /// <param name="State">Gets or sets the state to which the original annotation should be set..</param>
 /// <param name="Open">Gets or sets is the annotation open..</param>
 /// <param name="Icon">Gets or sets an icon to be used in displaying the annotation..</param>
 public TextAnnotation(List <Link> Links = default(List <Link>), Color Color = default(Color), string Contents = default(string), string Modified = default(string), string Id = default(string), List <AnnotationFlags> Flags = default(List <AnnotationFlags>), string Name = default(string), Rectangle Rect = default(Rectangle), int?PageIndex = default(int?), int?ZIndex = default(int?), HorizontalAlignment HorizontalAlignment = default(HorizontalAlignment), VerticalAlignment VerticalAlignment = default(VerticalAlignment), string CreationDate = default(string), string Subject = default(string), string Title = default(string), string RichText = default(string), AnnotationState State = default(AnnotationState), bool?Open = default(bool?), TextIcon Icon = default(TextIcon))
 {
     this.Links               = Links;
     this.Color               = Color;
     this.Contents            = Contents;
     this.Modified            = Modified;
     this.Id                  = Id;
     this.Flags               = Flags;
     this.Name                = Name;
     this.Rect                = Rect;
     this.PageIndex           = PageIndex;
     this.ZIndex              = ZIndex;
     this.HorizontalAlignment = HorizontalAlignment;
     this.VerticalAlignment   = VerticalAlignment;
     this.CreationDate        = CreationDate;
     this.Subject             = Subject;
     this.Title               = Title;
     this.RichText            = RichText;
     this.State               = State;
     this.Open                = Open;
     this.Icon                = Icon;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TextAnnotation" /> class.
 /// </summary>
 /// <param name="Links">Link to the document.</param>
 /// <param name="Color">Color of the annotation.</param>
 /// <param name="Contents">Get the annotation content.</param>
 /// <param name="Modified">The date and time when the annotation was last modified.</param>
 /// <param name="Id">Gets ID of the annotation.</param>
 /// <param name="Flags">Gets Flags of the annotation.</param>
 /// <param name="Name">Gets Name of the annotation.</param>
 /// <param name="Rect">Gets Rect of the annotation. (required)</param>
 /// <param name="PageIndex">Gets PageIndex of the annotation.</param>
 /// <param name="ZIndex">Gets ZIndex of the annotation.</param>
 /// <param name="HorizontalAlignment">Gets HorizontalAlignment of the annotation.</param>
 /// <param name="VerticalAlignment">Gets VerticalAlignment of the annotation.</param>
 /// <param name="CreationDate">The date and time when the annotation was created.</param>
 /// <param name="Subject">Get the annotation subject.</param>
 /// <param name="Title">Get the annotation title.</param>
 /// <param name="RichText">Get the annotation RichText.</param>
 /// <param name="State">Gets or sets the state to which the original annotation should be set.</param>
 /// <param name="Open">Gets or sets is the annotation open.</param>
 /// <param name="Icon">Gets or sets an icon to be used in displaying the annotation.</param>
 public TextAnnotation(List <Link> Links = default(List <Link>), Color Color = default(Color), string Contents = default(string), string Modified = default(string), string Id = default(string), List <AnnotationFlags> Flags = default(List <AnnotationFlags>), string Name = default(string), Rectangle Rect = default(Rectangle), int?PageIndex = default(int?), int?ZIndex = default(int?), HorizontalAlignment HorizontalAlignment = default(HorizontalAlignment), VerticalAlignment VerticalAlignment = default(VerticalAlignment), string CreationDate = default(string), string Subject = default(string), string Title = default(string), string RichText = default(string), AnnotationState State = default(AnnotationState), bool?Open = default(bool?), TextIcon Icon = default(TextIcon))
 {
     // to ensure "Rect" is required (not null)
     if (Rect == null)
     {
         throw new InvalidDataException("Rect is a required property for TextAnnotation and cannot be null");
     }
     else
     {
         this.Rect = Rect;
     }
     this.Links               = Links;
     this.Color               = Color;
     this.Contents            = Contents;
     this.Modified            = Modified;
     this.Id                  = Id;
     this.Flags               = Flags;
     this.Name                = Name;
     this.PageIndex           = PageIndex;
     this.ZIndex              = ZIndex;
     this.HorizontalAlignment = HorizontalAlignment;
     this.VerticalAlignment   = VerticalAlignment;
     this.CreationDate        = CreationDate;
     this.Subject             = Subject;
     this.Title               = Title;
     this.RichText            = RichText;
     this.State               = State;
     this.Open                = Open;
     this.Icon                = Icon;
 }
Ejemplo n.º 11
0
 public void TestCleanup()
 {
     _state = null;
 }
Ejemplo n.º 12
0
 public void TestInitialize()
 {
     _state = new AnnotationState(null);
 }
 public WarningAnnotationHighlighting(AnnotationState annotation)
     : base(annotation)
 {
 }
 public InfoAnnotationHighlighting(AnnotationState annotation)
     : base(annotation)
 {
 }
 public InfoAnnotationHighlighting(AnnotationState annotation)
     : base(annotation)
 {
 }
 public ErrorAnnotationHighlighting(AnnotationState annotation)
     : base(annotation)
 {
 }
 public ErrorAnnotationHighlighting(AnnotationState annotation)
     : base(annotation)
 {
 }
 protected AnnotationHighlighting(AnnotationState annotation)
 {
     this.annotation = annotation;
 }