Browse Source

changed DefaultFileNodeCommands.cs to accept XAML files; added some XAML file templates (Window, Page, FlowDocument, PageFunction, ResourceDictionary, UserControl)

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@639 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Mathias Simmack 20 years ago
parent
commit
565490bd49
  1. 35
      data/templates/file/CSharp/CSharp.AvalonFlowDocument.xft
  2. 61
      data/templates/file/CSharp/CSharp.AvalonPage.xft
  3. 78
      data/templates/file/CSharp/CSharp.AvalonPageFunction.xft
  4. 33
      data/templates/file/CSharp/CSharp.AvalonResourceDictionary.xft
  5. 67
      data/templates/file/CSharp/CSharp.AvalonUserControl.xft
  6. 66
      data/templates/file/CSharp/CSharp.AvalonWindow.xft
  7. 54
      data/templates/project/CSharp/AvalonApplication.xpt
  8. 54
      data/templates/project/CSharp/AvalonNavigationApplication.xpt
  9. 6
      src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/Commands/DefaultFileNodeCommands.cs

35
data/templates/file/CSharp/CSharp.AvalonFlowDocument.xft

@ -0,0 +1,35 @@
<?xml version="1.0"?>
<Template author="Mathias Simmack" version="1.0">
<Config
name = "Avalon FlowDocument"
icon = "Icons.32x32.XMLFileIcon"
category = "C#"
defaultname = "FlowDocument${Number}.xaml"
language = "XML"/>
<Description>An Avalon FlowDocument.</Description>
<!--
Special new file templates:
${StandardNamespace} -> Standardnamespace of the current project or FileNameWithoutExtension
${FullName} -> Full generated path name
${FileName} -> File name with extension
${FileNameWithoutExtension} -> File name without extension
${Extension} -> Extension in the form ".cs"
${Path} -> Full path of the file
-->
<Files>
<File name="${FullName}" language="XML" buildAction="Page"><![CDATA[<FlowDocument xmlns="http://schemas.microsoft.com/winfx/avalon/2005"
ColumnWidth="400" FontSize="14" FontFamily="Georgia"
>
<Paragraph>
</Paragraph>
</FlowDocument>]]></File>
</Files>
<AdditionalOptions/>
</Template>

61
data/templates/file/CSharp/CSharp.AvalonPage.xft

@ -0,0 +1,61 @@
<?xml version="1.0"?>
<Template author="Mathias Simmack" version="1.0">
<Config
name = "Avalon Page"
icon = "Icons.32x32.XMLFileIcon"
category = "C#"
defaultname = "Page${Number}.xaml"
language = "C#"/>
<Description>An Avalon page.</Description>
<!--
Special new file templates:
${StandardNamespace} -> Standardnamespace of the current project or FileNameWithoutExtension
${FullName} -> Full generated path name
${FileName} -> File name with extension
${FileNameWithoutExtension} -> File name without extension
${Extension} -> Extension in the form ".cs"
${Path} -> Full path of the file
-->
<Files>
<File name="${FullName}" language="XML" buildAction="Page"><![CDATA[<Page x:Class="${StandardNamespace}.${FileNameWithoutExtension}"
xmlns="http://schemas.microsoft.com/winfx/avalon/2005"
xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005"
Title="${FileNameWithoutExtension}"
>
<Grid>
</Grid>
</Page>]]></File>
<File name="${FullName}.cs" language="C#" dependentUpon="${FileName}" subType="Code"><![CDATA[using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Media;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace ${StandardNamespace}
{
/// <summary>
/// Interaction logic for ${FileName}
/// </summary>
public partial class ${FileNameWithoutExtension} : Page
{
// To use PageLoaded put Loaded="PageLoaded" in root element of .xaml file.
// private void PageLoaded(object sender, RoutedEventArgs e) {}
// Sample event handler:
// private void ButtonClick(object sender, RoutedEventArgs e) {}
}
}]]></File>
</Files>
<AdditionalOptions/>
</Template>

78
data/templates/file/CSharp/CSharp.AvalonPageFunction.xft

