// Token: 0x06007CB9 RID: 31929 RVA: 0x00231278 File Offset: 0x0022F478
        public void AddAttachedAnnotation(IAttachedAnnotation attachedAnnotation)
        {
            if (this._attachedAnnotation != null)
            {
                throw new ArgumentException(SR.Get("MoreThanOneAttachedAnnotation"));
            }
            EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.AddAttachedHighlightBegin);
            ITextContainer textContainer = this.CheckInputData(attachedAnnotation);
            TextAnchor     range         = attachedAnnotation.AttachedAnchor as TextAnchor;

            this.GetColors(attachedAnnotation.Annotation, out this._background, out this._selectedBackground);
            this._range = range;
            Invariant.Assert(textContainer.Highlights != null, "textContainer.Highlights is null");
            AnnotationHighlightLayer annotationHighlightLayer = textContainer.Highlights.GetLayer(typeof(HighlightComponent)) as AnnotationHighlightLayer;

            if (annotationHighlightLayer == null)
            {
                annotationHighlightLayer = new AnnotationHighlightLayer();
                textContainer.Highlights.AddLayer(annotationHighlightLayer);
            }
            this._attachedAnnotation = attachedAnnotation;
            this._attachedAnnotation.Annotation.CargoChanged += this.OnAnnotationUpdated;
            annotationHighlightLayer.AddRange(this);
            this.HighlightBrush   = new SolidColorBrush(this._background);
            base.IsHitTestVisible = false;
            EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.AddAttachedHighlightEnd);
        }
Ejemplo n.º 2
0
        protected bool ReportUp()
        {
            EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordInput | EventTrace.Keyword.KeywordPerf, EventTrace.Level.Info, EventTrace.Event.TouchUpReported, _deviceId);

            // DevDiv: 971187
            // If there is a hit test pending on the dispatcher queue for this touch device
            // we need to be sure that it is evaluated before we send a touch up.  Otherwise,
            // there may be visual tree changes that have invalidated the over property for
            // this device (such as removing the control we are over from the tree) that will
            // invalidate any touch ups and lead to missing events and other erroneous behavior.
            // This is safe to do as the next touch events for any correct touch device should
            // be constrained to a down or hover/move (if the device is not deactivated).  In
            // those cases another hit test will occur removing the over selected by this test.
            // Any "old" hit tests still on the queue will run either on deactivated device
            // (which is no issue), or mid-stream with other touch messages.  Since the messages
            // available would be downs or moves/hovers, this should be no issue (as they update
            // the hit test as well).  Hit testing is stateless (without capture) so the results
            // will also be the same as another hit test run on the same visual tree.  In cases
            // with capture the hit test is triggered already, so this will not change anything.
            if (_reevaluateOver != null)
            {
                _reevaluateOver = null;

                OnHitTestInvalidatedAsync(this, EventArgs.Empty);
            }

            bool handled = RaiseTouchUp();

            _isDown = false;
            UpdateDirectlyOver(/* isSynchronize = */ false);
            OnUpdated();

            Touch.ReportFrame();
            return(handled);
        }
 private object _CreateRootBrowserWindowCallback(object unused)
 {
     EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordPerf | EventTrace.Keyword.KeywordHosting, EventTrace.Event.WpfHost_RootBrowserWindowSetupStart);
     this.RootBrowserWindow = RootBrowserWindow.CreateAndInitialize();
     EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordPerf | EventTrace.Keyword.KeywordHosting, EventTrace.Event.WpfHost_RootBrowserWindowSetupEnd);
     return(null);
 }
