public override void DialogCommand() { var visualStudioService = ApplicationController.ResolveType(typeof(IVisualStudioService)) as IVisualStudioService; if (visualStudioService == null) { throw new NullReferenceException("visualStudioService"); } var files = visualStudioService.GetSelectedFileNamesQualified(); var request = new ImportCsvsRequest() { FolderOrFiles = ImportCsvsRequest.CsvImportOption.SpecificFiles, MatchByName = true, DateFormat = DateFormat.English, CsvsToImport = files.Select(f => new ImportCsvsRequest.CsvToImport() { Csv = new FileReference(f) }).ToArray() }; var uri = new UriQuery(); uri.AddObject(nameof(ImportCsvsDialog.Request), request); uri.AddObject(nameof(ImportCsvsDialog.SkipObjectEntry), true); ApplicationController.NavigateTo(typeof(ImportCsvsDialog), uri); }
public override void DialogCommand() { var visualStudioService = ApplicationController.ResolveType(typeof(IVisualStudioService)) as IVisualStudioService; if (visualStudioService == null) { throw new NullReferenceException("visualStudioService"); } var selectedItems = visualStudioService.GetSelectedFileNamesQualified(); if (selectedItems.Count() != 1) { ApplicationController.UserMessage("Only one file may be selected to refresh"); return; } //refresh cache in case customisation changes have been made var xrmService = ApplicationController.ResolveType(typeof(XrmRecordService)) as XrmRecordService; if (xrmService == null) { throw new NullReferenceException("xrmService"); } xrmService.ClearCache(); if (selectedItems.Count() != 1) { ApplicationController.UserMessage("Only one file may be selected to refresh"); return; } FileInfo fileInfo = new FileInfo(selectedItems.First()); var request = new CSharpRequest() { Folder = new Folder(fileInfo.DirectoryName), FileName = fileInfo.Name, Namespace = "Schema", Actions = true, Entities = true, Fields = true, FieldOptions = true, Relationships = true, SharedOptions = true, IncludeAllRecordTypes = true }; var uri = new UriQuery(); uri.AddObject(nameof(CSharpDialog.Request), request); uri.AddObject(nameof(CSharpDialog.SkipObjectEntry), true); ApplicationController.RequestNavigate("Main", typeof(CSharpDialog), uri); }
public override void DialogCommand() { var visualStudioService = ApplicationController.ResolveType(typeof(IVisualStudioService)) as IVisualStudioService; if (visualStudioService == null) { throw new NullReferenceException("visualStudioService"); } var selectedItems = visualStudioService.GetSelectedFileNamesQualified(); if (selectedItems.Count() != 1) { ApplicationController.UserMessage("Only one file may be selected to import"); return; } var request = new ImportSolutionRequest() { SolutionZip = new FileReference(selectedItems.First()) }; var uri = new UriQuery(); uri.AddObject(nameof(ImportSolutionDialog.Request), request); ApplicationController.RequestNavigate("Main", typeof(ImportSolutionDialog), uri); }
public override void DialogCommand() { var visualStudioService = ApplicationController.ResolveType(typeof(IVisualStudioService)) as IVisualStudioService; if (visualStudioService == null) { throw new NullReferenceException("visualStudioService"); } var packageSettings = ApplicationController.ResolveType(typeof(XrmPackageSettings)) as XrmPackageSettings; if (packageSettings == null) { throw new NullReferenceException("packageSettings"); } if (packageSettings.Solution == null) { throw new NullReferenceException("Solution is not populated in the package settings"); } //WARNING THIS FOLDER IS CLEARED BEFORE PROCESSING SO CAREFUL IF CHANGE DIRECTORY var folderPath = visualStudioService.SolutionDirectory + "/TempSolutionFolder"; var request = CreatePackageRequest.CreateForCreatePackage(folderPath, packageSettings.Solution); var uri = new UriQuery(); uri.AddObject(nameof(CreatePackageDialog.Request), request); ApplicationController.NavigateTo(typeof(VsixCreatePackageDialog), uri); }
public override void DialogCommand() { var visualStudioService = ApplicationController.ResolveType(typeof(IVisualStudioService)) as IVisualStudioService; if (visualStudioService == null) { throw new NullReferenceException("visualStudioService"); } var files = visualStudioService.GetSelectedFileNamesQualified(); var request = new DeployWebResourceRequest() { Files = files }; var uri = new UriQuery(); uri.AddObject(nameof(DeployWebResourceDialog.Request), request); uri.AddObject(nameof(DeployWebResourceDialog.SkipObjectEntry), true); ApplicationController.NavigateTo(typeof(DeployWebResourceDialog), uri); }
public override void DialogCommand() { var visualStudioService = ApplicationController.ResolveType(typeof(IVisualStudioService)) as IVisualStudioService; if (visualStudioService == null) { throw new NullReferenceException("visualStudioService"); } var selectedItems = visualStudioService.GetSelectedFileNamesQualified(); var request = new ImportRecordsRequest() { XmlFiles = selectedItems.Select(f => new FileReference(f)).ToArray() }; var uri = new UriQuery(); uri.AddObject(nameof(ImportRecordsDialog.Request), request); ApplicationController.NavigateTo(typeof(ImportRecordsDialog), uri); }
public override void DialogCommand() { var visualStudioService = ApplicationController.ResolveType(typeof(IVisualStudioService)) as IVisualStudioService; if (visualStudioService == null) { throw new NullReferenceException("visualStudioService"); } var selectedItems = visualStudioService.GetSelectedFileNamesQualified(); if (selectedItems.Count() != 1) { ApplicationController.UserMessage("Only one file may be selected to deploy"); return; } var packageSettings = ApplicationController.ResolveType(typeof(XrmPackageSettings)) as XrmPackageSettings; if (packageSettings == null) { throw new NullReferenceException("packageSettings"); } var request = new CustomisationImportRequest() { ExcelFile = new FileReference(selectedItems.First()), AddToSolution = packageSettings.AddToSolution, Solution = packageSettings.Solution, HideExcelFile = true, HideSolutionOptions = true }; //refresh cache in case customisation changes have been made var xrmService = ApplicationController.ResolveType(typeof(XrmRecordService)) as XrmRecordService; if (xrmService == null) { throw new NullReferenceException("xrmService"); } xrmService.ClearCache(); var uri = new UriQuery(); uri.AddObject(nameof(CustomisationImportDialog.Request), request); ApplicationController.NavigateTo(typeof(VsixCustomisationImportDialog), uri); }
public override void DialogCommand() { string folder = null; var visualStudioService = ApplicationController.ResolveType(typeof(IVisualStudioService)) as IVisualStudioService; if (visualStudioService == null) { throw new NullReferenceException("visualStudioService"); } var selectedItems = visualStudioService.GetSelectedItems(); foreach (var selectedItem in selectedItems) { var solutionFolder = selectedItem as ISolutionFolder; if (solutionFolder != null) { foreach (var item in solutionFolder.ProjectItems) { if (item.FileName?.EndsWith(".zip") ?? false) { folder = item.FileFolder; break; } } } } if (folder == null) { throw new Exception("Could not find the package directory. Could not find zip file in the selected solution folder"); } var request = DeployPackageRequest.CreateForDeployPackage(folder); var uri = new UriQuery(); uri.AddObject(nameof(DeployPackageDialog.Request), request); ApplicationController.RequestNavigate("Main", typeof(DeployPackageDialog), uri); }
public override void DialogCommand() { string solutionFolderPath = null; var visualStudioService = ApplicationController.ResolveType(typeof(IVisualStudioService)) as IVisualStudioService; if (visualStudioService == null) { throw new NullReferenceException("visualStudioService"); } var selectedItems = visualStudioService.GetSelectedItems(); foreach (var selectedItem in selectedItems) { var solutionFolder = selectedItem as ISolutionFolder; if (solutionFolder != null) { var parentFolderName = solutionFolder.ParentProjectName; solutionFolderPath = Path.Combine(visualStudioService.SolutionDirectory, parentFolderName, solutionFolder.Name); foreach (var item in solutionFolder.ProjectItems) { if (item.FileName?.EndsWith(".zip") ?? false) { if (item.FileFolder?.Replace("\\\\", "\\") != solutionFolderPath?.Replace("\\\\", "\\")) { throw new Exception($"The Zip File In the Package Folder Is In An Unexpected Directory. You Will Need To Move It Into A Matching Folder Path For The Solution Folder. The Expected Path Was {solutionFolderPath}, The Actual path Is {item.FileFolder}"); } } } var isDataFolderInVs = false; var dataFolderOnDisk = Path.Combine(solutionFolderPath, "Data"); foreach (var item in solutionFolder.SubFolders) { if (item.Name == "Data") { isDataFolderInVs = true; var filesInSolutionFolder = item .ProjectItems .Select(pi => pi.FileName?.Replace("\\\\", "\\")) .OrderBy(s => s) .ToArray(); var filesOnDisk = Directory.Exists(dataFolderOnDisk) ? FileUtility.GetFiles(dataFolderOnDisk) .Select(s => s?.Replace("\\\\", "\\")) .OrderBy(s => s) .ToArray() : new string[0]; var itemsOnDiskNotInVs = filesOnDisk.Except(filesInSolutionFolder).ToArray(); if (itemsOnDiskNotInVs.Any()) { throw new Exception($"At Least One Data File On Disk Is Not In The Visual Studio Solution Folder. For The Deployment Process To Run All Files In The Matching Directory On Disk Must Be Added In The Visual Studio Solution Folder. The First Unexpected Item On Disk Is {itemsOnDiskNotInVs.First()}"); } var itemsInVsNotOnDisk = filesInSolutionFolder.Except(filesOnDisk).ToArray(); if (itemsInVsNotOnDisk.Any()) { throw new Exception($"At Least One Of The Data Files In The Visual Studio Folder Is Not In The Correct Folder On Disk. For The Deployment Process To Run All Items In The Deployment Must Be In A Matching Directory For The Visual Studio Folder. The First Unexpected Item Is Located At {itemsInVsNotOnDisk.First()}"); } } } if (!isDataFolderInVs && Directory.Exists(dataFolderOnDisk) && FileUtility.GetFiles(dataFolderOnDisk).Any()) { throw new Exception($"There Is A Data Folder On Disk With Items Within The Solution Package Directory, But Those Items Are Not Added In The Visual Studio Release Folder. For The Deployment Process To Run All Items On Disk Within The Folder Must Be In Added In The Visual Studio Folder. The First Unexpected Item Is Located At {FileUtility.GetFiles(dataFolderOnDisk).First()}"); } } } if (solutionFolderPath == null) { throw new Exception("Could not find the package directory"); } var request = DeployPackageRequest.CreateForDeployPackage(solutionFolderPath); var uri = new UriQuery(); uri.AddObject(nameof(DeployPackageDialog.Request), request); ApplicationController.NavigateTo(typeof(DeployPackageDialog), uri); }