예제 #1
0
        private WindowsRuntimeDesignerContext(IEnumerable <string> paths, string name, bool designModeRequired)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (paths == null)
            {
                throw new ArgumentNullException("paths");
            }
            if (!AppDomain.CurrentDomain.IsDefaultAppDomain())
            {
                throw new NotSupportedException();
            }
            if (!AppDomain.IsAppXModel())
            {
                throw new NotSupportedException();
            }
            if (designModeRequired && !AppDomain.IsAppXDesignMode())
            {
                throw new NotSupportedException();
            }
            this.m_name = name;
            object obj = WindowsRuntimeDesignerContext.s_lock;

            lock (obj)
            {
                if (WindowsRuntimeDesignerContext.s_sharedContext == IntPtr.Zero)
                {
                    WindowsRuntimeDesignerContext.InitializeSharedContext(new string[0]);
                }
            }
            this.m_contextObject = WindowsRuntimeDesignerContext.CreateDesignerContext(paths, false);
        }
예제 #2
0
 public static void SetIterationContext(WindowsRuntimeDesignerContext context)
 {
     if (!AppDomain.CurrentDomain.IsDefaultAppDomain())
     {
         throw new NotSupportedException();
     }
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     lock (WindowsRuntimeDesignerContext.s_lock)
         WindowsRuntimeDesignerContext.SetCurrentContext(true, context.m_contextObject);
 }
예제 #3
0
        internal static IntPtr CreateDesignerContext(IEnumerable <string> paths, [MarshalAs(UnmanagedType.Bool)] bool shared)
        {
            List <string> list = new List <string>(paths);

            string[] array = list.ToArray();
            foreach (string text in array)
            {
                if (text == null)
                {
                    throw new ArgumentNullException(Environment.GetResourceString("ArgumentNull_Path"));
                }
                if (Path.IsRelative(text))
                {
                    throw new ArgumentException(Environment.GetResourceString("Argument_AbsolutePathRequired"));
                }
            }
            return(WindowsRuntimeDesignerContext.CreateDesignerContext(array, array.Length, shared));
        }
예제 #4
0
        internal static IntPtr CreateDesignerContext(IEnumerable <string> paths, [MarshalAs(UnmanagedType.Bool)] bool shared)
        {
            string[] array = new List <string>(paths).ToArray();
            foreach (string path in array)
            {
                if (path == null)
                {
                    throw new ArgumentNullException(Environment.GetResourceString("ArgumentNull_Path"));
                }
                if (Path.IsRelative(path))
                {
                    throw new ArgumentException(Environment.GetResourceString("Argument_AbsolutePathRequired"));
                }
            }
            string[] paths1 = array;
            int      length = paths1.Length;
            int      num    = shared ? 1 : 0;

            return(WindowsRuntimeDesignerContext.CreateDesignerContext(paths1, length, num != 0));
        }
예제 #5
0
 public static void InitializeSharedContext(IEnumerable <string> paths)
 {
     if (!AppDomain.CurrentDomain.IsDefaultAppDomain())
     {
         throw new NotSupportedException();
     }
     if (paths == null)
     {
         throw new ArgumentNullException("paths");
     }
     lock (WindowsRuntimeDesignerContext.s_lock)
     {
         if (WindowsRuntimeDesignerContext.s_sharedContext != IntPtr.Zero)
         {
             throw new NotSupportedException();
         }
         IntPtr local_2 = WindowsRuntimeDesignerContext.CreateDesignerContext(paths, true);
         WindowsRuntimeDesignerContext.SetCurrentContext(false, local_2);
         WindowsRuntimeDesignerContext.s_sharedContext = local_2;
     }
 }
 public static void SetIterationContext(WindowsRuntimeDesignerContext context)
 {
     throw new NotImplementedException();
 }
        public static void SetIterationContext(WindowsRuntimeDesignerContext context)
        {
            // WindowsRuntimeDesignerContext is only supported in the default domain.
            if (!AppDomain.CurrentDomain.IsDefaultAppDomain())
                throw new NotSupportedException();

            if (context == null)
                throw new ArgumentNullException("context");

            lock (s_lock)
            {
                SetCurrentContext(true, context.m_contextObject);
            }
        }