From 080f1697e97e13461ec6df4d31c8924d01257a1b Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Tue, 9 Apr 2019 01:47:48 +0300 Subject: MERGE --- .../Dialogs/NewProjectViewVM.cs | 70 ++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 Software/Visual_Studio/Scripting/Tango.Scripting.IDE/Dialogs/NewProjectViewVM.cs (limited to 'Software/Visual_Studio/Scripting/Tango.Scripting.IDE/Dialogs/NewProjectViewVM.cs') diff --git a/Software/Visual_Studio/Scripting/Tango.Scripting.IDE/Dialogs/NewProjectViewVM.cs b/Software/Visual_Studio/Scripting/Tango.Scripting.IDE/Dialogs/NewProjectViewVM.cs new file mode 100644 index 000000000..69cf8034e --- /dev/null +++ b/Software/Visual_Studio/Scripting/Tango.Scripting.IDE/Dialogs/NewProjectViewVM.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media.Imaging; +using Tango.Core.Commands; +using Tango.Scripting.IDE.ProjectTypes; +using Tango.SharedUI; +using Microsoft.WindowsAPICodePack.Dialogs; +using Microsoft.Win32; + +namespace Tango.Scripting.IDE.Dialogs +{ + public class NewProjectViewVM : BaseProjectDialogVM + { + /// + /// Gets or sets the last solution locations. + /// + public ObservableCollection LastSolutionPaths { get; set; } + + private String _solutionName = "App1"; + public String SolutionName + { + get { return _solutionName; } + set { _solutionName = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + #region Commands + public RelayCommand BrowseFileCommand { get; set; } + #endregion + + public NewProjectViewVM() : base() + { + Title = "New Project"; + BrowseFileCommand = new RelayCommand(BrowseFile); + } + + public NewProjectViewVM(IEnumerable lastSolutionFolders) : this() + { + LastSolutionPaths = new ObservableCollection(lastSolutionFolders); + ProjectLocation = LastSolutionPaths.FirstOrDefault(); + } + + private void BrowseFile() + { + CommonOpenFileDialog dialog = new CommonOpenFileDialog(); + dialog.InitialDirectory = LastSolutionPaths.LastOrDefault(); + dialog.IsFolderPicker = true; + if (dialog.ShowDialog() == CommonFileDialogResult.Ok) + { + if (Directory.Exists(dialog.FileName) == true) + { + if (false == LastSolutionPaths.Contains(dialog.FileName)) + { + LastSolutionPaths.Add(dialog.FileName); + } + ProjectLocation = dialog.FileName; + } + } + } + + protected override bool CanOK() + { + return base.CanOK() && !String.IsNullOrWhiteSpace(SolutionName); + } + } +} -- cgit v1.3.1