public bool AddAnimation(string FileName, bool DoPlayAcusticSignal, string ExtraSoundFilename) { bool flag = false; if (File.Exists(FileName)) { try { Mci mci2 = new Mci(); mci2.Open(FileName); int length = mci2.Length; if (mci2.IsOpen) { mci2.Close(); } mci2.Dispose(); _parts.Add(new Sequence.SequencePart(FileName, (long)length, 0, DoPlayAcusticSignal, ExtraSoundFilename, false)); flag = true; } catch { flag = false; } } return(flag); }
public void ShowGraphicPreviewAsync(string filename) { if (InvokeRequired) { Invoke((Delegate) new Preview.ShowGraphicPreviewAsyncDelegate(ShowGraphicPreviewAsync), (object)filename); } else { if (_mci_player != null && _mci_player.IsOpen) { _mci_player.Stop(); _mci_player.Dispose(); _mci_player = (Mci)null; } pictureBox1.Size = Size; _mci_player = new Mci(); _mci_player.Open(filename, (Control)pictureBox1); try { _mci_player.SetRectangle(0, 0, pictureBox1.Width, pictureBox1.Height); } catch { } try { _mci_player.Volume = 0; } catch { } try { _mci_player.Play(false); } catch { } } }
public void HideGraphic() { if (_mci_timer != null) { _mci_timer.Stop(); _mci_timer.Tick -= new EventHandler(_mci_timer_Tick); } if (_mci != null) { try { _mci.Stop(); } catch { } if (_mci.IsOpen) { try { _mci.Close(); } catch { } } try { _mci.Dispose(); } catch { } _mci = (Mci)null; } if (pictureBox1 == null) { return; } if (_my_effect != null) { while (_my_effect.ThreadActive) { Application.DoEvents(); } } hidePictureBoxAsync(pictureBox1); }
private void _media_timer_Tick(object sender, EventArgs e) { if (_do_start) { if (_player == null) { try { _invokes.SetPictureBoxImageAsync(_picturebox, Image.FromFile(_default_media_filename)); } catch { try { _player = new Mci(); _player.Open(_default_media_filename, (Control)_picturebox); _player.SetRectangle(0, 0, _picturebox.Width, _picturebox.Height); _player.Volume = 0; if (!_initial_start) { _remaining_media_time = _player.Length / 50; } _initial_start = false; _player.Play(true); } catch { _player = (Mci)null; } } } _do_start = false; _is_started = true; } if (_remaining_media_time > 0 && _player != null) { --_remaining_media_time; } if (_remaining_media_time == 0) { if (MediaEndTimeReached != null) { MediaEndTimeReached(this); } if (_player == null) { return; } _player.SetRectangle(0, 0, _picturebox.Width, _picturebox.Height); _player.Stop(); _player.Dispose(); _player = (Mci)null; _is_started = false; } else { if (MediaTimeChanged == null) { return; } MediaTimeChanged(this, _remaining_media_time); } }