PageRenderTime 54ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/SolutionFramework/Microsoft.VisualStudio.ServiceModel.DomainServices.Tools.10.0/Microsoft/VisualStudio/ServiceModel/DomainServices/Tools/BusinessApplicationServerTemplateWizard.cs

#
C# | 62 lines | 53 code | 9 blank | 0 comment | 3 complexity | 0470248efb56ba1b6975a656043106ee MD5 | raw file
Possible License(s): Apache-2.0, LGPL-3.0
  1. namespace Microsoft.VisualStudio.ServiceModel.DomainServices.Tools
  2. {
  3. using EnvDTE;
  4. using EnvDTE80;
  5. using Microsoft.VisualStudio.TemplateWizard;
  6. using Microsoft.Win32;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Globalization;
  10. public class BusinessApplicationServerTemplateWizard : IWizard
  11. {
  12. private DTE2 _dte2;
  13. public void BeforeOpeningFile(ProjectItem projectItem)
  14. {
  15. }
  16. private static string GetSilverlightRuntimeVersion()
  17. {
  18. string silverlightToolsVersion = TemplateUtilities.GetSilverlightToolsVersion();
  19. using (RegistryKey key = Registry.LocalMachine.OpenSubKey(string.Format(CultureInfo.InvariantCulture, @"SOFTWARE\Microsoft\Microsoft SDKs\Silverlight\{0}\ReferenceAssemblies", new object[] { silverlightToolsVersion })))
  20. {
  21. if (key != null)
  22. {
  23. string str2 = key.GetValue("SLRuntimeInstallVersion") as string;
  24. if (!string.IsNullOrEmpty(str2))
  25. {
  26. return str2;
  27. }
  28. }
  29. }
  30. return null;
  31. }
  32. public void ProjectFinishedGenerating(Project project)
  33. {
  34. }
  35. public void ProjectItemFinishedGenerating(ProjectItem projectItem)
  36. {
  37. }
  38. public void RunFinished()
  39. {
  40. }
  41. public void RunStarted(object automationObject, Dictionary<string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
  42. {
  43. this._dte2 = (DTE2) automationObject;
  44. replacementsDictionary["$safeclientprojectname$"] = (string) this._dte2.Globals["safeclientprojectname"];
  45. replacementsDictionary["__safeclientprojectname__"] = replacementsDictionary["$safeclientprojectname$"];
  46. replacementsDictionary["$runtime_version$"] = GetSilverlightRuntimeVersion() ?? string.Format(CultureInfo.InvariantCulture, "{0:0.0}", new object[] { 4.0M });
  47. }
  48. public bool ShouldAddProjectItem(string filePath)
  49. {
  50. return true;
  51. }
  52. }
  53. }