Creates the ResourceLoader instance using the static method GetForCurrentView() instead of the constructor to resolve the Visual Studio 2013 compiler warning
This commit is contained in:
@@ -62,7 +62,7 @@ namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests
|
||||
[TestMethod]
|
||||
public void ResourceLoaderInitializedWithClassName()
|
||||
{
|
||||
Assert.IsTrue(actual.Contains("new ResourceLoader(currentAssemblyName + \"/Resources\");"));
|
||||
Assert.IsTrue(actual.Contains("ResourceLoader.GetForCurrentView(currentAssemblyName + \"/Resources\");"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,7 +63,7 @@ namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests
|
||||
[TestMethod]
|
||||
public void ResourceLoaderInitializedWithClassName()
|
||||
{
|
||||
Assert.IsTrue(actual.Contains("new ResourceLoader(currentAssemblyName + \"/Resources\");"));
|
||||
Assert.IsTrue(actual.Contains("ResourceLoader.GetForCurrentView(currentAssemblyName + \"/Resources\");"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,7 +64,7 @@ namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests
|
||||
[TestMethod]
|
||||
public void ResourceLoaderInitializedWithClassName()
|
||||
{
|
||||
Assert.IsTrue(actual.Contains("New ResourceLoader(currentAssemblyName + \"/Resources\")"));
|
||||
Assert.IsTrue(actual.Contains("ResourceLoader.GetForCurrentView(currentAssemblyName + \"/Resources\")"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,7 @@ namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests
|
||||
[TestMethod]
|
||||
public void ResourceLoaderInitializedWithClassName()
|
||||
{
|
||||
Assert.IsTrue(actual.Contains("New ResourceLoader(currentAssemblyName + \"/Resources\")"));
|
||||
Assert.IsTrue(actual.Contains("ResourceLoader.GetForCurrentView(currentAssemblyName + \"/Resources\")"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,21 +84,31 @@ namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
|
||||
new CodeVariableReferenceExpression("currentAssemblyName"),
|
||||
new CodeArrayIndexerExpression(new CodeVariableReferenceExpression("currentAssemblySplit"), new CodePrimitiveExpression(1)));
|
||||
|
||||
// TODO: Call GetForCurrentView() instead of the constructor method because the constructor will be depracted after future versions of Windows 8.1
|
||||
|
||||
var createResourceLoader = new CodeConditionStatement(
|
||||
new CodeSnippetExpression("executingAssemblyName.Equals(currentAssemblyName)"),
|
||||
new CodeStatement[] // true
|
||||
{
|
||||
new CodeAssignStatement(
|
||||
new CodeFieldReferenceExpression(null, "resourceLoader"),
|
||||
new CodeObjectCreateExpression(new CodeTypeReference("ResourceLoader"),
|
||||
new CodeMethodInvokeExpression(new CodeTypeReferenceExpression("ResourceLoader"), "GetForCurrentView",
|
||||
new CodeSnippetExpression("\"" + className + "\"")))
|
||||
//new CodeAssignStatement(
|
||||
// new CodeFieldReferenceExpression(null, "resourceLoader"),
|
||||
// new CodeObjectCreateExpression(new CodeTypeReference("ResourceLoader"),
|
||||
// new CodeSnippetExpression("\"" + className + "\"")))
|
||||
},
|
||||
new CodeStatement[] // false
|
||||
{
|
||||
new CodeAssignStatement(
|
||||
new CodeFieldReferenceExpression(null, "resourceLoader"),
|
||||
new CodeObjectCreateExpression(new CodeTypeReference("ResourceLoader"),
|
||||
new CodeMethodInvokeExpression(new CodeTypeReferenceExpression("ResourceLoader"), "GetForCurrentView",
|
||||
new CodeSnippetExpression("currentAssemblyName + \"/" + className + "\"")))
|
||||
//new CodeAssignStatement(
|
||||
// new CodeFieldReferenceExpression(null, "resourceLoader"),
|
||||
// new CodeObjectCreateExpression(new CodeTypeReference("ResourceLoader"),
|
||||
// new CodeSnippetExpression("currentAssemblyName + \"/" + className + "\"")))
|
||||
});
|
||||
|
||||
constructor.Statements.Add(executingAssemblyVar);
|
||||
|
||||
@@ -29,7 +29,7 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.1.0.*")]
|
||||
[assembly: AssemblyVersion("1.2.0.*")]
|
||||
|
||||
[assembly: InternalsVisibleTo("VSPackage_IntegrationTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010045bd05a5b24c74b83f069df52e138682c2fb8b1ee65cb9d351fd7e8d622308aeb588b2a2975d75da4fe8a392510528baa26a3317809ec064d3cc852f0df94752ad2228d9f2a048ee2858c1e9d505b05f7fb4ede02f34154f75ea50445741c84f5ab1c814358f5fd6a6f08bb3d94284cff0524d5ca9d888c8648bcbc7a1e0a3c8")]
|
||||
[assembly: InternalsVisibleTo("VSPackage_UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010045bd05a5b24c74b83f069df52e138682c2fb8b1ee65cb9d351fd7e8d622308aeb588b2a2975d75da4fe8a392510528baa26a3317809ec064d3cc852f0df94752ad2228d9f2a048ee2858c1e9d505b05f7fb4ede02f34154f75ea50445741c84f5ab1c814358f5fd6a6f08bb3d94284cff0524d5ca9d888c8648bcbc7a1e0a3c8")]
|
||||
|
||||
Reference in New Issue
Block a user