public void Compose(IServiceRegistry serviceRegistry)
    {
        serviceRegistry.Register <IDizApp, DizApp>();
        serviceRegistry.Register <ICommonGui, CommonGui>();

        serviceRegistry.Register <IImportRomDialogView, ImportRomDialog>("ImportRomView");
        serviceRegistry.Register <IProgressView, ProgressDialog>("ProgressBarView");
        serviceRegistry.Register <ILogCreatorSettingsEditorView, LogCreatorSettingsEditorForm>("ExportDisassemblyView");
        serviceRegistry.Register <ILabelEditorView, AliasList>("LabelEditorView");
        serviceRegistry.Register <IMainGridWindowView, MainWindow>("MainGridWindowView");

        // the (string) names of the views above will be mapped to the method names of the interface below.
        // i.e. calling IViewFactory.GetLabelEditorView() will look for somthing named "LabelEditorView"
        serviceRegistry.EnableAutoFactories();
        serviceRegistry.RegisterAutoFactory <IViewFactory>();


        // coming soon. backported from upcoming 3.0 branch
        // serviceRegistry.RegisterSingleton<IDizApplication, DizApplication>();
        // serviceRegistry.Register<IMarkManyView, MarkManyView>();
        // serviceRegistry.Register(
        //     typeof(IDataSubsetRomByteDataGridLoader<,>),
        //     typeof(DataSubsetRomByteDataGridLoader<,>)
        //     );
        //
        // serviceRegistry.Register<IBytesGridViewer<ByteEntry>, DataGridEditorControl>();
        // serviceRegistry.Register<IDataGridEditorForm, DataGridEditorForm>();
        //
        // serviceRegistry.Register<IStartFormViewer, StartForm>("StartForm");
        //
        // serviceRegistry.Register<IDataGridEditorForm, DataGridEditorForm> ("DataGridForm");
    }
Ejemplo n.º 2
0
    public void Compose(IServiceRegistry serviceRegistry)
    {
        serviceRegistry.Register <IProjectController, ProjectController>("ProjectController");
        serviceRegistry.Register <ILogCreatorSettingsEditorController, LogCreatorSettingsEditorController>("AssemblyExporterSettingsController");
        serviceRegistry.Register <IImportRomDialogController, ImportRomDialogController>("ImportRomDialogController");
        serviceRegistry.Register <ILargeFilesReaderController, LargeFilesReader>("LargeFileReaderProgressController");

        serviceRegistry.EnableAutoFactories();
        serviceRegistry.RegisterAutoFactory <IControllerFactory>();

        serviceRegistry.Register <IDizDocument, DizDocument>();

        // sorry this is all a huge WIP mess, cleanup incoming soon.

        // serviceRegistry.Register<int, int, IReadOnlySnesRom, IMarkManyController>(
        //     (factory, offset, whichIndex, data) =>
        //     {
        //          // TODO: update this with updated controller from Diz 2.0 branch.
        //          // I think that means kill 'whichIndex', use the new format that doesn't rely on it.
        //         var view = factory.GetInstance<IMarkManyView>();
        //         var markManyController = new MarkManyController(offset, whichIndex, data, view);
        //         markManyController.MarkManyView.Controller = markManyController;
        //         return markManyController;
        //     });

        // TODO: might be able to make some of these register using
        // "open generics" to be more flexible.

#if DIZ_3_BRANCH
        serviceRegistry.Register(
            typeof(IDataController),
            typeof(RomByteDataBindingController <IGridRow <ByteEntry> >)
            );

        serviceRegistry.Register <IDataController, RomByteDataBindingGridController>();

        serviceRegistry.Register(
            typeof(IBytesGridDataController <,>),
            typeof(RomByteDataBindingController <>)
            );

        serviceRegistry.Register(
            typeof(IBytesGridDataController <IDataGridRow, ByteEntry>),
            typeof(RomByteDataBindingGridController)
            );

        serviceRegistry.Register <IStartFormController, StartFormController>();

        serviceRegistry.Register <IMainFormController, MainFormController>();

        serviceRegistry.Register <IProjectLoader, ProjectFileLoader>();
        serviceRegistry.Decorate(
            typeof(IProjectLoader),
            typeof(ProjectLoaderWithSampleDataDecorator));

        serviceRegistry.Register <IProjectsManager, ProjectsManager>();

        serviceRegistry.RegisterSingleton <ISampleProjectLoader, ProjectsManager>("SampleProjectLoader");
#endif
    }