/// <summary>
        /// 新規プロジェクト作成ダイアログを開く
        /// </summary>
        void RaiseNewProjectCommand()
        {
            var notification = new NewProjectNotification {
                Title = "New Project"
            };

            notification.ProjectName    = this.ProjectName.Value;
            notification.BaseFolderPath = this.BaseFolderPath.Value;
            notification.ProjectComment = this.ProjectComment.Value;
            NewProjectRequest.Raise(notification);
            if (notification.Confirmed)
            {
                this.ProjectName.Value    = notification.ProjectName;
                this.BaseFolderPath.Value = notification.BaseFolderPath;
                this.ProjectComment.Value = notification.ProjectComment;
                if (Directory.Exists(this.ProjectFolderPath.Value))
                {
                    OpenMessageBox(this.Title.Value, MessageBoxImage.Error, MessageBoxButton.OK, MessageBoxResult.OK,
                                   this.ProjectFolderPath.Value + "は既に存在しています。新しい名前を指定してください。");
                }
                else
                {
                    Directory.CreateDirectory(this.ProjectFolderPath.Value);
                    // コメントを出力
                    using (var fs = new FileStream(Path.Combine(this.ProjectFolderPath.Value, "Comment.txt"), FileMode.CreateNew)) {
                        using (var sw = new StreamWriter(fs)) {
                            sw.WriteLine(this.ProjectComment.Value);
                        }
                    }
                    FileTree.Clear();
                    FileTree.Add(new FileTreeItem(this.ProjectFolderPath.Value));
                }
            }
        }
Beispiel #2
0
        private void OKInteraction()
        {
            NewProjectNotification notification = _notification as NewProjectNotification;

            notification.BaseFolderPath = BaseFolderPath.Value;
            notification.ProjectName    = ProjectName.Value;
            notification.ProjectComment = ProjectComment.Value;
            _notification.Confirmed     = true;
            FinishInteraction();
        }
Beispiel #3
0
        /// <summary>
        /// [参照] ボタン
        /// </summary>
        private void RaiseBrowseFolderCommand()
        {
            NewProjectNotification notification = _notification as NewProjectNotification;
            var folderNotification = new FolderSelectDialogConfirmation()
            {
                SelectedPath        = notification.BaseFolderPath,
                RootFolder          = Environment.SpecialFolder.Personal,
                ShowNewFolderButton = false,
            };

            BrowseFolderRequest.Raise(folderNotification);
            if (folderNotification.Confirmed)
            {
                BaseFolderPath.Value = notification.BaseFolderPath = folderNotification.SelectedPath;
            }
        }