/// <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);
        }
        // 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);
        }
Exemple #3
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);
 }
Exemple #5
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);
        }
Exemple #6
0
        // pack the argv data and emit the event using TraceEvent
        internal unsafe override uint EventWrite(EventTrace.Event eventID, EventTrace.Keyword keywords, EventTrace.Level level, int argc, EventData *argv)
        {
            ClassicEtw.EVENT_HEADER header;
            header.Header.ClientContext = 0;
            header.Header.Flags         = ClassicEtw.WNODE_FLAG_TRACED_GUID | ClassicEtw.WNODE_FLAG_USE_MOF_PTR;
            header.Header.Guid          = EventTrace.GetGuidForEvent(eventID);
            header.Header.Level         = (byte)level;
            header.Header.Type          = (byte)EventTrace.GetOpcodeForEvent(eventID);
            header.Header.Version       = (ushort)EventTrace.GetVersionForEvent(eventID);
            // Extra copy on XP to move argv to the end of the EVENT_HEADER
            EventData *eventData = &header.Data;

            if (argc > ClassicEtw.MAX_MOF_FIELDS)
            {
                // Data will be lost on XP
                argc = ClassicEtw.MAX_MOF_FIELDS;
            }

            header.Header.Size = (ushort)(argc * sizeof(EventData) + 48);
            for (int x = 0; x < argc; x++)
            {
                eventData[x].Ptr  = argv[x].Ptr;
                eventData[x].Size = argv[x].Size;
            }

            return(ClassicEtw.TraceEvent(_traceHandle, &header));
        }
        // 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);
        }
            // Token: 0x0600872D RID: 34605 RVA: 0x0024F0F8 File Offset: 0x0024D2F8
            internal override bool BuildVisualTree(FrameworkElement container)
            {
                bool flag = EventTrace.IsEnabled(EventTrace.Keyword.KeywordGeneral, EventTrace.Level.Info);

                if (flag)
                {
                    EventTrace.EventProvider.TraceEvent(EventTrace.Event.WClientStringBegin, EventTrace.Keyword.KeywordGeneral, EventTrace.Level.Info, "ContentPresenter.BuildVisualTree");
                }
                bool result;

                try
                {
                    ContentPresenter contentPresenter = (ContentPresenter)container;
                    Visual           visual           = this.DefaultExpansion(contentPresenter.Content, contentPresenter);
                    result = (visual != null);
                }
                finally
                {
                    if (flag)
                    {
                        EventTrace.EventProvider.TraceEvent(EventTrace.Event.WClientStringEnd, EventTrace.Keyword.KeywordGeneral, EventTrace.Level.Info, string.Format(CultureInfo.InvariantCulture, "ContentPresenter.BuildVisualTree for CP {0}", new object[]
                        {
                            container.GetHashCode()
                        }));
                    }
                }
                return(result);
            }
        /// <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));
        }
Exemple #10
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);
        }
Exemple #12
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);
        }
Exemple #13
0
        /// <summary>
        /// </summary>
        protected override Size MeasureOverride(Size constraint)
        {
            Size desiredSize       = new Size();
            bool etwTracingEnabled = IsScrollClient && EventTrace.IsEnabled(EventTrace.Keyword.KeywordGeneral, EventTrace.Level.Info);

            if (etwTracingEnabled)
            {
                EventTrace.EventProvider.TraceEvent(EventTrace.Event.WClientStringBegin, EventTrace.Keyword.KeywordGeneral, EventTrace.Level.Info, "SCROLLCONTENTPRESENTER:MeasureOverride");
            }
            try
            {
                int count = this.VisualChildrenCount;


                if (count > 0)
                {
                    // The AdornerLayer is always the size of our surface, and does not contribute to our own size.
                    _adornerLayer.Measure(constraint);

                    if (!IsScrollClient)
                    {
                        desiredSize = base.MeasureOverride(constraint);
                    }
                    else
                    {
                        Size childConstraint = constraint;

                        if (_scrollData._canHorizontallyScroll)
                        {
                            childConstraint.Width = Double.PositiveInfinity;
                        }
                        if (_scrollData._canVerticallyScroll)
                        {
                            childConstraint.Height = Double.PositiveInfinity;
                        }

                        desiredSize = base.MeasureOverride(childConstraint);
                    }
                }

                // If we're handling scrolling (as the physical scrolling client, validate properties.
                if (IsScrollClient)
                {
                    VerifyScrollData(constraint, desiredSize);
                }

                desiredSize.Width  = Math.Min(constraint.Width, desiredSize.Width);
                desiredSize.Height = Math.Min(constraint.Height, desiredSize.Height);
            }
            finally
            {
                if (etwTracingEnabled)
                {
                    EventTrace.EventProvider.TraceEvent(EventTrace.Event.WClientStringEnd, EventTrace.Keyword.KeywordGeneral, EventTrace.Level.Info, "SCROLLCONTENTPRESENTER:MeasureOverride");
                }
            }
            return(desiredSize);
        }
