Exemple #1
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);
        }
 public void CloseIssue_AnnotationGetsNewMessageWithNewStatus()
 {
     Annotation annotation = CreateAnnotation();
     var messageSelected = new MessageSelectedEvent();
     AnnotationEditorModel annotationModel = CreateAnnotationModel(messageSelected);
     messageSelected.Raise(annotation, annotation.Messages.First());
     Assert.IsFalse(annotationModel.IsResolved);
     Assert.IsFalse(annotation.IsClosed);
     annotationModel.IsResolved = true;
     Assert.IsTrue(annotationModel.IsResolved);
     Assert.IsTrue(annotation.IsClosed);
 }
Exemple #3
0
        public void CloseIssue_AnnotationGetsNewMessageWithNewStatus()
        {
            Annotation            annotation      = CreateAnnotation();
            var                   messageSelected = new MessageSelectedEvent();
            AnnotationEditorModel annotationModel = CreateAnnotationModel(messageSelected);

            messageSelected.Raise(annotation, annotation.Messages.First());
            Assert.IsFalse(annotationModel.IsResolved);
            Assert.IsFalse(annotation.IsClosed);
            annotationModel.IsResolved = true;
            Assert.IsTrue(annotationModel.IsResolved);
            Assert.IsTrue(annotation.IsClosed);
        }
        public NotesInProjectViewModel( IChorusUser user, IEnumerable<AnnotationRepository> repositories, 
                                        MessageSelectedEvent messageSelectedEventToRaise, ChorusNotesDisplaySettings displaySettings,
                                    IProgress progress)
        {
            DisplaySettings = displaySettings;
            _user = user;
            _repositories = repositories;
            _messageSelectedEvent = messageSelectedEventToRaise;

            foreach (var repository in repositories)
            {
                repository.AddObserver(this, progress);
            }
        }
        public AnnotationEditorModel(IChorusUser user,
							MessageSelectedEvent messageSelectedEventToSubscribeTo,
							StyleSheet styleSheet,
							EmbeddedMessageContentHandlerRepository embeddedMessageContentHandlerRepository,
							NavigateToRecordEvent navigateToRecordEventToRaise,
						ChorusNotesDisplaySettings displaySettings)
        {
            _user = user;
            m_embeddedMessageContentHandlerRepository = embeddedMessageContentHandlerRepository;
            _navigateToRecordEventToRaise = navigateToRecordEventToRaise;
            _styleSheet = styleSheet;
            _displaySettings = displaySettings;
            messageSelectedEventToSubscribeTo.Subscribe(SetAnnotationAndFocussedMessage);
            EventToRaiseForChangedMessage = messageSelectedEventToSubscribeTo;
        }
Exemple #6
0
 public AnnotationEditorModel(IChorusUser user,
                              MessageSelectedEvent messageSelectedEventToSubscribeTo,
                              StyleSheet styleSheet,
                              EmbeddedMessageContentHandlerRepository embeddedMessageContentHandlerRepository,
                              NavigateToRecordEvent navigateToRecordEventToRaise,
                              ChorusNotesDisplaySettings displaySettings)
 {
     _user = user;
     m_embeddedMessageContentHandlerRepository = embeddedMessageContentHandlerRepository;
     _navigateToRecordEventToRaise             = navigateToRecordEventToRaise;
     _styleSheet      = styleSheet;
     _displaySettings = displaySettings;
     messageSelectedEventToSubscribeTo.Subscribe(SetAnnotationAndFocussedMessage);
     EventToRaiseForChangedMessage = messageSelectedEventToSubscribeTo;
 }
 public void ResolveButtonClicked_NewMessageHasContents_ResolutionAndMessageAreOne()
 {
     Annotation annotation = CreateAnnotation();
     var messageSelected = new MessageSelectedEvent();
     AnnotationEditorModel annotationModel = CreateAnnotationModel(messageSelected);
     messageSelected.Raise(annotation, annotation.Messages.First());
     Assert.IsFalse(annotationModel.IsResolved);
     Assert.IsFalse(annotation.IsClosed);
     Assert.AreEqual(1, annotation.Messages.Count());
     annotationModel.UnResolveAndAddMessage("hello");
     Assert.IsTrue(annotationModel.IsResolved, "should have changed status");
     Assert.AreEqual(2, annotation.Messages.Count());
     Assert.AreEqual("bob", annotation.Messages.Last().GetAuthor(""));
     Assert.AreEqual("hello", annotation.Messages.Last().Text);
     Assert.IsTrue(DateTime.Now.Subtract(annotation.Messages.Last().Date).Seconds < 2);
 }
