public static void CloseWindow() { if (!_instance) { return; } _instance.Close(); _instance = null; }
private void Deploy() { try { _Save(); } catch (Exception e) { _errorMessage = "Failed to save changes to package.json"; Debug.LogException(e); return; } if (!_IsPackageFileCommitted()) { new ExternCommand("TortoiseGitProc", @"/command:commit /path:../../").Execute(); if (!_IsPackageFileCommitted()) { _errorMessage = "Please commit main repo before deploy package"; // 恢复 package.json 文件 var versionToDeploy = version; version = _lastDeployedVersion; try { _Save(); } catch (Exception e) { Debug.LogException(e); } version = versionToDeploy; return; } } if (new ExternCommand("PackageDeploy.cmd", version).Execute() != 0) { _errorMessage = "Deploy operation is failed"; } else { _errorMessage = ""; PackageDeployWindow.CloseWindow(); Debug.Log($"Package v{version} is successfully deployed"); } }
/// <summary> /// Deploy the package. /// </summary> public override void Execute() { if (CurrentDocument != null) { Package package = CurrentDocument.Package; PackageDeployWindow dlg = new PackageDeployWindow(); dlg.PackageName = package.Name; // targets dlg.Targets.Add( "SalesForce Project", Project.Projects); List <string> localFolders = new List <string>( Properties.Settings.Default.DeployLocalFolderHistory.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries)); localFolders.Add("browse..."); dlg.Targets.Add("Local Folder", localFolders.ToArray()); // target type options dlg.TargetTypeOptions.Add( "SalesForce Project", new string[] { "Check Only", "Run All Tests" }); // target types dlg.TargetTypes = new string[] { "SalesForce Project", "Local Folder" }; dlg.SelectedTargetType = "SalesForce Project"; if (App.ShowDialog(dlg)) { if (dlg.SelectedTargetType == "SalesForce Project") { using (App.Wait("Deploying package...")) { PackageDeployToProjectStatusDocument document = new PackageDeployToProjectStatusDocument( package, dlg.SelectedTarget, dlg.SelectedTargetTypeOptions.Contains("Check Only"), dlg.SelectedTargetTypeOptions.Contains("Run All Tests")); App.Instance.Content.OpenDocument(document); } } else if (dlg.SelectedTargetType == "Local Folder") { bool isOK = true; if (System.IO.Directory.GetFiles(dlg.SelectedTarget).Length > 0 || System.IO.Directory.GetDirectories(dlg.SelectedTarget).Length > 0) { isOK = (App.MessageUser( "The files within the selected folder may be overwritten. Do you wish to continue?", "Overwrite", System.Windows.MessageBoxImage.Warning, new string[] { "Yes", "No" }) == "Yes"); } if (isOK) { // remember the selected local folder localFolders.RemoveAt(localFolders.Count - 1); localFolders.Remove(dlg.SelectedTarget); localFolders.Insert(0, dlg.SelectedTarget); if (localFolders.Count > 8) { localFolders.RemoveAt(localFolders.Count - 1); } Properties.Settings.Default.DeployLocalFolderHistory = String.Join(";", localFolders); Properties.Settings.Default.Save(); package.ExtractTo(dlg.SelectedTarget, true); App.MessageUser("Deployment complete", "Deployment", System.Windows.MessageBoxImage.Information, new string[] { "OK" }); } } } } }
private static void OpenWindow() { _instance = GetWindow <PackageDeployWindow> (); _instance._package = PackageDeployUtility.GetInstance(); _instance.position = GUIHelper.GetEditorWindowRect().AlignCenter(300, 250); }