Ejemplo n.º 1
0
 public static void ClearInstance()
 {
     if (_instance != null)
     {
         _instance.Dispose();
         _instance = null;
     }
 }
Ejemplo n.º 2
0
        private void App_OnStartup(object sender, StartupEventArgs e)
        {
            IDataTemplateManager manager = ApplicationKernel.Get <IDataTemplateManager>();

            foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
                Type[] types = assembly.GetTypes();
                foreach (Type viewModel in types.Where(x => typeof(ISwitchableViewModel).IsAssignableFrom(x) && !x.IsInterface))
                {
                    string viewName = viewModel.Name.Replace("ViewModel", "View");
                    manager.RegisterDataTemplate(viewModel, types.Single(x => x.Name == viewName));
                }
            }
        }