void AudiobookControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            AudiobookControl control = (AudiobookControl)sender;
            Audiobook        book    = audiobooks.Single(o => o.Name == control.Text);

            SelectAudiobook(book);
        }
 private void RefreshAudiobooks_Click(object sender, RoutedEventArgs e)
 {
     Audiobook_Stop();
     current_audiobook = null;
     audiobooks.Clear();
     wpAudiobooks.Children.Clear();
     ReadAudiobookFolder();
 }
Beispiel #3
0
        public static Audiobook FromSerializedFile(string filename)
        {
            IFormatter formatter = new BinaryFormatter();

            using (Stream stream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                Audiobook book = (Audiobook)formatter.Deserialize(stream);
                return(book);
            }
            throw new SerializationException("There was a problem deserializing the state file.");
        }
        private void SelectCover(Audiobook book)
        {
            var selector = new ImageSelector(book);

            selector.ShowDialog();

            if (selector.DialogResult.HasValue && selector.DialogResult.Value && selector.SelectedImage != null)
            {
                book.Cover = selector.SelectedImage;
            }
        }
 AudiobookControl GetControlForAudiobook(Audiobook book)
 {
     foreach (AudiobookControl control in wpAudiobooks.Children)
     {
         if (control.Audiobook == book)
         {
             return(control);
         }
     }
     throw new ArgumentException("Cannot find an audiobook control matching the audiobook.");
 }
Beispiel #6
0
        public static Audiobook FromFolderFiles(string path)
        {
            Audiobook     book      = new Audiobook();
            List <string> raw_files = book.ReadFilesFromFolder(path, "*.mp3");

            book.files    = book.ReadMediaLength(raw_files);
            book.length   = book.ComputeTotalLength();
            book.position = 0;
            book.path     = path;
            book.name     = new System.IO.DirectoryInfo(path).Name;
            book.SetCoverImage();
            return(book);
        }
 public AudiobookControl(Audiobook book)
 {
     InitializeComponent();
     dockContent.IsVisibleChanged += dockContent_IsVisibleChanged;
     audiobook = book;
     this.Text = book.Name;
     if (book.Cover != null)
     {
         imgCover.Source = Utilities.BitmapSourceFromImage(book.Cover);
     }
     book.OnCoverSearchFinished += book_OnCoverSearchFinished;
     SetupProgressBar(book.Progress);
 }
 void SelectAudiobook(Audiobook audiobook)
 {
     if (current_audiobook != null)
     {
         current_audiobook.Stop();
         DeselectCurrentAudiobook();
     }
     this.DataContext = audiobook;
     DeselectAllAudiobookControls();
     current_audiobook = audiobook;
     GetControlForAudiobook(audiobook).IsSelected = true;
     lstBookmarks.ItemsSource = current_audiobook.Bookmarks;
     UpdateAudiobookControls();
 }
 /// <summary>
 /// Creates a new instance of the ImageSelector that will perform it's own search.
 /// </summary>
 /// <param name="book">Book that will be searched for</param>
 /// <param name="no_of_results">Number of results that the user will be presented.</param>
 public ImageSelector(Audiobook book, int no_of_results = 8)
 {
     InitializeComponent();
     SearchImages(book.Name, no_of_results);
 }
 public AudioBookArgs(Audiobook audiobook, Thread thread = null)
 {
     this.audiobook = audiobook;
 }
        void ScanFolder(string path)
        {
            Audiobook new_book = Audiobook.FromFolder(path);

            OnScanFinished(this, new AudioBookArgs(new_book, Thread.CurrentThread));
        }
        private void ShowGotoDialog(Audiobook audiobook)
        {
            GotoDialog dialog = new GotoDialog(audiobook);

            dialog.ShowDialog();
        }
Beispiel #13
0
 public GotoDialog(Audiobook book)
 {
     InitializeComponent();
     this.DataContext = book;
 }