コード例 #1
0
        private void Browse_Click(object sender, EventArgs e)
        {
            if (target != null)
            {
                if (trackType == AudioType.Music)
                {
                    if (target.MusicTrack != null)
                    {
                        //todo localize
                        Undo.Push(new UndoTourStopChange(Language.GetLocalizedText(524, "Edit Music"), target.Owner));
                        ShowAudioProperties();
                        return;
                    }
                }
                else
                {
                    if (target.VoiceTrack != null)
                    {
                        Undo.Push(new UndoTourStopChange(Language.GetLocalizedText(525, "Edit Voiceover"), target.Owner)); UpdateTrackStatus();
                        ShowAudioProperties();
                        return;
                    }
                }

                var fileDialog = new OpenFileDialog();
                fileDialog.Filter = Language.GetLocalizedText(526, "Sound/Music(*.MP3;*.WMA)|*.MP3;*.WMA");

                if (fileDialog.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        var filename = fileDialog.FileName;
                        var audio = new AudioOverlay( target, filename);
                        audio.Name = filename.Substring(filename.LastIndexOf("\\") + 1);
                        if (trackType == AudioType.Music)
                        {
                            //todo localize
                            Undo.Push(new UndoTourStopChange(Language.GetLocalizedText(527, "Add Music"), target.Owner));
                            target.MusicTrack = audio;
                        }
                        else
                        {
                            //todo localize
                            Undo.Push(new UndoTourStopChange(Language.GetLocalizedText(528, "Add Voiceover"), target.Owner));
                            target.VoiceTrack = audio;
                        }
                        UpdateTrackStatus();
                        ShowAudioProperties();
                    }
                    catch
                    {
                        MessageBox.Show(Language.GetLocalizedText(131, "Could not load audio file. Check to make sure it is valid, a supported type and of a reasonable size."));
                    }
                }
            }
        }
コード例 #2
0
        public bool AddAudio(string filename)
        {
            if (tour == null || tour.CurrentTourStop == null)
            {
                return false;
            }

            AudioOverlay audio = new AudioOverlay( tour.CurrentTourStop, filename);
            audio.X = 900;
            audio.Y = 600;
            tour.CurrentTourStop.AddOverlay(audio);
            return true;
        }