public static DbImageNote FromNote(ImageNote note) => new DbImageNote { X = note.X, Y = note.Y, Width = note.Width, Height = note.Height, Content = note.Content };
private void SetFileButton_Click(object sender, RoutedEventArgs e) { if (MainViewModel.openAnyDialog.ShowDialog() == true) { if (ImageNote.IsImage(MainViewModel.openAnyDialog.FileName) && MessageBox.Show("This type of file can be displayed within IdeaTree.\n\nDo you want to show the file in an Image Note instead?", "Add as Image Note?", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { ImageNote newNote = new ImageNote() { FileName = MainViewModel.openAnyDialog.FileName }; MainViewModel.ReplaceNote((FileNote)DataContext, newNote); newNote.IsSelected = true; } else if (MediaNote.IsMedia(MainViewModel.openAnyDialog.FileName) && MessageBox.Show("This type of file can be displayed within IdeaTree.\n\nDo you want to show the file in a Media Note instead?", "Add as Media Note?", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { MediaNote newNote = new MediaNote() { FileName = MainViewModel.openAnyDialog.FileName }; MainViewModel.ReplaceNote((FileNote)DataContext, newNote); newNote.IsSelected = true; } else ((FileNote)DataContext).FileName = MainViewModel.openAnyDialog.FileName; } }
public List<ImageNote> GetNotes(Roll roll) { string sql = ImageNotesSql(roll); var reader = Data_Context.RunSelectSQLQuery(sql, 30); var imgNotes = new List<ImageNote>(); if (reader.HasRows) { var sReader = new SpecialistsReader(); while (reader.Read()) { string uName = reader["Author"] as string; var spec = sReader.GetSpecialist(uName); string n = reader["Note"] as string; DateTime date = reader.GetDateTime(3); int imgNum = reader.GetInt32(0); if (n.Count() > 16) { if (n.ToLower().Substring(0, 16) != "edited in imageq") { var imgNote = new ImageNote(spec, n, date, imgNum); imgNotes.Add(imgNote); } } else { var imgNote = new ImageNote(spec, n, date, imgNum); imgNotes.Add(imgNote); } } Data_Context.CloseConnection(); return imgNotes; } else return null; }
private void LoadImageNote(string path, IdeaNote parent, int index) { ImageNote newNote = new ImageNote(); newNote.FileName = path; AddNote(newNote, parent, index); }