Browse Source

support for DependentUpon and SubType attributes in XPT project templates added (see the Avalon* templates for a working demo)

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@638 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Mathias Simmack 20 years ago
parent
commit
8bd159545c
  1. 4
      data/templates/project/CSharp/AvalonApplication.xpt
  2. 4
      data/templates/project/CSharp/AvalonNavigationApplication.xpt
  3. 22
      src/Main/Base/Project/Src/Internal/Templates/File/FileDescriptionTemplate.cs
  4. 6
      src/Main/Base/Project/Src/Internal/Templates/Project/ProjectDescriptor.cs

4
data/templates/project/CSharp/AvalonApplication.xpt

@ -50,7 +50,7 @@
</Application.Resources> </Application.Resources>
</Application>]]></File> </Application>]]></File>
<File name="MyApp.xaml.cs"><![CDATA[using System; <File name="MyApp.xaml.cs" subType="Code" dependentUpon="MyApp.xaml"><![CDATA[using System;
using System.Windows; using System.Windows;
using System.Data; using System.Data;
using System.Xml; using System.Xml;
@ -82,7 +82,7 @@ namespace ${StandardNamespace}
</Grid> </Grid>
</Window>]]></File> </Window>]]></File>
<File name="Window1.xaml.cs"><![CDATA[using System; <File name="Window1.xaml.cs" subType="Code" dependentUpon="Window1.xaml"><![CDATA[using System;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data; using System.Windows.Data;

4
data/templates/project/CSharp/AvalonNavigationApplication.xpt

@ -49,7 +49,7 @@
</Application.Resources> </Application.Resources>
</Application>]]></File> </Application>]]></File>
<File name="MyApp.xaml.cs"><![CDATA[using System; <File name="MyApp.xaml.cs" subType="Code" dependentUpon="MyApp.xaml"><![CDATA[using System;
using System.Windows; using System.Windows;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Data; using System.Data;
@ -75,7 +75,7 @@ namespace ${StandardNamespace}
</StackPanel> </StackPanel>
</Page>]]></File> </Page>]]></File>
<File name="Page1.xaml.cs"><![CDATA[using System; <File name="Page1.xaml.cs" subType="Code" dependentUpon="Page1.xaml"><![CDATA[using System;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Navigation; using System.Windows.Navigation;

22
src/Main/Base/Project/Src/Internal/Templates/File/FileDescriptionTemplate.cs

@ -20,6 +20,8 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
string content; string content;
string buildAction; string buildAction;
string copyToOutputDirectory; string copyToOutputDirectory;
string dependentUpon;
string subType;
public FileDescriptionTemplate(XmlElement xml) public FileDescriptionTemplate(XmlElement xml)
{ {
@ -27,6 +29,8 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
language = xml.GetAttribute("language"); language = xml.GetAttribute("language");
buildAction = xml.GetAttribute("buildAction"); buildAction = xml.GetAttribute("buildAction");
copyToOutputDirectory = xml.GetAttribute("copyToOutputDirectory"); copyToOutputDirectory = xml.GetAttribute("copyToOutputDirectory");
dependentUpon = xml.GetAttribute("dependentUpon");
subType = xml.GetAttribute("subType");
content = xml.InnerText; content = xml.InnerText;
} }
@ -72,5 +76,23 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
copyToOutputDirectory = value; copyToOutputDirectory = value;
} }
} }
public string DependentUpon {
get {
return dependentUpon ?? "";
}
set {
dependentUpon = value;
}
}
public string SubType {
get {
return subType ?? "";
}
set {
subType = value;
}
}
} }
} }

6
src/Main/Base/Project/Src/Internal/Templates/Project/ProjectDescriptor.cs

@ -152,6 +152,12 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
if (file.CopyToOutputDirectory.Length > 0) { if (file.CopyToOutputDirectory.Length > 0) {
projectFile.CopyToOutputDirectory = (CopyToOutputDirectory)Enum.Parse(typeof(CopyToOutputDirectory), file.CopyToOutputDirectory); projectFile.CopyToOutputDirectory = (CopyToOutputDirectory)Enum.Parse(typeof(CopyToOutputDirectory), file.CopyToOutputDirectory);
} }
if (file.DependentUpon.Length > 0) {
projectFile.DependentUpon = file.DependentUpon;
}
if (file.SubType.Length > 0) {
projectFile.SubType = file.SubType;
}
projectFile.Include = FileUtility.GetRelativePath(project.Directory, fileName); projectFile.Include = FileUtility.GetRelativePath(project.Directory, fileName);

Loading…
Cancel
Save