Ejemplo n.º 1
0
        void RaiseFileViewSelectedItemChanged(FileTreeItem item)
        {
            if (item == null)
            {
                return;
            }
            var path = item._Directory.FullName;

            // TODO: このディレクトリ内の最初のIPアドレスの画像をView上に表示する
            string[] fileNames = Directory.GetFiles(path, "*.jpg");
            if (fileNames.Length > 0)
            {
                // ファイル名の数値が最小のファイル名を得る
                var fileName = fileNames.OrderBy(name =>
                {
                    var text = name.Split(new char[] { '\\' }).Last();
                    text     = text.Split(new char[] { '.' }).First();
                    return(int.Parse(text));
                }).First();
                using (Stream BitmapStream = System.IO.File.Open(fileName, System.IO.FileMode.Open)) {
                    BitmapSource bitmapSource = BitmapFrame.Create(BitmapStream, BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
                    this.PreviewingImage.Value = new TransformedBitmap(bitmapSource, new RotateTransform(270));
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 3D作成 - ワンショット
        /// </summary>
        void RaiseThreeDBuildingOne()
        {
            if (this.FileTree.First().Items.IsEmpty)
            {
                return;
            }
            // ファイルビューで選択中のフォルダ、または選択されているフォルダがなければ最後のフォルダを選択する
            var items = new FileTreeItem[this.FileTree.First().Items.Count];

            this.FileTree.First().Items.CopyTo(items, 0);
            var treeItem = items.FirstOrDefault(x => x.IsSelected);

            if (treeItem == null)
            {
                treeItem = items.Last();
            }
            var notification = new ThreeDBuildingNotification
            {
                Title                    = "3Dモデル作成",
                ImageFolderPath          = treeItem._Directory.FullName,// プロジェクトフォルダの下の、TreeView上で選択中の画像フォルダ
                ThreeDDataFolderPath     = this.ThreeDDataFolderPath.Value,
                IsCutPetTable            = this.IsCutPetTable.Value,
                IsEnableSkipAlreadyBuilt = false,
            };

            ThreeDBuildingOneRequest.Raise(notification);
            if (notification.Confirmed)
            {
                this.ThreeDDataFolderPath.Value = notification.ThreeDDataFolderPath;
                this.IsCutPetTable.Value        = notification.IsCutPetTable;

                if (Directory.Exists(this.ThreeDDataFolderPath.Value) == false)
                {
                    if (OpenMessageBox(this.Title.Value, MessageBoxImage.Question, MessageBoxButton.YesNo, MessageBoxResult.Yes,
                                       "フォルダ\n" + this.ThreeDDataFolderPath.Value + " は存在しません。\n作成しますか?") == MessageBoxResult.Yes)
                    {
                        try {
                            Directory.CreateDirectory(this.ThreeDDataFolderPath.Value);
                        } catch (Exception e) {
                            OpenMessageBox(this.Title.Value, MessageBoxImage.Stop, MessageBoxButton.OK, MessageBoxResult.OK, e.Message);
                            return;
                        }
                    }
                    else
                    {
                        return;
                    }
                }

                var startInfo = new ProcessStartInfo();
                startInfo.FileName         = "cmd.exe";
                startInfo.WorkingDirectory = @".\UserRibbonButtons";
                //startInfo.Arguments = "/k ";    // <- 本番は "/c"
                startInfo.Arguments = "/c ";    // <- 本番は "/c"
                                                //startInfo.Arguments += @"C:\DN3D\SyncShooter\UserRibbonButtons\button1.bat ";
                startInfo.Arguments += @".\button1.bat ";
                var argString = "\"" + notification.ImageFolderPath + "\" " +
                                "\"" + this.ThreeDDataFolderPath.Value + "\" " +
                                (this.IsCutPetTable.Value ? "yes" : "no");
                startInfo.Arguments += argString;
                var proc = Process.Start(startInfo);
                //proc.WaitForExit();
            }
        }