Exemple #8
0
        public void ResolveButtonClicked_NewMessageHasContents_ResolutionAndMessageAreOne()
        {
            Annotation            annotation      = CreateAnnotation();
            var                   messageSelected = new MessageSelectedEvent();
            AnnotationEditorModel annotationModel = CreateAnnotationModel(messageSelected);

            messageSelected.Raise(annotation, annotation.Messages.First());
            Assert.IsFalse(annotationModel.IsResolved);
            Assert.IsFalse(annotation.IsClosed);
            Assert.AreEqual(1, annotation.Messages.Count());
            annotationModel.UnResolveAndAddMessage("hello");
            Assert.IsTrue(annotationModel.IsResolved, "should have changed status");
            Assert.AreEqual(2, annotation.Messages.Count());
            Assert.AreEqual("bob", annotation.Messages.Last().GetAuthor(""));
            Assert.AreEqual("hello", annotation.Messages.Last().Text);
            Assert.IsTrue(DateTime.Now.Subtract(annotation.Messages.Last().Date).Seconds < 2);
        }
 public AnnotationEditorModel(IChorusUser user,
                     MessageSelectedEvent messageSelectedEventToSubscribeTo,
                     StyleSheet styleSheet,
                     EmbeddedMessageContentHandlerRepository embeddedMessageContentHandlerRepository,
                     NavigateToRecordEvent navigateToRecordEventToRaise,
                 ChorusNotesDisplaySettings displaySettings)
 {
     _user = user;
     m_embeddedMessageContentHandlerRepository = embeddedMessageContentHandlerRepository;
     _navigateToRecordEventToRaise = navigateToRecordEventToRaise;
     _styleSheet = styleSheet;
     _displaySettings = displaySettings;
      //CurrentWritingSystem = _displaySettings.First();
     messageSelectedEventToSubscribeTo.Subscribe((annotation, message) => SetAnnotationAndFocussedMessage(annotation, message));
     EventToRaiseForChangedMessage = messageSelectedEventToSubscribeTo;
     NewMessageText = string.Empty;
 }
Exemple #10
0
        public void AddButtonClicked_NewMessageHasContents_NewMessageAppendedToAnnotation()
        {
            Annotation            annotation      = CreateAnnotation();
            var                   messageSelected = new MessageSelectedEvent();
            AnnotationEditorModel annotationModel = CreateAnnotationModel(messageSelected);

            messageSelected.Raise(annotation, annotation.Messages.First());
            Assert.That(annotationModel.IsResolved, Is.False);
            Assert.That(annotation.IsClosed, Is.False);
            Assert.AreEqual(1, annotation.Messages.Count());
            annotationModel.AddMessage("hello");
            Assert.That(annotationModel.IsResolved, Is.False, "should not have changed status");
            Assert.AreEqual(2, annotation.Messages.Count());
            Assert.AreEqual("bob", annotation.Messages.Last().GetAuthor(""));
            Assert.AreEqual("hello", annotation.Messages.Last().Text);
            Assert.That(DateTime.Now.Subtract(annotation.Messages.Last().Date).Seconds, Is.LessThan(2));
        }
Exemple #11
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);
        }
 private AnnotationEditorModel CreateAnnotationModel(MessageSelectedEvent messageSelected)
 {
     return new AnnotationEditorModel(new ChorusUser("bob"), messageSelected, StyleSheet.CreateFromDisk(), new EmbeddedMessageContentHandlerRepository(), new NavigateToRecordEvent(),
         new ChorusNotesDisplaySettings());
 }
Exemple #13
0
 private AnnotationEditorModel CreateAnnotationModel(MessageSelectedEvent messageSelected)
 {
     return(new AnnotationEditorModel(new ChorusUser("bob"), messageSelected, StyleSheet.CreateFromDisk(), new EmbeddedMessageContentHandlerRepository(), new NavigateToRecordEvent(),
                                      new ChorusNotesDisplaySettings()));
 }