Ejemplo n.º 4
0
        public override ApplicationTrust DetermineApplicationTrust(Evidence applicationEvidence, Evidence activatorEvidence, TrustManagerContext context)
        {
            EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordPerf | EventTrace.Keyword.KeywordHosting, EventTrace.Level.Verbose, EventTrace.Event.WpfHost_DetermineApplicationTrustStart);
            Uri  uriFromActivationData = this.GetUriFromActivationData(0);
            bool flag = PresentationAppDomainManager.IsDebug || this.GetBoolFromActivationData(1);

            BrowserInteropHelper.SetBrowserHosted(true);
            ApplicationTrust applicationTrust;

            if (flag)
            {
                context.IgnorePersistedDecision = true;
                context.Persist   = false;
                context.KeepAlive = false;
                context.NoPrompt  = true;
                applicationTrust  = base.DetermineApplicationTrust(applicationEvidence, activatorEvidence, context);
            }
            else
            {
                Zone hostEvidence = applicationEvidence.GetHostEvidence <Zone>();
                context.NoPrompt = (hostEvidence.SecurityZone != SecurityZone.Intranet && hostEvidence.SecurityZone != SecurityZone.Trusted);
                bool flag2 = !context.NoPrompt && PresentationHostSecurityManager.ElevationPromptOwnerWindow != IntPtr.Zero;
                if (flag2)
                {
                    IntPtr ancestor = UnsafeNativeMethods.GetAncestor(new HandleRef(null, PresentationHostSecurityManager.ElevationPromptOwnerWindow), 2);
                    PresentationHostSecurityManager.SetFakeActiveWindow(ancestor);
                    PresentationHostSecurityManager.ElevationPromptOwnerWindow = IntPtr.Zero;
                }
                try
                {
                    applicationTrust = base.DetermineApplicationTrust(applicationEvidence, activatorEvidence, context);
                }
                finally
                {
                    if (flag2)
                    {
                        PresentationHostSecurityManager.SetFakeActiveWindow((IntPtr)0);
                    }
                }
            }
            if (applicationTrust != null)
            {
                PermissionSet permissionSet = applicationTrust.DefaultGrantSet.PermissionSet;
                if (flag)
                {
                    Uri uriFromActivationData2 = this.GetUriFromActivationData(2);
                    if (uriFromActivationData2 != null)
                    {
                        permissionSet = PresentationHostSecurityManager.AddPermissionForUri(permissionSet, uriFromActivationData2);
                    }
                }
                if (permissionSet is ReadOnlyPermissionSet)
                {
                    permissionSet = new PermissionSet(permissionSet);
                }
                applicationTrust.DefaultGrantSet.PermissionSet = permissionSet;
            }
            EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordPerf | EventTrace.Keyword.KeywordHosting, EventTrace.Level.Verbose, EventTrace.Event.WpfHost_DetermineApplicationTrustEnd);
            return(applicationTrust);
        }
        // Token: 0x060062CF RID: 25295 RVA: 0x001BB61C File Offset: 0x001B981C
        private static Annotation CreateStickyNoteForSelection(AnnotationService service, XmlQualifiedName noteType, string author)
        {
            AnnotationHelper.CheckInputs(service);
            ITextSelection textSelection = AnnotationHelper.GetTextSelection((FrameworkElement)service.Root);

            Invariant.Assert(textSelection != null, "TextSelection is null");
            if (textSelection.IsEmpty)
            {
                throw new InvalidOperationException(SR.Get("EmptySelectionNotSupported"));
            }
            Annotation annotation = null;

            EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.CreateStickyNoteBegin);
            try
            {
                annotation = AnnotationHelper.CreateAnnotationForSelection(service, textSelection, noteType, author);
                Invariant.Assert(annotation != null, "CreateAnnotationForSelection returned null.");
                service.Store.AddAnnotation(annotation);
                textSelection.SetCaretToPosition(textSelection.MovingPosition, textSelection.MovingPosition.LogicalDirection, true, true);
            }
            finally
            {
                EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.CreateStickyNoteEnd);
            }
            return(annotation);
        }
        /// <summary>Adds a new <see cref="T:System.Windows.Annotations.Annotation" /> to the store.</summary>
        /// <param name="newAnnotation">The annotation to add to the store.</param>
        /// <exception cref="T:System.ArgumentNullException">
        ///         <paramref name="newAnnotation" /> is <see langword="null" />.</exception>
        /// <exception cref="T:System.ArgumentException">An <see cref="T:System.Windows.Annotations.Annotation" /> with the same <see cref="P:System.Windows.Annotations.Annotation.Id" /> already is in the store.</exception>
        /// <exception cref="T:System.InvalidOperationException">An I/O <see cref="T:System.IO.Stream" /> has not been set for the store.</exception>
        /// <exception cref="T:System.ObjectDisposedException">
        ///         <see cref="Overload:System.Windows.Annotations.Storage.AnnotationStore.Dispose" /> has been called on the store.</exception>
        // Token: 0x0600636D RID: 25453 RVA: 0x001BF40C File Offset: 0x001BD60C
        public override void AddAnnotation(Annotation newAnnotation)
        {
            if (newAnnotation == null)
            {
                throw new ArgumentNullException("newAnnotation");
            }
            object syncRoot = base.SyncRoot;

            lock (syncRoot)
            {
                EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.AddAnnotationBegin);
                try
                {
                    this.CheckStatus();
                    XPathNavigator annotationNodeForId = this.GetAnnotationNodeForId(newAnnotation.Id);
                    if (annotationNodeForId != null)
                    {
                        throw new ArgumentException(SR.Get("AnnotationAlreadyExists"), "newAnnotation");
                    }
                    if (this._storeAnnotationsMap.FindAnnotation(newAnnotation.Id) != null)
                    {
                        throw new ArgumentException(SR.Get("AnnotationAlreadyExists"), "newAnnotation");
                    }
                    this._storeAnnotationsMap.AddAnnotation(newAnnotation, true);
                }
                finally
                {
                    EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.AddAnnotationEnd);
                }
            }
            this.OnStoreContentChanged(new StoreContentChangedEventArgs(StoreContentAction.Added, newAnnotation));
        }
        /// <summary>Returns the annotation with the specified <see cref="P:System.Windows.Annotations.Annotation.Id" /> from the store.</summary>
        /// <param name="annotationId">The globally unique identifier (GUID) <see cref="P:System.Windows.Annotations.Annotation.Id" /> property of the annotation to be returned.</param>
        /// <returns>The annotation with the given <paramref name="annotationId" />; otherwise, <see langword="null" /> if an annotation with the specified <paramref name="annotationId" /> was not found in the store.</returns>
        /// <exception cref="T:System.ObjectDisposedException">
        ///         <see cref="Overload:System.Windows.Annotations.Storage.AnnotationStore.Dispose" /> has been called on the store.</exception>
        // Token: 0x06006371 RID: 25457 RVA: 0x001BF6E8 File Offset: 0x001BD8E8
        public override Annotation GetAnnotation(Guid annotationId)
        {
            object     syncRoot = base.SyncRoot;
            Annotation result;

            lock (syncRoot)
            {
                Annotation annotation = null;
                EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.GetAnnotationByIdBegin);
                try
                {
                    this.CheckStatus();
                    annotation = this._storeAnnotationsMap.FindAnnotation(annotationId);
                    if (annotation != null)
                    {
                        return(annotation);
                    }
                    XPathNavigator annotationNodeForId = this.GetAnnotationNodeForId(annotationId);
                    if (annotationNodeForId != null)
                    {
                        annotation = (Annotation)XmlStreamStore._serializer.Deserialize(annotationNodeForId.ReadSubtree());
                        this._storeAnnotationsMap.AddAnnotation(annotation, false);
                    }
                }
                finally
                {
                    EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.GetAnnotationByIdEnd);
                }
                result = annotation;
            }
            return(result);
        }
