Ejemplo n.º 1
0
        public Shell()
        {
            InitializeComponent();

            AppDomain.CurrentDomain.AssemblyResolve += this.OnAssemblyResolve;

            container =
                new ConfigurationContainer(GetProfile(App.CommandLineParameters.ProfileFileName));

            container.RegisterInstance<IUIServiceWpf>(this);
            container.RegisterInstance<IWindowsFormsEditorService>(this);
            container.RegisterInstance<IUIService>(this);
            container.RegisterInstance<IAssemblyDiscoveryService>(new LoadedAssembliesDiscoveryService());

            container.DiscoverSubstituteTypesFromAssemblies();

            applicationModel = container.Resolve<IApplicationModel>();
            DataContext = applicationModel;

            applicationModel.New();
            applicationModel.OnCloseAction = () => RequestClose();

            InputBindings.Add(new InputBinding(applicationModel.NewConfigurationCommand, new KeyGesture(Key.N, ModifierKeys.Control)));
            InputBindings.Add(new InputBinding(applicationModel.SaveConfigurationCommand, new KeyGesture(Key.S, ModifierKeys.Control)));
            InputBindings.Add(new InputBinding(applicationModel.SaveAsConfigurationCommand, new KeyGesture(Key.A, ModifierKeys.Control)));
            InputBindings.Add(new InputBinding(applicationModel.OpenConfigurationCommand, new KeyGesture(Key.O, ModifierKeys.Control)));
        }
 public static void Registration(ConfigurationContainer container, Profile profile)
 {
     container.RegisterType<AssemblyLocator, BinPathProbingAssemblyLocator>(new ContainerControlledLifetimeManager());
     container.RegisterType<ConfigurationSectionLocator, AssemblyAttributeSectionLocator>(new ContainerControlledLifetimeManager());
     container.RegisterType<AnnotationService>(new ContainerControlledLifetimeManager());
     container.RegisterType<ElementLookup>(new ContainerControlledLifetimeManager());
     container.RegisterType<ConfigurationSourceModel>(new ContainerControlledLifetimeManager());
     container.RegisterType<ViewModel.Services.MenuCommandService>(new ContainerControlledLifetimeManager());
     container.RegisterType<ConfigurationSourceDependency>(new ContainerControlledLifetimeManager());
     container.RegisterType<IApplicationModel, ApplicationViewModel>(new ContainerControlledLifetimeManager());
     container.RegisterType<ValidationModel>(new ContainerControlledLifetimeManager());
     container.RegisterType(typeof(IResolver<>), typeof(GenericResolver<>));
     container.RegisterType<SaveOperation>(new ContainerControlledLifetimeManager());
     container.RegisterInstance<IServiceProvider>(container);
     container.RegisterInstance(profile);
 }
Ejemplo n.º 3
0
        public void Dispose()
        {
            applicationModel = null;
            if (container != null)
            {
                container.Dispose();
                container = null;
            }

            GC.SuppressFinalize(this);
        }
 protected override void Arrange()
 {
     this.container = new ConfigurationContainer();
 }