private void StartShow(int StartIndex) { if (lstFiles.Items.Count == 0) { // Nothing to show MessageBox.Show("No pictures to show.\nPlease drop some files to the list.", "Nothing to show", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } btnStop.Enabled = true; _showIndex = StartIndex; if (_showForm == null) { _showForm = new frmShow(); } if (_showForm.Visible == false) { _showForm.NextPic += _showForm_NextPic; _showForm.PrevPic += _showForm_PrevPic; _showForm.StopShow += _showForm_StopShow; _showForm.TogglePause += _showForm_TogglePause; _showForm.StartPosition = FormStartPosition.Manual; _showForm.WindowState = FormWindowState.Normal; _showForm.Left = _showScreen.WorkingArea.Left; _showForm.Top = _showScreen.WorkingArea.Top; _showForm.WindowState = FormWindowState.Maximized; _showForm.Show(this); } if (mnuTimer.Checked) { tmrShow.Interval = _intervalSec * 1000; tmrShow.Enabled = true; } _showForm.SetPicture(_photos[_showIndex].Path); UpdatePrevPic(_showIndex); }
private void _showForm_StopShow(object sender, EventStop e) { _showForm.NextPic -= _showForm_NextPic; _showForm.PrevPic -= _showForm_PrevPic; _showForm.StopShow -= _showForm_StopShow; _showForm.TogglePause -= _showForm_TogglePause; _showForm.Close(); _showForm = null; if (mnuTimer.Checked) { tmrShow.Enabled = false; } }