@ -0,0 +1,78 @@
<?xml version="1.0"?>
<Template author="Mathias Simmack" version="1.0">
<Config
name = "Avalon PageFunction"
icon = "Icons.32x32.XMLFileIcon"
category = "C#"
defaultname = "PageFunction${Number}.xaml"
language = "XML"/>
<Description>An Avalon PageFunction.</Description>
<!--
Special new file templates:
${StandardNamespace} -> Standardnamespace of the current project or FileNameWithoutExtension
${FullName} -> Full generated path name
${FileName} -> File name with extension
${FileNameWithoutExtension} -> File name without extension
${Extension} -> Extension in the form ".cs"
${Path} -> Full path of the file
-->
<Files>
<File name="${FullName}" language="XML" buildAction="Page"><![CDATA[<PageFunction x:Class="${StandardNamespace}.${FileNameWithoutExtension}" x:TypeArguments="String"
xmlns="http://schemas.microsoft.com/winfx/avalon/2005"
xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005"
Title="${FileNameWithoutExtension}"
>
<Grid>
</Grid>
</PageFunction>]]></File>
<File name="${FullName}.cs" language="C#" dependentUpon="${FileName}" subType="Code">
<![CDATA[using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Media;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace ${StandardNamespace}
{
/// <summary>
/// Interaction logic for ${FileName}
/// </summary>
public partial class ${FileNameWithoutExtension} : PageFunction<String>
{
// The OnLoaded handler can be run automatically when the class is loaded. To use it, add Loaded="OnLoaded" to the attributes of the root element of the .xaml file and uncomment the following line.
// private void OnLoaded(object sender, RoutedEventArgs e) {}
//
// Sample Finish Handler
// private void OnClickDone(object sender, RoutedEventArgs e)
// {
// OnFinish(new ReturnEventArgs<String>("The return value"));
// }
// To launch this page function, put this code in the launching page.
// ${FileNameWithoutExtension} pageFunction = new ${FileNameWithoutExtension}();
// pageFunction.Return += new ReturnEventHandler<String>(On${FileNameWithoutExtension}Returned);
// _NavWin.Navigate(pageFunction);
//
// This handler goes in the launching page.
// public void On${FileNameWithoutExtension}Returned(object sender, ReturnEventArgs<String> e)
// {
// Console.WriteLine("${FileNameWithoutExtension} returned: " + e.Result);
// }
}
}]]></File>
</Files>
<AdditionalOptions/>
</Template>

33
data/templates/file/CSharp/CSharp.AvalonResourceDictionary.xft

@ -0,0 +1,33 @@
<?xml version="1.0"?>
<Template author="Mathias Simmack" version="1.0">
<Config
name = "Avalon ResourceDictionary"
icon = "Icons.32x32.XMLFileIcon"
category = "C#"
defaultname = "Dictionary${Number}.xaml"
language = "XML"/>
<Description>An Avalon ResourceDictionary.</Description>
<!--
Special new file templates:
${StandardNamespace} -> Standardnamespace of the current project or FileNameWithoutExtension
${FullName} -> Full generated path name
${FileName} -> File name with extension
${FileNameWithoutExtension} -> File name without extension
${Extension} -> Extension in the form ".cs"
${Path} -> Full path of the file
-->
<Files>
<File name="${FullName}" language="XML" buildAction="Page"><![CDATA[<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/avalon/2005"
xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005"
>
</ResourceDictionary>]]></File>
</Files>
<AdditionalOptions/>
</Template>

67
data/templates/file/CSharp/CSharp.AvalonUserControl.xft

@ -0,0 +1,67 @@
<?xml version="1.0"?>
<Template author="Mathias Simmack" version="1.0">
<Config
name = "Avalon User Control"
icon = "Icons.32x32.XMLFileIcon"
category = "C#"
defaultname = "UserControl${Number}.xaml"
language = "XML"/>
<Description>An Avalon User Control.</Description>
<!--
Special new file templates:
${StandardNamespace} -> Standardnamespace of the current project or FileNameWithoutExtension
${FullName} -> Full generated path name
${FileName} -> File name with extension
${FileNameWithoutExtension} -> File name without extension
${Extension} -> Extension in the form ".cs"
${Path} -> Full path of the file
-->
<Files>
<File name="${FullName}" language="XML" buildAction="Page"><![CDATA[<UserControl x:Class="${StandardNamespace}.${FileNameWithoutExtension}"
xmlns="http://schemas.microsoft.com/winfx/avalon/2005"
xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005"
>
<UserControl.FixedTemplate>
<Grid>
</Grid>
</UserControl.FixedTemplate>
</UserControl>]]></File>
<File name="${FullName}.cs" language="C#" dependentUpon="${FileName}" subType="Code"><![CDATA[using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Media;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace ${StandardNamespace}
{
/// <summary>
/// Interaction logic for ${FileName}
/// </summary>
public partial class ${FileNameWithoutExtension} : UserControl
{
public ${FileNameWithoutExtension}()
{
InitializeComponent();
}
// To use this handler put Loaded="UserControlLoaded" in root element of .xaml file.
// private void UserControlLoaded(object sender, RoutedEventArgs e) {}
// Sample event handler:
// private void ButtonClick(object sender, RoutedEventArgs e) {}
}
}]]></File>
</Files>
<AdditionalOptions/>
</Template>