Ejemplo n.º 8
0
 public DocObjHost()
 {
     EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordPerf | EventTrace.Keyword.KeywordHosting, EventTrace.Event.WpfHost_DocObjHostCreated);
     SecurityHelper.DemandUnmanagedCode();
     this._mainThread = Thread.CurrentThread;
     this._initData.Value.ServiceProvider = this;
 }
        /// <summary>Deletes the annotation with the specified <see cref="P:System.Windows.Annotations.Annotation.Id" /> from the store. </summary>
        /// <param name="annotationId">The globally unique identifier (GUID) <see cref="P:System.Windows.Annotations.Annotation.Id" /> property of the annotation to be deleted.</param>
        /// <returns>The annotation that was deleted; otherwise, <see langword="null" /> if an annotation with the specified <paramref name="annotationId" /> was not found in the store.</returns>
        /// <exception cref="T:System.ObjectDisposedException">
        ///         <see cref="Overload:System.Windows.Annotations.Storage.AnnotationStore.Dispose" /> has been called on the store.</exception>
        /// <exception cref="T:System.InvalidOperationException">An I/O <see cref="T:System.IO.Stream" /> has not been set for the store.</exception>
        // Token: 0x0600636E RID: 25454 RVA: 0x001BF4E8 File Offset: 0x001BD6E8
        public override Annotation DeleteAnnotation(Guid annotationId)
        {
            Annotation annotation = null;
            object     syncRoot   = base.SyncRoot;

            lock (syncRoot)
            {
                EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.DeleteAnnotationBegin);
                try
                {
                    this.CheckStatus();
                    annotation = this._storeAnnotationsMap.FindAnnotation(annotationId);
                    XPathNavigator annotationNodeForId = this.GetAnnotationNodeForId(annotationId);
                    if (annotationNodeForId != null)
                    {
                        if (annotation == null)
                        {
                            annotation = (Annotation)XmlStreamStore._serializer.Deserialize(annotationNodeForId.ReadSubtree());
                        }
                        annotationNodeForId.DeleteSelf();
                    }
                    this._storeAnnotationsMap.RemoveAnnotation(annotationId);
                }
                finally
                {
                    EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.DeleteAnnotationEnd);
                }
            }
            if (annotation != null)
            {
                this.OnStoreContentChanged(new StoreContentChangedEventArgs(StoreContentAction.Deleted, annotation));
            }
            return(annotation);
        }
