private void UserControl_Loaded(object sender, RoutedEventArgs e) { AccumImage accumImage = AccumImage.GetInstance(parameterManager); accumImage.Exited += accumImage_Exited; accumImage.OnShort += accumImage_OnShot; viewTimer.Start(); Led led = Led.GetInstance(); ledSlider.Value = led.LastLightVoltage; ledTextBox.Text = led.LastLightVoltage.ToString(); switch (mode) { case ShootingMode.Single: modeLabel.Content = Properties.Strings.TakeSingle; break; case ShootingMode.Plurality: modeLabel.Content = Properties.Strings.TakePlurality; break; case ShootingMode.Accumlative: modeLabel.Content = Properties.Strings.TakeAccumlative; break; } abortButton.IsEnabled = false; progressPanel.Visibility = Visibility.Hidden; distanceRangeLabel.Content = "(" + Properties.Strings.Max + AccumImage.MaxDistance.ToString() + "mm)"; distanceTextBox.Text = string.Format("{0:0.00}", Properties.Settings.Default.ShootDistance); intervalTextBox.Text = string.Format("{0:0.0}", Properties.Settings.Default.ShootInterval); }
void ShootingStage_Unloaded(object sender, RoutedEventArgs e) { AccumImage accumImage = AccumImage.GetInstance(parameterManager); accumImage.Exited -= accumImage_Exited; accumImage.OnShort -= accumImage_OnShot; }
/// <summary> /// 撮影処理が行われたときのイベントハンドラ /// </summary> private void accumImage_OnShot(object sender, ActivityEventArgs e) { Dispatcher.BeginInvoke(new Action(delegate() { AccumImage accumImage = AccumImage.GetInstance(parameterManager); progressBar.Value = accumImage.CompletePercent; shootNumLabel.Content = accumImage.NumOfShots.ToString(); }), null); }
private void startButton_Click(object sender, RoutedEventArgs e) { if (!System.IO.Directory.Exists(destinationDir)) { MessageBox.Show(Properties.Strings.DirNotFound); return; } if (fileNameTextBox.Background == Brushes.Pink) { MessageBox.Show(Properties.Strings.FileNameInvalid); return; } AccumImage accumImage = AccumImage.GetInstance(parameterManager); if (accumImage.IsActive) { MessageBoxResult r = MessageBox.Show( Properties.Strings.ShootException01, Properties.Strings.Abort + "?", MessageBoxButton.YesNo); if (r == MessageBoxResult.Yes) { accumImage.Abort(); } else { return; } } try { accumImage.FilePath = destinationDir; accumImage.FilenamePrefix = fileName; double distance = double.Parse(distanceTextBox.Text); MotorControler mc = MotorControler.GetInstance(parameterManager); accumImage.IntervalUm = double.Parse(intervalTextBox.Text); accumImage.StartPoint = mc.GetPoint().Z; accumImage.EndPoint = accumImage.StartPoint + ((bool)minusRadioButton.IsChecked ? -distance : distance); progressPanel.Visibility = Visibility.Visible; progressBar.Minimum = 0; progressBar.Maximum = distance / accumImage.IntervalUm; accumImage.Start(); abortButton.IsEnabled = true; ledGroupBox.IsEnabled = false; Properties.Settings.Default.ShootDistance = double.Parse(distanceTextBox.Text); Properties.Settings.Default.ShootInterval = accumImage.IntervalUm; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void abortButton_Click(object sender, RoutedEventArgs e) { AccumImage accumImage = AccumImage.GetInstance(parameterManager); accumImage.Abort(); }