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)));
        }