Ejemplo n.º 10
0
        /// <summary>
        ///     Queries the Xml stream for annotations that have an anchor
        ///     that contains a locator that begins with the locator parts
        ///     in anchorLocator.
        /// </summary>
        /// <param name="anchorLocator">the locator we are looking for</param>
        /// <returns>
        ///    A list of annotations that have locators in their anchors
        ///    starting with the same locator parts list as of the input locator
        ///    If no such annotations an empty list will be returned. The method
        ///    never returns null.
        /// </returns>
        /// <exception cref="ObjectDisposedException">if object has been Disposed</exception>
        /// <exception cref="InvalidOperationException">the stream is null</exception>
        public override IList <Annotation> GetAnnotations(ContentLocator anchorLocator)
        {
            // First we generate the XPath expression
            if (anchorLocator == null)
            {
                throw new ArgumentNullException("anchorLocator");
            }

            if (anchorLocator.Parts == null)
            {
                throw new ArgumentNullException("anchorLocator.Parts");
            }

            //fire trace event
            EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.GetAnnotationByLocBegin);
            IList <Annotation> annotations = null;

            try
            {
                string query = @"//" + AnnotationXmlConstants.Prefixes.CoreSchemaPrefix + ":" + AnnotationXmlConstants.Elements.ContentLocator;

                if (anchorLocator.Parts.Count > 0)
                {
                    query += @"/child::*[1]/self::";
                    for (int i = 0; i < anchorLocator.Parts.Count; i++)
                    {
                        if (anchorLocator.Parts[i] != null)
                        {
                            if (i > 0)
                            {
                                query += @"/following-sibling::";
                            }

                            string fragment = anchorLocator.Parts[i].GetQueryFragment(_namespaceManager);

                            if (fragment != null)
                            {
                                query += fragment;
                            }
                            else
                            {
                                query += "*";
                            }
                        }
                    }
                }

                query += @"/ancestor::" + AnnotationXmlConstants.Prefixes.CoreSchemaPrefix + ":Anchors/ancestor::" + AnnotationXmlConstants.Prefixes.CoreSchemaPrefix + ":Annotation";

                annotations = InternalGetAnnotations(query, anchorLocator);
            }
            finally
            {
                //fire trace event
                EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.GetAnnotationByLocEnd);
            }

            return(annotations);
        }
Ejemplo n.º 11
0
        private void ReportFrame()
        {
            if (!_manipulationEnded)
            {
                EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordInput | EventTrace.Keyword.KeywordPerf, EventTrace.Level.Info, EventTrace.Event.ManipulationReportFrame, 0);

                _manipulationLogic.ReportFrame(_manipulators);
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Format and produce a text line either with or without previously known
        /// line break point.
        /// </summary>
        private TextLine FormatLineInternal(
            TextSource textSource,
            int firstCharIndex,
            int lineLength,
            double paragraphWidth,
            TextParagraphProperties paragraphProperties,
            TextLineBreak previousLineBreak,
            TextRunCache textRunCache
            )
        {
            EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordText, EventTrace.Level.Verbose, EventTrace.Event.WClientStringBegin, "TextFormatterImp.FormatLineInternal Start");

            // prepare formatting settings
            FormatSettings settings = PrepareFormatSettings(
                textSource,
                firstCharIndex,
                paragraphWidth,
                paragraphProperties,
                previousLineBreak,
                textRunCache,
                (lineLength != 0), // Do optimal break if break is given
                true,              // isSingleLineFormatting
                _textFormattingMode
                );

            TextLine textLine = null;

            if (!settings.Pap.AlwaysCollapsible &&
                previousLineBreak == null &&
                lineLength <= 0
                )
            {
                // simple text line.
                textLine = SimpleTextLine.Create(
                    settings,
                    firstCharIndex,
                    RealToIdealFloor(paragraphWidth),
                    textSource.PixelsPerDip
                    ) as TextLine;
            }

            if (textLine == null)
            {
                // content is complex, creating complex line
                textLine = new TextMetrics.FullTextLine(
                    settings,
                    firstCharIndex,
                    lineLength,
                    RealToIdealFloor(paragraphWidth),
                    LineFlags.None
                    ) as TextLine;
            }

            EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordText, EventTrace.Level.Verbose, EventTrace.Event.WClientStringEnd, "TextFormatterImp.FormatLineInternal End");

            return(textLine);
        }
Ejemplo n.º 13
0
 // Token: 0x06007A1C RID: 31260 RVA: 0x00229688 File Offset: 0x00227888
 private void XappLauncherApp_Exit(object sender, ExitEventArgs e)
 {
     EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordPerf | EventTrace.Keyword.KeywordHosting, EventTrace.Level.Verbose, EventTrace.Event.WpfHost_XappLauncherAppExit, this._runApplication);
     Invariant.Assert(!this._isInAsynchronousOperation, "Async downloading should have been canceled before XappLauncherApp exits.");
     this.RunApplicationAsyncCallback(null);
     this._browser                   = null;
     this._applicationRunner         = null;
     this._applicationRunnerCallback = null;
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Update the current visual state of the control
 /// </summary>
 /// <param name="useTransitions">
 /// true to use transitions when updating the visual state, false to
 /// snap directly to the new visual state.
 /// </param>
 internal void UpdateVisualState(bool useTransitions)
 {
     EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordGeneral | EventTrace.Keyword.KeywordPerf, EventTrace.Level.Info, EventTrace.Event.UpdateVisualStateStart);
     if (!VisualStateChangeSuspended)
     {
         ChangeVisualState(useTransitions);
     }
     EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordGeneral | EventTrace.Keyword.KeywordPerf, EventTrace.Level.Info, EventTrace.Event.UpdateVisualStateEnd);
 }
