Ejemplo n.º 1
0
        public static NavigationContext RestoreContext(this IDictionary <string, string> query)
        {
            string encodedContext;

            if (query.TryGetValue(Key, out encodedContext))
            {
                var json = Base64Decode(encodedContext);
                var navigationSerializer = new NavigationSerializer();
                return(navigationSerializer.Deserialize <NavigationContext>(json));
            }
            var actualQuery = query.Select(s => string.Format(" [{0}:{1}]", s.Key, s.Value)).Aggregate((s, a) => s + a);

            throw new NavigationException("Can't restore context, actual query is:" + actualQuery);
        }
Ejemplo n.º 2
0
        public static NavigationContext <TData> RestoreContext <TData>(this IDictionary <string, string> query)
        {
            Debug.WriteLine("NavigationQueryExtension::RestoreContext<{0}>", typeof(TData));
            string encodedContext;

            if (query.TryGetValue(Key, out encodedContext))
            {
                Debug.WriteLine("NavigationQueryExtension::EncodedContext " + encodedContext);
                var json = Base64Decode(encodedContext);
                var navigationSerializer = new NavigationSerializer();
                return(navigationSerializer.Deserialize <NavigationContext <TData> >(json));
            }
            var actualQuery = query.Select(s => string.Format(" [{0}:{1}]", s.Key, s.Value)).Aggregate((s, a) => s + a);

            throw new NavigationException("Can't restore context, actual query is:" + actualQuery);
        }