private void Load(Book book = null) { InitializeComponent(); vm = new EditBookViewModel(this, book); this.DataContext = vm; }
private void Load(Book book, Note note = null) { InitializeComponent(); vm = new EditNoteViewModel(this, book, note); this.DataContext = vm; }
public EditNoteViewModel(Window window, Book book, Note noteForEdit = null) { this.window = window; this.book = book; this.note = noteForEdit; InitializeValues(); }
public EditBookViewModel(EditBookWindow window, Book bookForEdit = null) { Ratings = new List<string>(); Ratings.Add(NotRead); for (int i = 0; i <= 5; i++) { Ratings.Add(i.ToString()); } this.window = window; book = bookForEdit; InitializeValues(); }
public override void Export(Book book, string path) { StreamWriter sw = new StreamWriter(path); StringBuilder sb = new StringBuilder(); foreach (var note in book.Notes) { if (IncludeLocation) sb.Append(note.Location + ": "); sb.Append(note.OriginalText); sb.AppendLine(); sw.WriteLine(sb.ToString()); sb.Clear(); } sw.Close(); }
public BulkAddNotesWindow(Book book) : this() { vm.SelectedBook = book; }
public EditBookWindow(Book book) { Load(book); }
public EditNotesWindow(Book book, Note note) { Load(book, note); }
public EditNotesWindow(Book book) { Load(book); }
private void SaveChange() { try { if (IsEdit) { book.DefaultTopic = DefaultTopic; book.Rating = GetDbRating(); book.Title = Title; book.Comments = Comments; Util.DB.SaveChanges(); } else { Book bk = new Book() { DefaultTopic = DefaultTopic, Created = DateTime.Now, Rating = GetDbRating(), Title = Title, Comments = Comments }; Workspace.Current.DB.Books.Add(bk); } Workspace.Current.DB.SaveChanges(); cancelled = false; window.Close(); } catch (Exception e) { Workspace.Current.DB.RejectChanges(); MessageBoxFactory.ShowError(e); } }