Ejemplo n.º 15
0
 void IBrowserHostServices.PostShutdown()
 {
     EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordHosting, EventTrace.Event.WpfHost_PostShutdown);
     if (this._appProxyInternal != null)
     {
         this._appProxyInternal.PostShutdown();
     }
     BrowserInteropHelper.ReleaseBrowserInterfaces();
 }
        public override ObjectHandle CreateInstance(ActivationContext actCtx)
        {
            if (EventTrace.IsEnabled(EventTrace.Keyword.KeywordHosting | EventTrace.Keyword.KeywordPerf, EventTrace.Level.Verbose))
            {
                EventTrace.EventProvider.TraceEvent(EventTrace.Event.WpfHost_ApplicationActivatorCreateInstanceStart,
                                                    EventTrace.Keyword.KeywordHosting | EventTrace.Keyword.KeywordPerf, EventTrace.Level.Verbose,
                                                    PresentationAppDomainManager.ActivationUri != null ? PresentationAppDomainManager.ActivationUri.ToString() : string.Empty);
            }

            ObjectHandle oh;

            if (PresentationAppDomainManager.ActivationUri != null)
            {
                oh = base.CreateInstance(
                    actCtx,
                    new string[] {
                    BindUriHelper.UriToString(PresentationAppDomainManager.ActivationUri),
                    PresentationAppDomainManager.IsDebug.ToString(),
                    (PresentationAppDomainManager.DebugSecurityZoneURL == null?
                     string.Empty
                        : PresentationAppDomainManager.DebugSecurityZoneURL.ToString())
                });
            }
            else
            {
                oh = base.CreateInstance(actCtx);
            }
            bool returnAppDomain = false;

            try
            {
                new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Assert(); // BlessedAssert:
                if (AppDomain.CurrentDomain.ActivationContext != null &&
                    AppDomain.CurrentDomain.ActivationContext.Identity.ToString().Equals(actCtx.Identity.ToString()))
                {
                    returnAppDomain = true;
                }
            }
            finally
            {
                CodeAccessPermission.RevertAssert();
            }

            EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordHosting | EventTrace.Keyword.KeywordPerf, EventTrace.Level.Verbose, EventTrace.Event.WpfHost_ApplicationActivatorCreateInstanceEnd);

            if (returnAppDomain)
            {
                // This is the new AppDomain. What we return here becomes the return value of
                // InPlaceHostingManager.Execute().
                return(new ObjectHandle(AppDomain.CurrentDomain));
            }
            else
            {
                return(oh);
            }
        }
Ejemplo n.º 17
0
 // Token: 0x06007A1B RID: 31259 RVA: 0x0022965B File Offset: 0x0022785B
 private void XappLauncherApp_Startup(object sender, StartupEventArgs e)
 {
     EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordPerf | EventTrace.Keyword.KeywordHosting, EventTrace.Level.Verbose, EventTrace.Event.WpfHost_XappLauncherAppStartup);
     this.CreateApplicationIdentity();
     if (this._identity != null)
     {
         this.TryApplicationIdActivation();
         return;
     }
     this.TryUriActivation();
 }
 /// <summary>Deletes ink sticky note annotations that are wholly contained within the current selection of the viewer control associated with the given <see cref="T:System.Windows.Annotations.AnnotationService" />.</summary>
 /// <param name="service">The annotation service from which to delete ink sticky note annotations.</param>
 /// <exception cref="T:System.ArgumentNullException">
 ///         <paramref name="service" /> is <see langword="null" />.</exception>
 /// <exception cref="T:System.ArgumentException">
 ///         <paramref name="service" /> is not enabled.</exception>
 // Token: 0x060062C0 RID: 25280 RVA: 0x001BB28C File Offset: 0x001B948C
 public static void DeleteInkStickyNotesForSelection(AnnotationService service)
 {
     EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.DeleteInkNoteBegin);
     try
     {
         AnnotationHelper.DeleteSpannedAnnotations(service, StickyNoteControl.InkSchemaName);
     }
     finally
     {
         EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.DeleteInkNoteEnd);
     }
 }
