Exemplo n.º 1
0
        public static void RegisterAllViewModelsForPages(this SimpleContainer container)
        {
            var pages = from assembly in AssemblySource.Instance
                        from type in assembly.GetTypes()
                        where typeof(PhoneApplicationPage).IsAssignableFrom(type)
                        select type;

            foreach (var page in pages)
            {
                var key = ViewModelLocator.DetermineKeyForViewType(page);

                var viewModelType = (from assembly in AssemblySource.Instance
                                     from type in assembly.GetTypes()
                                     where type.Name == key
                                     select type).FirstOrDefault();

                if (viewModelType != null)
                {
                    container.RegisterPerRequestPageVM(viewModelType);
                }
            }
        }
Exemplo n.º 2
0
 public static void RegisterPerRequestPageVM <TViewModel>(this SimpleContainer container)
 {
     container.RegisterPerRequestPageVM(typeof(TViewModel));
 }