Exemple #14
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;
 }
Exemple #15
0
 void IBrowserHostServices.PostShutdown()
 {
     EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordHosting, EventTrace.Event.WpfHost_PostShutdown);
     if (this._appProxyInternal != null)
     {
         this._appProxyInternal.PostShutdown();
     }
     BrowserInteropHelper.ReleaseBrowserInterfaces();
 }
Exemple #16
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);
        }
Exemple #17
0
        private void ReportFrame()
        {
            if (!_manipulationEnded)
            {
                EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordInput | EventTrace.Keyword.KeywordPerf, EventTrace.Level.Info, EventTrace.Event.ManipulationReportFrame, 0);

                _manipulationLogic.ReportFrame(_manipulators);
            }
        }
Exemple #18
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);
 }
 public PaymentController(
     UCenterDatabaseContext database,
     Settings settings,
     EventTrace eventTrace)
     : base(database)
 {
     this.settings   = settings;
     this.eventTrace = eventTrace;
 }
        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);
            }
        }
Exemple #21
0
        public ExceptionFilter()
        {
            var ExportProvider = CompositionContainerFactory.Create();

            SettingsInitializer.Initialize <UCenterEventDatabaseContextSettings>(
                ExportProvider,
                SettingsDefaultValueProvider <UCenterEventDatabaseContextSettings> .Default,
                AppConfigurationValueProvider.Default);
            this.eventTrace = ExportProvider.GetExportedValue <EventTrace>();
        }
Exemple #22
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();
 }
Exemple #23
0
 public AccountApiController(
     UCenterDatabaseContext database,
     Settings settings,
     IStorageContext storageContext,
     EventTrace eventTrace)
     : base(database)
 {
     this.settings       = settings;
     this.storageContext = storageContext;
     this.eventTrace     = eventTrace;
 }
 /// <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);
     }
 }
Exemple #25
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);
        }
 /// <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);
     }
 }
Exemple #27
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);
            }
        }
Exemple #28
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);
        }
        //------------------------------------------------------
        //
        //  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;
        }
 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;
 }
Exemple #31
0
 internal bool IsEnabled(EventTrace.Keyword keyword, EventTrace.Level level)
 {
    return _enabled &&
           (level <= _level) &&
           (keyword & _keywords) != 0 &&
           (keyword & _matchAllKeyword) == _matchAllKeyword;
 }
Exemple #32
0
        internal unsafe uint TraceEvent(EventTrace.Event eventID, EventTrace.Keyword keywords, EventTrace.Level level, params object[] eventPayload)
        {
            // It is the responsibility of the caller to check that flags/keywords are enabled before calling this method
            Debug.Assert(IsEnabled(keywords, level));

            int argCount = eventPayload.Length;

            Debug.Assert(argCount <= s_etwMaxNumberArguments);

            uint totalEventSize = 0;
            int stringIndex = 0;
            int[] stringPosition =  new int[s_etwAPIMaxStringCount];
            string [] dataString = new string[s_etwAPIMaxStringCount];
            EventData* userData = stackalloc EventData[argCount];
            EventData* userDataPtr = userData;
            byte* dataBuffer = stackalloc byte[s_basicTypeAllocationBufferSize * argCount];
            byte* currentBuffer = dataBuffer;


            for (int index = 0; index < argCount; index++)
            {
                if (eventPayload[index] != null)
                {
                    string isString = EncodeObject(ref eventPayload[index], userDataPtr, currentBuffer);
                    currentBuffer += s_basicTypeAllocationBufferSize;
                    totalEventSize = userDataPtr->Size;
                    userDataPtr++;
                    if (isString != null)
                    {
                        Debug.Assert(stringIndex < s_etwAPIMaxStringCount); // need to increase string count or emit fewer strings
                        dataString[stringIndex] = isString;
                        stringPosition[stringIndex] = index;
                        stringIndex++;
                    }
                }
            }

            if (totalEventSize > s_traceEventMaximumSize)
            {
                return ErrorEventTooBig;
            }

            fixed(char* s0 = dataString[0], s1 = dataString[1], s2 = dataString[2], s3 = dataString[3],
                    s4 = dataString[4], s5 = dataString[5], s6 = dataString[6], s7 = dataString[7])
            {
                userDataPtr = userData;
                if (dataString[0] != null)
                {
                    userDataPtr[stringPosition[0]].Ptr = (ulong)s0;
                }
                if (dataString[1] != null)
                {
                    userDataPtr[stringPosition[1]].Ptr = (ulong)s1;
                }
                if (dataString[2] != null)
                {
                    userDataPtr[stringPosition[2]].Ptr = (ulong)s2;
                }
                if (dataString[3] != null)
                {
                    userDataPtr[stringPosition[3]].Ptr = (ulong)s3;
                }
                if (dataString[4] != null)
                {
                    userDataPtr[stringPosition[4]].Ptr = (ulong)s4;
                }
                if (dataString[5] != null)
                {
                    userDataPtr[stringPosition[5]].Ptr = (ulong)s5;
                }
                if (dataString[6] != null)
                {
                    userDataPtr[stringPosition[6]].Ptr = (ulong)s6;
                }
                if (dataString[7] != null)
                {
                    userDataPtr[stringPosition[7]].Ptr = (ulong)s7;
                }

                return EventWrite(eventID, keywords, level, argCount, userData);
            }
        }