Ejemplo n.º 19
0
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------
        #region Constructors

        /// <summary>
        /// ApplicationProxyInternal is created only for browser-hosted applications.
        /// </summary>
        internal ApplicationProxyInternal()
        {
            EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordHosting | EventTrace.Keyword.KeywordPerf, EventTrace.Level.Verbose, EventTrace.Event.WpfHost_AppProxyCtor);

            if (_proxyInstance != null)
            {
                throw new InvalidOperationException(SR.Get(SRID.MultiSingleton, this.GetType().FullName));
            }
            // Set this here so it will be true for documents or applications (i.e. anything in the browser.)
            BrowserInteropHelper.SetBrowserHosted(true);
            _proxyInstance = this;
        }
Ejemplo n.º 20
0
        private void fireAutomationEvents()
        {
            //no reentrancy. It may happen if one of handlers calls UpdateLayout synchronously
            if (_inFireAutomationEvents)
            {
                return;
            }

            EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordLayout, EventTrace.Level.Verbose, EventTrace.Event.WClientLayoutFireAutomationEventsBegin);
            try
            {
                _inFireAutomationEvents = true;
                _firePostLayoutEvents   = false;

                LayoutEventList.ListItem [] copy = AutomationEvents.CopyToArray();

                for (int i = 0; i < copy.Length; i++)
                {
                    LayoutEventList.ListItem item = copy[i];
                    //store peer here in case if thread gets pre-empted between check for IsAlive and invocation
                    //and GC can run making something that was alive not callable.
                    AutomationPeer peer = null;
                    try
                    {
                        // this will return null if element is already GC'ed
                        peer = (AutomationPeer)(item.Target);
                    }
                    catch (InvalidOperationException) //this will happen if element is being resurrected after finalization
                    {
                        peer = null;
                    }

                    if (peer != null)
                    {
                        peer.FireAutomationEvents();
                        // if handler dirtied the tree, go clean it again before calling other handlers
                        if (hasDirtiness)
                        {
                            break;
                        }
                    }
                    else
                    {
                        AutomationEvents.Remove(item);
                    }
                }
            }
            finally
            {
                _inFireAutomationEvents = false;
                EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordLayout, EventTrace.Level.Verbose, EventTrace.Event.WClientLayoutFireAutomationEventsEnd);
            }
        }
 /// <summary>Clears all highlight annotations from the current selection of the viewer control associated with the given <see cref="T:System.Windows.Annotations.AnnotationService" />.</summary>
 /// <param name="service">The annotation service from which to remove highlight annotations.</param>
 /// <exception cref="T:System.ArgumentNullException">
 ///         <paramref name="service" /> is <see langword="null" />.</exception>
 /// <exception cref="T:System.ArgumentException">
 ///         <paramref name="service" /> is not enabled.</exception>
 // Token: 0x060062BE RID: 25278 RVA: 0x001BB204 File Offset: 0x001B9404
 public static void ClearHighlightsForSelection(AnnotationService service)
 {
     EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.ClearHighlightBegin);
     try
     {
         AnnotationHelper.Highlight(service, null, null, false);
     }
     finally
     {
         EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.ClearHighlightEnd);
     }
 }
Ejemplo n.º 22
0
        protected bool ReportMove()
        {
            EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordInput | EventTrace.Keyword.KeywordPerf, EventTrace.Level.Info, EventTrace.Event.TouchMoveReported, _deviceId);

            UpdateDirectlyOver(/* isSynchronize = */ false);
            bool handled = RaiseTouchMove();

            OnUpdated();

            Touch.ReportFrame();
            return(handled);
        }
