Код: Выделить всё
private void Timer_Tick_Ready(object sender, EventArgs e)
{
if(Flipbook.SelectedChallengeType!=0)
{
challengeCoverimage.Visible = true;
}
if (secondsRemaining > 1)
{
secondsRemaining--;
readyTimerLabel.Text = secondsRemaining.ToString();
}
else
{
readyTimerInfoLabel.Visible = false;
readyTimerLabel.Visible = false;
motionInfoLabel.Visible = true;
alertLabel.Visible = true;
shootingTimerLabel.Visible = true;
// 소리 재생
soundPlayer.controls.play();
Challengevideo1.Ctlcontrols.play();
// 이미지 저장 활성화
evfPictureBox.EnableImageSaving(true);
// 새로운 타이머 설정
//timer.Tick -= Timer_Tick_Ready;
//timer.Tick += Timer_Tick_Shoot;
readyGuideLabelImage.Visible = false;
recordingGuideLabelImage.Visible = true;
secondsRemaining = 7;
shootingTimerLabel.Text = secondsRemaining.ToString();
readyTimer.Stop();
videoTimer.Start();
}
}
// video shooting time handler
private void Timer_Tick_Shoot(object sender, EventArgs e)
{
challengeCoverimage.Visible = false;
if (secondsRemaining > 1)
{
secondsRemaining--;
shootingTimerLabel.Text = secondsRemaining.ToString();
}
else
{
evfPictureBox.EnableImageSaving(false);
if (shootCounter == 3)
{
shootCounter = 1;
secondsRemaining = 15;
shootIndexLabel.Text = shootCounter.ToString();
shootingTimerLabel.Text = secondsRemaining.ToString();
challengeCoverimage.Visible = false;
Challengevideo1.Visible = false;
motionInfoLabel.Visible = false;
Challengevideo1.close();
recordingGuideLabelImage.Visible = false;
shootingTransitionImage.Visible = true;
coverGuideLabelImage.Visible = true;
videoTimer.Stop();
photoTimer.Start();
//timer.Tick -= Timer_Tick_Shoot;
//timer.Tick += Timer_Tick_Cover;
}
else
{
//timer.Tick -= Timer_Tick_Shoot;
//timer.Tick += Timer_Tick_Ready;
videoTimer.Stop();
readyTimer.Start();
// 새로 영상 찍을 때마다 다시 초점 맞추기
_actionSource?.FireEvent(ActionEvent.Command.EVF_AF_ON, IntPtr.Zero);
Thread.Sleep(100);
_actionSource?.FireEvent(ActionEvent.Command.EVF_AF_OFF, IntPtr.Zero);
alertLabel.Visible = false;
shootingTimerLabel.Visible = false;
readyTimerInfoLabel.Visible = true;
readyTimerLabel.Visible = true;
motionInfoLabel.Visible = false;
readyGuideLabelImage.Visible = true;
recordingGuideLabelImage.Visible = false;
secondsRemaining = 10;
readyTimerLabel.Text = secondsRemaining.ToString();
evfPictureBox.SetSaveFolderPath(++shootCounter);
shootIndexLabel.Text = shootCounter.ToString();
}
}
}
// Shooting photo tick handler
private void Timer_Tick_Cover(object sender, EventArgs e)
{
Trace.WriteLine("cover time tick");
soundPlayer.URL = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Shooting_Sound.mp3");
soundPlayer.controls.stop();
if (secondsRemaining > 1)
{
Trace.WriteLine("cover time " + secondsRemaining);
if (secondsRemaining == 11)
{
coverFitLineHorizontalImage1.Visible = true;
coverFitLineHorizontalImage2.Visible = true;
coverFitLineVerticalImage1.Visible = true;
coverFitLineVerticalImage2.Visible = true;
shootingTransitionImage.Visible = false;
}
secondsRemaining--;
shootingTimerLabel.Text = secondsRemaining.ToString();
}
else
{
if (shootCounter == 3)
{
if (secondsRemaining == 0)
{
soundPlayer.controls.play();
_actionSource?.FireEvent(ActionEvent.Command.END_EVF, IntPtr.Zero);
photoTimer.Stop();
//타이머 객체 해제
readyTimer.Dispose();
videoTimer.Dispose();
photoTimer.Dispose();
// soundPlayer 메모리 관리
soundPlayer.close();
soundPlayer = null;
NextPageRequested?.Invoke(this, EventArgs.Empty);
}
else
{
soundPlayer.controls.play();
_actionSource?.FireEvent(ActionEvent.Command.TAKE_PICTURE, IntPtr.Zero);
secondsRemaining--;
shootingTimerLabel.Text = secondsRemaining.ToString();
}
}
else
{
soundPlayer.controls.play();
_actionSource?.FireEvent(ActionEvent.Command.TAKE_PICTURE, IntPtr.Zero);
secondsRemaining = 10;
shootCounter++;
shootIndexLabel.Text = shootCounter.ToString();
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/791 ... a-playr-at
Мобильная версия