Пример #1
0
 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;
     }
 }
Пример #2
0
 private void LoadMediaNote(string path, IdeaNote parent, int index)
 {
     MediaNote newNote = new MediaNote();
     newNote.FileName = path;
     AddNote(newNote, parent, index);
 }