Ejemplo n.º 23
0
        //------------------------------------------------------
        //
        //  Public Methods
        //
        //------------------------------------------------------

        /// <summary>
        /// Return the bytes requested
        /// </summary>
        /// <param name="buffer">destination buffer</param>
        /// <param name="offset">offset to write into that buffer</param>
        /// <param name="count">how many bytes requested</param>
        /// <returns>how many bytes were written into buffer</returns>
        /// <remarks>
        /// Blocks until data is available.
        /// The read semantics, and in particular the restoration of the position in case of an
        /// exception, is implemented by the inner stream, i.e. the stream returned by PackWebResponse.
        /// </remarks>
        public override int Read(byte[] buffer, int offset, int count)
        {
            EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordXPS, EventTrace.Level.Verbose, EventTrace.Event.WClientDRXReadStreamBegin, count);

            CheckDisposed();

            int rslt = _innerStream.Read(buffer, offset, count);

            EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordXPS, EventTrace.Level.Verbose, EventTrace.Event.WClientDRXReadStreamEnd, rslt);

            return(rslt);
        }
 internal ApplicationProxyInternal()
 {
     EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordPerf | EventTrace.Keyword.KeywordHosting, EventTrace.Level.Verbose, EventTrace.Event.WpfHost_AppProxyCtor);
     if (ApplicationProxyInternal._proxyInstance != null)
     {
         throw new InvalidOperationException(SR.Get("MultiSingleton", new object[]
         {
             base.GetType().FullName
         }));
     }
     BrowserInteropHelper.SetBrowserHosted(true);
     ApplicationProxyInternal._proxyInstance = this;
 }
        // [....] load a page
        private FixedPage _LoadPage()
        {
            EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordXPS, EventTrace.Event.WClientDRXGetPageBegin);

            FixedPage p = null;
            Stream    pageStream;

            try
            {
                if (_child != null)
                {
                    p = _child;
                }
                else
                {
                    Uri uriToLoad = _ResolveUri();

                    if (uriToLoad != null)
                    {
                        _LoadPageImpl(((IUriContext)this).BaseUri, uriToLoad, out p, out pageStream);

                        if (p == null || p.IsInitialized)
                        {
                            pageStream.Close();
                        }
                        else
                        {
                            _pendingStreams.Add(p, pageStream);
                            p.Initialized += new EventHandler(_OnPaserFinished);
                        }
                    }
                }

                if (p != null)
                {
                    LogicalTreeHelper.AddLogicalChild(this, p);
                    _pageRef = new WeakReference(p);
                }
                else
                {
                    _pageRef = null;
                }
            }
            finally
            {
                EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordXPS, EventTrace.Event.WClientDRXGetPageEnd);
            }

            return(p);
        }
        internal int Run(ApplicationProxyInternal.InitData initData)
        {
            EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordPerf | EventTrace.Keyword.KeywordHosting, EventTrace.Level.Verbose, EventTrace.Event.WpfHost_AppProxyRunStart);
            if (!AppDomain.CurrentDomain.IsDefaultAppDomain())
            {
                IntPtr iunknownForObject = Marshal.GetIUnknownForObject(initData.HostBrowser);
                try
                {
                    initData.HostBrowser = (IHostBrowser)Marshal.GetObjectForIUnknown(iunknownForObject);
                }
                finally
                {
                    Marshal.Release(iunknownForObject);
                }
            }
            BrowserInteropHelper.HostBrowser = initData.HostBrowser;
            MimeType value = initData.MimeType.Value;

            this._mimeType.Value = value;
            this.Uri             = initData.ActivationUri.Value;
            WpfWebRequestHelper.DefaultUserAgent = initData.UserAgentString;
            BrowserInteropHelper.HostingFlags    = initData.HostingFlags;
            this.Move(initData.WindowRect);
            this.Show(initData.ShowWindow);
            switch (value)
            {
            case MimeType.Document:
                throw new NotImplementedException();

            case MimeType.Application:
                goto IL_F6;

            case MimeType.Markup:
            {
                Invariant.Assert(AppDomain.CurrentDomain.FriendlyName == "XamlViewer");
                Application application = new Application();
                application.StartupUri = this.Uri;
                goto IL_F6;
            }
            }
            throw new InvalidOperationException();
IL_F6:
            Application.Current.MimeType = value;
            this.ServiceProvider         = initData.ServiceProvider;
            Application.Current.Dispatcher.Invoke(DispatcherPriority.Send, new DispatcherOperationCallback(this._RunDelegate), initData);
            int result = Application.Current.RunInternal(null);

            EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordPerf | EventTrace.Keyword.KeywordHosting, EventTrace.Level.Verbose, EventTrace.Event.WpfHost_AppProxyRunEnd);
            return(result);
        }
Ejemplo n.º 27
0
        /// <summary>
        ///     Delete the specified annotation.
        /// </summary>
        /// <param name="annotationId">the Id of the annotation to be deleted</param>
        /// <returns>the annotation that was deleted, or null if no annotation
        /// with the specified Id was found</returns>
        /// <exception cref="InvalidOperationException">if no stream has been set on the store</exception>
        /// <exception cref="ObjectDisposedException">if object has been disposed</exception>
        public override Annotation DeleteAnnotation(Guid annotationId)
        {
            Annotation annotation = null;

            // We are now going to modify internal data. Lock the object
            // to avoid modifications from other threads
            lock (SyncRoot)
            {
                //fire trace event
                EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.DeleteAnnotationBegin);

                try
                {
                    CheckStatus();

                    annotation = _storeAnnotationsMap.FindAnnotation(annotationId);

                    XPathNavigator editor = GetAnnotationNodeForId(annotationId);
                    if (editor != null)
                    {
                        // Only deserialize the annotation if its not already in our map
                        if (annotation == null)
                        {
                            annotation = (Annotation)_serializer.Deserialize(editor.ReadSubtree());
                        }
                        editor.DeleteSelf();
                    }

                    // Remove the instance from the map
                    _storeAnnotationsMap.RemoveAnnotation(annotationId);

                    // notice that in Add we add the annotation to the map only
                    // but in delete we delete it from both to the Xml and the map
                }
                finally
                {
                    //fire trace event
                    EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.DeleteAnnotationEnd);
                }
            }

            // Only fire notification if we actually removed an annotation
            if (annotation != null)
            {
                OnStoreContentChanged(new StoreContentChangedEventArgs(StoreContentAction.Deleted, annotation));
            }

            return(annotation);
        }
