Exemple #1
0
        /// <summary>
        /// Only call this directly if you're not using the synching stuff (e.g., testing the notes UI)
        /// </summary>
        /// <param name="builder"></param>
        public static void InjectNotesUI(ContainerBuilder builder)
        {
            builder.RegisterType <MessageSelectedEvent>().InstancePerLifetimeScope();
            builder.RegisterType <Chorus.notes.EmbeddedMessageContentHandlerRepository>().InstancePerLifetimeScope();
            builder.RegisterType <NotesInProjectViewModel>().InstancePerLifetimeScope();
            builder.RegisterType <NotesInProjectView>().InstancePerLifetimeScope();
            builder.RegisterType <Chorus.UI.Notes.AnnotationEditorView>().InstancePerLifetimeScope();
            builder.RegisterType <Chorus.UI.Notes.AnnotationEditorModel>().InstancePerDependency();
            builder.RegisterType <NotesBrowserPage>().InstancePerLifetimeScope();
            builder.Register <StyleSheet>(c => StyleSheet.CreateFromDisk()).InstancePerLifetimeScope();
            builder.RegisterGeneratedFactory <AnnotationEditorModel.Factory>().InstancePerLifetimeScope();
            builder.RegisterType <NotesBarModel>().InstancePerLifetimeScope();
            builder.RegisterGeneratedFactory <NotesBarModel.Factory>().InstancePerLifetimeScope();
            builder.RegisterType <NotesBarView>().InstancePerLifetimeScope();
            builder.RegisterGeneratedFactory <NotesBarView.Factory>().InstancePerLifetimeScope();

            builder.RegisterGeneratedFactory <NotesInProjectView.Factory>().InstancePerLifetimeScope();
            builder.RegisterGeneratedFactory <NotesInProjectViewModel.Factory>().InstancePerLifetimeScope();
            builder.RegisterGeneratedFactory <NotesBrowserPage.Factory>().InstancePerLifetimeScope();
        }
Exemple #2
0
 private AnnotationEditorModel CreateAnnotationModel(MessageSelectedEvent messageSelected)
 {
     return(new AnnotationEditorModel(new ChorusUser("bob"), messageSelected, StyleSheet.CreateFromDisk(), new EmbeddedMessageContentHandlerRepository(), new NavigateToRecordEvent(),
                                      new ChorusNotesDisplaySettings()));
 }
Exemple #3
0
        private void ShowBrowser(IEnumerable <AnnotationRepository> repositories)
        {
            //TODO (jh/jh): something here seems screwed up... we create a NotesInProjectViewModel here, and yet so does the NotesBrowserPage

            var messageSelected            = new MessageSelectedEvent();
            var chorusNotesDisplaySettings = new ChorusNotesDisplaySettings()
            {
                WritingSystemForNoteLabel   = new TestWritingSystem("Algerian"),
                WritingSystemForNoteContent = new TestWritingSystem("Bradley Hand ITC")
            };

            NotesInProjectViewModel notesInProjectModel = new NotesInProjectViewModel(new ChorusUser("Bob"), repositories, chorusNotesDisplaySettings, new ConsoleProgress());

            var annotationModel = new AnnotationEditorModel(new ChorusUser("bob"), messageSelected, StyleSheet.CreateFromDisk(),
                                                            new EmbeddedMessageContentHandlerRepository(), new NavigateToRecordEvent(), chorusNotesDisplaySettings);
            AnnotationEditorView annotationView = new AnnotationEditorView(annotationModel);

            annotationView.ModalDialogMode = false;
            var page = new NotesBrowserPage((unusedRepos, progress) => notesInProjectModel, repositories, annotationView);

            page.Dock = DockStyle.Fill;
            var form = new Form();

            form.Size = new Size(700, 600);
            form.Controls.Add(page);

            Application.EnableVisualStyles();
            Application.Run(form);
        }