Inheritance: DependencyObject
コード例 #1
0
        public static void ReflectAssemblies(System.Windows.Deployment current)
        {
            List <Assembly> assemblies = current.Parts.Select(
                ap => Application.GetResourceStream(new Uri(ap.Source, UriKind.Relative))).Select(
                stream => new AssemblyPart().Load(stream.Stream)).ToList();

            foreach (Assembly asm in assemblies)
            {
                foreach (Type t in asm.GetTypes().Where((at) => { return(at.IsDefined(typeof(ViewModelAttribute), true)); }))
                {
                    ViewModelAttribute vmAtt = t.GetCustomAttributes(true).FirstOrDefault(
                        (a) => { return(a is ViewModelAttribute); }) as ViewModelAttribute;

                    object       instance    = Activator.CreateInstance(t);
                    PropertyInfo pController = t.GetProperty("Controller", BindingFlags.Instance | BindingFlags.Public);
                    if (pController != null)
                    {
                        pController.SetValue(instance, ShellController, null);
                    }
                    ViewModelLocator.Register(vmAtt.ID, instance);
                }
            }
        }
コード例 #2
0
ファイル: UriHelper.cs プロジェクト: kangaroo/moon
		public static void Initialize (Deployment deployment)
		{
			// Store delegates in static fields to make sure they aren't collected by the gc
			functions.ctor_1 = Ctor1;
			functions.ctor_2 = Ctor2;
			functions.ctor_3 = Ctor3;
			functions.ctor_4 = Ctor4;
			functions.get_scheme = GetScheme;
			functions.get_host = GetHost;
			functions.get_port = GetPort;
			functions.get_fragment = GetFragment;
			functions.get_path = GetPath;
			functions.get_query = GetQuery;
			functions.get_original_string = GetOriginalString;
			functions.get_is_absolute = GetIsAbsolute;
			functions.tostring = ToString;
			functions.equals = Equals;
			functions.clone = Clone;
			functions.clone_with_scheme = CloneWithScheme;
			functions.toescapedstring = GetHttpRequestString;

			NativeMethods.deployment_set_uri_functions (deployment.native, ref functions);
		}
コード例 #3
0
		public WeakLayoutUpdatedListener (Deployment source, EventHandler listener)
		{
			Source = source;
			Listener = listener;
			Source.LayoutUpdated += HandleSourceLayoutUpdated;
		}