Ejemplo n.º 28
0
 // Token: 0x06007CD7 RID: 31959 RVA: 0x00231B88 File Offset: 0x0022FD88
 public void RemoveAttachedAnnotation(IAttachedAnnotation attachedAnnotation)
 {
     if (attachedAnnotation == null)
     {
         throw new ArgumentNullException("attachedAnnotation");
     }
     if (attachedAnnotation != this._attachedAnnotation)
     {
         throw new ArgumentException(SR.Get("InvalidAttachedAnnotation"), "attachedAnnotation");
     }
     EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.RemoveAttachedMHBegin);
     this.CleanUpAnchor();
     this._attachedAnnotation = null;
     EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.RemoveAttachedMHEnd);
 }
        /// <summary>Returns a list of annotations that have <see cref="P:System.Windows.Annotations.Annotation.Anchors" /> with locators that begin with a matching <see cref="T:System.Windows.Annotations.ContentLocatorPart" /> sequence.</summary>
        /// <param name="anchorLocator">The starting <see cref="T:System.Windows.Annotations.ContentLocatorPart" /> sequence to return matching annotations for.</param>
        /// <returns>The list of annotations that have <see cref="P:System.Windows.Annotations.Annotation.Anchors" /> with locators that start and match the given <paramref name="anchorLocator" />; otherwise, <see langword="null" /> if no matching annotations were found.</returns>
        // Token: 0x0600636F RID: 25455 RVA: 0x001BF5A4 File Offset: 0x001BD7A4
        public override IList <Annotation> GetAnnotations(ContentLocator anchorLocator)
        {
            if (anchorLocator == null)
            {
                throw new ArgumentNullException("anchorLocator");
            }
            if (anchorLocator.Parts == null)
            {
                throw new ArgumentNullException("anchorLocator.Parts");
            }
            EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.GetAnnotationByLocBegin);
            IList <Annotation> result = null;

            try
            {
                string text = "//anc:ContentLocator";
                if (anchorLocator.Parts.Count > 0)
                {
                    text += "/child::*[1]/self::";
                    for (int i = 0; i < anchorLocator.Parts.Count; i++)
                    {
                        if (anchorLocator.Parts[i] != null)
                        {
                            if (i > 0)
                            {
                                text += "/following-sibling::";
                            }
                            string queryFragment = anchorLocator.Parts[i].GetQueryFragment(this._namespaceManager);
                            if (queryFragment != null)
                            {
                                text += queryFragment;
                            }
                            else
                            {
                                text += "*";
                            }
                        }
                    }
                }
                text  += "/ancestor::anc:Anchors/ancestor::anc:Annotation";
                result = this.InternalGetAnnotations(text, anchorLocator);
            }
            finally
            {
                EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.GetAnnotationByLocEnd);
            }
            return(result);
        }
        /// <summary>Creates a highlight annotation on the current selection of the viewer control associated with the specified <see cref="T:System.Windows.Annotations.AnnotationService" />.</summary>
        /// <param name="service">The annotation service to use to create the highlight annotation.</param>
        /// <param name="author">The author of the annotation.</param>
        /// <param name="highlightBrush">The brush to use to draw the highlight over the selected content.</param>
        /// <returns>The highlight annotation; or <see langword="null" />, if there is no selected content to highlight.</returns>
        /// <exception cref="T:System.ArgumentNullException">
        ///         <paramref name="service" /> is <see langword="null" />.</exception>
        /// <exception cref="T:System.ArgumentException">
        ///         <paramref name="service" /> is not enabled. -or-
        ///         <paramref name="highlightBrush" /> in not a <see cref="T:System.Windows.Media.SolidColorBrush" />.</exception>
        /// <exception cref="T:System.InvalidOperationException">The viewer control contains no content selection.</exception>
        // Token: 0x060062BB RID: 25275 RVA: 0x001BB194 File Offset: 0x001B9394
        public static Annotation CreateHighlightForSelection(AnnotationService service, string author, Brush highlightBrush)
        {
            Annotation annotation = null;

            EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.CreateHighlightBegin);
            try
            {
                annotation = AnnotationHelper.Highlight(service, author, highlightBrush, true);
                Invariant.Assert(annotation != null, "Highlight not returned from create call.");
            }
            finally
            {
                EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.CreateHighlightEnd);
            }
            return(annotation);
        }