Ejemplo n.º 1
0
        private Uri GetTrackingUri(string pageUri)
        {
            int i = pageUri.IndexOf('?');

            if (i >= 0)
            {
                pageUri = pageUri.Substring(0, i);
            }

            var b = new StringBuilder();

            b.AppendFormat(CultureInfo.InvariantCulture, "{0}?utmac={1}", GaPixel, _ga);
            b.AppendFormat(CultureInfo.InvariantCulture, "&utmcc={0}", GenerateCookie());
            b.AppendFormat(CultureInfo.InvariantCulture, "&utmwv={0}", TrackingCodeVersion);
            b.AppendFormat(CultureInfo.InvariantCulture, "&utmn={0}", GetRandomAndUnique());
            b.AppendFormat(CultureInfo.InvariantCulture, "&utmdt={0}", Uri.EscapeDataString(_appName));
            b.AppendFormat(CultureInfo.InvariantCulture, "&utmr={0}", ReferralUri);

            IExposeRootFrame ierf = Application.Current as IExposeRootFrame;

            if (ierf != null && ierf.RootFrame != null)
            {
                bool isPortrait = ierf.RootFrame.IsPortrait();
                b.AppendFormat(CultureInfo.InvariantCulture, "&utsr={0}", isPortrait ? PortraitScreenResolution : LandscapeScreenResolution);
            }

            b.AppendFormat(CultureInfo.InvariantCulture, "&utmp={0}",
                           //System.Net.HttpUtility.UrlEncode(
                           Uri.EscapeDataString(
                               pageUri));
            var imageUri = new Uri(b.ToString());

            return(imageUri);
        }
Ejemplo n.º 2
0
        public static WilcoxTransitionFrame GetFrame(this Application app)
        {
            IExposeRootFrame f = app as IExposeRootFrame;

            if (f != null)
            {
                return(f.RootFrame);
            }

            throw new InvalidOperationException("The root frame could not be located.");
            // return null;
        }