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); }
/// <summary> /// Normally, don't use this, use the autofac-generated factory instead. /// </summary> public NotesBarView(NotesBarModel model, AnnotationEditorModel.Factory annotationViewModelFactory) { _model = model; _annotationEditorModelFactory = annotationViewModelFactory; InitializeComponent(); _model.UpdateContent += new EventHandler(OnUpdateContent); // ButtonHeight = 32; this.Height = 25;//nb: there is some confusion here. }
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 NoteDetailDialog(Annotation annotation, AnnotationEditorModel.Factory viewModelFactory) { InitializeComponent(); var model = viewModelFactory(annotation, false); Text = model.GetLongLabel(); _view = new AnnotationEditorView(model); _view.ModalDialogMode = true; _view.Dock = DockStyle.Fill; //_view.Size = new Size(Width, Height - 50); Controls.Add(_view); AcceptButton = _view.OKButton; _view.OnClose += (CloseButton_Click); }
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 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)); }