/// <summary>
        /// 撮影
        /// </summary>
        void RaiseCameraCapturing()
        {
            var notification = new CameraCapturingNotification {
                Title = "撮影番号設定"
            };

            CameraCapturingRequest.Raise(notification);
            if (!notification.Confirmed)
            {
                return;
            }
            // プレビュー中なら停止する
            IsCameraPreviewing.Value = false;

            try {
                // 撮影フォルダ名:
                // プロジェクトのフォルダ名+現在の年月日時分秒+撮影番号からなるフォルダ名のフォルダに画像を保存する
                string sTargetName = DateTime.Now.ToString("yyyyMMdd-HHmmss");
                if (!string.IsNullOrEmpty(notification.CapturingName))
                {
                    sTargetName += string.Format("({0})", notification.CapturingName);
                }
                string sTargetDir = Path.Combine(this.ProjectFolderPath.Value, sTargetName);
                Directory.CreateDirectory(sTargetDir);

                //// 正面カメラの画像を取得する
                //byte[] imaegData = _newSyncShooter.GetPreviewImageFront();
                //if ( imaegData.Length == 0 ) {
                //	OpenMessageBox( this.Title.Value, MessageBoxImage.Error, MessageBoxButton.OK, MessageBoxResult.OK,
                //		"正面カメラの画像を取得できませんでした。" );
                //	return;
                //}
                //var ms = new MemoryStream( imaegData );
                //BitmapSource bitmapSource = BitmapFrame.Create( ms, BitmapCreateOptions.None, BitmapCacheOption.OnLoad );

                // カメラ画像転送ダイアログを開く
                var notification2 = new ImagTransferingNotification()
                {
                    Title                  = "カメラ画像転送",
                    SyncShooter            = _newSyncShooter,
                    ConnectedIPAddressList = ConnectedIPAddressList,
                    TargetDir              = sTargetDir,
                    //Image = bitmapSource,
                };
                var t = DateTime.Now;

                this.ImageTransferingRequest.Raise(notification2);

                if (notification2.Confirmed)
                {
                    TimeSpan ts = DateTime.Now - t;
                    OpenMessageBox(this.Title.Value, MessageBoxImage.Information, MessageBoxButton.OK, MessageBoxResult.OK,
                                   "画像転送完了\n\nElapsed : " + ts.ToString("s\\.fff") + " sec");
                }

                // 「ファイルビュー」表示を更新
                FileTree.Clear();
                FileTree.Add(new FileTreeItem(this.ProjectFolderPath.Value));
            } catch (Exception e) {
                OpenMessageBox(this.Title.Value, MessageBoxImage.Error, MessageBoxButton.OK, MessageBoxResult.OK, e.Message);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 自動撮影を行う
        /// </summary>
        void CatureAutomatically()
        {
            // プレビュー中なら停止する
            IsCameraPreviewing.Value = false;

            try {
                // 現在のプロジェクトフォルダ内で、"Auto" で始まるフォルダ一覧を取得する
                // それらがある場合は、その最後の番号を、新規作成フォルダの番号とする
                // ない場合は "Auto0000" とする
                var directories = Directory.GetDirectories(this.ProjectFolderPath.Value);
                int nMaxIndex;
                if (directories.Length == 0)
                {
                    nMaxIndex = 0;
                }
                else
                {
                    directories = directories
                                  .Select(dir => Path.GetFileName(dir).ToUpper())
                                  .Where(dir => dir.StartsWith("AUTO(")).ToArray();
                    if (directories.Length == 0)
                    {
                        nMaxIndex = 0;
                    }
                    else
                    {
                        nMaxIndex = directories.Max(dir =>
                        {
                            string sName = dir.Remove(0, 5);
                            sName        = sName.Remove(sName.Length - 1);
                            return(int.Parse(sName));
                        });
                    }
                }
                string sTargetName = String.Format("Auto({0:0000})", nMaxIndex + 1);
                string sTargetDir  = Path.Combine(this.ProjectFolderPath.Value, sTargetName);
                Directory.CreateDirectory(sTargetDir);

                // カメラ画像転送ダイアログを開く
                var notification2 = new ImagTransferingNotification()
                {
                    Title                  = "カメラ画像転送",
                    SyncShooter            = _newSyncShooter,
                    ConnectedIPAddressList = ConnectedIPAddressList,
                    LocalHostIP            = _localHostIP,
                    TargetDir              = sTargetDir,
                };
                this.ImageTransferingRequest.Raise(notification2);

                // 「ファイルビュー」表示を更新
                FileTree.Clear();
                FileTree.Add(new FileTreeItem(this.ProjectFolderPath.Value));

                // 3D Dataを置くディレクトリを作る
                string sThreeDDataDir = Path.Combine(this.ThreeDDataFolderPath.Value, sTargetName);
                Directory.CreateDirectory(sThreeDDataDir);

                // 3D化(RC実行)タスクを実行
                var task = new Task(() => RunRCTask(sTargetDir, sThreeDDataDir, this.IsCutPetTable.Value));
                var pair = new Tuple <Task, string>(task, sTargetDir);
                task.ContinueWith(t => _runRCTaskList.Remove(pair));
                _runRCTaskList.Add(pair);
                task.Start();
            } catch (Exception e) {
                OpenMessageBox(this.Title.Value, MessageBoxImage.Error, MessageBoxButton.OK, MessageBoxResult.OK, e.Message);
            }
        }