Exemple #33
0
        internal unsafe uint TraceEvent(EventTrace.Event eventID, EventTrace.Keyword keywords, EventTrace.Level level, object eventData)
        {
            // It is the responsibility of the caller to check that flags/keywords are enabled before calling this method
            Debug.Assert(IsEnabled(keywords, level));

            uint status = 0;
            int argCount = 0;

            EventData userData;
            userData.Size = 0;
            string dataString = null;
            byte* dataBuffer = stackalloc byte[s_basicTypeAllocationBufferSize];

            if (eventData != null)
            {
                dataString = EncodeObject(ref eventData, &userData, dataBuffer);
                argCount = 1;
            }

            if (userData.Size > s_traceEventMaximumSize)
            {
                return ErrorEventTooBig;
            }

            if (dataString != null)
            {
                fixed(char* pdata = dataString)
                {
                    userData.Ptr = (ulong)pdata;
                    status = EventWrite(eventID, keywords, level, argCount, &userData);
                }
            }
            else
            {
                status = EventWrite(eventID, keywords, level, argCount, &userData);
            }

            return status;
        }
Exemple #34
0
        internal unsafe override uint EventWrite(EventTrace.Event eventID, EventTrace.Keyword keywords, EventTrace.Level level, int argc, EventData* argv)
        {
            ClassicEtw.EVENT_HEADER header;
            header.Header.ClientContext = 0;
            header.Header.Flags = ClassicEtw.WNODE_FLAG_TRACED_GUID | ClassicEtw.WNODE_FLAG_USE_MOF_PTR;
            header.Header.Guid = EventTrace.GetGuidForEvent(eventID);
            header.Header.Level = (byte)level;
            header.Header.Type = (byte)EventTrace.GetOpcodeForEvent(eventID);
            header.Header.Version = (ushort)EventTrace.GetVersionForEvent(eventID);
            // Extra copy on XP to move argv to the end of the EVENT_HEADER
            EventData* eventData = &header.Data;

            if (argc > ClassicEtw.MAX_MOF_FIELDS)
            {
                // Data will be lost on XP
                argc = ClassicEtw.MAX_MOF_FIELDS;
            }

            header.Header.Size = (ushort) (argc * sizeof(EventData) + 48);
            for (int x = 0; x < argc; x++)
            {
                eventData[x].Ptr = argv[x].Ptr;
                eventData[x].Size = argv[x].Size;
            }

            return ClassicEtw.TraceEvent(_traceHandle, &header);
        }
Exemple #35
0
 internal unsafe abstract uint EventWrite(EventTrace.Event eventID, EventTrace.Keyword keywords, EventTrace.Level level, int argc, EventData* argv);
Exemple #36
0
        internal unsafe override uint EventWrite(EventTrace.Event eventID, EventTrace.Keyword keywords, EventTrace.Level level, int argc, EventData* argv)
        {
            ManifestEtw.EventDescriptor eventDescriptor;
            eventDescriptor.Id = (ushort) eventID;
            eventDescriptor.Version = EventTrace.GetVersionForEvent(eventID);
            eventDescriptor.Channel = 0x10; // Since Channel isn't supported on XP we only use a single default channel.
            eventDescriptor.Level = (byte)level;
            eventDescriptor.Opcode = EventTrace.GetOpcodeForEvent(eventID);
            eventDescriptor.Task = EventTrace.GetTaskForEvent(eventID);
            eventDescriptor.Keywords = (long)keywords;
            if (argc == 0)
            {
                argv = null;
            }

            return ManifestEtw.EventWrite(_registrationHandle.Value, ref eventDescriptor, (uint)argc, argv);
        }
Exemple #37
0
 internal uint TraceEvent(EventTrace.Event eventID, EventTrace.Keyword keywords, EventTrace.Level level)
 {
     // Optimization for 0-1 arguments
     return TraceEvent(eventID, keywords, level, (object)null);
 }