Пример #1
0
		/// <summary>
		/// Split tracks button clicked
		/// </summary>
		private void btnSplit_Click(object sender, EventArgs e) {
			if (m_Reader == null)
				return;
			// Show dialog
			SplitAlbum a = new SplitAlbum(m_Reader);
			if (a.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
				// Undoable - save everything
				StackUndo(new UndoEdit(), true, delegate() {
					// Copy data
					Program.Album = new AlbumInfo(Program.Album);
					// And use new track info
					Program.Album.Tracks = a.Tracks;
					BuildTrackJoins();
				});
			}
		}
Пример #2
0
		/// <summary>
		/// Read a music file, display the AlbumDetails dialog to get details, display.
		/// Runs in a separate thread.
		/// </summary>
		/// <param name="next">Action to do after reading</param>
		private void readFile(Action next) {
			runTask(delegate() {
				// This is an undoable action - save all data on undo stack first
				StackUndo(new UndoEdit(), true, delegate() {
					loadFile(m_Filename);	// Load file, converting to wav if required
					Despatch(delegate() {
						// Show AlbumDetails dialog (in UI thread)
						if (m_AlbumDetails.ShowDialog() == System.Windows.Forms.DialogResult.OK)
							Program.Album = new AlbumInfo(m_AlbumDetails.Album);
					});
					if (Program.Album == null) {
						// No track info - make a single track for the whole album
						Program.Album = new AlbumInfo();
						Program.Album.Tracks.Add(new Track() {
							LengthSeconds = m_Reader.WaveFormat.BytesToSeconds(m_Reader.Length)
						});
					}
					Program.Album.Filename = m_Filename;
					bool split = false;
					if (Program.Album.Tracks.Count <= 1 || Program.Album.Tracks[0].LengthSeconds == 0) {
						Despatch(delegate() {
							// No track length info - go straight to SplitAlbum (in UI thread)
							SplitAlbum a = new SplitAlbum(m_Reader);
							if (a.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
								Program.Album = new AlbumInfo(Program.Album);
								Program.Album.Tracks = a.Tracks;
								split = true;
							}
						});
					}
					if (!split)
						autoGap();	// Only adjust track starts if SplitAlbum has not already done so
					Despatch(BuildTrackJoins);	// Create TrackJoin controls for tracks (and gap at the end)
					Status(m_Filename);
					if (next != null)
						Despatch(next);
				});
			});
		}