66
data/templates/file/CSharp/CSharp.AvalonWindow.xft

@ -0,0 +1,66 @@
<?xml version="1.0"?>
<Template author="Mathias Simmack" version="1.0">
<Config
name = "Avalon Window"
icon = "Icons.32x32.XMLFileIcon"
category = "C#"
defaultname = "Window${Number}.xaml"
language = "C#"/>
<Description>An Avalon window.</Description>
<!--
Special new file templates:
${StandardNamespace} -> Standardnamespace of the current project or FileNameWithoutExtension
${FullName} -> Full generated path name
${FileName} -> File name with extension
${FileNameWithoutExtension} -> File name without extension
${Extension} -> Extension in the form ".cs"
${Path} -> Full path of the file
-->
<Files>
<File name="${FullName}" language="XML" buildAction="Page"><![CDATA[<Window x:Class="${StandardNamespace}.${FileNameWithoutExtension}"
xmlns="http://schemas.microsoft.com/winfx/avalon/2005"
xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005"
Title="${StandardNamespace}"
>
<Grid>
</Grid>
</Window>]]></File>
<File name="${FullName}.cs" language="C#" dependentUpon="${FileName}" subType="Code"><![CDATA[using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Media;
using System.Windows.Shapes;
namespace ${StandardNamespace}
{
/// <summary>
/// Interaction logic for ${FileName}
/// </summary>
public partial class ${FileNameWithoutExtension} : Window
{
public ${FileNameWithoutExtension}()
{
InitializeComponent();
}
// To use Loaded event put Loaded="WindowLoaded" attribute in root element of .xaml file.
// private void WindowLoaded(object sender, RoutedEventArgs e) {}
// Sample event handler:
// private void ButtonClick(object sender, RoutedEventArgs e) {}
}
}]]></File>
</Files>
<AdditionalOptions/>
</Template>

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

@ -125,6 +125,60 @@ So, don't say I did not warn you. :-)
Mathias Mathias
(2005-10-26)]]></File> (2005-10-26)]]></File>
<File name="AssemblyInfo.cs"><![CDATA[#region Using directives
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Resources;
using System.Globalization;
using System.Windows;
using System.Runtime.InteropServices;
#endregion
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("${ProjectName}")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("${USER}")]
[assembly: AssemblyProduct("${ProjectName}")]
[assembly: AssemblyCopyright("Copyright @ ${USER} ${DATE}")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
DictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
DictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]]]></File>
</Files> </Files>
</Project> </Project>
</Combine> </Combine>

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

@ -100,6 +100,60 @@ So, don't say I did not warn you. :-)
Mathias Mathias
(2005-10-26)]]></File> (2005-10-26)]]></File>
<File name="AssemblyInfo.cs"><![CDATA[#region Using directives
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Resources;
using System.Globalization;
using System.Windows;
using System.Runtime.InteropServices;
#endregion
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("${ProjectName}")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("${USER}")]
[assembly: AssemblyProduct("${ProjectName}")]
[assembly: AssemblyCopyright("Copyright @ ${USER} ${DATE}")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
DictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
DictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]]]></File>
</Files> </Files>
</Project> </Project>
</Combine> </Combine>

6
src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/Commands/DefaultFileNodeCommands.cs

@ -145,6 +145,12 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
case ".resx": case ".resx":
case ".resources": case ".resources":
return ItemType.EmbeddedResource; return ItemType.EmbeddedResource;
// HACK: This isn't really a solution. :-( Maybe in the near
// future we can use the known attributes in the XFT files, too.
case ".xaml":
return ItemType.Page;
default: default:
return ItemType.Content; return ItemType.Content;
} }

Loading…
Cancel
Save